Re: [PATCH 1/1] ARM: EXYNOS: Consolidate CPU init code

2014-02-21 Thread Tomasz Figa

Hi Sachin,

On 22.01.2014 12:49, Sachin Kamat wrote:

cpu_table was used to distinguish between different Exynos4 and 5 SoCs
and assign the the initialization and io mapping pointers based on type.
exynos_init is dummy and no longer needed as we do a DT based booting.
By having a common io mapping function we can get rid of the whole
table and avoid populating it for every SoC.

Tested on Exynos4210, 5250 and 5420 based boards.

Signed-off-by: Sachin Kamat 
---
  arch/arm/mach-exynos/common.c |   93 -
  1 file changed, 17 insertions(+), 76 deletions(-)


On Exynos4412-based Trats2 board:

Tested-by: Tomasz Figa 

However, please see one minor comment inline.


diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index f18be40e5b21..02d0aaa7af59 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -48,55 +48,7 @@
  #define L2_AUX_VAL 0x7C470001
  #define L2_AUX_MASK 0xC200

-static const char name_exynos4210[] = "EXYNOS4210";
-static const char name_exynos4212[] = "EXYNOS4212";
-static const char name_exynos4412[] = "EXYNOS4412";
-static const char name_exynos5250[] = "EXYNOS5250";
-static const char name_exynos5420[] = "EXYNOS5420";
-static const char name_exynos5440[] = "EXYNOS5440";
-
-static void exynos4_map_io(void);
-static void exynos5_map_io(void);
-static int exynos_init(void);
-
-static struct cpu_table cpu_ids[] __initdata = {
-   {
-   .idcode = EXYNOS4210_CPU_ID,
-   .idmask = EXYNOS4_CPU_MASK,
-   .map_io = exynos4_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos4210,
-   }, {
-   .idcode = EXYNOS4212_CPU_ID,
-   .idmask = EXYNOS4_CPU_MASK,
-   .map_io = exynos4_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos4212,
-   }, {
-   .idcode = EXYNOS4412_CPU_ID,
-   .idmask = EXYNOS4_CPU_MASK,
-   .map_io = exynos4_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos4412,
-   }, {
-   .idcode = EXYNOS5250_SOC_ID,
-   .idmask = EXYNOS5_SOC_MASK,
-   .map_io = exynos5_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos5250,
-   }, {
-   .idcode = EXYNOS5420_SOC_ID,
-   .idmask = EXYNOS5_SOC_MASK,
-   .map_io = exynos5_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos5420,
-   }, {
-   .idcode = EXYNOS5440_SOC_ID,
-   .idmask = EXYNOS5_SOC_MASK,
-   .init   = exynos_init,
-   .name   = name_exynos5440,
-   },
-};
+static void exynos_map_io(void);


cosmetic: Instead of adding forward declaration, the resulting 
exynos_map_io() function could be simply merged with exynos_init_io().


Best regards,
Tomasz
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] ARM: EXYNOS: Consolidate CPU init code

2014-01-22 Thread Sachin Kamat
cpu_table was used to distinguish between different Exynos4 and 5 SoCs
and assign the the initialization and io mapping pointers based on type.
exynos_init is dummy and no longer needed as we do a DT based booting.
By having a common io mapping function we can get rid of the whole
table and avoid populating it for every SoC.

Tested on Exynos4210, 5250 and 5420 based boards.

Signed-off-by: Sachin Kamat 
---
 arch/arm/mach-exynos/common.c |   93 -
 1 file changed, 17 insertions(+), 76 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index f18be40e5b21..02d0aaa7af59 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -48,55 +48,7 @@
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200
 
-static const char name_exynos4210[] = "EXYNOS4210";
-static const char name_exynos4212[] = "EXYNOS4212";
-static const char name_exynos4412[] = "EXYNOS4412";
-static const char name_exynos5250[] = "EXYNOS5250";
-static const char name_exynos5420[] = "EXYNOS5420";
-static const char name_exynos5440[] = "EXYNOS5440";
-
-static void exynos4_map_io(void);
-static void exynos5_map_io(void);
-static int exynos_init(void);
-
-static struct cpu_table cpu_ids[] __initdata = {
-   {
-   .idcode = EXYNOS4210_CPU_ID,
-   .idmask = EXYNOS4_CPU_MASK,
-   .map_io = exynos4_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos4210,
-   }, {
-   .idcode = EXYNOS4212_CPU_ID,
-   .idmask = EXYNOS4_CPU_MASK,
-   .map_io = exynos4_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos4212,
-   }, {
-   .idcode = EXYNOS4412_CPU_ID,
-   .idmask = EXYNOS4_CPU_MASK,
-   .map_io = exynos4_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos4412,
-   }, {
-   .idcode = EXYNOS5250_SOC_ID,
-   .idmask = EXYNOS5_SOC_MASK,
-   .map_io = exynos5_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos5250,
-   }, {
-   .idcode = EXYNOS5420_SOC_ID,
-   .idmask = EXYNOS5_SOC_MASK,
-   .map_io = exynos5_map_io,
-   .init   = exynos_init,
-   .name   = name_exynos5420,
-   }, {
-   .idcode = EXYNOS5440_SOC_ID,
-   .idmask = EXYNOS5_SOC_MASK,
-   .init   = exynos_init,
-   .name   = name_exynos5440,
-   },
-};
+static void exynos_map_io(void);
 
 /* Initial IO mappings */
 
@@ -355,28 +307,28 @@ void __init exynos_init_io(void)
/* detect cpu id and rev. */
s5p_init_cpu(S5P_VA_CHIPID);
 
-   s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+   exynos_map_io();
 }
 
-static void __init exynos4_map_io(void)
+static void __init exynos_map_io(void)
 {
-   iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
-
-   if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0)
-   iotable_init(exynos4_iodesc0, ARRAY_SIZE(exynos4_iodesc0));
-   else
-   iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1));
-
-   if (soc_is_exynos4210())
+   if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412())
+   iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
+
+   if (soc_is_exynos5250() || soc_is_exynos5420())
+   iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
+
+   if (soc_is_exynos4210()) {
+   if (samsung_rev() == EXYNOS4210_REV_0)
+   iotable_init(exynos4_iodesc0,
+   ARRAY_SIZE(exynos4_iodesc0));
+   else
+   iotable_init(exynos4_iodesc1,
+   ARRAY_SIZE(exynos4_iodesc1));
iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc));
+   }
if (soc_is_exynos4212() || soc_is_exynos4412())
iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc));
-}
-
-static void __init exynos5_map_io(void)
-{
-   iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
-
if (soc_is_exynos5250())
iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
@@ -386,10 +338,6 @@ struct bus_type exynos_subsys = {
.dev_name   = "exynos-core",
 };
 
-static struct device exynos4_dev = {
-   .bus= &exynos_subsys,
-};
-
 static int __init exynos_core_init(void)
 {
return subsys_system_register(&exynos_subsys, NULL);
@@ -409,10 +357,3 @@ static in