public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls
@ 2026-01-05 21:06 Rob Herring (Arm)
  2026-01-05 21:06 ` [PATCH v3 1/3] mtd: nand: atmel: Defer probe if SRAM is missing Rob Herring (Arm)
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-01-05 21:06 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
  Cc: linux-mtd, linux-arm-kernel, linux-kernel

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/20180712192222.32481-1-robh@kernel.org/
[2] https://lore.kernel.org/all/3908fa6f-dc33-4aac-c21f-4a676a3a6b23@microchip.com/

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
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/20251120-at91-probe-v2-0-8c8592f02e8e@kernel.org

---
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,
--  
Rob Herring (Arm) <robh@kernel.org>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/3] mtd: nand: atmel: Defer probe if SRAM is missing
  2026-01-05 21:06 [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Rob Herring (Arm)
@ 2026-01-05 21:06 ` Rob Herring (Arm)
  2026-01-05 21:06 ` [PATCH v3 2/3] ARM: at91: Move PM init functions to .init_late hook Rob Herring (Arm)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-01-05 21:06 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
  Cc: linux-mtd, linux-arm-kernel, linux-kernel

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.

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
v3:
 - Use dev_err_probe()
---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 83ba4ebd02d4..e7fdf532c5fe 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -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,

-- 
2.51.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/3] ARM: at91: Move PM init functions to .init_late hook
  2026-01-05 21:06 [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Rob Herring (Arm)
  2026-01-05 21:06 ` [PATCH v3 1/3] mtd: nand: atmel: Defer probe if SRAM is missing Rob Herring (Arm)
