* [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper
@ 2026-11-06 11:13 Ahmad Fatoum
2026-11-06 11:13 ` [PATCH 2/4] ARM: at91: sama5d3_xplained: drop invalid hostname Ahmad Fatoum
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2026-11-06 11:13 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
From: Ahmad Fatoum <a.fatoum@barebox.org>
The SAMA5D3 xload entry points pass a literal 0 instead of the BootROM's
r4 to sama5d3_atmci_start_image(). This leads to wrong $bootsource
computation.
Fix this by passing r4 through. Tested on a SAMA5D3 Xplained booting
from SD.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/boards/microchip-ksz9477-evb/lowlevel.c | 2 +-
arch/arm/boards/microchip-sama5d3-eds/lowlevel.c | 2 +-
arch/arm/boards/sama5d3_xplained/lowlevel.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
index aa2161daeef0..e59578987ba2 100644
--- a/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
+++ b/arch/arm/boards/microchip-ksz9477-evb/lowlevel.c
@@ -44,7 +44,7 @@ SAMA5D3_ENTRY_FUNCTION(start_sama5d3_xplained_ung8071_xload_mmc, r4)
if (IS_ENABLED(CONFIG_DEBUG_LL))
dbgu_init();
- sama5d3_atmci_start_image(0, MASTER_CLOCK, 0);
+ sama5d3_atmci_start_image(r4, MASTER_CLOCK, 0);
}
extern char __dtb_z_at91_microchip_ksz9477_evb_start[];
diff --git a/arch/arm/boards/microchip-sama5d3-eds/lowlevel.c b/arch/arm/boards/microchip-sama5d3-eds/lowlevel.c
index 79346a9b6ac1..b05824c7d1b0 100644
--- a/arch/arm/boards/microchip-sama5d3-eds/lowlevel.c
+++ b/arch/arm/boards/microchip-sama5d3-eds/lowlevel.c
@@ -44,7 +44,7 @@ SAMA5D3_ENTRY_FUNCTION(start_microchip_sama5d3_eds_xload_mmc, r4)
if (IS_ENABLED(CONFIG_DEBUG_LL))
dbgu_init();
- sama5d3_atmci_start_image(0, MASTER_CLOCK, 0);
+ sama5d3_atmci_start_image(r4, MASTER_CLOCK, 0);
}
extern char __dtb_z_at91_microchip_sama5d3_eds_start[];
diff --git a/arch/arm/boards/sama5d3_xplained/lowlevel.c b/arch/arm/boards/sama5d3_xplained/lowlevel.c
index 2a0fed1141de..c7578e6db18c 100644
--- a/arch/arm/boards/sama5d3_xplained/lowlevel.c
+++ b/arch/arm/boards/sama5d3_xplained/lowlevel.c
@@ -45,7 +45,7 @@ SAMA5D3_ENTRY_FUNCTION(start_sama5d3_xplained_xload_mmc, r4)
sama5d3_udelay_init(MASTER_CLOCK);
sama5d3_xplained_ddrconf();
- sama5d3_atmci_start_image(0, MASTER_CLOCK, 0);
+ sama5d3_atmci_start_image(r4, MASTER_CLOCK, 0);
}
extern char __dtb_z_at91_sama5d3_xplained_start[];
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/4] ARM: at91: sama5d3_xplained: drop invalid hostname 2026-11-06 11:13 [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Ahmad Fatoum @ 2026-11-06 11:13 ` Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 3/4] pwm: atmel: look up the clock without a name Ahmad Fatoum ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-11-06 11:13 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum From: Ahmad Fatoum <a.fatoum@barebox.org> Host names can't contain underscores, so barebox complains at every boot: WARNING: Hostname is not valid, please fix it Without the override, the hostname is derived from the "atmel,sama5d3-xplained" compatible instead, which is valid, so let's drop it. The net boot entry now looks for *-sama5d3-xplained instead of *-sama5d3_xplained. This isn't worth a migration guide entry, as barebox has been warning about the old name since v2024.05.0. Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org> --- arch/arm/boards/sama5d3_xplained/board.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/boards/sama5d3_xplained/board.c b/arch/arm/boards/sama5d3_xplained/board.c index 4d908e6b9f62..c6c1105e5eb5 100644 --- a/arch/arm/boards/sama5d3_xplained/board.c +++ b/arch/arm/boards/sama5d3_xplained/board.c @@ -39,8 +39,6 @@ static int sama5d3_xplained_probe(struct device *dev) { struct clk *clk; - barebox_set_hostname("sama5d3_xplained"); - if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC)) defaultenv_append_directory(defaultenv_sama5d3_xplained); -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] pwm: atmel: look up the clock without a name 2026-11-06 11:13 [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 2/4] ARM: at91: sama5d3_xplained: drop invalid hostname Ahmad Fatoum @ 2026-11-06 11:13 ` Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 4/4] ARM: at91: sama5d3: Migrate to MFD-based SMC driver Ahmad Fatoum 2026-11-09 9:52 ` [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Sascha Hauer 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-11-06 11:13 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum From: Ahmad Fatoum <a.fatoum@barebox.org> The SAMA5D2, SAMA5D3 and SAMA5D4 device trees don't name the PWM clock, so probe fails with -ENOENT on these SoCs. Linux requests the clock without a name, so let's do the same. at91sam9263.dtsi has only the one clock, so it keeps working. Fixes: 3b4a22e803bb ("pwm: add pwm-atmel from Linux kernel 4.14") Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org> --- drivers/pwm/pwm-atmel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index a847d4d434e3..35299cbc563a 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c @@ -432,7 +432,7 @@ static int atmel_pwm_probe(struct device *dev) atmel_pwm = xzalloc(sizeof(*atmel_pwm)); atmel_pwm->data = data; atmel_pwm->dev = dev; - atmel_pwm->clk = clk_get(dev, "pwm_clk"); + atmel_pwm->clk = clk_get(dev, NULL); if (IS_ERR(atmel_pwm->clk)) return PTR_ERR(atmel_pwm->clk); -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] ARM: at91: sama5d3: Migrate to MFD-based SMC driver 2026-11-06 11:13 [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 2/4] ARM: at91: sama5d3_xplained: drop invalid hostname Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 3/4] pwm: atmel: look up the clock without a name Ahmad Fatoum @ 2026-11-06 11:13 ` Ahmad Fatoum 2026-11-09 9:52 ` [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Sascha Hauer 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-11-06 11:13 UTC (permalink / raw) To: barebox; +Cc: Alexander Shiyan, Ahmad Fatoum From: Alexander Shiyan <eagle.alexander923@gmail.com> This replaces the low-level SMC driver implementation with the MFD-based driver for SAMA5D3 platforms. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Tested-by: Ahmad Fatoum <a.fatoum@barebox.org> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org> --- arch/arm/boards/sama5d3_xplained/board.c | 46 ------------------------ arch/arm/mach-at91/Kconfig | 1 - arch/arm/mach-at91/sam9_smc.c | 5 +-- 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/arch/arm/boards/sama5d3_xplained/board.c b/arch/arm/boards/sama5d3_xplained/board.c index c6c1105e5eb5..a5530bc49acc 100644 --- a/arch/arm/boards/sama5d3_xplained/board.c +++ b/arch/arm/boards/sama5d3_xplained/board.c @@ -3,58 +3,12 @@ #include <common.h> #include <init.h> #include <envfs.h> -#include <mach/at91/at91sam9_smc.h> -#include <mach/at91/hardware.h> -#include <linux/clk.h> - -static struct sam9_smc_config sama5d3_xplained_nand_smc_config = { - .ncs_read_setup = 1, - .nrd_setup = 2, - .ncs_write_setup = 1, - .nwe_setup = 2, - - .ncs_read_pulse = 5, - .nrd_pulse = 3, - .ncs_write_pulse = 5, - .nwe_pulse = 3, - - .read_cycle = 8, - .write_cycle = 8, - - .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | - AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, - .tdf_cycles = 3, - - .tclr = 3, - .tadl = 10, - .tar = 3, - .ocms = 0, - .trr = 4, - .twb = 5, - .rbnsel = 3, - .nfsel = 1 -}; static int sama5d3_xplained_probe(struct device *dev) { - struct clk *clk; - if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC)) defaultenv_append_directory(defaultenv_sama5d3_xplained); - add_generic_device("at91sam9-smc", DEVICE_ID_SINGLE, NULL, - SAMA5D3_BASE_HSMC + 0x600, 0xa0, - IORESOURCE_MEM, NULL); - - clk = clk_lookup("hsmc_clk"); - if (IS_ERR(clk)) - dev_warn(dev, "couldn't get hsmc_clk: %pe\n", clk); - - clk_enable(clk); - - /* configure chip-select 3 (NAND) */ - sama5_smc_configure(0, 3, &sama5d3_xplained_nand_smc_config); - return 0; } diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index df20943254a9..fb55c9c2817f 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -107,7 +107,6 @@ config SOC_SAMA5D2 config SOC_SAMA5D3 bool select SOC_SAMA5 - select AT91SAM9_SMC select CLOCKSOURCE_ATMEL_PIT select HAVE_AT91_SMD select HAVE_AT91_USB_CLK diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c index 6c9e169a8e3e..66b30694ce96 100644 --- a/arch/arm/mach-at91/sam9_smc.c +++ b/arch/arm/mach-at91/sam9_smc.c @@ -14,8 +14,7 @@ #define AT91_SAM9_SMC_CS_STRIDE 0x10 #define AT91_SAMA5_SMC_CS_STRIDE 0x14 -#define AT91_SMC_CS_STRIDE ((at91_soc_initdata.type == AT91_SOC_SAMA5D3 \ - || at91_soc_initdata.type == AT91_SOC_SAMA5D4) \ +#define AT91_SMC_CS_STRIDE ((at91_soc_initdata.type == AT91_SOC_SAMA5D4) \ ? AT91_SAMA5_SMC_CS_STRIDE : AT91_SAM9_SMC_CS_STRIDE) #define AT91_SMC_CS(id, n) (smc_base_addr[id] + ((n) * AT91_SMC_CS_STRIDE)) @@ -27,7 +26,6 @@ static void sam9_smc_cs_write_mode(void __iomem *base, void __iomem *mode_reg; switch (at91_soc_initdata.type) { - case AT91_SOC_SAMA5D3: case AT91_SOC_SAMA5D4: mode_reg = base + AT91_SAMA5_SMC_MODE; break; @@ -101,7 +99,6 @@ static void sam9_smc_cs_read_mode(void __iomem *base, void __iomem *mode_reg; switch (at91_soc_initdata.type) { - case AT91_SOC_SAMA5D3: case AT91_SOC_SAMA5D4: mode_reg = base + AT91_SAMA5_SMC_MODE; break; -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper 2026-11-06 11:13 [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Ahmad Fatoum ` (2 preceding siblings ...) 2026-11-06 11:13 ` [PATCH 4/4] ARM: at91: sama5d3: Migrate to MFD-based SMC driver Ahmad Fatoum @ 2026-11-09 9:52 ` Sascha Hauer 3 siblings, 0 replies; 5+ messages in thread From: Sascha Hauer @ 2026-11-09 9:52 UTC (permalink / raw) To: barebox, Ahmad Fatoum; +Cc: Ahmad Fatoum On Fri, 06 Nov 2026 12:13:47 +0100, Ahmad Fatoum wrote: > The SAMA5D3 xload entry points pass a literal 0 instead of the BootROM's > r4 to sama5d3_atmci_start_image(). This leads to wrong $bootsource > computation. > > Fix this by passing r4 through. Tested on a SAMA5D3 Xplained booting > from SD. > > [...] Applied, thanks! [1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper https://git.pengutronix.de/cgit/barebox/commit/?id=2f461f48d41b (link may not be stable) [2/4] ARM: at91: sama5d3_xplained: drop invalid hostname https://git.pengutronix.de/cgit/barebox/commit/?id=92fa6d8b837b (link may not be stable) [3/4] pwm: atmel: look up the clock without a name https://git.pengutronix.de/cgit/barebox/commit/?id=b44d49b5192d (link may not be stable) [4/4] ARM: at91: sama5d3: Migrate to MFD-based SMC driver https://git.pengutronix.de/cgit/barebox/commit/?id=9ef0ba56aaff (link may not be stable) Best regards, -- Sascha Hauer <s.hauer@pengutronix.de> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-09 10:16 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-06 11:13 [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 2/4] ARM: at91: sama5d3_xplained: drop invalid hostname Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 3/4] pwm: atmel: look up the clock without a name Ahmad Fatoum 2026-11-06 11:13 ` [PATCH 4/4] ARM: at91: sama5d3: Migrate to MFD-based SMC driver Ahmad Fatoum 2026-11-09 9:52 ` [PATCH 1/4] ARM: at91: sama5d3: pass BootROM r4 on to barebox proper Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox