From f4c24f36c3e457cb727f9f548f146d805739e8e0 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 21 Jun 2016 11:20:23 +0100 Subject: ARM: SAMSUNG: Fixup endian issues in CPU detection If the system is built for big endian, then the CPU identificaiton register will be read in the wrong order. Fix this by using readl_relaxed() on the register. Signed-off-by: Ben Dooks Signed-off-by: Krzysztof Kozlowski --- arch/arm/plat-samsung/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/arm/plat-samsung') diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c index 71333bb61013..bd12a55401e0 100644 --- a/arch/arm/plat-samsung/cpu.c +++ b/arch/arm/plat-samsung/cpu.c @@ -29,14 +29,14 @@ EXPORT_SYMBOL(samsung_rev); void __init s3c64xx_init_cpu(void) { - samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0x118); + samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0x118); if (!samsung_cpu_id) { /* * S3C6400 has the ID register in a different place, * and needs a write before it can be read. */ - __raw_writel(0x0, S3C_VA_SYS + 0xA1C); - samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0xA1C); + writel_relaxed(0x0, S3C_VA_SYS + 0xA1C); + samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C); } samsung_cpu_rev = 0; @@ -46,7 +46,7 @@ void __init s3c64xx_init_cpu(void) void __init s5p_init_cpu(void __iomem *cpuid_addr) { - samsung_cpu_id = __raw_readl(cpuid_addr); + samsung_cpu_id = readl_relaxed(cpuid_addr); samsung_cpu_rev = samsung_cpu_id & 0xFF; pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); -- cgit v1.2.3 From 8558643d03f0736a43edd1b95a2c81037e8ac6e3 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 21 Jun 2016 11:20:27 +0100 Subject: ARM: SAMSUNG: Fixup usage of __raw IO in PM Fix the use of __raw accesors in pm-common.c to use the _relaxed variants to deal with any issues due to endian related fetches. Signed-off-by: Ben Dooks Signed-off-by: Krzysztof Kozlowski --- arch/arm/plat-samsung/pm-common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/arm/plat-samsung') diff --git a/arch/arm/plat-samsung/pm-common.c b/arch/arm/plat-samsung/pm-common.c index 515cd53372bd..6534c3ff9fe2 100644 --- a/arch/arm/plat-samsung/pm-common.c +++ b/arch/arm/plat-samsung/pm-common.c @@ -31,7 +31,7 @@ void s3c_pm_do_save(struct sleep_save *ptr, int count) { for (; count > 0; count--, ptr++) { - ptr->val = __raw_readl(ptr->reg); + ptr->val = readl_relaxed(ptr->reg); S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val); } } @@ -51,9 +51,9 @@ void s3c_pm_do_restore(const struct sleep_save *ptr, int count) { for (; count > 0; count--, ptr++) { pr_debug("restore %p (restore %08lx, was %08x)\n", - ptr->reg, ptr->val, __raw_readl(ptr->reg)); + ptr->reg, ptr->val, readl_relaxed(ptr->reg)); - __raw_writel(ptr->val, ptr->reg); + writel_relaxed(ptr->val, ptr->reg); } } @@ -71,5 +71,5 @@ void s3c_pm_do_restore(const struct sleep_save *ptr, int count) void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count) { for (; count > 0; count--, ptr++) - __raw_writel(ptr->val, ptr->reg); + writel_relaxed(ptr->val, ptr->reg); } -- cgit v1.2.3 From d3221cc6358cf9178bf4178e29241ebaa4485318 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 21 Jun 2016 13:20:53 +0100 Subject: ARM: SAMSUNG: Fix missing s5p_init_cpu() declaration The declaration of s5p_init_cpu() in arch/arm/mach-exynos/common.h is not included in the platform file arch/arm/plat-samsung/cpu.c which generates a warning. Fix the following warning by moving the declaration to somewhere both the machine and platform code can get to it, and including the right files as necessary: arch/arm/plat-samsung/cpu.c:47:13: warning: symbol 's5p_init_cpu' was not declared. Should it be static? Signed-off-by: Ben Dooks Signed-off-by: Krzysztof Kozlowski --- arch/arm/plat-samsung/include/plat/cpu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/plat-samsung') diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 61d14f3a0426..4f8a6221dc6d 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h @@ -113,6 +113,7 @@ extern void s3c_init_cpu(unsigned long idcode, extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); extern void s3c64xx_init_cpu(void); +extern void s5p_init_cpu(void __iomem *cpuid_addr); extern unsigned int samsung_rev(void); -- cgit v1.2.3 From 9251e1d634946fb9caf504288409b3504c795eca Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Tue, 5 Jul 2016 15:56:54 +0200 Subject: ARM: SAMSUNG: Constify iomem address passed to s5p_init_cpu The iomem passed to s5p_init_cpu is used as read-only. Signed-off-by: Krzysztof Kozlowski --- arch/arm/plat-samsung/cpu.c | 2 +- arch/arm/plat-samsung/include/plat/cpu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/plat-samsung') diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c index bd12a55401e0..a107b3a0b095 100644 --- a/arch/arm/plat-samsung/cpu.c +++ b/arch/arm/plat-samsung/cpu.c @@ -44,7 +44,7 @@ void __init s3c64xx_init_cpu(void) pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); } -void __init s5p_init_cpu(void __iomem *cpuid_addr) +void __init s5p_init_cpu(const void __iomem *cpuid_addr) { samsung_cpu_id = readl_relaxed(cpuid_addr); samsung_cpu_rev = samsung_cpu_id & 0xFF; diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 4f8a6221dc6d..b7b702a72cac 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h @@ -113,7 +113,7 @@ extern void s3c_init_cpu(unsigned long idcode, extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); extern void s3c64xx_init_cpu(void); -extern void s5p_init_cpu(void __iomem *cpuid_addr); +extern void s5p_init_cpu(const void __iomem *cpuid_addr); extern unsigned int samsung_rev(void); -- cgit v1.2.3