@ 2026-01-05 21:06 ` Rob Herring (Arm)
  2026-01-05 21:06 ` [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls Rob Herring (Arm)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-01-05 21:06 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
  Cc: linux-mtd, linux-arm-kernel, linux-kernel

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

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
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(-)

diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 4f8186211619..2ac564eb8bbb 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -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
diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c
index 7e572189a5eb..cf07cba4ee5d 100644
--- a/arch/arm/mach-at91/at91sam9.c
+++ b/arch/arm/mach-at91/at91sam9.c
@@ -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
diff --git a/arch/arm/mach-at91/sam9x60.c b/arch/arm/mach-at91/sam9x60.c
index d8c739d25458..a31beaaeffcd 100644
--- a/arch/arm/mach-at91/sam9x60.c
+++ b/arch/arm/mach-at91/sam9x60.c
@@ -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
diff --git a/arch/arm/mach-at91/sam9x7.c b/arch/arm/mach-at91/sam9x7.c
index e1ff30b5b09b..0c73f7fefd4f 100644
--- a/arch/arm/mach-at91/sam9x7.c
+++ b/arch/arm/mach-at91/sam9x7.c
@@ -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
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
index bf2b5c6a18c6..576654cba82d 100644
--- a/arch/arm/mach-at91/sama5.c
+++ b/arch/arm/mach-at91/sama5.c
@@ -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
diff --git a/arch/arm/mach-at91/sama7.c b/arch/arm/mach-at91/sama7.c
index bd43733ede18..8bf57a020f1c 100644
--- a/arch/arm/mach-at91/sama7.c
+++ b/arch/arm/mach-at91/sama7.c
@@ -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

-- 
2.51.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls
  2026-01-05 21:06 [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Rob Herring (Arm)
  2026-01-05 21:06 ` [PATCH v3 1/3] mtd: nand: atmel: Defer probe if SRAM is missing Rob Herring (Arm)
  2026-01-05 21:06 ` [PATCH v3 2/3] ARM: at91: Move PM init functions to .init_late hook Rob Herring (Arm)
@ 2026-01-05 21:06 ` Rob Herring (Arm)
  2026-04-23  8:24   ` Alexander Dahl
  2026-01-10 15:57 ` [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Claudiu Beznea
  2026-01-19 10:21 ` Miquel Raynal
  4 siblings, 1 reply; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-01-05 21:06 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
  Cc: linux-mtd, linux-arm-kernel, linux-kernel

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.

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
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(-)

diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 2ac564eb8bbb..d15997fff5d7 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -7,18 +7,10 @@
  *                2012 Joachim Eastwood <manabian@gmail.com>
  */
 
-#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
diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c
index cf07cba4ee5d..b9d2909d1b65 100644
--- a/arch/arm/mach-at91/at91sam9.c
+++ b/arch/arm/mach-at91/at91sam9.c
@@ -6,19 +6,11 @@
  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
  */
 
-#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
diff --git a/arch/arm/mach-at91/sam9x60.c b/arch/arm/mach-at91/sam9x60.c
index a31beaaeffcd..744bab2cbb92 100644
--- a/arch/arm/mach-at91/sam9x60.c
+++ b/arch/arm/mach-at91/sam9x60.c
@@ -7,19 +7,11 @@
  * Author: Claudiu Beznea <claudiu.beznea@microchip.com>
  */
 
-#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
diff --git a/arch/arm/mach-at91/sam9x7.c b/arch/arm/mach-at91/sam9x7.c
index 0c73f7fefd4f..166c8625509d 100644
--- a/arch/arm/mach-at91/sam9x7.c
+++ b/arch/arm/mach-at91/sam9x7.c
@@ -7,18 +7,10 @@
  * Author: Varshini Rajendran <varshini.rajendran@microchip.com>
  */
 
-#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
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
index 576654cba82d..e56022f00800 100644
--- a/arch/arm/mach-at91/sama5.c
+++ b/arch/arm/mach-at91/sama5.c
@@ -6,9 +6,6 @@
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
  */
 
-#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,
diff --git a/arch/arm/mach-at91/sama7.c b/arch/arm/mach-at91/sama7.c
index 8bf57a020f1c..f56828d61199 100644
--- a/arch/arm/mach-at91/sama7.c
+++ b/arch/arm/mach-at91/sama7.c
@@ -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
 

-- 
2.51.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls
  2026-01-05 21:06 [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Rob Herring (Arm)
                   ` (2 preceding siblings ...)
  2026-01-05 21:06 ` [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls Rob Herring (Arm)
@ 2026-01-10 15:57 ` Claudiu Beznea
  2026-01-19 10:21 ` Miquel Raynal
  4 siblings, 0 replies; 7+ messages in thread
From: Claudiu Beznea @ 2026-01-10 15:57 UTC (permalink / raw)
  To: Rob Herring (Arm), Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Nicolas Ferre, Alexandre Belloni,
	Russell King
  Cc: linux-mtd, linux-arm-kernel, linux-kernel



On 1/5/26 23:06, Rob Herring (Arm) wrote:
> 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!

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls
  2026-01-05 21:06 [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Rob Herring (Arm)
                   ` (3 preceding siblings ...)
  2026-01-10 15:57 ` [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Claudiu Beznea
@ 2026-01-19 10:21 ` Miquel Raynal
  4 siblings, 0 replies; 7+ messages in thread
From: Miquel Raynal @ 2026-01-19 10:21 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Russell King,
	Rob Herring (Arm)
  Cc: Miquel Raynal, linux-mtd, linux-arm-kernel, linux-kernel

On Mon, 05 Jan 2026 15:06:42 -0600, Rob Herring (Arm) wrote:
> 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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls
  2026-01-05 21:06 ` [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls Rob Herring (Arm)
@ 2026-04-23  8:24   ` Alexander Dahl
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Dahl @ 2026-04-23  8:24 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King,
	linux-mtd, linux-arm-kernel, linux-kernel

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):
> 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.
> 
> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

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

> ---
> 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(-)
> 
> diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
> index 2ac564eb8bbb..d15997fff5d7 100644
> --- a/arch/arm/mach-at91/at91rm9200.c
> +++ b/arch/arm/mach-at91/at91rm9200.c
> @@ -7,18 +7,10 @@
>   *                2012 Joachim Eastwood <manabian@gmail.com>
>   */
>  
> -#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
> diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c
> index cf07cba4ee5d..b9d2909d1b65 100644
> --- a/arch/arm/mach-at91/at91sam9.c
> +++ b/arch/arm/mach-at91/at91sam9.c
> @@ -6,19 +6,11 @@
>   *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
>   */
>  
> -#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
> diff --git a/arch/arm/mach-at91/sam9x60.c b/arch/arm/mach-at91/sam9x60.c
> index a31beaaeffcd..744bab2cbb92 100644
> --- a/arch/arm/mach-at91/sam9x60.c
> +++ b/arch/arm/mach-at91/sam9x60.c
> @@ -7,19 +7,11 @@
>   * Author: Claudiu Beznea <claudiu.beznea@microchip.com>
>   */
>  
> -#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
> diff --git a/arch/arm/mach-at91/sam9x7.c b/arch/arm/mach-at91/sam9x7.c
> index 0c73f7fefd4f..166c8625509d 100644
> --- a/arch/arm/mach-at91/sam9x7.c
> +++ b/arch/arm/mach-at91/sam9x7.c
> @@ -7,18 +7,10 @@
>   * Author: Varshini Rajendran <varshini.rajendran@microchip.com>
>   */
>  
> -#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
> diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
> index 576654cba82d..e56022f00800 100644
> --- a/arch/arm/mach-at91/sama5.c
> +++ b/arch/arm/mach-at91/sama5.c
> @@ -6,9 +6,6 @@
>   *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
>   */
>  
> -#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,
> diff --git a/arch/arm/mach-at91/sama7.c b/arch/arm/mach-at91/sama7.c
> index 8bf57a020f1c..f56828d61199 100644
> --- a/arch/arm/mach-at91/sama7.c
> +++ b/arch/arm/mach-at91/sama7.c
> @@ -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
>  
> 
> -- 
> 2.51.0
> 
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-04-23  8:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 21:06 [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Rob Herring (Arm)
2026-01-05 21:06 ` [PATCH v3 1/3] mtd: nand: atmel: Defer probe if SRAM is missing Rob Herring (Arm)
2026-01-05 21:06 ` [PATCH v3 2/3] ARM: at91: Move PM init functions to .init_late hook Rob Herring (Arm)
2026-01-05 21:06 ` [PATCH v3 3/3] ARM: at91: remove unnecessary of_platform_default_populate calls Rob Herring (Arm)
2026-04-23  8:24   ` Alexander Dahl
2026-01-10 15:57 ` [PATCH v3 0/3] at91: Remove of_platform_default_populate() calls Claudiu Beznea
2026-01-19 10:21 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox