ARM: at91: remove unnecessary of_platform_default_populate calls
PATCH 1/1 ARM: at91: remove unnecessary of_platform_default_populate calls
The DT core will call of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.
--- arch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 5 ----- 3 files changed, 15 deletions(-)
arch/arm/mach-at91/at91rm9200.c +0 -5
@@ -8,17 +8,12 @@* Licensed under GPLv2 or later. */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include "generic.h" static void __init at91rm9200_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91rm9200_pm_init (); }
arch/arm/mach-at91/at91sam9.c +0 -5
@@ -7,9 +7,6 @@* Licensed under GPLv2 or later. */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/system_misc.h>
@@ -17,8 +14,6 @@static void __init at91sam9_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91sam9_pm_init (); }
arch/arm/mach-at91/sama5.c +0 -5
@@ -7,9 +7,6 @@* Licensed under GPLv2 or later. */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/system_misc.h>
@@ -18,7 +15,6 @@static void __init sama5_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5_pm_init (); }
@@ -47,7 +43,6 @@ MACHINE_ENDstatic void __init sama5d2_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5d2_pm_init (); }
Signature · 1 line
2.17.1
Quoted 10 lines · Rob Herring
The DT core will call
of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Rob Herring <[email protected]>
Quoted 5 lines
--- arch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 5 ----- 3 files changed, 15 deletions(-)
Ping?
Quoted 79 lines
arch/arm/mach-at91/at91rm9200.c +0
-5@@ -8,17 +8,12 @@* Licensed under GPLv2 or later. */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include "generic.h" static void __init at91rm9200_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91rm9200_pm_init (); }arch/arm/mach-at91/at91sam9.c +0
-5@@ -7,9 +7,6 @@* Licensed under GPLv2 or later. */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/system_misc.h> @@ -17,8 +14,6 @@static void __init at91sam9_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91sam9_pm_init (); }arch/arm/mach-at91/sama5.c +0
-6@@ -7,9 +7,6 @@* Licensed under GPLv2 or later. */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/system_misc.h> @@ -18,7 +15,6 @@static void __init sama5_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5_pm_init (); }@@ -47,7 +43,6 @@ MACHINE_ENDstatic void __init sama5d2_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5d2_pm_init (); } --2.17.1
Alexandre Belloni
maintainerHi,
Quoted 17 lines · Rob Herring
Quoted 10 lines · Rob Herring
The DT core will call
of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Rob Herring <[email protected]>Quoted 5 lines
--- arch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 5 ----- 3 files changed, 15 deletions(-)
Quoted 2 lines
Ping?
This breaks the platform in two different ways:
- PM is not working anymore because of the missing SRAM node
- the pinctrl driver fails to probe and so many drivers are deferring the probe forever
Relevant messages (once the earlycon crap is removed to let earlyprintk do its job):
at91_pm_sram_init: failed to find sram device!
AT91: PM not supported, due to no SRAM allocated
pinctrl-at91 ahb:apb:pinctrl at fc06a000: you need to specify at least one gpio-controller
pinctrl-at91: probe of ahb:apb:pinctrl at fc06a000 failed with error -22 gpio-at91 fc06a000.gpio: at address (ptrval)
gpio-at91 fc06b000.gpio: at address (ptrval)
gpio-at91 fc06c000.gpio: at address (ptrval)
gpio-at91 fc068000.gpio: at address (ptrval)
gpio-at91 fc06d000.gpio: at address (ptrval)
at91_i2c f8014000.i2c: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/i2c0/i2c0-0, deferring probe atmel_usart f8004000.serial: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/uart0/uart0-0, deferring probe atmel_usart fc00c000.serial: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/usart3/usart3-0, deferring probe atmel_usart fc010000.serial: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/usart4/usart4-0, deferring probe atmel_spi f8010000.spi: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/spi0/spi0-0, deferring probe atmel_spi fc018000.spi: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/spi1/spi1-0, deferring probe macb f8020000.ethernet: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/macb0/macb0_rmii-0, deferring probe atmel_mci fc000000.mmc: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/mmc1/mmc1_clk_cmd_dat0, deferring probe at91_adc fc034000.adc: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/adc0/adc0_ad0, deferring probe gpio-keys gpio_keys: could not find pctldev for node /ahb/apb/pinctrl at fc06a000/board/key_gpio_0, deferring probe
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Quoted 29 lines · Alexandre Belloni
Hi,
Quoted 17 lines · Rob Herring
Quoted 10 lines · Rob Herring
The DT core will call
of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Rob Herring <[email protected]>Quoted 5 lines
--- arch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 5 ----- 3 files changed, 15 deletions(-)Quoted 2 lines
Ping?
This breaks the platform in two different ways:
- PM is not working anymore because of the missing SRAM node
- the pinctrl driver fails to probe and so many drivers are deferring the probe forever
Quoted 5 lines
Relevant messages (once the earlycon crap is removed to let earlyprintk do its job):
at91_pm_sram_init: failed to find sram device!
AT91: PM not supported, due to no SRAM allocated
So the at91_pm_sram_init function tries to get SRAM platform device, but it doesn't exist yet. Of course, that is fragile because while the device may exist, it's just luck that it's driver has probed already. Would using .init_late hook instead of .init_machine work for you?
Ideally, couldn't much of this code be converted to a driver? It's a bit strange for initcall code to have a driver dependency.
Quoted 3 lines
pinctrl-at91 ahb:apb:pinctrl at
fc06a000: you need to specify at least one gpio-controller
pinctrl-at91: probe of ahb:apb:pinctrl atfc06a000failed with error -22
So this one has the strange dependency that the child nodes probe before the parent node. That's backwards. Probe order is probably changing from link order (all the devices are created before drivers register) to device creation order. I think the fix is the pinctrl driver should just count the gpio child nodes rather than relying on aliases (which I'm not a fan of either). I can write a patch to do that.
Rob
Alexandre Belloni
maintainerQuoted 37 lines · Rob Herring
Quoted 29 lines · Alexandre Belloni
Hi,
Quoted 17 lines · Rob Herring
Quoted 10 lines · Rob Herring
The DT core will call
of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Rob Herring <[email protected]>Quoted 5 lines
--- arch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 5 ----- 3 files changed, 15 deletions(-)Quoted 2 lines
Ping?
This breaks the platform in two different ways:
- PM is not working anymore because of the missing SRAM node
- the pinctrl driver fails to probe and so many drivers are deferring the probe foreverQuoted 5 lines
Relevant messages (once the earlycon crap is removed to let earlyprintk do its job):
at91_pm_sram_init: failed to find sram device!
AT91: PM not supported, due to no SRAM allocated
Quoted 8 lines
So the
at91_pm_sram_initfunction tries to get SRAM platform device, but it doesn't exist yet. Of course, that is fragile because while the device may exist, it's just luck that it's driver has probed already. Would using .init_late hook instead of .init_machine work for you?Ideally, couldn't much of this code be converted to a driver? It's a bit strange for initcall code to have a driver dependency.
.init_late seems to work after testing quickly
You probably didn't see it because they still have a soc_device parent but Arnd wanted us to remove it so it is gone.
Quoted 11 lines
Quoted 3 lines
pinctrl-at91 ahb:apb:pinctrl at
fc06a000: you need to specify at least one gpio-controller
pinctrl-at91: probe of ahb:apb:pinctrl atfc06a000failed with error -22So this one has the strange dependency that the child nodes probe before the parent node. That's backwards. Probe order is probably changing from link order (all the devices are created before drivers register) to device creation order. I think the fix is the pinctrl driver should just count the gpio child nodes rather than relying on aliases (which I'm not a fan of either). I can write a patch to do that.
I'll let you do that.
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
[email protected]
maintainerPATCH 1/1 ARM: at91: remove unnecessary of_platform_default_populate calls
In reply to Alexandre BelloniFrom: Rob Herring <[email protected]>
DO NOT APPLY: breaking boot on at91 (sama5d3 xplained / NAND at least)
The DT core will call of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.
---
Rob, Alexandre,
This is the updated patch by Rob.
Tested on sama5d3 xplained platform it fails at least with NAND and, as you observed Alexandre, SRAM.
The pinctrl patch [1] applied seem to solve the problem with GPIO/pinctrl.
So, this move is not ready now, but we can make progress, little by little.
Best regards,
Nicolas
arch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 7 +------ arch/arm/mach-at91/sama7.c | 4 ---- 4 files changed, 1 insertion(+), 20 deletions(-)
arch/arm/mach-at91/at91rm9200.c +0 -5
@@ -7,17 +7,12 @@* 2012 Joachim Eastwood <[email protected]> */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include "generic.h" static void __init at91rm9200_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91rm9200_pm_init (); }
arch/arm/mach-at91/at91sam9.c +0 -5
@@ -6,9 +6,6 @@* 2011 Nicolas Ferre <[email protected]> */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/system_misc.h>
@@ -16,8 +13,6 @@static void __init at91sam9_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91sam9_pm_init (); }
arch/arm/mach-at91/sama5.c +1 -6
@@ -6,14 +6,11 @@* 2013 Ludovic Desroches <[email protected]> */ -#include <linux/of.h> -#include <linux/of_platform.h> - -#include <asm/hardware/cache-l2x0.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/outercache.h> #include <asm/system_misc.h> +#include <asm/hardware/cache-l2x0.h> #include "generic.h" #include "sam_secure.h"
@@ -32,7 +29,6 @@ static void __init sama5_secure_cache_init(void)static void __init sama5_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5_pm_init (); }
@@ -61,7 +57,6 @@ MACHINE_ENDstatic void __init sama5d2_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5d2_pm_init (); }
arch/arm/mach-at91/sama7.c +0 -4
@@ -6,9 +6,6 @@* */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/system_misc.h>
@@ -16,7 +13,6 @@static void __init sama7_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama7_pm_init (); }
Signature · 1 line
2.34.1
Nicolas Ferre
maintainerQuoted 14 lines · On 24/01/2023 at 12:23, [email protected] wrote:
From: Rob Herring <[email protected]>
DO NOT APPLY: breaking boot on at91 (sama5d3 xplained / NAND at least)
The DT core will call
of_platform_default_populate, so it is not necessary for machine specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.Cc Alexandre Belloni <[email protected]>Signed-off-by Rob Herring <[email protected]>[[email protected]: update to newest kernel, add sama7.c file]Signed-off-by Nicolas Ferre <[email protected]>
Quoted 8 lines
---
Rob, Alexandre,This is the updated patch by Rob.
Tested on sama5d3 xplained platform it fails at least with NAND and, as you observed Alexandre, SRAM.The pinctrl patch [1] applied seem to solve the problem with GPIO/pinctrl.
Ref. missing:
[1] https://lore.kernel.org/all/[email protected]/
Quoted 123 lines
So, this move is not ready now, but we can make progress, little by little.
Best regards,
Nicolasarch/arm/mach-at91/at91rm9200.c | 5 ----- arch/arm/mach-at91/at91sam9.c | 5 ----- arch/arm/mach-at91/sama5.c | 7 +------ arch/arm/mach-at91/sama7.c | 4 ---- 4 files changed, 1 insertion(+), 20 deletions(-)arch/arm/mach-at91/at91rm9200.c +0
-5@@ -7,17 +7,12 @@* 2012 Joachim Eastwood <[email protected]> */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include "generic.h" static void __init at91rm9200_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91rm9200_pm_init (); }arch/arm/mach-at91/at91sam9.c +0
-5@@ -6,9 +6,6 @@* 2011 Nicolas Ferre <[email protected]> */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/system_misc.h> @@ -16,8 +13,6 @@static void __init at91sam9_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL ); -at91sam9_pm_init (); }arch/arm/mach-at91/sama5.c +1
-6@@ -6,14 +6,11 @@* 2013 Ludovic Desroches <[email protected]> */ -#include <linux/of.h> -#include <linux/of_platform.h> - -#include <asm/hardware/cache-l2x0.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/outercache.h> #include <asm/system_misc.h> +#include <asm/hardware/cache-l2x0.h> #include "generic.h" #include "sam_secure.h" @@ -32,7 +29,6 @@ static void __init sama5_secure_cache_init(void)static void __init sama5_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5_pm_init (); }@@ -61,7 +57,6 @@ MACHINE_ENDstatic void __init sama5d2_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama5d2_pm_init (); }arch/arm/mach-at91/sama7.c +0
-5@@ -6,9 +6,6 @@* */ -#include <linux/of.h> -#include <linux/of_platform.h> -#include <asm/mach/arch.h> #include <asm/system_misc.h> @@ -16,7 +13,6 @@static void __init sama7_dt_device_init (void ) { -of_platform_default_populate (NULL ,NULL ,NULL );sama7_pm_init (); } --2.34.1
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 1 line
Nicolas Ferre