Skip to contentSkip to conversation

at91: Remove of_platform_default_populate() calls

PATCH Applied Rob Herring (Arm) 4 participants 14 messages Jan 5 – May 6

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v3 cover at91: Remove of_platform_default_populate() calls

This is another attempt at removing of_platform_default_populate() calls on at91 platforms. The last attempts were in 2018[1] and 2023[2]. The problems reported are PM and NAND failures. Both of these depend on SRAM pool which doesn't have any fw_devlink tracking. Also, the PM code is not a driver, so fw_devlink wouldn't help. For the NAND driver, we can simply defer probe. For the PM init, we can move it to the .late_init hook.

Rob

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

---
Changes in v3:
- Fixup mismatch in my author vs. Sob.
- Fixup the split between patch 2 and 3 to fix bisection
- Use dev_err_probe() in NAND driver
- Link to v2: https://patch.msgid.link/[email protected]

---
Rob Herring (Arm) (3):
mtd: nand: atmel: Defer probe if SRAM is missing
ARM: at91: Move PM init functions to .init_late hook
ARM: at91: remove unnecessary of_platform_default_populate calls

 arch/arm/mach-at91/at91rm9200.c              | 12 +-----------
 arch/arm/mach-at91/at91sam9.c                | 12 +-----------
 arch/arm/mach-at91/sam9x60.c                 | 12 +-----------
 arch/arm/mach-at91/sam9x7.c                  | 12 +-----------
 arch/arm/mach-at91/sama5.c                   | 21 +++------------------
 arch/arm/mach-at91/sama7.c                   | 11 +----------
 drivers/mtd/nand/raw/atmel/nand-controller.c |  6 ++----
 7 files changed, 10 insertions(+), 76 deletions(-)

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251120-at91-probe-20fbce9a6d1b

Best regards,

Signature · 1 line
Rob Herring (Arm) <[email protected]>
#1 lore raw

PATCH v3 1/3 mtd: nand: atmel: Defer probe if SRAM is missing

The Atmel NAND controller driver depends on an SRAM pool and has an implicit assumption that the SRAM pool has already been created. Changing the initcall ordering can break this. Unfortunately, fw_devlink can't save us here as there's not a standard property to track the dependency. So it's up to deferring probe to save us.

---
v3:
- Use dev_err_probe()

---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +2 -4
index 83ba4ebd02d4..e7fdf532c5fe 100644
@@ -2304,10 +2304,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
 
 	nc->sram.pool = of_gen_pool_get(nc->base.dev->of_node,
 					 "atmel,nfc-sram", 0);
-	if (!nc->sram.pool) {
-		dev_err(nc->base.dev, "Missing SRAM\n");
-		return -ENOMEM;
-	}
+	if (!nc->sram.pool)
+		return dev_err_probe(nc->base.dev, -EPROBE_DEFER, "Missing SRAM\n");
 
 	nc->sram.virt = (void __iomem *)gen_pool_dma_alloc(nc->sram.pool,
 							   ATMEL_NFC_SRAM_SIZE,
Signature · 1 line
2.51.0
#2 lore raw

PATCH v3 2/3 ARM: at91: Move PM init functions to .init_late hook

In reply to Rob Herring (Arm)

Move the AT91 PM init functions to .init_late hook to ensure driver dependencies have probed.

---
v3:
- Fix author name adding "(Arm)"
- Fixup split between patch 2 and 3

v2:
- new patch

---
 arch/arm/mach-at91/at91rm9200.c | 3 +--
 arch/arm/mach-at91/at91sam9.c   | 3 +--
 arch/arm/mach-at91/sam9x60.c    | 3 +--
 arch/arm/mach-at91/sam9x7.c     | 3 +--
 arch/arm/mach-at91/sama5.c      | 5 +++--
 arch/arm/mach-at91/sama7.c      | 2 +-
 6 files changed, 8 insertions(+), 11 deletions(-)
arch/arm/mach-at91/at91rm9200.c +1 -2
index 4f8186211619..2ac564eb8bbb 100644
@@ -17,8 +17,6 @@
 static void __init at91rm9200_dt_device_init(void)
 {
 	of_platform_default_populate(NULL, NULL, NULL);
-
-	at91rm9200_pm_init();
 }
 
 static const char *const at91rm9200_dt_board_compat[] __initconst = {
@@ -27,6 +25,7 @@ static const char *const at91rm9200_dt_board_compat[] __initconst = {
 };
 
 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
+	.init_late	= at91rm9200_pm_init,
 	.init_machine	= at91rm9200_dt_device_init,
 	.dt_compat	= at91rm9200_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/at91sam9.c +1 -2
index 7e572189a5eb..cf07cba4ee5d 100644
@@ -17,8 +17,6 @@
 static void __init at91sam9_init(void)
 {
 	of_platform_default_populate(NULL, NULL, NULL);
-
-	at91sam9_pm_init();
 }
 
 static const char *const at91_dt_board_compat[] __initconst = {
@@ -28,6 +26,7 @@ static const char *const at91_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9")
 	/* Maintainer: Atmel */
+	.init_late	= at91sam9_pm_init,
 	.init_machine	= at91sam9_init,
 	.dt_compat	= at91_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x60.c +1 -2
index d8c739d25458..a31beaaeffcd 100644
@@ -18,8 +18,6 @@
 static void __init sam9x60_init(void)
 {
 	of_platform_default_populate(NULL, NULL, NULL);
-
-	sam9x60_pm_init();
 }
 
 static const char *const sam9x60_dt_board_compat[] __initconst = {
@@ -29,6 +27,7 @@ static const char *const sam9x60_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sam9x60_dt, "Microchip SAM9X60")
 	/* Maintainer: Microchip */
+	.init_late	= sam9x60_pm_init,
 	.init_machine	= sam9x60_init,
 	.dt_compat	= sam9x60_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x7.c +1 -2
index e1ff30b5b09b..0c73f7fefd4f 100644
@@ -17,8 +17,6 @@
 static void __init sam9x7_init(void)
 {
 	of_platform_default_populate(NULL, NULL, NULL);
-
-	sam9x7_pm_init();
 }
 
 static const char * const sam9x7_dt_board_compat[] __initconst = {
@@ -28,6 +26,7 @@ static const char * const sam9x7_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sam9x7_dt, "Microchip SAM9X7")
 	/* Maintainer: Microchip */
+	.init_late	= sam9x7_pm_init,
 	.init_machine	= sam9x7_init,
 	.dt_compat	= sam9x7_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sama5.c +3 -2
index bf2b5c6a18c6..576654cba82d 100644
@@ -33,7 +33,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();
 }
 
 static const char *const sama5_dt_board_compat[] __initconst = {
@@ -43,6 +42,7 @@ static const char *const sama5_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
+	.init_late	= sama5_pm_init,
 	.init_machine	= sama5_dt_device_init,
 	.dt_compat	= sama5_dt_board_compat,
 MACHINE_END
@@ -55,6 +55,7 @@ static const char *const sama5_alt_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
 	.init_machine	= sama5_dt_device_init,
+	.init_late	= sama5_pm_init,
 	.dt_compat	= sama5_alt_dt_board_compat,
 	.l2c_aux_mask	= ~0UL,
 MACHINE_END
@@ -62,7 +63,6 @@ MACHINE_END
 static void __init sama5d2_init(void)
 {
 	of_platform_default_populate(NULL, NULL, NULL);
-	sama5d2_pm_init();
 }
 
 static const char *const sama5d2_compat[] __initconst = {
@@ -74,6 +74,7 @@ DT_MACHINE_START(sama5d2, "Atmel SAMA5")
 	/* Maintainer: Atmel */
 	.init_machine	= sama5d2_init,
 	.init_early	= sama5_secure_cache_init,
+	.init_late	= sama5d2_pm_init,
 	.dt_compat	= sama5d2_compat,
 	.l2c_aux_mask	= ~0UL,
 MACHINE_END
arch/arm/mach-at91/sama7.c +1 -1
index bd43733ede18..8bf57a020f1c 100644
@@ -17,7 +17,6 @@
 static void __init sama7_dt_device_init(void)
 {
 	of_platform_default_populate(NULL, NULL, NULL);
-	sama7_pm_init();
 }
 
 static const char *const sama7_dt_board_compat[] __initconst = {
@@ -27,6 +26,7 @@ static const char *const sama7_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sama7_dt, "Microchip SAMA7")
 	/* Maintainer: Microchip */
+	.init_late	= sama7_pm_init,
 	.init_machine	= sama7_dt_device_init,
 	.dt_compat	= sama7_dt_board_compat,
 MACHINE_END
Signature · 1 line
2.51.0
#3 lore raw

PATCH v3 3/3 ARM: at91: remove unnecessary of_platform_default_populate calls

In reply to Rob Herring (Arm)

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.

---
v3:
- Fixup split between patch 2 and 3.

v2:
- Dust off and rebase to 6.18-rc1
- Add new platforms added since v1

---
 arch/arm/mach-at91/at91rm9200.c |  9 ---------
 arch/arm/mach-at91/at91sam9.c   |  9 ---------
 arch/arm/mach-at91/sam9x60.c    |  9 ---------
 arch/arm/mach-at91/sam9x7.c     |  9 ---------
 arch/arm/mach-at91/sama5.c      | 16 ----------------
 arch/arm/mach-at91/sama7.c      |  9 ---------
 6 files changed, 61 deletions(-)
arch/arm/mach-at91/at91rm9200.c +0 -9
index 2ac564eb8bbb..d15997fff5d7 100644
@@ -7,18 +7,10 @@
  *                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);
-}
-
 static const char *const at91rm9200_dt_board_compat[] __initconst = {
 	"atmel,at91rm9200",
 	NULL
@@ -26,6 +18,5 @@ static const char *const at91rm9200_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
 	.init_late	= at91rm9200_pm_init,
-	.init_machine	= at91rm9200_dt_device_init,
 	.dt_compat	= at91rm9200_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/at91sam9.c +0 -9
index cf07cba4ee5d..b9d2909d1b65 100644
@@ -6,19 +6,11 @@
  *                2011 Nicolas Ferre <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init at91sam9_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const at91_dt_board_compat[] __initconst = {
 	"atmel,at91sam9",
 	NULL
@@ -27,6 +19,5 @@ static const char *const at91_dt_board_compat[] __initconst = {
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9")
 	/* Maintainer: Atmel */
 	.init_late	= at91sam9_pm_init,
-	.init_machine	= at91sam9_init,
 	.dt_compat	= at91_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x60.c +0 -9
index a31beaaeffcd..744bab2cbb92 100644
@@ -7,19 +7,11 @@
  * Author: Claudiu Beznea <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init sam9x60_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sam9x60_dt_board_compat[] __initconst = {
 	"microchip,sam9x60",
 	NULL
@@ -28,6 +20,5 @@ static const char *const sam9x60_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sam9x60_dt, "Microchip SAM9X60")
 	/* Maintainer: Microchip */
 	.init_late	= sam9x60_pm_init,
-	.init_machine	= sam9x60_init,
 	.dt_compat	= sam9x60_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x7.c +0 -9
index 0c73f7fefd4f..166c8625509d 100644
@@ -7,18 +7,10 @@
  * Author: Varshini Rajendran <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 
 #include "generic.h"
 
-static void __init sam9x7_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char * const sam9x7_dt_board_compat[] __initconst = {
 	"microchip,sam9x7",
 	NULL
@@ -27,6 +19,5 @@ static const char * const sam9x7_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sam9x7_dt, "Microchip SAM9X7")
 	/* Maintainer: Microchip */
 	.init_late	= sam9x7_pm_init,
-	.init_machine	= sam9x7_init,
 	.dt_compat	= sam9x7_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sama5.c +0 -16
index 576654cba82d..e56022f00800 100644
@@ -6,9 +6,6 @@
  *                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>
@@ -30,11 +27,6 @@ static void __init sama5_secure_cache_init(void)
 		outer_cache.write_sec = sama5_l2c310_write_sec;
 }
 
-static void __init sama5_dt_device_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama5_dt_board_compat[] __initconst = {
 	"atmel,sama5",
 	NULL
@@ -43,7 +35,6 @@ static const char *const sama5_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
 	.init_late	= sama5_pm_init,
-	.init_machine	= sama5_dt_device_init,
 	.dt_compat	= sama5_dt_board_compat,
 MACHINE_END
 
@@ -54,17 +45,11 @@ static const char *const sama5_alt_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
-	.init_machine	= sama5_dt_device_init,
 	.init_late	= sama5_pm_init,
 	.dt_compat	= sama5_alt_dt_board_compat,
 	.l2c_aux_mask	= ~0UL,
 MACHINE_END
 
-static void __init sama5d2_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama5d2_compat[] __initconst = {
 	"atmel,sama5d2",
 	NULL
@@ -72,7 +57,6 @@ static const char *const sama5d2_compat[] __initconst = {
 
 DT_MACHINE_START(sama5d2, "Atmel SAMA5")
 	/* Maintainer: Atmel */
-	.init_machine	= sama5d2_init,
 	.init_early	= sama5_secure_cache_init,
 	.init_late	= sama5d2_pm_init,
 	.dt_compat	= sama5d2_compat,
arch/arm/mach-at91/sama7.c +0 -9
index 8bf57a020f1c..f56828d61199 100644
@@ -6,19 +6,11 @@
  *
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init sama7_dt_device_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama7_dt_board_compat[] __initconst = {
 	"microchip,sama7",
 	NULL
@@ -27,7 +19,6 @@ static const char *const sama7_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama7_dt, "Microchip SAMA7")
 	/* Maintainer: Microchip */
 	.init_late	= sama7_pm_init,
-	.init_machine	= sama7_dt_device_init,
 	.dt_compat	= sama7_dt_board_compat,
 MACHINE_END
 
Signature · 1 line
2.51.0
#4 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Hello everyone,

I'm afraid this patch breaks finding rootfs on raw nand on sam9x60, see below:

Am Mon, Jan 05, 2026 at 03:06:45PM -0600 schrieb Rob Herring (Arm):

Quoted 8 lines

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.

Not sure what was actually tested, but this change breaks booting from raw NAND flash on our sam9x60 based board. I bisected the boot failure to this exact change. Before the change I see the nand controller messages in the kernel log like this:

atmel-nand-controller 10000000.ebi:nand-controller: using dma0chan5 for DMA transfers
nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
nand: AMD/Spansion S34ML02G1
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64

After the change, there are no kernel log messages related to nand at all, the driver does not seem to load. This of course leads to no mtd and ubi devices created, no ubi volumes found, no rootfs, and eventually this message:

VFS: Cannot open root device "ubi0:rootfs2" or unknown-block(0,253): error -19

I tried to understand the whole patch series, and to my understanding the intend was the device nodes still get populated, and the drivers loaded, right? Patch 1/3 is related to the atmel nand controller, and that one is not in the tree yet when bisecting to the end. However it is present in v7.0-rc1 (and later) and trying to boot that kernel (or 7.0 or todays master) fails, too. (Also I don't see those probe defer messages related to SRAM on v7.0-rc1, so I assume that's not the problem?)

Now the strange thing is: on a different hardware based on sama5d2 v7.0-rc1 boots fine from raw nand flash. I wonder what's the difference which makes it work on one atmel platform and not work on the other?

I compared kernel .config of both boards, no obvious pieces missing. Looking at the dts (and included dtsi) files of both boards I could spot no mistake. Also no obvious flaws in sama5d2.dtsi or sam9x60.dtsi.

Note: raw NAND flash is the only storage for rootfs on our platforms, we can not simply put rootfs to a different storage. I could try setting up NFS boot for further investigation, but that will take a while.

Does anyone have an idea how to make booting from raw NAND flash work on sam9x60 again (despite the obviously not desired revert)? What can I try? What information would be interesting for debugging?

Greets
Alex

Quoted 235 lines

---
v3:
- Fixup split between patch 2 and 3.

v2:
- Dust off and rebase to 6.18-rc1
- Add new platforms added since v1

---
 arch/arm/mach-at91/at91rm9200.c |  9 ---------
 arch/arm/mach-at91/at91sam9.c   |  9 ---------
 arch/arm/mach-at91/sam9x60.c    |  9 ---------
 arch/arm/mach-at91/sam9x7.c     |  9 ---------
 arch/arm/mach-at91/sama5.c      | 16 ----------------
 arch/arm/mach-at91/sama7.c      |  9 ---------
 6 files changed, 61 deletions(-)
arch/arm/mach-at91/at91rm9200.c +0 -9
index 2ac564eb8bbb..d15997fff5d7 100644
@@ -7,18 +7,10 @@
  *                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);
-}
-
 static const char *const at91rm9200_dt_board_compat[] __initconst = {
 	"atmel,at91rm9200",
 	NULL
@@ -26,6 +18,5 @@ static const char *const at91rm9200_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
 	.init_late	= at91rm9200_pm_init,
-	.init_machine	= at91rm9200_dt_device_init,
 	.dt_compat	= at91rm9200_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/at91sam9.c +0 -9
index cf07cba4ee5d..b9d2909d1b65 100644
@@ -6,19 +6,11 @@
  *                2011 Nicolas Ferre <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init at91sam9_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const at91_dt_board_compat[] __initconst = {
 	"atmel,at91sam9",
 	NULL
@@ -27,6 +19,5 @@ static const char *const at91_dt_board_compat[] __initconst = {
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9")
 	/* Maintainer: Atmel */
 	.init_late	= at91sam9_pm_init,
-	.init_machine	= at91sam9_init,
 	.dt_compat	= at91_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x60.c +0 -9
index a31beaaeffcd..744bab2cbb92 100644
@@ -7,19 +7,11 @@
  * Author: Claudiu Beznea <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init sam9x60_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sam9x60_dt_board_compat[] __initconst = {
 	"microchip,sam9x60",
 	NULL
@@ -28,6 +20,5 @@ static const char *const sam9x60_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sam9x60_dt, "Microchip SAM9X60")
 	/* Maintainer: Microchip */
 	.init_late	= sam9x60_pm_init,
-	.init_machine	= sam9x60_init,
 	.dt_compat	= sam9x60_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x7.c +0 -9
index 0c73f7fefd4f..166c8625509d 100644
@@ -7,18 +7,10 @@
  * Author: Varshini Rajendran <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 
 #include "generic.h"
 
-static void __init sam9x7_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char * const sam9x7_dt_board_compat[] __initconst = {
 	"microchip,sam9x7",
 	NULL
@@ -27,6 +19,5 @@ static const char * const sam9x7_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sam9x7_dt, "Microchip SAM9X7")
 	/* Maintainer: Microchip */
 	.init_late	= sam9x7_pm_init,
-	.init_machine	= sam9x7_init,
 	.dt_compat	= sam9x7_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sama5.c +0 -16
index 576654cba82d..e56022f00800 100644
@@ -6,9 +6,6 @@
  *                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>
@@ -30,11 +27,6 @@ static void __init sama5_secure_cache_init(void)
 		outer_cache.write_sec = sama5_l2c310_write_sec;
 }
 
-static void __init sama5_dt_device_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama5_dt_board_compat[] __initconst = {
 	"atmel,sama5",
 	NULL
@@ -43,7 +35,6 @@ static const char *const sama5_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
 	.init_late	= sama5_pm_init,
-	.init_machine	= sama5_dt_device_init,
 	.dt_compat	= sama5_dt_board_compat,
 MACHINE_END
 
@@ -54,17 +45,11 @@ static const char *const sama5_alt_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
-	.init_machine	= sama5_dt_device_init,
 	.init_late	= sama5_pm_init,
 	.dt_compat	= sama5_alt_dt_board_compat,
 	.l2c_aux_mask	= ~0UL,
 MACHINE_END
 
-static void __init sama5d2_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama5d2_compat[] __initconst = {
 	"atmel,sama5d2",
 	NULL
@@ -72,7 +57,6 @@ static const char *const sama5d2_compat[] __initconst = {
 
 DT_MACHINE_START(sama5d2, "Atmel SAMA5")
 	/* Maintainer: Atmel */
-	.init_machine	= sama5d2_init,
 	.init_early	= sama5_secure_cache_init,
 	.init_late	= sama5d2_pm_init,
 	.dt_compat	= sama5d2_compat,
arch/arm/mach-at91/sama7.c +0 -9
index 8bf57a020f1c..f56828d61199 100644
@@ -6,19 +6,11 @@
  *
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init sama7_dt_device_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama7_dt_board_compat[] __initconst = {
 	"microchip,sama7",
 	NULL
@@ -27,7 +19,6 @@ static const char *const sama7_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama7_dt, "Microchip SAMA7")
 	/* Maintainer: Microchip */
 	.init_late	= sama7_pm_init,
-	.init_machine	= sama7_dt_device_init,
 	.dt_compat	= sama7_dt_board_compat,
 MACHINE_END
 
Signature · 2 lines
-- 
2.51.0
#5 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Hei hei,

after few hints in IRC yesterday, I tried to understand why neither the ebi driver nor the nand driver are probed, but I failed. See below.

Am Thu, Apr 23, 2026 at 10:24:46AM +0200 schrieb Alexander Dahl:

Quoted 51 lines

Hello everyone,

I'm afraid this patch breaks finding rootfs on raw nand on sam9x60, see below:

Am Mon, Jan 05, 2026 at 03:06:45PM -0600 schrieb Rob Herring (Arm):

Quoted 8 lines

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.

Not sure what was actually tested, but this change breaks booting from raw NAND flash on our sam9x60 based board. I bisected the boot failure to this exact change. Before the change I see the nand controller messages in the kernel log like this:

atmel-nand-controller 10000000.ebi:nand-controller: using dma0chan5 for DMA transfers
nand: device found, Manufacturer ID: 0x01, Chip ID: 0xda
nand: AMD/Spansion S34ML02G1
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64

After the change, there are no kernel log messages related to nand at all, the driver does not seem to load. This of course leads to no mtd and ubi devices created, no ubi volumes found, no rootfs, and eventually this message:

VFS: Cannot open root device "ubi0:rootfs2" or unknown-block(0,253): error -19

I tried to understand the whole patch series, and to my understanding the intend was the device nodes still get populated, and the drivers loaded, right? Patch 1/3 is related to the atmel nand controller, and that one is not in the tree yet when bisecting to the end. However it is present in v7.0-rc1 (and later) and trying to boot that kernel (or 7.0 or todays master) fails, too. (Also I don't see those probe defer messages related to SRAM on v7.0-rc1, so I assume that's not the problem?)

Now the strange thing is: on a different hardware based on sama5d2 v7.0-rc1 boots fine from raw nand flash. I wonder what's the difference which makes it work on one atmel platform and not work on the other?

I compared kernel .config of both boards, no obvious pieces missing. Looking at the dts (and included dtsi) files of both boards I could spot no mistake. Also no obvious flaws in sama5d2.dtsi or sam9x60.dtsi.

Quoted 4 lines

Note: raw NAND flash is the only storage for rootfs on our platforms, we can not simply put rootfs to a different storage. I could try setting up NFS boot for further investigation, but that will take a while.

Meanwhile I got to boot the device over NFS and did some instrumentation of the atmel-ebi driver and the atmel rawnand driver.

Can confirm, that the probe functions of those drivers are not called (still v7.0-rc1 on sam9x60). The atmel-pmecc driver however actually is probed/loaded, but that device node sits in a different area of the device tree.

Quoted 3 lines

Does anyone have an idea how to make booting from raw NAND flash work on sam9x60 again (despite the obviously not desired revert)? What can I try? What information would be interesting for debugging?

Tried booting with cmdline option 'fw_devlink=off' but that did not change anything.

When mounting debugfs, the file /sys/kernel/debug/devices_deferred is empty, so deferred devices waiting on something seems not the cause.

Strange thing is /sys/bus/platform/devices/ has an entry '10000000.ebi' but none for the child node of the nand-controller. And /sys/bus/platform/drivers has an entry for 'atmel-nand-controller' but 'atmel-ebi' is missing (it is not on the sama5d2 system).

I don't get what the key difference between those systems is and what's necessary so the atmel-ebi probe function gets called?

The fw_devlink stuff also does not really make sense to me. FWIW, from the sam9x60 system:

    $ ls -1 /sys/class/devlink/
    platform:ahb:apb:pinctrl@fffff400--platform:10000000.ebi
    platform:ahb:apb:pinctrl@fffff400--platform:f0014000.spi
    platform:ahb:apb:pinctrl@fffff400--platform:f802c000.ethernet
    platform:ahb:apb:pinctrl@fffff400--platform:fffff200.serial
    platform:ahb:apb:pinctrl@fffff400--platform:gpio-keys
    platform:ahb:apb:pinctrl@fffff400--platform:led-controller-0
    platform:ahb:apb:pinctrl@fffff400--platform:spi-gpio-1
    platform:fffff400.gpio--platform:spi-gpio-1
    platform:fffff600.gpio--mdio_bus:f802c000.ethernet-ffffffff:03
    platform:fffff600.gpio--spi:spi1.0
    platform:fffffa00.gpio--platform:10000000.ebi

The sama5d2 system (which successfully loads the nand-controller driver) has this:

    $ ls -1 /sys/class/devlink/
    platform:ahb:apb--platform:f8034200.serial
    platform:f802c000.pwm--platform:led-controller-1
    platform:fc038000.pinctrl--platform:10000000.ebi
    platform:fc038000.pinctrl--platform:f8000000.spi
    platform:fc038000.pinctrl--platform:f8008000.ethernet
    platform:fc038000.pinctrl--platform:f8020000.serial
    platform:fc038000.pinctrl--platform:f802c000.pwm
    platform:fc038000.pinctrl--platform:f8034000.flexcom
    platform:fc038000.pinctrl--platform:gpio-keys
    platform:fc038000.pinctrl--spi:spi0.0

So both platforms use different pinctrl drivers (pinctrl-at91-pio4.c vs. pinctrl-at91.c) but can that be the issue?

I know not many people use raw nand on at91, but any ideas welcome. Also where I should look in sysfs, debugfs, or code?

Greets
Alex

Quoted 239 lines

Greets
Alex

Quoted 235 lines

---
v3:
- Fixup split between patch 2 and 3.

v2:
- Dust off and rebase to 6.18-rc1
- Add new platforms added since v1

---
 arch/arm/mach-at91/at91rm9200.c |  9 ---------
 arch/arm/mach-at91/at91sam9.c   |  9 ---------
 arch/arm/mach-at91/sam9x60.c    |  9 ---------
 arch/arm/mach-at91/sam9x7.c     |  9 ---------
 arch/arm/mach-at91/sama5.c      | 16 ----------------
 arch/arm/mach-at91/sama7.c      |  9 ---------
 6 files changed, 61 deletions(-)
arch/arm/mach-at91/at91rm9200.c +0 -9
index 2ac564eb8bbb..d15997fff5d7 100644
@@ -7,18 +7,10 @@
  *                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);
-}
-
 static const char *const at91rm9200_dt_board_compat[] __initconst = {
 	"atmel,at91rm9200",
 	NULL
@@ -26,6 +18,5 @@ static const char *const at91rm9200_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
 	.init_late	= at91rm9200_pm_init,
-	.init_machine	= at91rm9200_dt_device_init,
 	.dt_compat	= at91rm9200_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/at91sam9.c +0 -9
index cf07cba4ee5d..b9d2909d1b65 100644
@@ -6,19 +6,11 @@
  *                2011 Nicolas Ferre <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init at91sam9_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const at91_dt_board_compat[] __initconst = {
 	"atmel,at91sam9",
 	NULL
@@ -27,6 +19,5 @@ static const char *const at91_dt_board_compat[] __initconst = {
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9")
 	/* Maintainer: Atmel */
 	.init_late	= at91sam9_pm_init,
-	.init_machine	= at91sam9_init,
 	.dt_compat	= at91_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x60.c +0 -9
index a31beaaeffcd..744bab2cbb92 100644
@@ -7,19 +7,11 @@
  * Author: Claudiu Beznea <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init sam9x60_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sam9x60_dt_board_compat[] __initconst = {
 	"microchip,sam9x60",
 	NULL
@@ -28,6 +20,5 @@ static const char *const sam9x60_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sam9x60_dt, "Microchip SAM9X60")
 	/* Maintainer: Microchip */
 	.init_late	= sam9x60_pm_init,
-	.init_machine	= sam9x60_init,
 	.dt_compat	= sam9x60_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sam9x7.c +0 -9
index 0c73f7fefd4f..166c8625509d 100644
@@ -7,18 +7,10 @@
  * Author: Varshini Rajendran <[email protected]>
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 
 #include "generic.h"
 
-static void __init sam9x7_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char * const sam9x7_dt_board_compat[] __initconst = {
 	"microchip,sam9x7",
 	NULL
@@ -27,6 +19,5 @@ static const char * const sam9x7_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sam9x7_dt, "Microchip SAM9X7")
 	/* Maintainer: Microchip */
 	.init_late	= sam9x7_pm_init,
-	.init_machine	= sam9x7_init,
 	.dt_compat	= sam9x7_dt_board_compat,
 MACHINE_END
arch/arm/mach-at91/sama5.c +0 -16
index 576654cba82d..e56022f00800 100644
@@ -6,9 +6,6 @@
  *                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>
@@ -30,11 +27,6 @@ static void __init sama5_secure_cache_init(void)
 		outer_cache.write_sec = sama5_l2c310_write_sec;
 }
 
-static void __init sama5_dt_device_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama5_dt_board_compat[] __initconst = {
 	"atmel,sama5",
 	NULL
@@ -43,7 +35,6 @@ static const char *const sama5_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
 	.init_late	= sama5_pm_init,
-	.init_machine	= sama5_dt_device_init,
 	.dt_compat	= sama5_dt_board_compat,
 MACHINE_END
 
@@ -54,17 +45,11 @@ static const char *const sama5_alt_dt_board_compat[] __initconst = {
 
 DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
 	/* Maintainer: Atmel */
-	.init_machine	= sama5_dt_device_init,
 	.init_late	= sama5_pm_init,
 	.dt_compat	= sama5_alt_dt_board_compat,
 	.l2c_aux_mask	= ~0UL,
 MACHINE_END
 
-static void __init sama5d2_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama5d2_compat[] __initconst = {
 	"atmel,sama5d2",
 	NULL
@@ -72,7 +57,6 @@ static const char *const sama5d2_compat[] __initconst = {
 
 DT_MACHINE_START(sama5d2, "Atmel SAMA5")
 	/* Maintainer: Atmel */
-	.init_machine	= sama5d2_init,
 	.init_early	= sama5_secure_cache_init,
 	.init_late	= sama5d2_pm_init,
 	.dt_compat	= sama5d2_compat,
arch/arm/mach-at91/sama7.c +0 -9
index 8bf57a020f1c..f56828d61199 100644
@@ -6,19 +6,11 @@
  *
  */
 
-#include <linux/of.h>
-#include <linux/of_platform.h>
-
 #include <asm/mach/arch.h>
 #include <asm/system_misc.h>
 
 #include "generic.h"
 
-static void __init sama7_dt_device_init(void)
-{
-	of_platform_default_populate(NULL, NULL, NULL);
-}
-
 static const char *const sama7_dt_board_compat[] __initconst = {
 	"microchip,sama7",
 	NULL
@@ -27,7 +19,6 @@ static const char *const sama7_dt_board_compat[] __initconst = {
 DT_MACHINE_START(sama7_dt, "Microchip SAMA7")
 	/* Maintainer: Microchip */
 	.init_late	= sama7_pm_init,
-	.init_machine	= sama7_dt_device_init,
 	.dt_compat	= sama7_dt_board_compat,
 MACHINE_END
 
Signature · 2 lines
-- 
2.51.0
maintainer
#6 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Hi Alexander,

Quoted 5 lines · Alexander Dahl

Hei hei,

after few hints in IRC yesterday, I tried to understand why neither the ebi driver nor the nand driver are probed, but I failed. See below.

Just to be clear, I would not expect the NAND driver to probe "alone", it is described as a child node of the EBI controller which has its own compatible. As a result, only the of_platform_populate() at the end of the probe of the EBI can lead to the NAND controller to probe. The EBI node being a child node of a "simple-bus", this is the one we should focus on, because it should be probed.

One reason (trying to be creative) could the that Rob's patch is dropping an explicit populate that maybe kind of bypasses checks that the "official" populate does. So maybe there is one resource that is missing and which is not ignored as it used to be by the core device driver (likely, dd.c).

Can you enable CONFIG_DEBUG_DRIVER and see in the logs if anything pops up? Maybe trying to trace (manually) in the core why we do not attempt to probe the EBI controller by looking for possible conditions to bail out early. Pinctrl is one of them, so maybe just removing all pinctrl references in the DT may help troubleshooting this (obviously probe will fail if pinctrl is incorrect, but if it is attempted we will have a culprit).

Good luck,
Miquèl

#7 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Hello Miquel,

thanks for your kind reply, I think with your help I have new information now.

First of all: I could reproduce on an off-the-shelve sam9x60-curiosity board, which has mainline dts, so others should be able to reproduce, too. Tested with v7.0 release and today's master (v7.1-rc1-58-gdca922e019dd7). See below for details:

Am Mon, Apr 27, 2026 at 05:07:01PM +0200 schrieb Miquel Raynal:

Quoted 10 lines

Hi Alexander,

Quoted 5 lines · Alexander Dahl

Hei hei,

after few hints in IRC yesterday, I tried to understand why neither the ebi driver nor the nand driver are probed, but I failed. See below.

Quoted 6 lines

Just to be clear, I would not expect the NAND driver to probe "alone", it is described as a child node of the EBI controller which has its own compatible. As a result, only the of_platform_populate() at the end of the probe of the EBI can lead to the NAND controller to probe. The EBI node being a child node of a "simple-bus", this is the one we should focus on, because it should be probed.

Right, this is how I understood it, too.

Quoted 6 lines

One reason (trying to be creative) could the that Rob's patch is dropping an explicit populate that maybe kind of bypasses checks that the "official" populate does. So maybe there is one resource that is missing and which is not ignored as it used to be by the core device driver (likely, dd.c).

Quoted 7 lines

Can you enable CONFIG_DEBUG_DRIVER and see in the logs if anything pops up? Maybe trying to trace (manually) in the core why we do not attempt to probe the EBI controller by looking for possible conditions to bail out early. Pinctrl is one of them, so maybe just removing all pinctrl references in the DT may help troubleshooting this (obviously probe will fail if pinctrl is incorrect, but if it is attempted we will have a culprit).

Was not aware of that option before, produces a lot of output, but I think helpful output for this kind of problem, not quoting the whole kernel log, but what I think is relevant here:

    [    0.177130] device: '10000000.ebi': device_add
    [    0.177222] bus: 'platform': add device 10000000.ebi
    [    0.177343] PM: Adding info for platform:10000000.ebi
    [    0.177531] platform 10000000.ebi: Not linking /ahb/apb/clock-controller@fffffc00 - might never become dev
    [    0.177584] /ahb/ebi@10000000 Dropping the fwnode link to /ahb/apb/clock-controller@fffffc00
    …
    [    0.217944] device: 'platform:fffffa00.gpio--platform:10000000.ebi': device_add
    [    0.218200] platform 10000000.ebi: Linked as a sync state only consumer to fffffa00.gpio
    …
    [    0.958298] bus: 'platform': add driver atmel-ebi
    [    0.958451] platform 10000000.ebi: bus: 'platform': __driver_probe_device: matched device with driver atmel-ebi
    [    0.958566] platform 10000000.ebi: error -EPROBE_DEFER: wait for supplier /ahb/apb/pinctrl@fffff400/ebi/ebi-data-lsb
    [    0.958649] platform 10000000.ebi: Added to deferred list
    [    0.959429] bus: 'platform': remove driver atmel-ebi
    [    0.959540] driver: 'atmel-ebi': driver_release
    …
    [    1.170809] pinctrl-at91 ahb:apb:pinctrl@fffff400: driver: 'pinctrl-at91': driver_bound: bound to device
    [    1.170871] /ahb/apb/adc@f804c000 Linked as a fwnode consumer to /ahb/apb/pinctrl@fffff400
    [    1.170947] /ahb/apb/adc@f804c000 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400/adc/adc-default
    [    1.171031] /ahb/apb/adc@f804c000 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400/adc/adtrg-default
    [    1.171122] /ahb/apb/can@f8004000 Linked as a fwnode consumer to /ahb/apb/pinctrl@fffff400
    [    1.171184] /ahb/apb/can@f8004000 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400/can1/can1-rx-tx
    [    1.171267] /ahb/apb/serial@fffff200 Linked as a fwnode consumer to /ahb/apb/pinctrl@fffff400
    [    1.171327] /ahb/apb/serial@fffff200 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400/dbgu/dbgu-0
    [    1.171409] /ahb/ebi@10000000 Linked as a fwnode consumer to /ahb/apb/pinctrl@fffff400
    [    1.171464] /ahb/ebi@10000000 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400/ebi/ebi-data-lsb
    [    1.171536] /ahb/ebi@10000000 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400/ebi/ebi-addr-nand
    …
    [    1.176057] platform 10000000.ebi: Linked as a sync state only consumer to ahb:apb:pinctrl@fffff400
    [    1.176127] device: 'platform:ahb:apb:pinctrl@fffff400--platform:f802c000.ethernet': device_add
    …
    [    1.178167] devices_kset: Moving 10000000.ebi to end of list
    [    1.178191] PM: Moving platform:10000000.ebi to end of list
    [    1.178222] platform 10000000.ebi: Linked as a consumer to ahb:apb:pinctrl@fffff400
    [    1.178248] /ahb/ebi@10000000 Dropping the fwnode link to /ahb/apb/pinctrl@fffff400
    …
    [    3.431138] devices_kset: Moving 10000000.ebi to end of list
    [    3.431206] PM: Moving platform:10000000.ebi to end of list
    [    3.431256] platform 10000000.ebi: Retrying from deferred list
	…
    [    3.437765] UBI error: cannot open mtd rootfs, error -2

So the ebi driver is probed but returns with -EPROBE_DEFER, to my interpretation because the pinctrl driver is not ready? Later the pinctrl driver drops the relation? On retry from the deferred list the driver does not probe again? This feels strange, because other drivers probe as usual after that "Retrying from deferred list" message. But other deferred drivers do not have that "remove driver" and "driver release" messages.

The pinctrl itself seems to work, gpiodetect and gpioinfo show reasonable output, gpio connected LED works as expected.

No time to dig into this further right now,
but sharing what I have so far anyways.

Greets
Alex

maintainer
#8 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Hi Alexander,

Quoted 6 lines
    [    0.958298] bus: 'platform': add driver atmel-ebi
    [    0.958451] platform 10000000.ebi: bus: 'platform': __driver_probe_device: matched device with driver atmel-ebi
    [    0.958566] platform 10000000.ebi: error -EPROBE_DEFER: wait for supplier /ahb/apb/pinctrl@fffff400/ebi/ebi-data-lsb
    [    0.958649] platform 10000000.ebi: Added to deferred list
    [    0.959429] bus: 'platform': remove driver atmel-ebi
    [    0.959540] driver: 'atmel-ebi': driver_release

Interesting.

If you look at the very last line of the driver, the EBI driver does not use a standard "module_platform_driver" macro, it uses some kind of run-once probe that is kept in an __init section:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/memory/atmel-ebi.c#L637

And this seems to be incompatible with probe deferrals:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/base/platform.c#L948

I would suggest trying something alone these lines:

drivers/memory/atmel-ebi.c +2 -1
@@ -633,5 +633,6 @@ static struct platform_driver atmel_ebi_driver = {
                .of_match_table = atmel_ebi_id_table,
                .pm = &atmel_ebi_pm_ops,
        },
+       .probe = atmel_ebi_probe,
 };
-builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe);
+builtin_platform_driver(atmel_ebi_driver);

Memory taken by the probe function will remain mapped. That seems to be the drawback.

Thanks,
Miquèl

#9 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Hello Miquel,

Am Wed, Apr 29, 2026 at 11:42:19AM +0200 schrieb Miquel Raynal:

Quoted 11 lines

Hi Alexander,

Quoted 6 lines
    [    0.958298] bus: 'platform': add driver atmel-ebi
    [    0.958451] platform 10000000.ebi: bus: 'platform': __driver_probe_device: matched device with driver atmel-ebi
    [    0.958566] platform 10000000.ebi: error -EPROBE_DEFER: wait for supplier /ahb/apb/pinctrl@fffff400/ebi/ebi-data-lsb
    [    0.958649] platform 10000000.ebi: Added to deferred list
    [    0.959429] bus: 'platform': remove driver atmel-ebi
    [    0.959540] driver: 'atmel-ebi': driver_release

Interesting.

Quoted 7 lines

If you look at the very last line of the driver, the EBI driver does not use a standard "module_platform_driver" macro, it uses some kind of run-once probe that is kept in an __init section:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/memory/atmel-ebi.c#L637

And this seems to be incompatible with probe deferrals:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/base/platform.c#L948

Indeed. o.O

Quoted 13 lines

I would suggest trying something alone these lines:

drivers/memory/atmel-ebi.c +2 -1
@@ -633,5 +633,6 @@ static struct platform_driver atmel_ebi_driver = {
                .of_match_table = atmel_ebi_id_table,
                .pm = &atmel_ebi_pm_ops,
        },
+       .probe = atmel_ebi_probe,
 };
-builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe);
+builtin_platform_driver(atmel_ebi_driver);
Quoted 2 lines

Memory taken by the probe function will remain mapped. That seems to be the drawback.

This works. Sent a patch, see:

https://lore.kernel.org/all/[email protected]/

Regarding the drawback: This can't be much memory, can it?

Greets
Alex

maintainer
#10 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

Quoted 37 lines · Alexander Dahl

Hello Miquel,

Am Wed, Apr 29, 2026 at 11:42:19AM +0200 schrieb Miquel Raynal:

Quoted 11 lines

Hi Alexander,

Quoted 6 lines
    [    0.958298] bus: 'platform': add driver atmel-ebi
    [    0.958451] platform 10000000.ebi: bus: 'platform': __driver_probe_device: matched device with driver atmel-ebi
    [    0.958566] platform 10000000.ebi: error -EPROBE_DEFER: wait for supplier /ahb/apb/pinctrl@fffff400/ebi/ebi-data-lsb
    [    0.958649] platform 10000000.ebi: Added to deferred list
    [    0.959429] bus: 'platform': remove driver atmel-ebi
    [    0.959540] driver: 'atmel-ebi': driver_release

Interesting.

Quoted 7 lines

If you look at the very last line of the driver, the EBI driver does not use a standard "module_platform_driver" macro, it uses some kind of run-once probe that is kept in an __init section:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/memory/atmel-ebi.c#L637

And this seems to be incompatible with probe deferrals:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/base/platform.c#L948

Indeed. o.O

Quoted 13 lines

I would suggest trying something alone these lines:

drivers/memory/atmel-ebi.c +2 -1
@@ -633,5 +633,6 @@ static struct platform_driver atmel_ebi_driver = {
                .of_match_table = atmel_ebi_id_table,
                .pm = &atmel_ebi_pm_ops,
        },
+       .probe = atmel_ebi_probe,
 };
-builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe);
+builtin_platform_driver(atmel_ebi_driver);
Quoted 8 lines
Quoted 2 lines

Memory taken by the probe function will remain mapped. That seems to be the drawback.

This works. Sent a patch, see:

https://lore.kernel.org/all/[email protected]/

Regarding the drawback: This can't be much memory, can it?

I guess it is preferable to have the probe mapped at the cost of a few hundred more RAM bytes than a brick...

Good to know that this fixed your problem.

Thanks,
Miquèl

#11 lore raw

Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls

In reply to Alexander Dahl
Quoted 19 lines · Alexander Dahl

Hello Miquel,

Am Wed, Apr 29, 2026 at 11:42:19AM +0200 schrieb Miquel Raynal:

Quoted 16 lines

Hi Alexander,

Quoted 6 lines
    [    0.958298] bus: 'platform': add driver atmel-ebi
    [    0.958451] platform 10000000.ebi: bus: 'platform': __driver_probe_device: matched device with driver atmel-ebi
    [    0.958566] platform 10000000.ebi: error -EPROBE_DEFER: wait for supplier /ahb/apb/pinctrl@fffff400/ebi/ebi-data-lsb
    [    0.958649] platform 10000000.ebi: Added to deferred list
    [    0.959429] bus: 'platform': remove driver atmel-ebi
    [    0.959540] driver: 'atmel-ebi': driver_release

Interesting.

If you look at the very last line of the driver, the EBI driver does not use a standard "module_platform_driver" macro, it uses some kind of run-once probe that is kept in an __init section:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/memory/atmel-ebi.c#L637

Quoted 4 lines
Quoted 2 lines

And this seems to be incompatible with probe deferrals:
https://elixir.bootlin.com/linux/v7.0.1/source/drivers/base/platform.c#L948

Indeed. o.O

Saravana, Is there something we can do to make this issue more obvious?

Quoted 26 lines
Quoted 14 lines

I would suggest trying something alone these lines:

drivers/memory/atmel-ebi.c +2 -1
@@ -633,5 +633,6 @@ static struct platform_driver atmel_ebi_driver = {
                .of_match_table = atmel_ebi_id_table,
                .pm = &atmel_ebi_pm_ops,
        },
+       .probe = atmel_ebi_probe,
 };
-builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe);
+builtin_platform_driver(atmel_ebi_driver);
Quoted 2 lines

Memory taken by the probe function will remain mapped. That seems to be the drawback.

This works. Sent a patch, see:

https://lore.kernel.org/all/[email protected]/

Regarding the drawback: This can't be much memory, can it?

Greets
Alex

maintainer Applied
#12 lore raw
In reply to Rob Herring (Arm)
Quoted 3 lines · Rob Herring (Arm)

Rob Herring (Arm) (3):
ARM: at91: Move PM init functions to .init_late hook
ARM: at91: remove unnecessary of_platform_default_populate calls

Applied to at91-soc, thanks!

maintainer Applied
#13 lore raw
In reply to Rob Herring (Arm)
Quoted 9 lines · Rob Herring (Arm)

This is another attempt at removing of_platform_default_populate() calls on at91 platforms. The last attempts were in 2018[1] and 2023[2]. The problems reported are PM and NAND failures. Both of these depend on SRAM pool which doesn't have any fw_devlink tracking. Also, the PM code is not a driver, so fw_devlink wouldn't help. For the NAND driver, we can simply defer probe. For the PM init, we can move it to the .late_init hook.

[...]

Applied to nand/next, thanks!

[1/3] mtd: nand: atmel: Defer probe if SRAM is missing

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl