mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/9] ARM: zynq: add MMC aliases
@ 2024-12-13 21:00 Lucas Stach
  2024-12-13 21:00 ` [PATCH 2/9] ARM: zynq: zed: define SDHCI bus-width Lucas Stach
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

The upstream DT doesn't include those, yet. Make sure
MMC controllers end up with a deterministic numbering.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/dts/zynq-7000.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/dts/zynq-7000.dtsi b/arch/arm/dts/zynq-7000.dtsi
index f7a0d70babef..90b0c098fc82 100644
--- a/arch/arm/dts/zynq-7000.dtsi
+++ b/arch/arm/dts/zynq-7000.dtsi
@@ -1,4 +1,11 @@
 
+/ {
+	aliases {
+		mmc0 = &sdhci0;
+		mmc1 = &sdhci1;
+	};
+};
+
 &amba {
 	qspi: spi@e000d000 {
 		compatible = "xlnx,zynq-qspi-1.0";
-- 
2.47.1




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

* [PATCH 2/9] ARM: zynq: zed: define SDHCI bus-width
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 3/9] ARM: zynq: zed: guard board initcall Lucas Stach
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

The SDHCI controller on the Zedboard is routed to a SD card
slot. Define bus-width to allow the controller to use the
full bandwidth.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/dts/zynq-zed.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/zynq-zed.dts b/arch/arm/dts/zynq-zed.dts
index 465758ebf62f..25b4d6df2937 100644
--- a/arch/arm/dts/zynq-zed.dts
+++ b/arch/arm/dts/zynq-zed.dts
@@ -7,6 +7,10 @@ chosen {
 	};
 };
 
+&sdhci0 {
+	bus-width = <4>;
+};
+
 &qspi {
 	status = "okay";
 	num-cs = <1>;
-- 
2.47.1




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

* [PATCH 3/9] ARM: zynq: zed: guard board initcall
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
  2024-12-13 21:00 ` [PATCH 2/9] ARM: zynq: zed: define SDHCI bus-width Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 4/9] ARM: zynq: zed: add environment Lucas Stach
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

Make sure the board initcall is only executed on a
compatible board.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/boards/avnet-zedboard/board.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boards/avnet-zedboard/board.c b/arch/arm/boards/avnet-zedboard/board.c
index 15332189ca09..faa0bacf0ce1 100644
--- a/arch/arm/boards/avnet-zedboard/board.c
+++ b/arch/arm/boards/avnet-zedboard/board.c
@@ -12,6 +12,9 @@
 
 static int zedboard_console_init(void)
 {
+	if (!of_machine_is_compatible("avnet,zynq-zed"))
+		return 0;
+
 	barebox_set_hostname("zedboard");
 
 	return 0;
-- 
2.47.1




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

* [PATCH 4/9] ARM: zynq: zed: add environment
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
  2024-12-13 21:00 ` [PATCH 2/9] ARM: zynq: zed: define SDHCI bus-width Lucas Stach
  2024-12-13 21:00 ` [PATCH 3/9] ARM: zynq: zed: guard board initcall Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 5/9] ARM: zynq: zed: add Barebox update handler Lucas Stach
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

This adds support for a persistent environment on the first
FAT partition on the SD card, next to the barebox binary.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/dts/zynq-zed.dts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/dts/zynq-zed.dts b/arch/arm/dts/zynq-zed.dts
index 25b4d6df2937..2a166189d683 100644
--- a/arch/arm/dts/zynq-zed.dts
+++ b/arch/arm/dts/zynq-zed.dts
@@ -4,6 +4,12 @@
 / {
 	chosen {
 		stdout-path = &uart1;
+
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &sdhci0, "partname:0";
+			file-path = "barebox.env";
+		};
 	};
 };
 
-- 
2.47.1




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

* [PATCH 5/9] ARM: zynq: zed: add Barebox update handler
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
                   ` (2 preceding siblings ...)
  2024-12-13 21:00 ` [PATCH 4/9] ARM: zynq: zed: add environment Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 6/9] ARM: zynq: enable some useful things in defconfig Lucas Stach
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

Add a BBU handler for easy updating.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/boards/avnet-zedboard/board.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boards/avnet-zedboard/board.c b/arch/arm/boards/avnet-zedboard/board.c
index faa0bacf0ce1..b19b26bfb307 100644
--- a/arch/arm/boards/avnet-zedboard/board.c
+++ b/arch/arm/boards/avnet-zedboard/board.c
@@ -2,6 +2,7 @@
 // SPDX-FileCopyrightText: 2013 Steffen Trumtrar <s.trumtrar@pengutronix.de>
 
 #include <asm/armlinux.h>
+#include <bbu.h>
 #include <common.h>
 #include <environment.h>
 #include <asm/mach-types.h>
@@ -17,6 +18,9 @@ static int zedboard_console_init(void)
 
 	barebox_set_hostname("zedboard");
 
+	bbu_register_std_file_update("SD", BBU_HANDLER_FLAG_DEFAULT,
+				     "/boot/BOOT.bin", filetype_zynq_image);
+
 	return 0;
 }
 console_initcall(zedboard_console_init);
-- 
2.47.1




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

* [PATCH 6/9] ARM: zynq: enable some useful things in defconfig
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
                   ` (3 preceding siblings ...)
  2024-12-13 21:00 ` [PATCH 5/9] ARM: zynq: zed: add Barebox update handler Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 7/9] ARM: zynq: zed: switch to entry function with stack Lucas Stach
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

The default bootsource for the Zedboard is the SD card.
Enable Arasan SDHCI, FAT support, Barebox update and
environment in FS support to be able to update the
Barebox image and store the environment on the card.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/configs/zynq_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/configs/zynq_defconfig b/arch/arm/configs/zynq_defconfig
index 226942e6b40b..1a1378d3e079 100644
--- a/arch/arm/configs/zynq_defconfig
+++ b/arch/arm/configs/zynq_defconfig
@@ -37,13 +37,20 @@ CONFIG_CMD_MENU_MANAGEMENT=y
 CONFIG_CMD_READLINE=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_CLK=y
+CONFIG_CMD_BAREBOX_UPDATE=y
 CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIME=y
 CONFIG_NET=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
 CONFIG_DRIVER_SERIAL_CADENCE=y
 CONFIG_DRIVER_NET_MACB=y
 # CONFIG_SPI is not set
+CONFIG_MCI=y
+CONFIG_MCI_ARASAN=y
 CONFIG_GPIO_ZYNQ=y
 # CONFIG_PINCTRL is not set
 CONFIG_FS_TFTP=y
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_WRITE=y
 CONFIG_DIGEST=y
-- 
2.47.1




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

* [PATCH 7/9] ARM: zynq: zed: switch to entry function with stack
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
                   ` (4 preceding siblings ...)
  2024-12-13 21:00 ` [PATCH 6/9] ARM: zynq: enable some useful things in defconfig Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 8/9] ARM: zynq: call common arm lowlevel init from zynq lowlevel init Lucas Stach
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

Use the upper non-contiguous OCM region vacated by the
BootROM as the entry stack.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/boards/avnet-zedboard/lowlevel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/avnet-zedboard/lowlevel.c b/arch/arm/boards/avnet-zedboard/lowlevel.c
index 6e5a17d7eff5..c681764bd009 100644
--- a/arch/arm/boards/avnet-zedboard/lowlevel.c
+++ b/arch/arm/boards/avnet-zedboard/lowlevel.c
@@ -286,7 +286,7 @@ static void avnet_zedboard_pbl_console_init(void)
 	pr_debug("\nAvnet ZedBoard PBL\n");
 }
 
-ENTRY_FUNCTION(start_avnet_zedboard, r0, r1, r2)
+ENTRY_FUNCTION_WITHSTACK(start_avnet_zedboard, 0xfffff000, r0, r1, r2)
 {
 
 	void *fdt = __dtb_z_zynq_zed_start + get_runtime_offset();
-- 
2.47.1




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

* [PATCH 8/9] ARM: zynq: call common arm lowlevel init from zynq lowlevel init
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
                   ` (5 preceding siblings ...)
  2024-12-13 21:00 ` [PATCH 7/9] ARM: zynq: zed: switch to entry function with stack Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-13 21:00 ` [PATCH 9/9] ARM: zynq: zed: always relocate in PBL Lucas Stach
  2024-12-16  7:24 ` [PATCH 1/9] ARM: zynq: add MMC aliases Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

This had previously been reverted as it may cause some stack
usage. Now that we have a stack on entry, it should be safe to
so.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/boards/avnet-zedboard/lowlevel.c | 1 -
 arch/arm/mach-zynq/cpu_init.c             | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/avnet-zedboard/lowlevel.c b/arch/arm/boards/avnet-zedboard/lowlevel.c
index c681764bd009..1ecddf24085f 100644
--- a/arch/arm/boards/avnet-zedboard/lowlevel.c
+++ b/arch/arm/boards/avnet-zedboard/lowlevel.c
@@ -301,7 +301,6 @@ ENTRY_FUNCTION_WITHSTACK(start_avnet_zedboard, 0xfffff000, r0, r1, r2)
 	writel((1<<7), 0xe000a208 );    // Output enable
 	writel((1<<7), 0xe000a040 );    // DATA Register
 
-	arm_cpu_lowlevel_init();
 	zynq_cpu_lowlevel_init();
 
 	avnet_zedboard_ps7_init();
diff --git a/arch/arm/mach-zynq/cpu_init.c b/arch/arm/mach-zynq/cpu_init.c
index 7194c7e21627..cc7b8d1142a9 100644
--- a/arch/arm/mach-zynq/cpu_init.c
+++ b/arch/arm/mach-zynq/cpu_init.c
@@ -7,6 +7,8 @@
 
 void zynq_cpu_lowlevel_init(void)
 {
+	arm_cpu_lowlevel_init();
+
 	enable_arm_errata_761320_war();
 	enable_arm_errata_794072_war();
 	enable_arm_errata_845369_war();
-- 
2.47.1




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

* [PATCH 9/9] ARM: zynq: zed: always relocate in PBL
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
                   ` (6 preceding siblings ...)
  2024-12-13 21:00 ` [PATCH 8/9] ARM: zynq: call common arm lowlevel init from zynq lowlevel init Lucas Stach
@ 2024-12-13 21:00 ` Lucas Stach
  2024-12-16  7:24 ` [PATCH 1/9] ARM: zynq: add MMC aliases Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2024-12-13 21:00 UTC (permalink / raw)
  To: barebox

The PBL console is currently broken, as the setup relocates the
running code, invalidating the previously computed FDT address.
Relocate always to avoid those differences in behavior.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/boards/avnet-zedboard/lowlevel.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boards/avnet-zedboard/lowlevel.c b/arch/arm/boards/avnet-zedboard/lowlevel.c
index 1ecddf24085f..026a03d04be8 100644
--- a/arch/arm/boards/avnet-zedboard/lowlevel.c
+++ b/arch/arm/boards/avnet-zedboard/lowlevel.c
@@ -276,10 +276,6 @@ static void avnet_zedboard_ps7_init(void)
 
 static void avnet_zedboard_pbl_console_init(void)
 {
-	relocate_to_current_adr();
-	setup_c();
-	barrier();
-
 	cadence_uart_init((void *)ZYNQ_UART1_BASE_ADDR);
 	pbl_set_putc(cadence_uart_putc, (void *)ZYNQ_UART1_BASE_ADDR);
 
@@ -288,9 +284,6 @@ static void avnet_zedboard_pbl_console_init(void)
 
 ENTRY_FUNCTION_WITHSTACK(start_avnet_zedboard, 0xfffff000, r0, r1, r2)
 {
-
-	void *fdt = __dtb_z_zynq_zed_start + get_runtime_offset();
-
 	/* MIO_07 in GPIO Mode 3.3V VIO, can be uncomented because it is the default value */
 	writel(0x0000DF0D, ZYNQ_SLCR_UNLOCK);
 	writel(0x00000600, 0xF800071C );
@@ -305,8 +298,12 @@ ENTRY_FUNCTION_WITHSTACK(start_avnet_zedboard, 0xfffff000, r0, r1, r2)
 
 	avnet_zedboard_ps7_init();
 
+	relocate_to_current_adr();
+	setup_c();
+	barrier();
+
 	if (IS_ENABLED(CONFIG_PBL_CONSOLE))
 		avnet_zedboard_pbl_console_init();
 
-	barebox_arm_entry(0, SZ_512M, fdt);
+	barebox_arm_entry(0, SZ_512M, __dtb_z_zynq_zed_start);
 }
-- 
2.47.1




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

* Re: [PATCH 1/9] ARM: zynq: add MMC aliases
  2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
                   ` (7 preceding siblings ...)
  2024-12-13 21:00 ` [PATCH 9/9] ARM: zynq: zed: always relocate in PBL Lucas Stach
@ 2024-12-16  7:24 ` Sascha Hauer
  8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2024-12-16  7:24 UTC (permalink / raw)
  To: barebox, Lucas Stach


On Fri, 13 Dec 2024 22:00:07 +0100, Lucas Stach wrote:
> The upstream DT doesn't include those, yet. Make sure
> MMC controllers end up with a deterministic numbering.
> 
> 

Applied, thanks!

[1/9] ARM: zynq: add MMC aliases
      https://git.pengutronix.de/cgit/barebox/commit/?id=2382be74da92 (link may not be stable)
[2/9] ARM: zynq: zed: define SDHCI bus-width
      https://git.pengutronix.de/cgit/barebox/commit/?id=b3e5d422c70a (link may not be stable)
[3/9] ARM: zynq: zed: guard board initcall
      https://git.pengutronix.de/cgit/barebox/commit/?id=d07d89b423fd (link may not be stable)
[4/9] ARM: zynq: zed: add environment
      https://git.pengutronix.de/cgit/barebox/commit/?id=745d8db539f8 (link may not be stable)
[5/9] ARM: zynq: zed: add Barebox update handler
      https://git.pengutronix.de/cgit/barebox/commit/?id=3a33d49dafe2 (link may not be stable)
[6/9] ARM: zynq: enable some useful things in defconfig
      https://git.pengutronix.de/cgit/barebox/commit/?id=8651c3304b9a (link may not be stable)
[7/9] ARM: zynq: zed: switch to entry function with stack
      https://git.pengutronix.de/cgit/barebox/commit/?id=5d9d50da97de (link may not be stable)
[8/9] ARM: zynq: call common arm lowlevel init from zynq lowlevel init
      https://git.pengutronix.de/cgit/barebox/commit/?id=33582abd435c (link may not be stable)
[9/9] ARM: zynq: zed: always relocate in PBL
      https://git.pengutronix.de/cgit/barebox/commit/?id=4cd14313773e (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-12-16  7:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 21:00 [PATCH 1/9] ARM: zynq: add MMC aliases Lucas Stach
2024-12-13 21:00 ` [PATCH 2/9] ARM: zynq: zed: define SDHCI bus-width Lucas Stach
2024-12-13 21:00 ` [PATCH 3/9] ARM: zynq: zed: guard board initcall Lucas Stach
2024-12-13 21:00 ` [PATCH 4/9] ARM: zynq: zed: add environment Lucas Stach
2024-12-13 21:00 ` [PATCH 5/9] ARM: zynq: zed: add Barebox update handler Lucas Stach
2024-12-13 21:00 ` [PATCH 6/9] ARM: zynq: enable some useful things in defconfig Lucas Stach
2024-12-13 21:00 ` [PATCH 7/9] ARM: zynq: zed: switch to entry function with stack Lucas Stach
2024-12-13 21:00 ` [PATCH 8/9] ARM: zynq: call common arm lowlevel init from zynq lowlevel init Lucas Stach
2024-12-13 21:00 ` [PATCH 9/9] ARM: zynq: zed: always relocate in PBL Lucas Stach
2024-12-16  7:24 ` [PATCH 1/9] ARM: zynq: add MMC aliases Sascha Hauer

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