mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card"
@ 2020-11-28 21:39 Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 02/11] ARM: dts: rpi: drop unnecessary /chosen/stdout-path overrides Ahmad Fatoum
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

Since d6d3d0aecece ("mci: add driver for BCM283x sdhost core"), we now
have driver support for the sdhost controller in barebox as well.
We can thus drop the device tree override and use the same MCI the
kernel uses. This was tested on a Raspberry Pi zero W, which has
the same bcm2835 SoC as the Raspberry Pi 1.

This reverts commit abc0447440d68af720127fcca3c17f04ee144fcc.

Cc: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/dts/bcm2835-rpi.dts | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/dts/bcm2835-rpi.dts b/arch/arm/dts/bcm2835-rpi.dts
index 4f227508010b..cc5a8a927112 100644
--- a/arch/arm/dts/bcm2835-rpi.dts
+++ b/arch/arm/dts/bcm2835-rpi.dts
@@ -9,11 +9,3 @@
 &{/memory@0} {
 	reg = <0x0 0x0>;
 };
-
-&sdhci {
-	status = "okay";
-};
-
-&sdhost {
-	status = "disabled";
-};
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 02/11] ARM: dts: rpi: drop unnecessary /chosen/stdout-path overrides
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 03/11] ARM: rpi: make functions in rpi-common.c static Ahmad Fatoum
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

The upstream device trees reference the stdout-path via alias.
barebox overrides them with a path to the node, but the effect is
the same as both barebox and the kernel accept both for the property's
value.

No functional change:

	serial0	serial1	upstream stdout-path
 Rpi1	&uart0	&uart1 	serial0
 Rpi2	&uart0	&uart1 	serial0
 Rpi3	&uart0	&uart1 	serial1

Tested on a Raspberry Pi 3B.

Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/dts/bcm2835-rpi.dts   | 6 ------
 arch/arm/dts/bcm2836-rpi-2.dts | 6 ------
 arch/arm/dts/bcm2837-rpi-3.dts | 6 ------
 3 files changed, 18 deletions(-)

diff --git a/arch/arm/dts/bcm2835-rpi.dts b/arch/arm/dts/bcm2835-rpi.dts
index cc5a8a927112..121edebdb3a0 100644
--- a/arch/arm/dts/bcm2835-rpi.dts
+++ b/arch/arm/dts/bcm2835-rpi.dts
@@ -1,11 +1,5 @@
 #include <arm/bcm2835-rpi-a.dts>
 
-/ {
-	chosen {
-		stdout-path = &uart0;
-	};
-};
-
 &{/memory@0} {
 	reg = <0x0 0x0>;
 };
diff --git a/arch/arm/dts/bcm2836-rpi-2.dts b/arch/arm/dts/bcm2836-rpi-2.dts
index c9c3892d6a21..c9106515ee1f 100644
--- a/arch/arm/dts/bcm2836-rpi-2.dts
+++ b/arch/arm/dts/bcm2836-rpi-2.dts
@@ -1,11 +1,5 @@
 #include <arm/bcm2836-rpi-2-b.dts>
 
-/ {
-	chosen {
-		stdout-path = &uart0;
-	};
-};
-
 &{/memory@0} {
 	reg = <0x0 0x0>;
 };
diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
index d66beddb2281..e82d518fa551 100644
--- a/arch/arm/dts/bcm2837-rpi-3.dts
+++ b/arch/arm/dts/bcm2837-rpi-3.dts
@@ -1,11 +1,5 @@
 #include <arm64/broadcom/bcm2837-rpi-3-b.dts>
 
-/ {
-	chosen {
-		stdout-path = &uart1;
-	};
-};
-
 &{/memory@0} {
 	reg = <0x0 0x0>;
 };
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 03/11] ARM: rpi: make functions in rpi-common.c static
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 02/11] ARM: dts: rpi: drop unnecessary /chosen/stdout-path overrides Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 04/11] ARM: rpi: move rpi_model_init() to postcore Ahmad Fatoum
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

They aren't (and arguably shouldn't) be used outside, so give them all
internal linkage and drop the header.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 22 +++++++++++++++------
 arch/arm/boards/raspberry-pi/rpi.h        | 24 -----------------------
 2 files changed, 16 insertions(+), 30 deletions(-)
 delete mode 100644 arch/arm/boards/raspberry-pi/rpi.h

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index d5995fb86d7f..2535146af488 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -25,9 +25,19 @@
 #include <mach/mbox.h>
 #include <mach/platform.h>
 
-#include "rpi.h"
 #include "lowlevel.h"
 
+struct rpi_model {
+	const char *name;
+	void (*init)(void);
+};
+
+#define RPI_MODEL(_id, _name, _init)	\
+	[_id] = {				\
+		.name			= _name,\
+		.init			= _init,\
+	}
+
 struct msg_get_arm_mem {
 	struct bcm2835_mbox_hdr hdr;
 	struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
@@ -85,7 +95,7 @@ static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
 	return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
 }
 
-void rpi_set_usbethaddr(void)
+static void rpi_set_usbethaddr(void)
 {
 	BCM2835_MBOX_STACK_ALIGN(struct msg_get_mac_address, msg);
 	int ret;
@@ -103,7 +113,7 @@ void rpi_set_usbethaddr(void)
 	eth_register_ethaddr(0, msg->get_mac_address.body.resp.mac);
 }
 
-struct gpio_led rpi_leds[] = {
+static struct gpio_led rpi_leds[] = {
 	{
 		.gpio	= -EINVAL,
 		.led	= {
@@ -149,7 +159,7 @@ static void rpi_b_plus_init(void)
 }
 
 /* See comments in mbox.h for data source */
-const struct rpi_model rpi_models_old_scheme[] = {
+static const struct rpi_model rpi_models_old_scheme[] = {
 	RPI_MODEL(0, "Unknown model", NULL),
 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_2, "Model B (no P5)", rpi_b_init),
 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_3, "Model B (no P5)", rpi_b_init),
@@ -170,7 +180,7 @@ const struct rpi_model rpi_models_old_scheme[] = {
 	RPI_MODEL(BCM2835_BOARD_REV_A_PLUS_15, "Model A+", NULL),
 };
 
-const struct rpi_model rpi_models_new_scheme[] = {
+static const struct rpi_model rpi_models_new_scheme[] = {
 	RPI_MODEL(BCM2835_BOARD_REV_A, 		"Model A",	NULL ),
 	RPI_MODEL(BCM2835_BOARD_REV_B, 		"Model B", 	rpi_b_init ),
 	RPI_MODEL(BCM2835_BOARD_REV_A_PLUS, 	"Model A+", 	NULL ),
@@ -191,7 +201,7 @@ const struct rpi_model rpi_models_new_scheme[] = {
 };
 
 static int rpi_board_rev = 0;
-const struct rpi_model *model = NULL;
+static const struct rpi_model *model = NULL;
 
 static void rpi_get_board_rev(void)
 {
diff --git a/arch/arm/boards/raspberry-pi/rpi.h b/arch/arm/boards/raspberry-pi/rpi.h
deleted file mode 100644
index b2a0401bd01b..000000000000
--- a/arch/arm/boards/raspberry-pi/rpi.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __ARCH_ARM_BOARDS_RPI_H__
-#define __ARCH_ARM_BOARDS_RPI_H__
-
-#include <types.h>
-#include <led.h>
-
-#include <mach/mbox.h>
-
-#define RPI_MODEL(_id, _name, _init)	\
-	[_id] = {				\
-		.name			= _name,\
-		.init			= _init,\
-	}
-
-struct rpi_model {
-	const char *name;
-	void (*init)(void);
-};
-
-extern struct gpio_led rpi_leds[];
-
-void rpi_set_usbethaddr(void);
-
-#endif /* __ARCH_ARM_BOARDS_RPI_H__ */
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 04/11] ARM: rpi: move rpi_model_init() to postcore
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 02/11] ARM: dts: rpi: drop unnecessary /chosen/stdout-path overrides Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 03/11] ARM: rpi: make functions in rpi-common.c static Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 05/11] ARM: rpi: support raspberry pi 1 and zero mini-uart Ahmad Fatoum
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

rpi_model_init() was so far run at late initcall level, at which time
most drivers have already been probed and it's too late to modify the
built-in device tree and see the changes take effect.

To use the same barebox image for multiple boards, it would be
nice to be able to fix up the device tree a bit. Facilitate this by
moving rpi_model_init() to postcore.

This is ok to do because eth_register_ethaddr() can be called prior
to Ethernet driver probe as well. This was tested on a Raspberry Pi 3B.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 2535146af488..292bcba608d4 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -279,7 +279,6 @@ static void rpi_model_init(void)
 		return;
 
 	model->init();
-	rpi_add_led();
 }
 
 static int rpi_mem_init(void)
@@ -301,6 +300,7 @@ static int rpi_postcore_init(void)
 {
 	rpi_get_board_rev();
 	barebox_set_hostname("rpi");
+	rpi_model_init();
 
 	return 0;
 }
@@ -463,7 +463,7 @@ static int rpi_devices_init(void)
 {
 	struct regulator *reg;
 
-	rpi_model_init();
+	rpi_add_led();
 	bcm2835_register_fb();
 	armlinux_set_architecture(MACH_TYPE_BCM2708);
 	rpi_env_init();
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 05/11] ARM: rpi: support raspberry pi 1 and zero mini-uart
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 04/11] ARM: rpi: move rpi_model_init() to postcore Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 06/11] ARM: rpi: add new init function for Raspberry Pi Zero Ahmad Fatoum
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

We don't have a clock driver for the raspberry pi, so board code needs
to list which used devices have clocks that are already known to be active
on boot. The Mini UART is one such device. We already wave away the
clock on the BCM2836, do the same for the BCM2835 as well.

Cc: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/rpi-common.c     | 1 +
 arch/arm/mach-bcm283x/include/mach/platform.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 292bcba608d4..46c8ad6f52d9 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -347,6 +347,7 @@ static int rpi_console_clock_init(void)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
+	clkdev_add_physbase(clk, BCM2835_MINIUART_BASE, NULL);
 	clkdev_add_physbase(clk, BCM2836_MINIUART_BASE, NULL);
 
 	clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index d8561c1610f1..310f2463f2e5 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -32,6 +32,7 @@
 
 #define BCM2835_PL011_BASE 0x20201000
 #define BCM2836_PL011_BASE 0x3f201000
+#define BCM2835_MINIUART_BASE 0x20215040
 #define BCM2836_MINIUART_BASE 0x3f215040
 
 #endif
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 06/11] ARM: rpi: add new init function for Raspberry Pi Zero
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 05/11] ARM: rpi: support raspberry pi 1 and zero mini-uart Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 07/11] ARM: rpi: Add Raspberry Pi Zero W mini-uart support Ahmad Fatoum
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

The Raspberry Pi Zero and Zero W have no power LED and lack the USB
hub and ethernet port. The rpi_b_plus_init is thus the wrong init function
to use. Add a new init function that just configures the activity LED
and configure the new exposed USB port for OTG.

While we have a dwc2 gadget driver, it doesn't yet work for the Rpi:

	barebox@RaspberryPi Zero W:/ usbgadget -a
	udc0: registering UDC driver [g_multi]
	multi_bind: creating ACM function
	g_multi usbgadget: Multifunction Composite Gadget
	g_multi usbgadget: g_multi ready
	dwc2 20980000.usb@7e980000.of: bound driver g_multi
	WARNING: at drivers/usb/dwc2/gadget.c:1896/dwc2_gadget_pullup()!

But let's add dr_mode = otg anyway, so it can be debugged out of the box
with only config changes.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 19 +++++++++++++++++--
 arch/arm/dts/bcm2835-rpi.dts              |  4 ++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 46c8ad6f52d9..dba68d17992f 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -113,6 +113,15 @@ static void rpi_set_usbethaddr(void)
 	eth_register_ethaddr(0, msg->get_mac_address.body.resp.mac);
 }
 
+static void rpi_set_usbotg(const char *alias)
+{
+	struct device_node *usb;
+
+	usb = of_find_node_by_alias(NULL, alias);
+	if (usb)
+		of_property_write_string(usb, "dr_mode", "otg");
+}
+
 static struct gpio_led rpi_leds[] = {
 	{
 		.gpio	= -EINVAL,
@@ -158,6 +167,12 @@ static void rpi_b_plus_init(void)
 	rpi_set_usbethaddr();
 }
 
+static void rpi_0_init(void)
+{
+	rpi_leds[0].gpio = 47;
+	rpi_set_usbotg("usb0");
+}
+
 /* See comments in mbox.h for data source */
 static const struct rpi_model rpi_models_old_scheme[] = {
 	RPI_MODEL(0, "Unknown model", NULL),
@@ -190,10 +205,10 @@ static const struct rpi_model rpi_models_new_scheme[] = {
 	RPI_MODEL(BCM2835_BOARD_REV_CM1, 	"Compute Module", NULL ),
 	RPI_MODEL(0x7, "Unknown model", NULL),
 	RPI_MODEL(BCM2837_BOARD_REV_3_B, 	"Model 3B", 	rpi_b_init ),
-	RPI_MODEL(BCM2835_BOARD_REV_ZERO, 	"Zero", 	rpi_b_plus_init),
+	RPI_MODEL(BCM2835_BOARD_REV_ZERO, 	"Zero", 	rpi_0_init),
 	RPI_MODEL(BCM2837_BOARD_REV_CM3, 	"Compute Module 3", NULL ),
 	RPI_MODEL(0xb, "Unknown model", NULL),
-	RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, 	"Zero W", 	rpi_b_plus_init),
+	RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, 	"Zero W", 	rpi_0_init),
 	RPI_MODEL(BCM2837B0_BOARD_REV_3B_PLUS, 	"Model 3 B+", 	rpi_b_plus_init ),
 	RPI_MODEL(BCM2837B0_BOARD_REV_3A_PLUS, 	"Nodel 3 A+", 	rpi_b_plus_init),
 	RPI_MODEL(0xf, "Unknown model", NULL),
diff --git a/arch/arm/dts/bcm2835-rpi.dts b/arch/arm/dts/bcm2835-rpi.dts
index 121edebdb3a0..8d352a457da6 100644
--- a/arch/arm/dts/bcm2835-rpi.dts
+++ b/arch/arm/dts/bcm2835-rpi.dts
@@ -1,5 +1,9 @@
 #include <arm/bcm2835-rpi-a.dts>
 
+&{/aliases} {
+	usb0 = &usb;
+};
+
 &{/memory@0} {
 	reg = <0x0 0x0>;
 };
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 07/11] ARM: rpi: Add Raspberry Pi Zero W mini-uart support
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 06/11] ARM: rpi: add new init function for Raspberry Pi Zero Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 08/11] ARM: rpi: drop no longer needed environment Ahmad Fatoum
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

Unlike the Raspberry Pi 1 and Raspberry Pi Zero, the Raspberry Pi Zero W
has its console pins on the header connected to the mini-uart, not the
PL011. The secondary PL011 UART is connected to the bluetooth module.

Set the mini-uart as default console and disable the PL011. That way we
can use the Raspberry Pi 1 image for the Zero W as well.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 23 ++++++++++++++++++++++-
 drivers/of/base.c                         | 15 +++++++++++++++
 include/of.h                              |  1 +
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index dba68d17992f..f1d8a4e0f609 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -173,6 +173,27 @@ static void rpi_0_init(void)
 	rpi_set_usbotg("usb0");
 }
 
+static void rpi_0_w_init(void)
+{
+	struct device_node *np;
+	int ret;
+
+	rpi_0_init();
+
+	np = of_find_node_by_path("/chosen");
+	if (!np)
+		return;
+
+	if (!of_device_enable_and_register_by_alias("serial1"))
+		return;
+
+	ret = of_property_write_string(np, "stdout-path", "serial1:115200n8");
+	if (ret)
+		return;
+
+	of_device_disable_by_alias("serial0");
+}
+
 /* See comments in mbox.h for data source */
 static const struct rpi_model rpi_models_old_scheme[] = {
 	RPI_MODEL(0, "Unknown model", NULL),
@@ -208,7 +229,7 @@ static const struct rpi_model rpi_models_new_scheme[] = {
 	RPI_MODEL(BCM2835_BOARD_REV_ZERO, 	"Zero", 	rpi_0_init),
 	RPI_MODEL(BCM2837_BOARD_REV_CM3, 	"Compute Module 3", NULL ),
 	RPI_MODEL(0xb, "Unknown model", NULL),
-	RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, 	"Zero W", 	rpi_0_init),
+	RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, 	"Zero W", 	rpi_0_w_init),
 	RPI_MODEL(BCM2837B0_BOARD_REV_3B_PLUS, 	"Model 3 B+", 	rpi_b_plus_init ),
 	RPI_MODEL(BCM2837B0_BOARD_REV_3A_PLUS, 	"Nodel 3 A+", 	rpi_b_plus_init),
 	RPI_MODEL(0xf, "Unknown model", NULL),
diff --git a/drivers/of/base.c b/drivers/of/base.c
index dcb5ccd01844..4ff60aa81435 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2566,6 +2566,21 @@ int of_device_disable_path(const char *path)
 	return of_device_disable(node);
 }
 
+/**
+ * of_device_disable_path_by_alias - disable a devicenode by alias
+ * @alias - the alias of the device tree node to disable
+ */
+int of_device_disable_by_alias(const char *alias)
+{
+	struct device_node *node;
+
+	node = of_find_node_by_alias(NULL, alias);
+	if (!node)
+		return -ENODEV;
+
+	return of_device_disable(node);
+}
+
 /**
  * of_get_reproducible_name() - get a reproducible name of a node
  * @node: The node to get a name from
diff --git a/include/of.h b/include/of.h
index 60445729e81a..2104802df709 100644
--- a/include/of.h
+++ b/include/of.h
@@ -1006,6 +1006,7 @@ int of_device_enable(struct device_node *node);
 int of_device_enable_path(const char *path);
 int of_device_disable(struct device_node *node);
 int of_device_disable_path(const char *path);
+int of_device_disable_by_alias(const char *alias);
 
 phandle of_get_tree_max_phandle(struct device_node *root);
 phandle of_node_create_phandle(struct device_node *node);
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 08/11] ARM: rpi: drop no longer needed environment
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (5 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 07/11] ARM: rpi: Add Raspberry Pi Zero W mini-uart support Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 09/11] ARM: rpi: fix model description string Ahmad Fatoum
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

The barebox PL011 driver automatically arranges for the kernel to be
called with the appropriate console argument (placed in
${global.linux.bootargs.console}. There is thus no need to hard code a
TTY. Indeed we shouldn't because some Raspberry Pis don't use the PL011,
but the mini-uart, which is a ttyS.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/env/init/bootargs-base | 3 ---
 arch/arm/configs/rpi_defconfig                      | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)
 delete mode 100644 arch/arm/boards/raspberry-pi/env/init/bootargs-base

diff --git a/arch/arm/boards/raspberry-pi/env/init/bootargs-base b/arch/arm/boards/raspberry-pi/env/init/bootargs-base
deleted file mode 100644
index 416dc8a6f4fc..000000000000
--- a/arch/arm/boards/raspberry-pi/env/init/bootargs-base
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-global.linux.bootargs.base="console=ttyAMA0,115200"
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index dd5ca7585a83..f42b8819afc9 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -23,7 +23,7 @@ CONFIG_BOOTM_OFTREE=y
 CONFIG_BLSPEC=y
 CONFIG_CONSOLE_ALLOW_COLOR=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/raspberry-pi/env"
+CONFIG_DEFAULT_ENVIRONMENT_PATH=""
 CONFIG_CMD_DMESG=y
 CONFIG_LONGHELP=y
 CONFIG_CMD_IOMEM=y
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 09/11] ARM: rpi: fix model description string
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (6 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 08/11] ARM: rpi: drop no longer needed environment Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 10/11] ARM: rpi: add new rpi boot target Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3 Ahmad Fatoum
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox

s/Model/Nodel/ as well as drop the space the other ones (e.g. Model 2B)
lack.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index f1d8a4e0f609..30bfa995b3fa 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -230,8 +230,8 @@ static const struct rpi_model rpi_models_new_scheme[] = {
 	RPI_MODEL(BCM2837_BOARD_REV_CM3, 	"Compute Module 3", NULL ),
 	RPI_MODEL(0xb, "Unknown model", NULL),
 	RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, 	"Zero W", 	rpi_0_w_init),
-	RPI_MODEL(BCM2837B0_BOARD_REV_3B_PLUS, 	"Model 3 B+", 	rpi_b_plus_init ),
-	RPI_MODEL(BCM2837B0_BOARD_REV_3A_PLUS, 	"Nodel 3 A+", 	rpi_b_plus_init),
+	RPI_MODEL(BCM2837B0_BOARD_REV_3B_PLUS, 	"Model 3B+", 	rpi_b_plus_init ),
+	RPI_MODEL(BCM2837B0_BOARD_REV_3A_PLUS, 	"Model 3A+", 	rpi_b_plus_init),
 	RPI_MODEL(0xf, "Unknown model", NULL),
 	RPI_MODEL(BCM2837B0_BOARD_REV_CM3_PLUS, "Compute Module 3+", NULL),
 };
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 10/11] ARM: rpi: add new rpi boot target
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (7 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 09/11] ARM: rpi: fix model description string Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-28 21:39 ` [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3 Ahmad Fatoum
  9 siblings, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox; +Cc: Tomaz Solc

For drop-in placement of barebox into the boot chain, it's useful to
have a target to boot the kernel like the VideoCore would have booted
the kernel if barebox hadn't been started instead.

This commit is based on the information here:
https://www.tablix.org/~avian/blog/archives/2019/03/booting_raspbian_from_barebox/

Cc: Tomaz Solc <tomaz.solc@tablix.org>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/boards/raspberry-pi/Makefile             |  1 +
 .../boards/raspberry-pi/defaultenv-rpi/boot/rpi   |  5 +++++
 arch/arm/boards/raspberry-pi/rpi-common.c         | 15 +++++++++++++++
 3 files changed, 21 insertions(+)
 create mode 100755 arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi

diff --git a/arch/arm/boards/raspberry-pi/Makefile b/arch/arm/boards/raspberry-pi/Makefile
index a3e93eb73a32..ddcf015f0848 100644
--- a/arch/arm/boards/raspberry-pi/Makefile
+++ b/arch/arm/boards/raspberry-pi/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_MACH_RPI_COMMON) += rpi-common.o
 lwl-y += lowlevel.o
+bbenv-y += defaultenv-rpi
diff --git a/arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi b/arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi
new file mode 100755
index 000000000000..bf81aeb87bb0
--- /dev/null
+++ b/arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+global linux.bootargs.dyn.vc="${global.vc.bootargs}"
+global.bootm.image="/boot/${global.vc.kernel}"
+global.bootm.oftree=/vc.dtb
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 30bfa995b3fa..e326732b3aa4 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -20,6 +20,7 @@
 #include <generated/mach-types.h>
 #include <linux/sizes.h>
 #include <globalvar.h>
+#include <asm/system_info.h>
 
 #include <mach/core.h>
 #include <mach/mbox.h>
@@ -414,6 +415,8 @@ static int rpi_env_init(void)
 		return 0;
 	}
 
+	defaultenv_append_directory(defaultenv_rpi);
+
 	default_environment_path_set("/boot/barebox.env");
 
 	return 0;
@@ -450,6 +453,18 @@ static int rpi_vc_fdt_bootargs(void *fdt)
 
 	globalvar_add_simple("vc.bootargs", cmdline);
 
+	switch(cpu_architecture()) {
+	case CPU_ARCH_ARMv6:
+		globalvar_add_simple("vc.kernel", "kernel.img");
+		break;
+	case CPU_ARCH_ARMv7:
+		globalvar_add_simple("vc.kernel", "kernel7.img");
+		break;
+	case CPU_ARCH_ARMv8:
+		globalvar_add_simple("vc.kernel", "kernel7l.img");
+		break;
+	}
+
 out:
 	if (root)
 		of_delete_node(root);
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
                   ` (8 preceding siblings ...)
  2020-11-28 21:39 ` [PATCH 10/11] ARM: rpi: add new rpi boot target Ahmad Fatoum
@ 2020-11-28 21:39 ` Ahmad Fatoum
  2020-11-29 19:50   ` Roland Hieber
  2020-12-07 10:00   ` [PATCH] fixup! " Ahmad Fatoum
  9 siblings, 2 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-28 21:39 UTC (permalink / raw)
  To: barebox; +Cc: Andrew John, Roland Hieber, Robert Carnecky, Rouven Czerwinski

As described in the UART configuration[1] article in the Raspberry Pi
Foundation documentation, Raspberry Pi 3 & 4 as well as Zero W use the
mini-uart as primary (easily user-accessible) UART. At least on the
Raspberry Zero W and CM3, we need to pass uart_2ndstage=1, so the
BootROM leaves the 8250 IP in a suitable state for use by barebox.
Document this.

[1]: https://www.raspberrypi.org/documentation/configuration/uart.md

Cc: Roland Hieber <rhi@pengutronix.de>
Cc: Rouven Czerwinski <rcz@pengutronix.de>
Cc: Robert Carnecky <robert@neopsis.com>
Cc: Andrew John <andrew@mobius-embedded-systems.co.uk>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 Documentation/boards/bcm2835.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index c896871e0d82..dbdfc2633173 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -23,6 +23,13 @@ Raspberry Pi
          kernel=barebox.img
          enable_uart=1
 
+     If you want to use the mini-uart instead of the PL011, you might need to additionally set::
+
+         uart_2ndstage=1
+
+     This is useful on newer boards like the Raspberry Pi Zero W and CM3, which route the
+     more easily accessible primary UART to the mini-uart.
+
      (For more information, refer to the `documentation for config.txt`_.)
 
   5. Connect to board's UART (115200 8N1);
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-11-28 21:39 ` [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3 Ahmad Fatoum
@ 2020-11-29 19:50   ` Roland Hieber
  2020-11-29 20:20     ` Ahmad Fatoum
  2020-12-07  7:10     ` Sascha Hauer
  2020-12-07 10:00   ` [PATCH] fixup! " Ahmad Fatoum
  1 sibling, 2 replies; 17+ messages in thread
From: Roland Hieber @ 2020-11-29 19:50 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Andrew John, Robert Carnecky, Rouven Czerwinski

On Sat, Nov 28, 2020 at 10:39:34PM +0100, Ahmad Fatoum wrote:
> As described in the UART configuration[1] article in the Raspberry Pi
> Foundation documentation, Raspberry Pi 3 & 4 as well as Zero W use the
> mini-uart as primary (easily user-accessible) UART. At least on the
> Raspberry Zero W and CM3, we need to pass uart_2ndstage=1, so the
> BootROM leaves the 8250 IP in a suitable state for use by barebox.
> Document this.
> 
> [1]: https://www.raspberrypi.org/documentation/configuration/uart.md
> 
> Cc: Roland Hieber <rhi@pengutronix.de>
> Cc: Rouven Czerwinski <rcz@pengutronix.de>
> Cc: Robert Carnecky <robert@neopsis.com>
> Cc: Andrew John <andrew@mobius-embedded-systems.co.uk>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  Documentation/boards/bcm2835.rst | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
> index c896871e0d82..dbdfc2633173 100644
> --- a/Documentation/boards/bcm2835.rst
> +++ b/Documentation/boards/bcm2835.rst
> @@ -23,6 +23,13 @@ Raspberry Pi
>           kernel=barebox.img
>           enable_uart=1
>  
> +     If you want to use the mini-uart instead of the PL011, you might need to additionally set::
> +
> +         uart_2ndstage=1
> +
> +     This is useful on newer boards like the Raspberry Pi Zero W and CM3, which route the
> +     more easily accessible primary UART to the mini-uart.

This seems to be non-optional on RPi Zero W, so I would word it more
strongly.

With this series, at least barebox boots, which is better than in master
:-) However, I cannot get the stock kernel (/boot/kernel.img) to boot on
Zero W, and I cannot figure out why:

    barebox@RaspberryPi Zero W:/ cat /boot/config.txt 
    enable_uart=1
    kernel=barebox.img
    uart_2ndstage=1
    barebox@RaspberryPi Zero W:/ global bootm.image=/boot/kernel.img
    barebox@RaspberryPi Zero W:/ global bootm.oftree=/boot/bcm2708-rpi-0-w.dtb
    barebox@RaspberryPi Zero W:/ global linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw" 
    barebox@RaspberryPi Zero W:/ bootm -v

    Loading ARM Linux zImage '/boot/kernel.img'
    OS image not yet relocated
    Passing control to ARM zImage handler
    no OS load address, defaulting to 0x014e9000
    no initrd load address, defaulting to 0x01a18000
    Loading devicetree from '/boot/bcm2708-rpi-0-w.dtb'
    commandline: console=ttyS1,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw

    Starting kernel at 0x014e9000, oftree at 0x01a18000...
    Starting kernel in secure mode

and then nothing happens at least for a minute.

I tried leaving 'uart_2ndstage=1' out, leaving 'enable_uart=1' out, setting
'console=ttyS1,115200n8' on the kernel command line, and setting
'console=ttyAMA0,115200n8' (as before), but nothing helped.

The same setup works on a RPI-1B (with bootm.oftree=/boot/bcm2708-rpi-b.dtb),
so at least there's that :)

Did you do anything else for your Zero W?

 - Roland

> +
>       (For more information, refer to the `documentation for config.txt`_.)
>  
>    5. Connect to board's UART (115200 8N1);
> -- 
> 2.28.0
> 
> 

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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-11-29 19:50   ` Roland Hieber
@ 2020-11-29 20:20     ` Ahmad Fatoum
  2020-12-07  7:10     ` Sascha Hauer
  1 sibling, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-11-29 20:20 UTC (permalink / raw)
  To: Roland Hieber, Ahmad Fatoum
  Cc: barebox, Andrew John, Robert Carnecky, Rouven Czerwinski

Hello,

On 29.11.20 20:50, Roland Hieber wrote:
> On Sat, Nov 28, 2020 at 10:39:34PM +0100, Ahmad Fatoum wrote:
>> As described in the UART configuration[1] article in the Raspberry Pi
>> Foundation documentation, Raspberry Pi 3 & 4 as well as Zero W use the
>> mini-uart as primary (easily user-accessible) UART. At least on the
>> Raspberry Zero W and CM3, we need to pass uart_2ndstage=1, so the
>> BootROM leaves the 8250 IP in a suitable state for use by barebox.
>> Document this.
>>
>> [1]: https://www.raspberrypi.org/documentation/configuration/uart.md
>>
>> Cc: Roland Hieber <rhi@pengutronix.de>
>> Cc: Rouven Czerwinski <rcz@pengutronix.de>
>> Cc: Robert Carnecky <robert@neopsis.com>
>> Cc: Andrew John <andrew@mobius-embedded-systems.co.uk>
>> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
>> ---
>>  Documentation/boards/bcm2835.rst | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
>> index c896871e0d82..dbdfc2633173 100644
>> --- a/Documentation/boards/bcm2835.rst
>> +++ b/Documentation/boards/bcm2835.rst
>> @@ -23,6 +23,13 @@ Raspberry Pi
>>           kernel=barebox.img
>>           enable_uart=1
>>  
>> +     If you want to use the mini-uart instead of the PL011, you might need to additionally set::
>> +
>> +         uart_2ndstage=1
>> +
>> +     This is useful on newer boards like the Raspberry Pi Zero W and CM3, which route the
>> +     more easily accessible primary UART to the mini-uart.
> 
> This seems to be non-optional on RPi Zero W, so I would word it more
> strongly.
>
> With this series, at least barebox boots, which is better than in master
> :-) However, I cannot get the stock kernel (/boot/kernel.img) to boot on
> Zero W, and I cannot figure out why:
> 
>     barebox@RaspberryPi Zero W:/ cat /boot/config.txt 
>     enable_uart=1
>     kernel=barebox.img
>     uart_2ndstage=1
>     barebox@RaspberryPi Zero W:/ global bootm.image=/boot/kernel.img
>     barebox@RaspberryPi Zero W:/ global bootm.oftree=/boot/bcm2708-rpi-0-w.dtb
>     barebox@RaspberryPi Zero W:/ global linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw" 
>     barebox@RaspberryPi Zero W:/ bootm -v
> 
>     Loading ARM Linux zImage '/boot/kernel.img'
>     OS image not yet relocated
>     Passing control to ARM zImage handler
>     no OS load address, defaulting to 0x014e9000
>     no initrd load address, defaulting to 0x01a18000
>     Loading devicetree from '/boot/bcm2708-rpi-0-w.dtb'
>     commandline: console=ttyS1,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw
> 
>     Starting kernel at 0x014e9000, oftree at 0x01a18000...
>     Starting kernel in secure mode
> 
> and then nothing happens at least for a minute.
> 
> I tried leaving 'uart_2ndstage=1' out, leaving 'enable_uart=1' out, setting
> 'console=ttyS1,115200n8' on the kernel command line, and setting
> 'console=ttyAMA0,115200n8' (as before), but nothing helped.
> 
> The same setup works on a RPI-1B (with bootm.oftree=/boot/bcm2708-rpi-b.dtb),
> so at least there's that :)
> 
> Did you do anything else for your Zero W?

Can you try `boot rpi` instead?

> 
>  - Roland
> 
>> +
>>       (For more information, refer to the `documentation for config.txt`_.)
>>  
>>    5. Connect to board's UART (115200 8N1);
>> -- 
>> 2.28.0
>>
>>
> 

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-11-29 19:50   ` Roland Hieber
  2020-11-29 20:20     ` Ahmad Fatoum
@ 2020-12-07  7:10     ` Sascha Hauer
  2020-12-07 10:00       ` Ahmad Fatoum
  1 sibling, 1 reply; 17+ messages in thread
From: Sascha Hauer @ 2020-12-07  7:10 UTC (permalink / raw)
  To: Roland Hieber
  Cc: barebox, Ahmad Fatoum, Andrew John, Robert Carnecky, Rouven Czerwinski

On Sun, Nov 29, 2020 at 08:50:42PM +0100, Roland Hieber wrote:
> On Sat, Nov 28, 2020 at 10:39:34PM +0100, Ahmad Fatoum wrote:
> > As described in the UART configuration[1] article in the Raspberry Pi
> > Foundation documentation, Raspberry Pi 3 & 4 as well as Zero W use the
> > mini-uart as primary (easily user-accessible) UART. At least on the
> > Raspberry Zero W and CM3, we need to pass uart_2ndstage=1, so the
> > BootROM leaves the 8250 IP in a suitable state for use by barebox.
> > Document this.
> > 
> > [1]: https://www.raspberrypi.org/documentation/configuration/uart.md
> > 
> > Cc: Roland Hieber <rhi@pengutronix.de>
> > Cc: Rouven Czerwinski <rcz@pengutronix.de>
> > Cc: Robert Carnecky <robert@neopsis.com>
> > Cc: Andrew John <andrew@mobius-embedded-systems.co.uk>
> > Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> > ---
> >  Documentation/boards/bcm2835.rst | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
> > index c896871e0d82..dbdfc2633173 100644
> > --- a/Documentation/boards/bcm2835.rst
> > +++ b/Documentation/boards/bcm2835.rst
> > @@ -23,6 +23,13 @@ Raspberry Pi
> >           kernel=barebox.img
> >           enable_uart=1
> >  
> > +     If you want to use the mini-uart instead of the PL011, you might need to additionally set::
> > +
> > +         uart_2ndstage=1
> > +
> > +     This is useful on newer boards like the Raspberry Pi Zero W and CM3, which route the
> > +     more easily accessible primary UART to the mini-uart.
> 
> This seems to be non-optional on RPi Zero W, so I would word it more
> strongly.
> 
> With this series, at least barebox boots, which is better than in master
> :-) However, I cannot get the stock kernel (/boot/kernel.img) to boot on
> Zero W, and I cannot figure out why:

Should I wait for this being fixed before I merge this series?

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH] fixup! doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-11-28 21:39 ` [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3 Ahmad Fatoum
  2020-11-29 19:50   ` Roland Hieber
@ 2020-12-07 10:00   ` Ahmad Fatoum
  1 sibling, 0 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2020-12-07 10:00 UTC (permalink / raw)
  To: barebox

---
 Documentation/boards/bcm2835.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index dbdfc2633173..8af6a09c13db 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -23,12 +23,12 @@ Raspberry Pi
          kernel=barebox.img
          enable_uart=1
 
-     If you want to use the mini-uart instead of the PL011, you might need to additionally set::
+     If you want to use the mini-uart instead of the PL011, you may need to additionally set::
 
          uart_2ndstage=1
 
-     This is useful on newer boards like the Raspberry Pi Zero W and CM3, which route the
-     more easily accessible primary UART to the mini-uart.
+     This is required on boards, like the Raspberry Pi Zero W, that use the mini-uart as the
+     primary UART. It is needed on boards like the CM3 as well if the mini-uart is to be used.
 
      (For more information, refer to the `documentation for config.txt`_.)
 
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-12-07  7:10     ` Sascha Hauer
@ 2020-12-07 10:00       ` Ahmad Fatoum
  2020-12-07 10:29         ` Sascha Hauer
  0 siblings, 1 reply; 17+ messages in thread
From: Ahmad Fatoum @ 2020-12-07 10:00 UTC (permalink / raw)
  To: Sascha Hauer, Roland Hieber
  Cc: barebox, Ahmad Fatoum, Andrew John, Robert Carnecky, Rouven Czerwinski

On Mon, 2020-12-07 at 08:10 +0100, Sascha Hauer wrote:
> On Sun, Nov 29, 2020 at 08:50:42PM +0100, Roland Hieber wrote:
> > On Sat, Nov 28, 2020 at 10:39:34PM +0100, Ahmad Fatoum wrote:
> > > As described in the UART configuration[1] article in the
> > > Raspberry Pi
> > > Foundation documentation, Raspberry Pi 3 & 4 as well as Zero W
> > > use the
> > > mini-uart as primary (easily user-accessible) UART. At least on
> > > the
> > > Raspberry Zero W and CM3, we need to pass uart_2ndstage=1, so the
> > > BootROM leaves the 8250 IP in a suitable state for use by
> > > barebox.
> > > Document this.
> > > 
> > > [1]: 
> > > https://www.raspberrypi.org/documentation/configuration/uart.md
> > > 
> > > Cc: Roland Hieber <rhi@pengutronix.de>
> > > Cc: Rouven Czerwinski <rcz@pengutronix.de>
> > > Cc: Robert Carnecky <robert@neopsis.com>
> > > Cc: Andrew John <andrew@mobius-embedded-systems.co.uk>
> > > Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> > > ---
> > >  Documentation/boards/bcm2835.rst | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/Documentation/boards/bcm2835.rst
> > > b/Documentation/boards/bcm2835.rst
> > > index c896871e0d82..dbdfc2633173 100644
> > > --- a/Documentation/boards/bcm2835.rst
> > > +++ b/Documentation/boards/bcm2835.rst
> > > @@ -23,6 +23,13 @@ Raspberry Pi
> > >           kernel=barebox.img
> > >           enable_uart=1
> > >  
> > > +     If you want to use the mini-uart instead of the PL011, you
> > > might need to additionally set::
> > > +
> > > +         uart_2ndstage=1
> > > +
> > > +     This is useful on newer boards like the Raspberry Pi Zero W
> > > and CM3, which route the
> > > +     more easily accessible primary UART to the mini-uart.
> > 
> > This seems to be non-optional on RPi Zero W, so I would word it
> > more
> > strongly.
> > 
> > With this series, at least barebox boots, which is better than in
> > master
> > :-) However, I cannot get the stock kernel (/boot/kernel.img) to
> > boot on
> > Zero W, and I cannot figure out why:
> 
> Should I wait for this being fixed before I merge this series?

I sent a fixup. I think it's ok to merge that way.

> 
> Sascha
> 


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3
  2020-12-07 10:00       ` Ahmad Fatoum
@ 2020-12-07 10:29         ` Sascha Hauer
  0 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2020-12-07 10:29 UTC (permalink / raw)
  To: Ahmad Fatoum
  Cc: barebox, Andrew John, Robert Carnecky, Ahmad Fatoum,
	Roland Hieber, Rouven Czerwinski

On Mon, Dec 07, 2020 at 11:00:49AM +0100, Ahmad Fatoum wrote:
> On Mon, 2020-12-07 at 08:10 +0100, Sascha Hauer wrote:
> > On Sun, Nov 29, 2020 at 08:50:42PM +0100, Roland Hieber wrote:
> > > On Sat, Nov 28, 2020 at 10:39:34PM +0100, Ahmad Fatoum wrote:
> > > > As described in the UART configuration[1] article in the
> > > > Raspberry Pi
> > > > Foundation documentation, Raspberry Pi 3 & 4 as well as Zero W
> > > > use the
> > > > mini-uart as primary (easily user-accessible) UART. At least on
> > > > the
> > > > Raspberry Zero W and CM3, we need to pass uart_2ndstage=1, so the
> > > > BootROM leaves the 8250 IP in a suitable state for use by
> > > > barebox.
> > > > Document this.
> > > > 
> > > > [1]: 
> > > > https://www.raspberrypi.org/documentation/configuration/uart.md
> > > > 
> > > > Cc: Roland Hieber <rhi@pengutronix.de>
> > > > Cc: Rouven Czerwinski <rcz@pengutronix.de>
> > > > Cc: Robert Carnecky <robert@neopsis.com>
> > > > Cc: Andrew John <andrew@mobius-embedded-systems.co.uk>
> > > > Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> > > > ---
> > > >  Documentation/boards/bcm2835.rst | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > > 
> > > > diff --git a/Documentation/boards/bcm2835.rst
> > > > b/Documentation/boards/bcm2835.rst
> > > > index c896871e0d82..dbdfc2633173 100644
> > > > --- a/Documentation/boards/bcm2835.rst
> > > > +++ b/Documentation/boards/bcm2835.rst
> > > > @@ -23,6 +23,13 @@ Raspberry Pi
> > > >           kernel=barebox.img
> > > >           enable_uart=1
> > > >  
> > > > +     If you want to use the mini-uart instead of the PL011, you
> > > > might need to additionally set::
> > > > +
> > > > +         uart_2ndstage=1
> > > > +
> > > > +     This is useful on newer boards like the Raspberry Pi Zero W
> > > > and CM3, which route the
> > > > +     more easily accessible primary UART to the mini-uart.
> > > 
> > > This seems to be non-optional on RPi Zero W, so I would word it
> > > more
> > > strongly.
> > > 
> > > With this series, at least barebox boots, which is better than in
> > > master
> > > :-) However, I cannot get the stock kernel (/boot/kernel.img) to
> > > boot on
> > > Zero W, and I cannot figure out why:
> > 
> > Should I wait for this being fixed before I merge this series?
> 
> I sent a fixup. I think it's ok to merge that way.

Ok, did that.

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-12-07 10:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 02/11] ARM: dts: rpi: drop unnecessary /chosen/stdout-path overrides Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 03/11] ARM: rpi: make functions in rpi-common.c static Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 04/11] ARM: rpi: move rpi_model_init() to postcore Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 05/11] ARM: rpi: support raspberry pi 1 and zero mini-uart Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 06/11] ARM: rpi: add new init function for Raspberry Pi Zero Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 07/11] ARM: rpi: Add Raspberry Pi Zero W mini-uart support Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 08/11] ARM: rpi: drop no longer needed environment Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 09/11] ARM: rpi: fix model description string Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 10/11] ARM: rpi: add new rpi boot target Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3 Ahmad Fatoum
2020-11-29 19:50   ` Roland Hieber
2020-11-29 20:20     ` Ahmad Fatoum
2020-12-07  7:10     ` Sascha Hauer
2020-12-07 10:00       ` Ahmad Fatoum
2020-12-07 10:29         ` Sascha Hauer
2020-12-07 10:00   ` [PATCH] fixup! " Ahmad Fatoum

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