mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi
@ 2023-12-14 15:18 Ahmad Fatoum
  2023-12-14 15:18 ` [PATCH 2/3] ARM: dts: rpi4: add DTs for CM4 and Rpi 400 Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-12-14 15:18 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Since commit 4ead6e90a9cb ("mci: handle SDIO cards gracefully"), barebox
no longer chokes on SDIO cards, but skips them gracefully. We thus don't
need to force disable them in the barebox DT.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/dts/bcm2711-rpi-4.dts | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/dts/bcm2711-rpi-4.dts b/arch/arm/dts/bcm2711-rpi-4.dts
index 3c0caa73f8f1..de748e2fc65b 100644
--- a/arch/arm/dts/bcm2711-rpi-4.dts
+++ b/arch/arm/dts/bcm2711-rpi-4.dts
@@ -4,11 +4,6 @@
 	reg = <0x0 0x0 0x0>;
 };
 
-&sdhci {
-	/* no use for SDIO WiFi in barebox */
-	status = "disabled";
-};
-
 &uart1 {
 	/* VPU core clock is reported at 200MHz, but needs to be 500Mhz
 	 * for ns16550 driver to set correct baudrate. Until that's
-- 
2.39.2




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

* [PATCH 2/3] ARM: dts: rpi4: add DTs for CM4 and Rpi 400
  2023-12-14 15:18 [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Ahmad Fatoum
@ 2023-12-14 15:18 ` Ahmad Fatoum
  2023-12-14 15:18 ` [PATCH 3/3] ARM: rpi: look for env in mmc0 as well Ahmad Fatoum
  2023-12-15 11:06 ` [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-12-14 15:18 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

CM4 is quite different from the Rpi4, so we should really not use the
same DT for both. Rpi 400 is nearly the same, but has a different MDIO
clock, so let's ship a different DT for that as well. They are
compressed anyway and the FAT partition should be big enough to handle a
few extra tens of kilobytes.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/lowlevel.c |  8 ++++++--
 arch/arm/dts/Makefile                   |  2 +-
 arch/arm/dts/bcm2711-rpi-4.dts          | 15 +++------------
 arch/arm/dts/bcm2711-rpi-400.dts        |  4 ++++
 arch/arm/dts/bcm2711-rpi-cm4-io.dts     |  4 ++++
 arch/arm/dts/bcm2711-rpi.dtsi           | 13 +++++++++++++
 6 files changed, 31 insertions(+), 15 deletions(-)
 create mode 100644 arch/arm/dts/bcm2711-rpi-400.dts
 create mode 100644 arch/arm/dts/bcm2711-rpi-cm4-io.dts
 create mode 100644 arch/arm/dts/bcm2711-rpi.dtsi

diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index f8078dba677c..a1e195d81151 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -71,6 +71,8 @@ extern char __dtb_z_bcm2836_rpi_2_start[];
 extern char __dtb_z_bcm2837_rpi_3_start[];
 extern char __dtb_z_bcm2837_rpi_cm3_start[];
 extern char __dtb_z_bcm2711_rpi_4_start[];
+extern char __dtb_z_bcm2711_rpi_400_start[];
+extern char __dtb_z_bcm2711_rpi_cm4_io_start[];
 
 RPI_ENTRY_FUNCTION(start_raspberry_pi1, SZ_128M, fdt)
 {
@@ -132,9 +134,11 @@ static void *rpi_get_board_fdt(int rev)
 		return DT_IF_ENABLED(__dtb_z_bcm2837_rpi_cm3_start, CONFIG_MACH_RPI_CM3);
 
 	case BCM2711_BOARD_REV_4_B:
-	case BCM2711_BOARD_REV_400:
-	case BCM2711_BOARD_REV_CM4:
 		return DT_IF_ENABLED(__dtb_z_bcm2711_rpi_4_start, CONFIG_MACH_RPI4);
+	case BCM2711_BOARD_REV_400:
+		return DT_IF_ENABLED(__dtb_z_bcm2711_rpi_400_start, CONFIG_MACH_RPI4);
+	case BCM2711_BOARD_REV_CM4:
+		return DT_IF_ENABLED(__dtb_z_bcm2711_rpi_cm4_io_start, CONFIG_MACH_RPI4);
 	}
 
 	return NULL;
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 4d837b13411c..04af3bd64687 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -123,7 +123,7 @@ lwl-$(CONFIG_MACH_RPI) += bcm2835-rpi.dtb.o
 lwl-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2.dtb.o
 lwl-$(CONFIG_MACH_RPI3) += bcm2837-rpi-3.dtb.o
 lwl-$(CONFIG_MACH_RPI_CM3) += bcm2837-rpi-cm3.dtb.o
-lwl-$(CONFIG_MACH_RPI4) += bcm2711-rpi-4.dtb.o
+lwl-$(CONFIG_MACH_RPI4) += bcm2711-rpi-4.dtb.o bcm2711-rpi-400.dtb.o bcm2711-rpi-cm4-io.dtb.o
 lwl-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
 lwl-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o imx6qp-sabresd.dtb.o
 lwl-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += imx6sx-sdb.dtb.o
diff --git a/arch/arm/dts/bcm2711-rpi-4.dts b/arch/arm/dts/bcm2711-rpi-4.dts
index de748e2fc65b..6d46dd3b839c 100644
--- a/arch/arm/dts/bcm2711-rpi-4.dts
+++ b/arch/arm/dts/bcm2711-rpi-4.dts
@@ -1,13 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+
 #include <arm64/broadcom/bcm2711-rpi-4-b.dts>
-
-&{/memory@0} {
-	reg = <0x0 0x0 0x0>;
-};
-
-&uart1 {
-	/* VPU core clock is reported at 200MHz, but needs to be 500Mhz
-	 * for ns16550 driver to set correct baudrate. Until that's
-	 * figured out, hardcode clock frequency to the expected value
-	 */
-	clock-frequency = <500000000>;
-};
+#include "bcm2711-rpi.dtsi"
diff --git a/arch/arm/dts/bcm2711-rpi-400.dts b/arch/arm/dts/bcm2711-rpi-400.dts
new file mode 100644
index 000000000000..fb9cccb2b914
--- /dev/null
+++ b/arch/arm/dts/bcm2711-rpi-400.dts
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <arm64/broadcom/bcm2711-rpi-400.dts>
+#include "bcm2711-rpi.dtsi"
diff --git a/arch/arm/dts/bcm2711-rpi-cm4-io.dts b/arch/arm/dts/bcm2711-rpi-cm4-io.dts
new file mode 100644
index 000000000000..115491e7a638
--- /dev/null
+++ b/arch/arm/dts/bcm2711-rpi-cm4-io.dts
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <arm64/broadcom/bcm2711-rpi-cm4-io.dts>
+#include "bcm2711-rpi.dtsi"
diff --git a/arch/arm/dts/bcm2711-rpi.dtsi b/arch/arm/dts/bcm2711-rpi.dtsi
new file mode 100644
index 000000000000..cb2952ccac85
--- /dev/null
+++ b/arch/arm/dts/bcm2711-rpi.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+
+&{/memory@0} {
+	reg = <0x0 0x0 0x0>;
+};
+
+&uart1 {
+	/* VPU core clock is reported at 200MHz, but needs to be 500Mhz
+	 * for ns16550 driver to set correct baudrate. Until that's
+	 * figured out, hardcode clock frequency to the expected value
+	 */
+	clock-frequency = <500000000>;
+};
-- 
2.39.2




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

* [PATCH 3/3] ARM: rpi: look for env in mmc0 as well
  2023-12-14 15:18 [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Ahmad Fatoum
  2023-12-14 15:18 ` [PATCH 2/3] ARM: dts: rpi4: add DTs for CM4 and Rpi 400 Ahmad Fatoum
@ 2023-12-14 15:18 ` Ahmad Fatoum
  2023-12-15 11:06 ` [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-12-14 15:18 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Raspberry Pi Compute Module 4S device tree has a DT alias for the eMMC,
which makes it mmc0. Use that as a fallback, so environment and /boot
mount is correct there as well.

There is no upstream device tree for this S-variant yet, but it's already
bootable when barebox is passed the device tree by the VideoCore.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index f3a28e87c6f0..abee5ffcdbee 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -188,14 +188,20 @@ mem_initcall(rpi_mem_init);
 static int rpi_env_init(void)
 {
 	struct stat s;
-	const char *diskdev = "/dev/disk0.0";
+	const char *diskdev;
 	int ret;
 
 	device_detect_by_name("mci0");
 
+	diskdev = "/dev/disk0.0";
 	ret = stat(diskdev, &s);
 	if (ret) {
-		printf("no %s. using default env\n", diskdev);
+		device_detect_by_name("mmc0");
+		diskdev = "/dev/mmc0.0";
+		ret = stat(diskdev, &s);
+	}
+	if (ret) {
+		printf("no /dev/disk0.0 or /dev/mmc0.0. using default env\n");
 		return 0;
 	}
 
-- 
2.39.2




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

* Re: [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi
  2023-12-14 15:18 [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Ahmad Fatoum
  2023-12-14 15:18 ` [PATCH 2/3] ARM: dts: rpi4: add DTs for CM4 and Rpi 400 Ahmad Fatoum
  2023-12-14 15:18 ` [PATCH 3/3] ARM: rpi: look for env in mmc0 as well Ahmad Fatoum
@ 2023-12-15 11:06 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-12-15 11:06 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Dec 14, 2023 at 04:18:03PM +0100, Ahmad Fatoum wrote:
> Since commit 4ead6e90a9cb ("mci: handle SDIO cards gracefully"), barebox
> no longer chokes on SDIO cards, but skips them gracefully. We thus don't
> need to force disable them in the barebox DT.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/dts/bcm2711-rpi-4.dts | 5 -----
>  1 file changed, 5 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/dts/bcm2711-rpi-4.dts b/arch/arm/dts/bcm2711-rpi-4.dts
> index 3c0caa73f8f1..de748e2fc65b 100644
> --- a/arch/arm/dts/bcm2711-rpi-4.dts
> +++ b/arch/arm/dts/bcm2711-rpi-4.dts
> @@ -4,11 +4,6 @@
>  	reg = <0x0 0x0 0x0>;
>  };
>  
> -&sdhci {
> -	/* no use for SDIO WiFi in barebox */
> -	status = "disabled";
> -};
> -
>  &uart1 {
>  	/* VPU core clock is reported at 200MHz, but needs to be 500Mhz
>  	 * for ns16550 driver to set correct baudrate. Until that's
> -- 
> 2.39.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] 4+ messages in thread

end of thread, other threads:[~2023-12-15 11:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 15:18 [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Ahmad Fatoum
2023-12-14 15:18 ` [PATCH 2/3] ARM: dts: rpi4: add DTs for CM4 and Rpi 400 Ahmad Fatoum
2023-12-14 15:18 ` [PATCH 3/3] ARM: rpi: look for env in mmc0 as well Ahmad Fatoum
2023-12-15 11:06 ` [PATCH 1/3] ARM: dts: rpi4: drop disabling of SDHCI node used for WiFi Sascha Hauer

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