From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 06/11] ARM: rpi: add new init function for Raspberry Pi Zero
Date: Sat, 28 Nov 2020 22:39:29 +0100 [thread overview]
Message-ID: <20201128213934.681065-6-ahmad@a3f.at> (raw)
In-Reply-To: <20201128213934.681065-1-ahmad@a3f.at>
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
next prev parent reply other threads:[~2020-11-28 21:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Ahmad Fatoum [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201128213934.681065-6-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox