mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support
@ 2023-01-09 13:08 Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 01/11] ARM: at91: sama5: switch to nonnaked entry functions Ahmad Fatoum
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox

The Wifx L1 is a SAMA5D4 LoRaWAN gateway. It boots from NAND, but this
can be overridden by inserting a bootable SD-Card.

This first port only provides second-stage SD-Card support. It enables
use of UART, I2C/EEPROM, Ethernet and SD-Card. For NAND use on SAMA5D4,
an updated Linux driver was ported to barebox.
This will follow separately.

v1 -> v2:
  - skip stack setup on SAMA5D2 (Sascha)
  - Add Sam's Acked-by
  - Rebase on upstream/next

Ahmad Fatoum (11):
  ARM: at91: sama5: switch to nonnaked entry functions
  ARM: at91: sama5d4: add entry point helpers
  ARM: at91: sama5d4: enable for DT use
  net: macb: match atmel,sama5d4-gem compatible
  i2c: at91: extend for SAMA5D4 support
  eeprom: at24: add 24mac402/602 support
  driver: always ensure probe of RAM registered with mem_platform_driver
  common: deep-probe: don't build without CONFIG_OFDEVICE
  pinctrl: at91: make deep-probe compatible
  ARM: at91: make bootsource code generic to all SAMA5
  ARM: at91: SAMA5D4: add Wifx L1 support

 arch/arm/boards/Makefile                      |   1 +
 .../boards/microchip-ksz9477-evb/lowlevel.c   |   6 +-
 .../arm/boards/sama5d27-giantboard/lowlevel.c |   4 +-
 arch/arm/boards/sama5d27-som1/lowlevel.c      |   4 +-
 arch/arm/boards/sama5d3_xplained/lowlevel.c   |   6 +-
 arch/arm/boards/sama5d4_wifx/Makefile         |   4 +
 arch/arm/boards/sama5d4_wifx/board.c          |  38 ++
 arch/arm/boards/sama5d4_wifx/lowlevel.c       |  18 +
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/at91-sama5d4_wifx_l1.dts         | 358 ++++++++++++++++++
 arch/arm/dts/sama5d4.dtsi                     |   9 +
 arch/arm/mach-at91/Kconfig                    |  11 +
 arch/arm/mach-at91/Makefile                   |   3 +-
 arch/arm/mach-at91/bootm-barebox.c            |   3 +-
 arch/arm/mach-at91/ddramc.c                   |   7 +
 arch/arm/mach-at91/include/mach/barebox-arm.h |  23 +-
 arch/arm/mach-at91/include/mach/cpu.h         |   1 -
 arch/arm/mach-at91/include/mach/ddramc.h      |   1 +
 .../mach-at91/include/mach/sama5_bootsource.h |   5 +
 arch/arm/mach-at91/sama5_bootsource.c         |  36 ++
 arch/arm/mach-at91/sama5d2.c                  |  15 -
 arch/arm/mach-at91/setup.c                    |   3 -
 common/Makefile                               |   2 +-
 drivers/eeprom/at24.c                         |   2 +
 drivers/i2c/busses/i2c-at91.c                 |  14 +-
 drivers/net/macb.c                            |   1 +
 drivers/pinctrl/pinctrl-at91.c                |  20 +-
 images/Makefile.at91                          |   4 +
 include/deep-probe.h                          |   7 +
 include/driver.h                              |  13 +-
 30 files changed, 572 insertions(+), 48 deletions(-)
 create mode 100644 arch/arm/boards/sama5d4_wifx/Makefile
 create mode 100644 arch/arm/boards/sama5d4_wifx/board.c
 create mode 100644 arch/arm/boards/sama5d4_wifx/lowlevel.c
 create mode 100644 arch/arm/dts/at91-sama5d4_wifx_l1.dts
 create mode 100644 arch/arm/dts/sama5d4.dtsi
 create mode 100644 arch/arm/mach-at91/sama5_bootsource.c

-- 
2.30.2




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

* [PATCH v2 01/11] ARM: at91: sama5: switch to nonnaked entry functions
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 02/11] ARM: at91: sama5d4: add entry point helpers Ahmad Fatoum
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

Functions were kept naked because they modify the stack pointer.
We can hoist that up and change the board-provided entry point
to be non-naked to be more robust in face of unexpected compiler
optimizations.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 .../boards/microchip-ksz9477-evb/lowlevel.c   |  6 ++----
 .../arm/boards/sama5d27-giantboard/lowlevel.c |  4 ++--
 arch/arm/boards/sama5d27-som1/lowlevel.c      |  4 ++--
 arch/arm/boards/sama5d3_xplained/lowlevel.c   |  6 ++----
 arch/arm/mach-at91/include/mach/barebox-arm.h | 19 +++++++++++++++----
 5 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
index 93ae4819750c..6290766caa78 100644
--- a/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
+++ b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
@@ -32,7 +32,7 @@ static void dbgu_init(void)
 	putc_ll('>');
 }
 
-SAMA5_ENTRY_FUNCTION(start_sama5d3_xplained_ung8071_xload_mmc, r4)
+SAMA5D3_ENTRY_FUNCTION(start_sama5d3_xplained_ung8071_xload_mmc, r4)
 {
 	sama5d3_lowlevel_init();
 
@@ -49,12 +49,10 @@ SAMA5_ENTRY_FUNCTION(start_sama5d3_xplained_ung8071_xload_mmc, r4)
 
 extern char __dtb_z_at91_microchip_ksz9477_evb_start[];
 
-SAMA5_ENTRY_FUNCTION(start_sama5d3_xplained_ung8071, r4)
+SAMA5D3_ENTRY_FUNCTION(start_sama5d3_xplained_ung8071, r4)
 {
 	void *fdt;
 
-	arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE);
-
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		dbgu_init();
 
diff --git a/arch/arm/boards/sama5d27-giantboard/lowlevel.c b/arch/arm/boards/sama5d27-giantboard/lowlevel.c
index ee8297fa4562..fac39dd066a2 100644
--- a/arch/arm/boards/sama5d27-giantboard/lowlevel.c
+++ b/arch/arm/boards/sama5d27-giantboard/lowlevel.c
@@ -15,7 +15,7 @@
 /* PCK = 492MHz, MCK = 164MHz */
 #define MASTER_CLOCK	164000000
 
-SAMA5_ENTRY_FUNCTION(start_sama5d27_giantboard_xload_mmc, r4)
+SAMA5D2_ENTRY_FUNCTION(start_sama5d27_giantboard_xload_mmc, r4)
 {
 	void __iomem *dbgu_base;
 
@@ -36,7 +36,7 @@ SAMA5_ENTRY_FUNCTION(start_sama5d27_giantboard_xload_mmc, r4)
 
 extern char __dtb_z_at91_sama5d27_giantboard_start[];
 
-SAMA5_ENTRY_FUNCTION(start_sama5d27_giantboard, r4)
+SAMA5D2_ENTRY_FUNCTION(start_sama5d27_giantboard, r4)
 {
 	void *fdt;
 
diff --git a/arch/arm/boards/sama5d27-som1/lowlevel.c b/arch/arm/boards/sama5d27-som1/lowlevel.c
index b0937119184b..24c08d9722b3 100644
--- a/arch/arm/boards/sama5d27-som1/lowlevel.c
+++ b/arch/arm/boards/sama5d27-som1/lowlevel.c
@@ -39,7 +39,7 @@ static void ek_turn_led(unsigned color)
 	}
 }
 
-SAMA5_ENTRY_FUNCTION(start_sama5d27_som1_ek_xload_mmc, r4)
+SAMA5D2_ENTRY_FUNCTION(start_sama5d27_som1_ek_xload_mmc, r4)
 {
 	void __iomem *dbgu_base;
 	sama5d2_lowlevel_init();
@@ -60,7 +60,7 @@ SAMA5_ENTRY_FUNCTION(start_sama5d27_som1_ek_xload_mmc, r4)
 
 extern char __dtb_z_at91_sama5d27_som1_ek_start[];
 
-SAMA5_ENTRY_FUNCTION(start_sama5d27_som1_ek, r4)
+SAMA5D2_ENTRY_FUNCTION(start_sama5d27_som1_ek, r4)
 {
 	void *fdt;
 
diff --git a/arch/arm/boards/sama5d3_xplained/lowlevel.c b/arch/arm/boards/sama5d3_xplained/lowlevel.c
index df561af36d5e..be6b2960d40d 100644
--- a/arch/arm/boards/sama5d3_xplained/lowlevel.c
+++ b/arch/arm/boards/sama5d3_xplained/lowlevel.c
@@ -33,7 +33,7 @@ static void dbgu_init(void)
 	pbl_set_putc(at91_dbgu_putc, IOMEM(AT91_BASE_DBGU1));
 }
 
-SAMA5_ENTRY_FUNCTION(start_sama5d3_xplained_xload_mmc, r4)
+SAMA5D3_ENTRY_FUNCTION(start_sama5d3_xplained_xload_mmc, r4)
 {
 	sama5d3_lowlevel_init();
 
@@ -50,12 +50,10 @@ SAMA5_ENTRY_FUNCTION(start_sama5d3_xplained_xload_mmc, r4)
 
 extern char __dtb_z_at91_sama5d3_xplained_start[];
 
-SAMA5_ENTRY_FUNCTION(start_sama5d3_xplained, r4)
+SAMA5D3_ENTRY_FUNCTION(start_sama5d3_xplained, r4)
 {
 	void *fdt;
 
-	arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE);
-
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		dbgu_init();
 
diff --git a/arch/arm/mach-at91/include/mach/barebox-arm.h b/arch/arm/mach-at91/include/mach/barebox-arm.h
index 4a65c6f8fa55..f6bdd5ab2375 100644
--- a/arch/arm/mach-at91/include/mach/barebox-arm.h
+++ b/arch/arm/mach-at91/include/mach/barebox-arm.h
@@ -3,19 +3,30 @@
 #define AT91_BAREBOX_ARM_H_
 
 #include <asm/barebox-arm.h>
+#include <asm/common.h>
+#include <mach/sama5d3.h>
 
-#define SAMA5_ENTRY_FUNCTION(name, r4)						\
+#define SAMA5_ENTRY_FUNCTION(name, stack_top, r4)				\
 	void name (u32 r0, u32 r1, u32 r2, u32 r3);				\
 										\
 	static void __##name(u32);						\
 										\
-	void NAKED __section(.text_head_entry_##name)	name			\
+	void __naked __section(.text_head_entry_##name)	name			\
 				(u32 r0, u32 r1, u32 r2, u32 r3)		\
 		{								\
 			register u32 r4 asm("r4");				\
 			__barebox_arm_head();					\
+			if (stack_top)						\
+				arm_setup_stack(stack_top);			\
 			__##name(r4);						\
 		}								\
-		static void NAKED noinline __##name				\
-			(u32 r4)
+		static void noinline __##name(u32 r4)
+
+/* BootROM already initialized usable stack top */
+#define SAMA5D2_ENTRY_FUNCTION(name, r4)					\
+	SAMA5_ENTRY_FUNCTION(name, 0, r4)
+
+#define SAMA5D3_ENTRY_FUNCTION(name, r4)					\
+	SAMA5_ENTRY_FUNCTION(name, SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE, r4)
+
 #endif
-- 
2.30.2




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

* [PATCH v2 02/11] ARM: at91: sama5d4: add entry point helpers
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 01/11] ARM: at91: sama5: switch to nonnaked entry functions Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 03/11] ARM: at91: sama5d4: enable for DT use Ahmad Fatoum
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

Like already done for sama5d2 and sama5d3, provide a set of helpers for
use in device-tree-enabled SAMA5D4 boards.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-at91/ddramc.c                        | 7 +++++++
 arch/arm/mach-at91/include/mach/barebox-arm.h      | 4 ++++
 arch/arm/mach-at91/include/mach/ddramc.h           | 1 +
 arch/arm/mach-at91/include/mach/sama5_bootsource.h | 3 +++
 4 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-at91/ddramc.c b/arch/arm/mach-at91/ddramc.c
index 6383789f641f..1e94fbf9ee67 100644
--- a/arch/arm/mach-at91/ddramc.c
+++ b/arch/arm/mach-at91/ddramc.c
@@ -33,6 +33,13 @@ void __noreturn sama5d3_barebox_entry(unsigned int r4, void *boarddata)
 	barebox_arm_entry(SAMA5_DDRCS, at91sama5d3_get_ddram_size(),
 			  boarddata);
 }
+void __noreturn sama5d4_barebox_entry(unsigned int r4, void *boarddata)
+{
+	__sama5d4_stashed_bootrom_r4 = r4;
+
+	barebox_arm_entry(SAMA5_DDRCS, at91sama5d4_get_ddram_size(),
+			  boarddata);
+}
 
 static int sama5_ddr_probe(struct device *dev)
 {
diff --git a/arch/arm/mach-at91/include/mach/barebox-arm.h b/arch/arm/mach-at91/include/mach/barebox-arm.h
index f6bdd5ab2375..707444180c36 100644
--- a/arch/arm/mach-at91/include/mach/barebox-arm.h
+++ b/arch/arm/mach-at91/include/mach/barebox-arm.h
@@ -5,6 +5,7 @@
 #include <asm/barebox-arm.h>
 #include <asm/common.h>
 #include <mach/sama5d3.h>
+#include <mach/sama5d4.h>
 
 #define SAMA5_ENTRY_FUNCTION(name, stack_top, r4)				\
 	void name (u32 r0, u32 r1, u32 r2, u32 r3);				\
@@ -29,4 +30,7 @@
 #define SAMA5D3_ENTRY_FUNCTION(name, r4)					\
 	SAMA5_ENTRY_FUNCTION(name, SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE, r4)
 
+#define SAMA5D4_ENTRY_FUNCTION(name, r4)					\
+	SAMA5_ENTRY_FUNCTION(name, SAMA5D4_SRAM_BASE + SAMA5D4_SRAM_SIZE, r4)
+
 #endif
diff --git a/arch/arm/mach-at91/include/mach/ddramc.h b/arch/arm/mach-at91/include/mach/ddramc.h
index 7daef1763641..d09392262e39 100644
--- a/arch/arm/mach-at91/include/mach/ddramc.h
+++ b/arch/arm/mach-at91/include/mach/ddramc.h
@@ -34,5 +34,6 @@ void at91_lpddr1_sdram_initialize(void __iomem *base_address,
 
 void __noreturn sama5d2_barebox_entry(unsigned int r4, void *boarddata);
 void __noreturn sama5d3_barebox_entry(unsigned int r4, void *boarddata);
+void __noreturn sama5d4_barebox_entry(unsigned int r4, void *boarddata);
 
 #endif /* #ifndef __DDRAMC_H__ */
diff --git a/arch/arm/mach-at91/include/mach/sama5_bootsource.h b/arch/arm/mach-at91/include/mach/sama5_bootsource.h
index 931e1f29c8e0..b31d20bc7c34 100644
--- a/arch/arm/mach-at91/include/mach/sama5_bootsource.h
+++ b/arch/arm/mach-at91/include/mach/sama5_bootsource.h
@@ -49,6 +49,9 @@ static inline int sama5_bootsource_instance(u32 reg)
 #define __sama5d3_stashed_bootrom_r4 \
 	(*(volatile u32 *)(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 0x4))
 
+#define __sama5d4_stashed_bootrom_r4 \
+	(*(volatile u32 *)(SAMA5D4_SRAM_BASE + SAMA5D4_SRAM_SIZE - 0x4))
+
 static inline void __noreturn sama5_boot_xload(void __noreturn (*bb)(void), u32 r4)
 {
 	asm volatile("mov r4, %0" : : "r"(r4) : );
-- 
2.30.2




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

* [PATCH v2 03/11] ARM: at91: sama5d4: enable for DT use
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 01/11] ARM: at91: sama5: switch to nonnaked entry functions Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 02/11] ARM: at91: sama5d4: add entry point helpers Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-11 10:37   ` Sascha Hauer
  2023-01-09 13:08 ` [PATCH v2 04/11] net: macb: match atmel,sama5d4-gem compatible Ahmad Fatoum
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

The sama5d4[devices].c files are for non-OF instantiation of platform
devices. We don't need anything out of these two files, so don't build
them when compiling for CONFIG_OFDEVICE.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-at91/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 390d49d03dee..b9fda00b2e1a 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_SOC_AT91SAM9G10) += at91sam9261.o at91sam9261_devices.o
 ifeq ($(CONFIG_OFDEVICE),)
 obj-$(CONFIG_SOC_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
 obj-$(CONFIG_SOC_SAMA5D3)	+= sama5d3.o sama5d3_devices.o
+obj-$(CONFIG_SOC_SAMA5D4)	+= sama5d4.o sama5d4_devices.o
 endif
 lwl-$(CONFIG_SOC_AT91SAM9263)	+= sam9263_ll.o
 lwl-$(CONFIG_SOC_SAMA5D2)	+= sama5d2_ll.o
@@ -39,4 +40,3 @@ obj-$(CONFIG_SOC_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
 obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
 obj-$(CONFIG_SOC_AT91SAM9X5)	+= at91sam9x5.o at91sam9x5_devices.o
 obj-$(CONFIG_SOC_AT91SAM9N12)	+= at91sam9n12.o at91sam9n12_devices.o
-obj-$(CONFIG_SOC_SAMA5D4)	+= sama5d4.o sama5d4_devices.o
-- 
2.30.2




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

* [PATCH v2 04/11] net: macb: match atmel,sama5d4-gem compatible
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 03/11] ARM: at91: sama5d4: enable for DT use Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 05/11] i2c: at91: extend for SAMA5D4 support Ahmad Fatoum
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

After adjustments for SAMA5D2, driver readily works on SAMA5D4 if we
have the appropriate of_device_id entry. Add it.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/net/macb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 29d62b4f105d..3d7627fed828 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -935,6 +935,7 @@ static const struct of_device_id macb_dt_ids[] = {
 	{ .compatible = "cdns,at91sam9260-macb",},
 	{ .compatible = "atmel,sama5d2-gem",},
 	{ .compatible = "atmel,sama5d3-gem",},
+	{ .compatible = "atmel,sama5d4-gem",},
 	{ .compatible = "cdns,zynq-gem",},
 	{ .compatible = "cdns,zynqmp-gem",},
 	{ .compatible = "sifive,fu540-c000-gem", .data = &fu540_c000_config },
-- 
2.30.2




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

* [PATCH v2 05/11] i2c: at91: extend for SAMA5D4 support
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 04/11] net: macb: match atmel,sama5d4-gem compatible Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 06/11] eeprom: at24: add 24mac402/602 support Ahmad Fatoum
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

The driver was recently updated for SAMA5D2 support and SAMA5D4/SAM9x60
is straight-forward to add on top. While at it, drop has_clear_cmd,
which denotes hardware I2C bus recovery support. We never used the
member.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/i2c/busses/i2c-at91.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 2fe21a7ec95d..86fa4c03b7bf 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -78,7 +78,6 @@ struct at91_twi_pdata {
 	bool has_dig_filtr;
 	bool has_adv_dig_filtr;
 	bool has_ana_filtr;
-	bool has_clear_cmd;
 };
 
 struct at91_twi_dev {
@@ -438,6 +437,13 @@ static struct at91_twi_pdata at91sam9x5_config = {
 	.has_unre_flag = false,
 };
 
+static struct at91_twi_pdata sama5d4_config = {
+	.clk_max_div = 7,
+	.clk_offset = 4,
+	.has_hold_field = true,
+	.has_dig_filtr = true,
+};
+
 static struct at91_twi_pdata sama5d2_config = {
 	.clk_max_div = 7,
 	.clk_offset = 3,
@@ -492,9 +498,15 @@ static struct of_device_id at91_twi_dt_ids[] = {
 	}, {
 		.compatible = "atmel,at91sam9x5-i2c",
 		.data = &at91sam9x5_config,
+	}, {
+		.compatible = "atmel,sama5d4-i2c",
+		.data = &sama5d4_config,
 	}, {
 		.compatible = "atmel,sama5d2-i2c",
 		.data = &sama5d2_config,
+	}, {
+		.compatible = "microchip,sam9x60-i2c",
+		.data = &sama5d2_config,
 	}, {
 		/* sentinel */
 	}
-- 
2.30.2




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

* [PATCH v2 06/11] eeprom: at24: add 24mac402/602 support
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 05/11] i2c: at91: extend for SAMA5D4 support Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 07/11] driver: always ensure probe of RAM registered with mem_platform_driver Ahmad Fatoum
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

The 24MAC chips feature an independent address mode for a MAC address.
Linux handles these by registering a device that's just 6/8 bytes of
size and that seeks to a fixed offset. In barebox, we'll just report
the real size and expect code to use the appropriate offset.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/eeprom/at24.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 059a92c718c0..43cd78a88328 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -99,6 +99,8 @@ static struct platform_device_id at24_ids[] = {
 	/* old variants can't be handled with this generic entry! */
 	{ "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) },
 	{ "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) },
+	{ "24mac402",	AT24_DEVICE_MAGIC(2048 / 8, AT24_FLAG_READONLY) },
+	{ "24mac602",	AT24_DEVICE_MAGIC(2048 / 8, AT24_FLAG_READONLY) },
 	/* spd is a 24c02 in memory DIMMs */
 	{ "spd", AT24_DEVICE_MAGIC(2048 / 8,
 		AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
-- 
2.30.2




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

* [PATCH v2 07/11] driver: always ensure probe of RAM registered with mem_platform_driver
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (5 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 06/11] eeprom: at24: add 24mac402/602 support Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 08/11] common: deep-probe: don't build without CONFIG_OFDEVICE Ahmad Fatoum
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

Normally, SDRAM controllers are already set up by the time barebox
proper runs. The function of SDRAM controller drivers is thus limited
to reading out configured SDRAM size and registering the result as a
barebox memory bank.

This needs to happen before MMU setup, so the whole of RAM can be
initially mapped cacheable. Therefore, probe order is enforced either
via initcall level or via of_devices_ensure_probed_by_dev_id on
deep-probe-enabled systems. We have this opencoded at two places
and instead of adding a third, just rewrite mem_platform_driver
to do the expected thing.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/driver.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/driver.h b/include/driver.h
index 693d5cb3e580..0ea5799d0dfb 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -442,13 +442,22 @@ int platform_driver_register(struct driver *drv);
 	register_driver_macro(device,platform,drv)
 #define console_platform_driver(drv)	\
 	register_driver_macro(console,platform,drv)
-#define mem_platform_driver(drv)	\
-	register_driver_macro(mem,platform,drv)
 #define fs_platform_driver(drv)	\
 	register_driver_macro(fs,platform,drv)
 #define late_platform_driver(drv)	\
 	register_driver_macro(late,platform,drv)
 
+#define mem_platform_driver(drv)						\
+	static int __init drv##_init(void)					\
+	{									\
+		int ret;							\
+		ret = platform_driver_register(&drv);				\
+		if (ret)							\
+			return ret;						\
+		return of_devices_ensure_probed_by_dev_id(drv.of_compatible);	\
+	}									\
+	mem_initcall(drv##_init);
+
 int platform_device_register(struct device *new_device);
 
 struct cdev_operations {
-- 
2.30.2




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

* [PATCH v2 08/11] common: deep-probe: don't build without CONFIG_OFDEVICE
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (6 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 07/11] driver: always ensure probe of RAM registered with mem_platform_driver Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 09/11] pinctrl: at91: make deep-probe compatible Ahmad Fatoum
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

We have a number of drivers that can be used with and without device
trees. On AT91, some non-OF enabled configurations run from on-chip
SRAM, which is limited to few tens of kilobytes in size. We need to
be very size-concious there and having deep_probe_is_supported() as
static inline helper evaluating to false when unused makes it easy to
discard code that is not needed for the non-OF case.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/Makefile      | 2 +-
 include/deep-probe.h | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/Makefile b/common/Makefile
index 25f5653f906a..bd5b50bc3be2 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -6,7 +6,7 @@ obj-y				+= memory_display.o
 pbl-$(CONFIG_PBL_CONSOLE)	+= memory_display.o
 obj-y				+= clock.o
 obj-y				+= console_common.o
-obj-y				+= deep-probe.o
+obj-$(CONFIG_OFDEVICE)		+= deep-probe.o
 obj-y				+= startup.o
 obj-y				+= misc.o
 obj-pbl-y			+= memsize.o
diff --git a/include/deep-probe.h b/include/deep-probe.h
index f75ad1065c86..927dd8d6cf50 100644
--- a/include/deep-probe.h
+++ b/include/deep-probe.h
@@ -9,7 +9,14 @@ struct deep_probe_entry {
 	const struct of_device_id *device_id;
 };
 
+#ifdef CONFIG_OFDEVICE
 bool deep_probe_is_supported(void);
+#else
+static inline bool deep_probe_is_supported(void)
+{
+	return false;
+}
+#endif
 
 extern struct deep_probe_entry __barebox_deep_probe_start;
 extern struct deep_probe_entry __barebox_deep_probe_end;
-- 
2.30.2




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

* [PATCH v2 09/11] pinctrl: at91: make deep-probe compatible
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (7 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 08/11] common: deep-probe: don't build without CONFIG_OFDEVICE Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 10/11] ARM: at91: make bootsource code generic to all SAMA5 Ahmad Fatoum
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

GPIO banks are probed independently from pinctrl parent device as it's
simple-bus compatible. The pinctrl driver needs access to the GPIO
banks though for applying a pin configuration. This has two problems:

  - When we have a pinctrl hog, we can't apply it if GPIOs weren't
    probed before

  - In a deep probe system, pinctrl may be used before GPIO was probed

Fix this for deep probe systems by probing relevant GPIO banks on
demand. We wrap this in a deep_probe_is_supported() check to avoid
increasing code size for the configurations that use non-DT enabled
barebox proper as first stage bootloader.

Tested on SAMA5D4.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/pinctrl/pinctrl-at91.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 1f0a8fe038f3..b80fa85f829a 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -16,6 +16,7 @@
 #include <init.h>
 #include <driver.h>
 #include <getopt.h>
+#include <deep-probe.h>
 
 #include <mach/at91_pio.h>
 #include <mach/gpio.h>
@@ -47,17 +48,25 @@ struct at91_gpio_chip {
 #define DEBOUNCE_VAL_SHIFT      17
 #define DEBOUNCE_VAL    (0x3fff << DEBOUNCE_VAL_SHIFT)
 
-static int gpio_banks;
-
 static struct at91_gpio_chip gpio_chip[MAX_GPIO_BANKS];
 
 static inline struct at91_gpio_chip *pin_to_controller(unsigned pin)
 {
+	struct at91_gpio_chip *chip;
+
 	pin /= MAX_NB_GPIO_PER_BANK;
-	if (likely(pin < gpio_banks))
-		return &gpio_chip[pin];
+	if (unlikely(pin >= MAX_GPIO_BANKS))
+		return NULL;
+
+	chip = &gpio_chip[pin];
+
+	if (!chip->regbase && deep_probe_is_supported()) {
+		char alias[] = "gpioX";
+		scnprintf(alias, sizeof(alias), "gpio%u", pin);
+		of_device_ensure_probed_by_alias(alias);
+	}
 
-	return NULL;
+	return chip;
 }
 
 /**
@@ -652,7 +661,6 @@ static int at91_gpio_probe(struct device *dev)
 		return ret;
 	}
 
-	gpio_banks = max(gpio_banks, alias_idx + 1);
 	at91_gpio->regbase = dev_request_mem_region_err_null(dev, 0);
 	if (!at91_gpio->regbase)
 		return -ENOENT;
-- 
2.30.2




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

* [PATCH v2 10/11] ARM: at91: make bootsource code generic to all SAMA5
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (8 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 09/11] pinctrl: at91: make deep-probe compatible Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-09 13:08 ` [PATCH v2 11/11] ARM: at91: SAMA5D4: add Wifx L1 support Ahmad Fatoum
  2023-01-10 15:05 ` [PATCH v2 00/11] ARM: at91: sama5d4: add basic " Sascha Hauer
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

While I couldn't find documentation, the BootROM of all of SAMA5D2, D3
and D4 populates R4 when calling next stage bootloader with information
about the booutsource. barebox PBL will pass along this information to
barebox proper, so add a generic initcall that sets the bootsource.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-at91/Kconfig                    |  3 ++
 arch/arm/mach-at91/Makefile                   |  1 +
 arch/arm/mach-at91/bootm-barebox.c            |  3 +-
 arch/arm/mach-at91/include/mach/cpu.h         |  1 -
 .../mach-at91/include/mach/sama5_bootsource.h |  2 ++
 arch/arm/mach-at91/sama5_bootsource.c         | 36 +++++++++++++++++++
 arch/arm/mach-at91/sama5d2.c                  | 15 --------
 arch/arm/mach-at91/setup.c                    |  3 --
 8 files changed, 43 insertions(+), 21 deletions(-)
 create mode 100644 arch/arm/mach-at91/sama5_bootsource.c

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index bc55b1c4e76e..529512b6c0db 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -75,6 +75,9 @@ config SOC_SAMA5
 	select HAVE_AT91SAM9_RST
 	select CPU_V7
 
+config SOC_SAMA5_MULTI
+	def_bool SOC_SAMA5 && AT91_MULTI_BOARDS
+
 config SOC_SAMA5D2
 	bool
 	select SOC_SAMA5
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index b9fda00b2e1a..bd39aad97410 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -40,3 +40,4 @@ obj-$(CONFIG_SOC_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
 obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
 obj-$(CONFIG_SOC_AT91SAM9X5)	+= at91sam9x5.o at91sam9x5_devices.o
 obj-$(CONFIG_SOC_AT91SAM9N12)	+= at91sam9n12.o at91sam9n12_devices.o
+obj-$(CONFIG_SOC_SAMA5_MULTI)	+= sama5_bootsource.o
diff --git a/arch/arm/mach-at91/bootm-barebox.c b/arch/arm/mach-at91/bootm-barebox.c
index 3c99d5813b53..afd0c3cf6962 100644
--- a/arch/arm/mach-at91/bootm-barebox.c
+++ b/arch/arm/mach-at91/bootm-barebox.c
@@ -6,7 +6,6 @@
 #include <common.h>
 #include <init.h>
 #include <memory.h>
-#include <mach/cpu.h>
 #include <mach/sama5_bootsource.h>
 
 static int do_bootm_at91_barebox_image(struct image_data *data)
@@ -40,7 +39,7 @@ static struct image_handler image_handler_at91_barebox_image = {
 
 static int at91_register_barebox_image_handler(void)
 {
-	if (!of_machine_is_compatible("atmel,sama5d2"))
+	if (!of_machine_is_compatible("atmel,sama5"))
 	    return 0;
 
 	return register_image_handler(&image_handler_at91_barebox_image);
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 37e516947b57..ca85e8be6e24 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -160,7 +160,6 @@ struct at91_socinfo {
 extern struct at91_socinfo at91_soc_initdata;
 const char *at91_get_soc_type(struct at91_socinfo *c);
 const char *at91_get_soc_subtype(struct at91_socinfo *c);
-extern unsigned long at91_bootsource;
 
 static inline int at91_soc_is_detected(void)
 {
diff --git a/arch/arm/mach-at91/include/mach/sama5_bootsource.h b/arch/arm/mach-at91/include/mach/sama5_bootsource.h
index b31d20bc7c34..8072e7c25154 100644
--- a/arch/arm/mach-at91/include/mach/sama5_bootsource.h
+++ b/arch/arm/mach-at91/include/mach/sama5_bootsource.h
@@ -52,6 +52,8 @@ static inline int sama5_bootsource_instance(u32 reg)
 #define __sama5d4_stashed_bootrom_r4 \
 	(*(volatile u32 *)(SAMA5D4_SRAM_BASE + SAMA5D4_SRAM_SIZE - 0x4))
 
+extern unsigned long at91_bootsource;
+
 static inline void __noreturn sama5_boot_xload(void __noreturn (*bb)(void), u32 r4)
 {
 	asm volatile("mov r4, %0" : : "r"(r4) : );
diff --git a/arch/arm/mach-at91/sama5_bootsource.c b/arch/arm/mach-at91/sama5_bootsource.c
new file mode 100644
index 000000000000..ea657ae36011
--- /dev/null
+++ b/arch/arm/mach-at91/sama5_bootsource.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <mach/sama5_bootsource.h>
+#include <linux/export.h>
+#include <bootsource.h>
+#include <init.h>
+#include <of.h>
+
+unsigned long at91_bootsource;
+EXPORT_SYMBOL(at91_bootsource);
+
+/*
+ * sama5_bootsource_init - initialize bootsource
+ *
+ * BootROM will populate r4 when loading first stage bootloader
+ * with information about boot source. The entry points for
+ * multi-image capable SAMA5 boards will pass this information
+ * along. If you use a bootloader before barebox, you need to
+ * ensure that r4 is initialized for $bootsource to be correct
+ * in barebox. Example implementing it for AT91Bootstrap:
+ * https://github.com/linux4sam/at91bootstrap/pull/159
+ */
+static int sama5_bootsource_init(void)
+{
+	if (!of_machine_is_compatible("atmel,sama5"))
+		return 0;
+
+	at91_bootsource = __sama5d2_stashed_bootrom_r4;
+
+	if (at91_bootsource)
+		bootsource_set_raw(sama5_bootsource(at91_bootsource),
+				   sama5_bootsource_instance(at91_bootsource));
+
+	return 0;
+}
+postcore_initcall(sama5_bootsource_init);
diff --git a/arch/arm/mach-at91/sama5d2.c b/arch/arm/mach-at91/sama5d2.c
index b05d6a56bdd8..b0a04beb639e 100644
--- a/arch/arm/mach-at91/sama5d2.c
+++ b/arch/arm/mach-at91/sama5d2.c
@@ -6,7 +6,6 @@
 #include <mach/aic.h>
 #include <mach/sama5d2.h>
 #include <asm/cache-l2x0.h>
-#include <mach/sama5_bootsource.h>
 #include <asm/mmu.h>
 #include <mach/cpu.h>
 
@@ -54,17 +53,3 @@ static int sama5d2_init(void)
 	return 0;
 }
 postmmu_initcall(sama5d2_init);
-
-static int sama5d2_bootsource_init(void)
-{
-	if (!of_machine_is_compatible("atmel,sama5d2"))
-		return 0;
-
-	at91_bootsource = __sama5d2_stashed_bootrom_r4;
-
-	bootsource_set_raw(sama5_bootsource(at91_bootsource),
-			   sama5_bootsource_instance(at91_bootsource));
-
-	return 0;
-}
-postcore_initcall(sama5d2_bootsource_init);
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 8a21d8debcd5..3d49624cd5c1 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -403,6 +403,3 @@ void at91sam_phy_reset(void __iomem *rstc_base)
 	/* Restore NRST value */
 	writel(AT91_RSTC_KEY | (rstc) | AT91_RSTC_URSTEN, rstc_base + AT91_RSTC_MR);
 }
-
-unsigned long at91_bootsource;
-EXPORT_SYMBOL(at91_bootsource);
-- 
2.30.2




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

* [PATCH v2 11/11] ARM: at91: SAMA5D4: add Wifx L1 support
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (9 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 10/11] ARM: at91: make bootsource code generic to all SAMA5 Ahmad Fatoum
@ 2023-01-09 13:08 ` Ahmad Fatoum
  2023-01-10 15:05 ` [PATCH v2 00/11] ARM: at91: sama5d4: add basic " Sascha Hauer
  11 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2023-01-09 13:08 UTC (permalink / raw)
  To: barebox; +Cc: Sam Ravnborg, Ahmad Fatoum

The Wifx L1 is a SAMA5D4 LoRaWAN gateway. It boots from NAND, but this
can be overridden by inserting a bootable SD-Card.

This first port only provides second-stage SD-Card support. It enables
use of UART, I2C/EEPROM, Ethernet and SD-Card. For NAND use on SAMA5D4,
an updated Linux driver was ported to barebox.
This will follow separately.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/Makefile                |   1 +
 arch/arm/boards/sama5d4_wifx/Makefile   |   4 +
 arch/arm/boards/sama5d4_wifx/board.c    |  38 +++
 arch/arm/boards/sama5d4_wifx/lowlevel.c |  18 ++
 arch/arm/dts/Makefile                   |   1 +
 arch/arm/dts/at91-sama5d4_wifx_l1.dts   | 358 ++++++++++++++++++++++++
 arch/arm/dts/sama5d4.dtsi               |   9 +
 arch/arm/mach-at91/Kconfig              |   8 +
 images/Makefile.at91                    |   4 +
 9 files changed, 441 insertions(+)
 create mode 100644 arch/arm/boards/sama5d4_wifx/Makefile
 create mode 100644 arch/arm/boards/sama5d4_wifx/board.c
 create mode 100644 arch/arm/boards/sama5d4_wifx/lowlevel.c
 create mode 100644 arch/arm/dts/at91-sama5d4_wifx_l1.dts
 create mode 100644 arch/arm/dts/sama5d4.dtsi

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 0f4339ebed5d..f47aea6602a6 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -132,6 +132,7 @@ obj-$(CONFIG_MACH_SAMA5D3XEK)			+= sama5d3xek/
 obj-$(CONFIG_MACH_SAMA5D3_XPLAINED)		+= sama5d3_xplained/
 obj-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB)	+= microchip-ksz9477-evb/
 obj-$(CONFIG_MACH_SAMA5D4_XPLAINED)		+= sama5d4_xplained/
+obj-$(CONFIG_MACH_SAMA5D4_WIFX)			+= sama5d4_wifx/
 obj-$(CONFIG_MACH_SAMA5D4EK)			+= sama5d4ek/
 obj-$(CONFIG_MACH_SCB9328)			+= scb9328/
 obj-$(CONFIG_MACH_SEEED_ODYSSEY)		+= seeed-odyssey/
diff --git a/arch/arm/boards/sama5d4_wifx/Makefile b/arch/arm/boards/sama5d4_wifx/Makefile
new file mode 100644
index 000000000000..5678718188b9
--- /dev/null
+++ b/arch/arm/boards/sama5d4_wifx/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+lwl-y += lowlevel.o
+obj-y += board.o
diff --git a/arch/arm/boards/sama5d4_wifx/board.c b/arch/arm/boards/sama5d4_wifx/board.c
new file mode 100644
index 000000000000..028bedcfb05a
--- /dev/null
+++ b/arch/arm/boards/sama5d4_wifx/board.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <deep-probe.h>
+#include <bootsource.h>
+#include <driver.h>
+#include <init.h>
+#include <bbu.h>
+#include <of.h>
+
+static int wifx_l1_probe(struct device *dev)
+{
+	int flags_sd = 0;
+
+	if (bootsource_get() == BOOTSOURCE_NAND) {
+		of_device_enable_path("/chosen/environment-nand");
+	} else {
+		of_device_enable_path("/chosen/environment-microsd");
+		flags_sd = BBU_HANDLER_FLAG_DEFAULT;
+	}
+
+	bbu_register_std_file_update("sd", flags_sd, "/mnt/mmc1.0/barebox.bin",
+				     filetype_arm_barebox);
+
+	return 0;
+}
+
+static const struct of_device_id wifx_l1_of_match[] = {
+	{ .compatible = "wifx,l1" },
+	{ /* sentinel */ },
+};
+BAREBOX_DEEP_PROBE_ENABLE(wifx_l1_of_match);
+
+static struct driver wifx_l1_board_driver = {
+	.name = "board-lxa-mc1",
+	.probe = wifx_l1_probe,
+	.of_compatible = wifx_l1_of_match,
+};
+device_platform_driver(wifx_l1_board_driver);
diff --git a/arch/arm/boards/sama5d4_wifx/lowlevel.c b/arch/arm/boards/sama5d4_wifx/lowlevel.c
new file mode 100644
index 000000000000..0c3529e65965
--- /dev/null
+++ b/arch/arm/boards/sama5d4_wifx/lowlevel.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: 2022 Ahmad Fatoum, Pengutronix
+
+#include <debug_ll.h>
+#include <mach/barebox-arm.h>
+#include <mach/ddramc.h>
+
+SAMA5D4_ENTRY_FUNCTION(start_sama5d4_wifx_l1, r4)
+{
+	extern char __dtb_z_at91_sama5d4_wifx_l1_start[];
+	void *fdt;
+
+	putc_ll('>');
+
+	fdt = __dtb_z_at91_sama5d4_wifx_l1_start + get_runtime_offset();
+
+	sama5d4_barebox_entry(r4, fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 5ceb97129fed..dca13df4ba6f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -191,6 +191,7 @@ lwl-$(CONFIG_MACH_SAMA5D3_XPLAINED) += at91-sama5d3_xplained.dtb.o
 lwl-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
 lwl-$(CONFIG_MACH_SAMA5D27_SOM1) += at91-sama5d27_som1_ek.dtb.o
 lwl-$(CONFIG_MACH_SAMA5D27_GIANTBOARD) += at91-sama5d27_giantboard.dtb.o
+lwl-$(CONFIG_MACH_SAMA5D4_WIFX) += at91-sama5d4_wifx_l1.dtb.o
 lwl-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
 lwl-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
 lwl-$(CONFIG_MACH_XILINX_ZCU106) += zynqmp-zcu106-revA.dtb.o
diff --git a/arch/arm/dts/at91-sama5d4_wifx_l1.dts b/arch/arm/dts/at91-sama5d4_wifx_l1.dts
new file mode 100644
index 000000000000..ea16ea21344c
--- /dev/null
+++ b/arch/arm/dts/at91-sama5d4_wifx_l1.dts
@@ -0,0 +1,358 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
+// SPDX-FileCopyrightText: 2021 Wifx
+// SPDX-FileCopyrightText: 2021 Yannick Lanz <yannick.lanz@wifx.net>
+// SPDX-FileCopyrightText: 2022 Ahmad Fatoum, Pengutronix
+
+/dts-v1/;
+
+#include <arm/sama5d4.dtsi>
+#include "sama5d4.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	model = "Wifx L1";
+	compatible = "wifx,l1", "atmel,sama5d4", "atmel,sama5";
+
+	chosen {
+		stdout-path = &usart3;
+
+		environment-microsd {
+			compatible = "barebox,environment";
+			device-path = &mmc1;
+			file-path = "barebox.env";
+			status = "disabled";
+		};
+
+		environment-nand {
+			compatible = "barebox,environment";
+			device-path = &env_nand;
+			status = "disabled";
+		};
+	};
+
+	aliases {
+		rtc0 = &ds1339;
+		rtc1 = &rtc_internal;
+		serial1 = &usart1;
+		serial4 = &usart4;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		status = "okay";
+
+		status_internal {
+			gpios = <&pioE 15 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "heartbeat";
+		};
+	};
+
+	pps {
+	      compatible = "pps-gpio";
+	      pinctrl-names = "default";
+	      pinctrl-0 = <&pinctrl_gnss_pps>;
+
+	      gpios = <&pioC 24 GPIO_ACTIVE_HIGH>;
+	      /* assert-falling-edge; */
+	};
+
+	vddbu_2v_reg: regulator-vddbu-2v {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDBU_2V";
+		regulator-min-microvolt = <2000000>;
+		regulator-max-microvolt = <2000000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+};
+
+&slow_xtal {
+	clock-frequency = <32768>;
+};
+
+&main_xtal {
+	clock-frequency = <12000000>;
+};
+
+&spi0 {
+	status = "okay";
+	cs-gpios = <&pioC 3 GPIO_ACTIVE_HIGH>;
+
+	sx1302@0 {
+		compatible = "semtech,sx1301";
+		spi-max-frequency = <10000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	status = "okay";
+	clock-frequency = <100000>;
+	i2c-digital-filter;
+	i2c-analog-filter;
+};
+
+&i2c1 {
+	status = "okay";
+	clock-frequency = <400000>;
+	i2c-digital-filter;
+	i2c-analog-filter;
+
+	stts751: temp_sensor@38 {
+		compatible = "stts751";
+		reg = <0x38>;
+	};
+
+	m24c08: eeprom@54 {
+		compatible = "atmel,24c08";
+		reg = <0x54>;
+		pagesize = <16>;
+	};
+
+	mac_at24mac402: eeprom@58 {
+		compatible = "atmel,24mac402";
+		reg = <0x58>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		ethaddr: mac-address@9a {
+			reg = <0x9a 6>;
+		};
+	};
+
+	ds1339: rtc@68 {
+		compatible = "dallas,ds1339";
+		reg = <0x68>;
+		trickle-resistor-ohms = <250>;
+	};
+};
+
+&i2c2 {
+	status = "okay";
+	clock-frequency = <400000>;
+	i2c-digital-filter;
+	i2c-analog-filter;
+
+	ec@2a {
+		compatible = "wifx,wgw-ec-i2c";
+		reg = <0x2a>;
+
+		interrupt-parent = <&pioE>;
+		interrupts = <27 IRQ_TYPE_EDGE_RISING>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_mcu_irq &pinctrl_mcu_cpu_state>;
+
+		cpu-state-gpios = <&pioA 19 0>;
+
+		usb_typec: usbc {
+			compatible = "wifx,wgw-ec-usbc";
+			#trigger-source-cells = <0>;
+		};
+
+		leds {
+			compatible = "wifx,wgw-ec-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			statusled {
+				reg = <0>;
+				label = "status";
+				max-brightness = <255>;
+				linux,default-trigger = "heartbeat";
+			};
+
+			serviceled {
+				reg = <1>;
+				label = "service";
+				max-brightness = <255>;
+				linux,default-trigger = "wgw-usbc-data-mode";
+				trigger-sources = <&usb_typec>;
+			};
+		};
+	};
+};
+
+&macb0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
+	phy-mode = "rmii";
+	phy-handle = <&phy0>;
+	nvmem-cells = <&ethaddr>;
+	nvmem-cell-names = "mac-address";
+	status = "okay";
+
+	phy0: ethernet-phy@1 {
+		interrupt-parent = <&pioA>;
+		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+		reg = <1>;
+	};
+};
+
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>;
+	status = "okay";
+
+	slot@0 {
+		reg = <0>;
+		bus-width = <4>;
+		cd-gpios = <&pioE 3 0>;
+	};
+};
+
+&usart1 {
+	atmel,use-dma-rx;
+	atmel,use-dma-tx;
+	pinctrl-0 = <&pinctrl_usart1>;
+	status = "okay";
+};
+
+&usart3 {
+	atmel,use-dma-rx;
+	atmel,use-dma-tx;
+	status = "okay";
+};
+
+&tcb0 {
+	timer@0 {
+		compatible = "atmel,tcb-timer";
+		reg = <0>;
+	};
+
+	timer@1 {
+		compatible = "atmel,tcb-timer";
+		reg = <1>;
+	};
+};
+
+/* disable unused TCBs */
+&tcb1 {
+	status = "disabled";
+};
+
+&tcb2 {
+	status = "disabled";
+};
+
+&watchdog {
+	status = "okay";
+};
+
+rtc_internal: &{/ahb/apb/rtc@fc0686b0} {
+	status = "okay";
+};
+
+&usb0 {
+	atmel,vbus-gpio = <&pioE 31 GPIO_ACTIVE_HIGH>;
+	atmel,id-gpio = <&pioD 11 GPIO_ACTIVE_HIGH>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_vbus>;
+	status = "okay";
+};
+
+&usb1 {
+	num-ports = <3>;
+	atmel,vbus-gpio = <0 0 0 >;
+	atmel,id-gpio = <&pioD 11 GPIO_ACTIVE_HIGH 0 0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_id>;
+	status = "okay";
+};
+
+&usb2 {
+	status = "okay";
+};
+
+&ebi {
+	pinctrl-0 = <&pinctrl_ebi_cs3 &pinctrl_ebi_nrd_nandoe
+			&pinctrl_ebi_nwe_nandwe &pinctrl_ebi_nandrdy
+			&pinctrl_ebi_data_0_7 &pinctrl_ebi_nand_addr>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
+&nand_controller {
+	status = "okay";
+	atmel,pmecc-cap = <4>;
+	atmel,pmecc-sector-size = <512>;
+
+	nand@3 {
+		reg = <0x3 0x0 0x2>;
+		atmel,rb = <0>;
+		nand-bus-width = <8>;
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+		label = "atmel_nand";
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			at91bootstrap@0 {
+				label = "at91bootstrap";
+				reg = <0x0 0x40000>;
+			};
+
+			uboot@40000 {
+				label = "uboot";
+				reg = <0x40000 0xC0000>;
+			};
+
+			env_nand: uboot-env@100000 {
+				label = "uboot-env";
+				reg = <0x100000 0x80000>;
+			};
+
+			ubi@180000 {
+				label = "ubi";
+				reg = <0x180000 0x3FE00000>;
+			};
+		};
+	};
+};
+
+&pinctrl {
+	board {
+		pinctrl_mmc1_cd: mmc1_cd {
+			atmel,pins = <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_usb_vbus: usb_vbus {
+			atmel,pins = <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_usb_id: usb_id {
+			atmel,pins = <AT91_PIOD 11 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_mcu_irq: mcu_irq_0 {
+			atmel,pins = <AT91_PIOE 27 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_mcu_cpu_state: mcu_cpu_state {
+			atmel,pins = <AT91_PIOA 19 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT | AT91_PINCTRL_OUTPUT_VAL(1))>;
+		};
+		pinctrl_macb0_phy_irq: macb0_phy_irq_0 {
+			atmel,pins = <AT91_PIOA 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_sx130x_rst: sx130x_rst {
+			atmel,pins = <AT91_PIOA 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_rf_front_pwr_en: rf_front_pwr_en {
+			atmel,pins = <AT91_PIOA 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+
+		pinctrl_ext_rst: ext_rst {
+			atmel,pins = <AT91_PIOA 17 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_ext_pwr_en: ext_pwr_en {
+			atmel,pins = <AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_DOWN>;
+		};
+		pinctrl_ext_boot_n: ext_boot_n {
+			atmel,pins = <AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_ext_wake: ext_wake {
+			atmel,pins = <AT91_PIOA 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
+		};
+		pinctrl_gnss_pps: gnss_pps {
+			atmel,pins = <AT91_PIOC 24 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
+		};
+	};
+};
diff --git a/arch/arm/dts/sama5d4.dtsi b/arch/arm/dts/sama5d4.dtsi
new file mode 100644
index 000000000000..d7dbba667d14
--- /dev/null
+++ b/arch/arm/dts/sama5d4.dtsi
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/ {
+	aliases {
+		mmc0 = &mmc0;
+		mmc1 = &mmc1;
+	};
+};
+
+/delete-node/ &{/memory@20000000};
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 529512b6c0db..22ed71350cb1 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -640,6 +640,14 @@ config MACH_SAMA5D27_GIANTBOARD
 	help
 	  Select this if you are using the Groboards sama5d27 Giantboard
 
+config MACH_SAMA5D4_WIFX
+	bool "Wifx L1 LoRaWAN base station"
+	select SOC_SAMA5D4
+	select OFDEVICE
+	select COMMON_CLK_OF_PROVIDER
+	help
+	  Select this if you are using the SAMA5D4-based Wifx L1.
+
 endif
 
 comment "AT91 Board Options"
diff --git a/images/Makefile.at91 b/images/Makefile.at91
index 71cc959f5d05..c6a6fb697bfe 100644
--- a/images/Makefile.at91
+++ b/images/Makefile.at91
@@ -51,3 +51,7 @@ pblb-$(CONFIG_MACH_SKOV_ARM9CPU) += start_skov_arm9cpu
 FILE_barebox-skov-arm9cpu.img = start_skov_arm9cpu.pblb
 MAX_PBL_MEMORY_SIZE_start_skov_arm9cpu = 0x12000
 image-$(CONFIG_MACH_SKOV_ARM9CPU) += barebox-skov-arm9cpu.img
+
+pblb-$(CONFIG_MACH_SAMA5D4_WIFX) += start_sama5d4_wifx_l1
+FILE_barebox-wifx-l1.img = start_sama5d4_wifx_l1.pblb
+image-$(CONFIG_MACH_SAMA5D4_WIFX) += barebox-wifx-l1.img
-- 
2.30.2




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

* Re: [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support
  2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
                   ` (10 preceding siblings ...)
  2023-01-09 13:08 ` [PATCH v2 11/11] ARM: at91: SAMA5D4: add Wifx L1 support Ahmad Fatoum
@ 2023-01-10 15:05 ` Sascha Hauer
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2023-01-10 15:05 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Jan 09, 2023 at 02:08:11PM +0100, Ahmad Fatoum wrote:
> The Wifx L1 is a SAMA5D4 LoRaWAN gateway. It boots from NAND, but this
> can be overridden by inserting a bootable SD-Card.
> 
> This first port only provides second-stage SD-Card support. It enables
> use of UART, I2C/EEPROM, Ethernet and SD-Card. For NAND use on SAMA5D4,
> an updated Linux driver was ported to barebox.
> This will follow separately.
> 
> v1 -> v2:
>   - skip stack setup on SAMA5D2 (Sascha)
>   - Add Sam's Acked-by
>   - Rebase on upstream/next
> 
> Ahmad Fatoum (11):
>   ARM: at91: sama5: switch to nonnaked entry functions
>   ARM: at91: sama5d4: add entry point helpers
>   ARM: at91: sama5d4: enable for DT use
>   net: macb: match atmel,sama5d4-gem compatible
>   i2c: at91: extend for SAMA5D4 support
>   eeprom: at24: add 24mac402/602 support
>   driver: always ensure probe of RAM registered with mem_platform_driver
>   common: deep-probe: don't build without CONFIG_OFDEVICE
>   pinctrl: at91: make deep-probe compatible
>   ARM: at91: make bootsource code generic to all SAMA5
>   ARM: at91: SAMA5D4: add Wifx L1 support

Applied, thanks

Sascha

> 
>  arch/arm/boards/Makefile                      |   1 +
>  .../boards/microchip-ksz9477-evb/lowlevel.c   |   6 +-
>  .../arm/boards/sama5d27-giantboard/lowlevel.c |   4 +-
>  arch/arm/boards/sama5d27-som1/lowlevel.c      |   4 +-
>  arch/arm/boards/sama5d3_xplained/lowlevel.c   |   6 +-
>  arch/arm/boards/sama5d4_wifx/Makefile         |   4 +
>  arch/arm/boards/sama5d4_wifx/board.c          |  38 ++
>  arch/arm/boards/sama5d4_wifx/lowlevel.c       |  18 +
>  arch/arm/dts/Makefile                         |   1 +
>  arch/arm/dts/at91-sama5d4_wifx_l1.dts         | 358 ++++++++++++++++++
>  arch/arm/dts/sama5d4.dtsi                     |   9 +
>  arch/arm/mach-at91/Kconfig                    |  11 +
>  arch/arm/mach-at91/Makefile                   |   3 +-
>  arch/arm/mach-at91/bootm-barebox.c            |   3 +-
>  arch/arm/mach-at91/ddramc.c                   |   7 +
>  arch/arm/mach-at91/include/mach/barebox-arm.h |  23 +-
>  arch/arm/mach-at91/include/mach/cpu.h         |   1 -
>  arch/arm/mach-at91/include/mach/ddramc.h      |   1 +
>  .../mach-at91/include/mach/sama5_bootsource.h |   5 +
>  arch/arm/mach-at91/sama5_bootsource.c         |  36 ++
>  arch/arm/mach-at91/sama5d2.c                  |  15 -
>  arch/arm/mach-at91/setup.c                    |   3 -
>  common/Makefile                               |   2 +-
>  drivers/eeprom/at24.c                         |   2 +
>  drivers/i2c/busses/i2c-at91.c                 |  14 +-
>  drivers/net/macb.c                            |   1 +
>  drivers/pinctrl/pinctrl-at91.c                |  20 +-
>  images/Makefile.at91                          |   4 +
>  include/deep-probe.h                          |   7 +
>  include/driver.h                              |  13 +-
>  30 files changed, 572 insertions(+), 48 deletions(-)
>  create mode 100644 arch/arm/boards/sama5d4_wifx/Makefile
>  create mode 100644 arch/arm/boards/sama5d4_wifx/board.c
>  create mode 100644 arch/arm/boards/sama5d4_wifx/lowlevel.c
>  create mode 100644 arch/arm/dts/at91-sama5d4_wifx_l1.dts
>  create mode 100644 arch/arm/dts/sama5d4.dtsi
>  create mode 100644 arch/arm/mach-at91/sama5_bootsource.c
> 
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [PATCH v2 03/11] ARM: at91: sama5d4: enable for DT use
  2023-01-09 13:08 ` [PATCH v2 03/11] ARM: at91: sama5d4: enable for DT use Ahmad Fatoum
@ 2023-01-11 10:37   ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2023-01-11 10:37 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Sam Ravnborg

On Mon, Jan 09, 2023 at 02:08:14PM +0100, Ahmad Fatoum wrote:
> The sama5d4[devices].c files are for non-OF instantiation of platform
> devices. We don't need anything out of these two files, so don't build
> them when compiling for CONFIG_OFDEVICE.
> 
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/mach-at91/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
> index 390d49d03dee..b9fda00b2e1a 100644
> --- a/arch/arm/mach-at91/Makefile
> +++ b/arch/arm/mach-at91/Makefile
> @@ -30,6 +30,7 @@ obj-$(CONFIG_SOC_AT91SAM9G10) += at91sam9261.o at91sam9261_devices.o
>  ifeq ($(CONFIG_OFDEVICE),)
>  obj-$(CONFIG_SOC_AT91SAM9263) += at91sam9263.o at91sam9263_devices.o
>  obj-$(CONFIG_SOC_SAMA5D3)	+= sama5d3.o sama5d3_devices.o
> +obj-$(CONFIG_SOC_SAMA5D4)	+= sama5d4.o sama5d4_devices.o
>  endif
>  lwl-$(CONFIG_SOC_AT91SAM9263)	+= sam9263_ll.o
>  lwl-$(CONFIG_SOC_SAMA5D2)	+= sama5d2_ll.o
> @@ -39,4 +40,3 @@ obj-$(CONFIG_SOC_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o
>  obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o
>  obj-$(CONFIG_SOC_AT91SAM9X5)	+= at91sam9x5.o at91sam9x5_devices.o
>  obj-$(CONFIG_SOC_AT91SAM9N12)	+= at91sam9n12.o at91sam9n12_devices.o
> -obj-$(CONFIG_SOC_SAMA5D4)	+= sama5d4.o sama5d4_devices.o

This breaks compilation of sama5d4ek_defconfig and
sama5d4_xplained_defconfig:

arch/arm/boards/sama5d4_xplained/sama5d4_xplained.o: in function `sama5d4_xplained_mem_init':
arch/arm/boards/sama5d4_xplained/sama5d4_xplained.c:251: undefined reference to `at91_add_device_sdram'

Several more undefined references follow.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-01-11 10:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 13:08 [PATCH v2 00/11] ARM: at91: sama5d4: add basic Wifx L1 support Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 01/11] ARM: at91: sama5: switch to nonnaked entry functions Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 02/11] ARM: at91: sama5d4: add entry point helpers Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 03/11] ARM: at91: sama5d4: enable for DT use Ahmad Fatoum
2023-01-11 10:37   ` Sascha Hauer
2023-01-09 13:08 ` [PATCH v2 04/11] net: macb: match atmel,sama5d4-gem compatible Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 05/11] i2c: at91: extend for SAMA5D4 support Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 06/11] eeprom: at24: add 24mac402/602 support Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 07/11] driver: always ensure probe of RAM registered with mem_platform_driver Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 08/11] common: deep-probe: don't build without CONFIG_OFDEVICE Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 09/11] pinctrl: at91: make deep-probe compatible Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 10/11] ARM: at91: make bootsource code generic to all SAMA5 Ahmad Fatoum
2023-01-09 13:08 ` [PATCH v2 11/11] ARM: at91: SAMA5D4: add Wifx L1 support Ahmad Fatoum
2023-01-10 15:05 ` [PATCH v2 00/11] ARM: at91: sama5d4: add basic " Sascha Hauer

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