ARM: lpc32xx: only run SoC init on LPC32xx hardware
Subsystems (3)
PATCH v2 1/1 ARM: lpc32xx: only run SoC init on LPC32xx hardware
lpc32xx_check_uid() and lpc32xx_pm_init() are arch_initcalls that poke LPC32xx-only registers. Since the multiplatform conversion they also run on other ARCH_MULTI_V5 boards where access faults e.g. on versatile:
Unable to handle kernel paging request at virtual address f4004130 PC is at lpc32xx_check_uid+0x2c/0x9c
Drop the arch_initcall() registrations and call both functions directly from lpc3250_machine_init(), the machine's .init_machine hook. The calls are placed in link order (common.c, pm.c, phy3250.c) to keep their previous relative ordering.
---
v2:
- Rather than guarding the two arch_initcalls, drop the initcalls entirely and call both functions from lpc3250_machine_init(), which is already guarded properly. (Suggested by Arnd.)
arch/arm/mach-lpc32xx/common.c | 5 +---- arch/arm/mach-lpc32xx/common.h | 2 ++ arch/arm/mach-lpc32xx/phy3250.c | 2 ++ arch/arm/mach-lpc32xx/pm.c | 5 +---- 4 files changed, 6 insertions(+), 8 deletions(-)
arch/arm/mach-lpc32xx/common.c +1 -4
@@ -106,7 +106,7 @@ void __init lpc32xx_map_io(void)iotable_init (lpc32xx_io_desc,ARRAY_SIZE (lpc32xx_io_desc)); } -static int __init lpc32xx_check_uid (void ) +void __init lpc32xx_check_uid (void ) {u32 uid[4 ];
@@ -119,7 +119,4 @@ static int __init lpc32xx_check_uid(void) system_serial_low = uid[0 ]; system_serial_high = uid[1 ]; } - -return 1 ; } -arch_initcall (lpc32xx_check_uid);
arch/arm/mach-lpc32xx/common.h +2 -0
@@ -16,6 +16,8 @@* Other arch specific structures and functions */ extern void __init lpc32xx_map_io (void ); +extern void __init lpc32xx_check_uid (void ); +extern void __init lpc32xx_pm_init (void );extern void __init lpc32xx_serial_init (void );/*
arch/arm/mach-lpc32xx/phy3250.c +2 -0
@@ -71,6 +71,8 @@ static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {static void __init lpc3250_machine_init (void ) { +lpc32xx_check_uid (); +lpc32xx_pm_init ();lpc32xx_serial_init ();of_platform_default_populate (NULL , lpc32xx_auxdata_lookup,NULL );
arch/arm/mach-lpc32xx/pm.c +1 -4
@@ -120,7 +120,7 @@ static const struct platform_suspend_ops lpc32xx_pm_ops = {#define EMC_DYN_MEM_CTRL_OFS 0x20#define EMC_SRMMC (1 << 3)#define EMC_CTRL_REG io_p2v(LPC32XX_EMC_BASE + EMC_DYN_MEM_CTRL_OFS) -static int __init lpc32xx_pm_init (void ) +void __init lpc32xx_pm_init (void ) {/* * Setup SDRAM self-refresh clock to automatically disable o
@@ -129,7 +129,4 @@ static int __init lpc32xx_pm_init(void)__raw_writel (__raw_readl (EMC_CTRL_REG ) |EMC_SRMMC ,EMC_CTRL_REG );suspend_set_ops (&lpc32xx_pm_ops); - -return 0 ; } -arch_initcall (lpc32xx_pm_init);
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 7 lines · Karl Mehltretter
lpc32xx_check_uid()andlpc32xx_pm_init()arearch_initcallsthat poke LPC32xx-only registers. Since the multiplatform conversion they also run on otherARCH_MULTI_V5boards where access faults e.g. on versatile:Unable to handle kernel paging request at virtual address f4004130 PC is at lpc32xx_check_uid+0x2c/0x9c
Quoted 8 lines
Drop the
arch_initcall()registrations and call both functions directly fromlpc3250_machine_init(), the machine's .init_machine hook. The calls are placed in link order (common.c,pm.c,phy3250.c) to keep their previous relative ordering.Fixes 75bf1bd7d2f9 ("ARM: lpc32xx: allow multiplatform build")Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Karl Mehltretter <[email protected]>
Looks good to me,
Vladimir, I assume you'll pick this up and forward it to [email protected]. Let us know if you prefer Karl to send it there directly and save you the extra pull request.
Arnd
Vladimir Zapolskiy
maintainerQuoted 17 lines · Arnd Bergmann
Quoted 7 lines · Karl Mehltretter
lpc32xx_check_uid()andlpc32xx_pm_init()arearch_initcallsthat poke LPC32xx-only registers. Since the multiplatform conversion they also run on otherARCH_MULTI_V5boards where access faults e.g. on versatile:Unable to handle kernel paging request at virtual address f4004130 PC is at lpc32xx_check_uid+0x2c/0x9cQuoted 8 lines
Drop the
arch_initcall()registrations and call both functions directly fromlpc3250_machine_init(), the machine's .init_machine hook. The calls are placed in link order (common.c,pm.c,phy3250.c) to keep their previous relative ordering.Fixes 75bf1bd7d2f9 ("ARM: lpc32xx: allow multiplatform build")Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Karl Mehltretter <[email protected]>
Quoted 7 lines
Looks good to me,
Reviewed-by Arnd Bergmann <[email protected]>Vladimir, I assume you'll pick this up and forward it to [email protected]. Let us know if you prefer Karl to send it there directly and save you the extra pull request.
Will do it next week, if it's not too late.
Many thanks for the change and for the review!
Signature · 2 lines
Best wishes, Vladimir
Quoted 88 lines · Karl Mehltretter
lpc32xx_check_uid()andlpc32xx_pm_init()arearch_initcallsthat poke LPC32xx-only registers. Since the multiplatform conversion they also run on otherARCH_MULTI_V5boards where access faults e.g. on versatile:Unable to handle kernel paging request at virtual address f4004130 PC is at lpc32xx_check_uid+0x2c/0x9cDrop the
arch_initcall()registrations and call both functions directly fromlpc3250_machine_init(), the machine's .init_machine hook. The calls are placed in link order (common.c,pm.c,phy3250.c) to keep their previous relative ordering.Fixes 75bf1bd7d2f9 ("ARM: lpc32xx: allow multiplatform build")Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Karl Mehltretter <[email protected]>---
v2:
- Rather than guarding the twoarch_initcalls, drop the initcalls entirely and call both functions fromlpc3250_machine_init(), which is already guarded properly. (Suggested by Arnd.)arch/arm/mach-lpc32xx/common.c | 5 +---- arch/arm/mach-lpc32xx/common.h | 2 ++ arch/arm/mach-lpc32xx/phy3250.c | 2 ++ arch/arm/mach-lpc32xx/pm.c | 5 +---- 4 files changed, 6 insertions(+), 8 deletions(-)arch/arm/mach-lpc32xx/common.c +1
-4@@ -106,7 +106,7 @@ void __init lpc32xx_map_io(void)iotable_init (lpc32xx_io_desc,ARRAY_SIZE (lpc32xx_io_desc)); } -static int __init lpc32xx_check_uid (void ) +void __init lpc32xx_check_uid (void ) {u32 uid[4 ];@@ -119,7 +119,4 @@ static int __init lpc32xx_check_uid(void) system_serial_low = uid[0 ]; system_serial_high = uid[1 ]; } - -return 1 ; } -arch_initcall (lpc32xx_check_uid);arch/arm/mach-lpc32xx/common.h +2
-0@@ -16,6 +16,8 @@* Other arch specific structures and functions */ extern void __init lpc32xx_map_io (void ); +extern void __init lpc32xx_check_uid (void ); +extern void __init lpc32xx_pm_init (void );extern void __init lpc32xx_serial_init (void );/* arch/arm/mach-lpc32xx/phy3250.c +2
-0@@ -71,6 +71,8 @@ static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {static void __init lpc3250_machine_init (void ) { +lpc32xx_check_uid (); +lpc32xx_pm_init ();lpc32xx_serial_init ();of_platform_default_populate (NULL , lpc32xx_auxdata_lookup,NULL );arch/arm/mach-lpc32xx/pm.c +1
-1@@ -120,7 +120,7 @@ static const struct platform_suspend_ops lpc32xx_pm_ops = {#define EMC_DYN_MEM_CTRL_OFS 0x20#define EMC_SRMMC (1 << 3)#define EMC_CTRL_REG io_p2v(LPC32XX_EMC_BASE + EMC_DYN_MEM_CTRL_OFS) -static int __init lpc32xx_pm_init (void ) +void __init lpc32xx_pm_init (void ) {/* * Setup SDRAM self-refresh clock to automatically disable o
arch/arm/mach-lpc32xx/pm.c static int __init lpc32xx_pm_init(void) · line 135
Quoted 7 lines
arch/arm/mach-lpc32xx/pm.c +0
-3@@ -129,7 +129,4 @@ static int __init lpc32xx_pm_init(void)__raw_writel (__raw_readl (EMC_CTRL_REG ) |EMC_SRMMC ,EMC_CTRL_REG );suspend_set_ops (&lpc32xx_pm_ops); - -return 0 ; } -arch_initcall (lpc32xx_pm_init);
Signature · 2 lines
Best wishes, Vladimir