Skip to contentSkip to conversation

ARM: dts: bcm2835-rpi-zero: Enable OTG mode

PATCH New Stefan Wahren 2 participants 8 messages May 21, 2017 – Jun 12, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ARM: dts: bcm2835-rpi-zero: Enable OTG mode

This patch series enable OTG mode for Raspberry Pi Zero because dwc2 driver has been fixed now.

Patch 1 adds a new dtsi file to setup OTG mode (could also be used for boards like RPi Zero W or the Compute Module). The second patch adds the USB PHY and was part of Raspberry Pi Zero support patch series before split up [1]. The enabling of OTG mode of RPi Zero is done by patch number 3. The last patch updates the BCM2835 defconfig.

[1] - http://lists.infradead.org/pipermail/linux-rpi-kernel/2016-July/004153.html

Stefan Wahren (4):
ARM: dts: bcm283x: Add dtsi for OTG mode
ARM: dts: bcm283x: Add generic USB PHY
ARM: dts: bcm2835-rpi-zero: Enable OTG mode
ARM: bcm2835_defconfig: Enable serial & ethernet USB gadget support

 arch/arm/boot/dts/bcm2835-rpi-zero.dts     |  2 +-
 arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi | 10 ++++++++++
 arch/arm/boot/dts/bcm283x.dtsi             |  6 ++++++
 arch/arm/configs/bcm2835_defconfig         |  8 ++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 ARM: dts: bcm283x: Add dtsi for OTG mode

The Raspberry Pi Zero also supports OTG mode. So provide a dtsi file to configure the USB interface accordingly. The fifo sizes are optimized for device endpoint 6 and 7 with the maximum of 768.

---
 arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi
arch/arm/boot/dts/bcm283x-rpi-usb-otg.dtsi new file +10 -0
new file mode 100644
index 0000000..e7d217c
@@ -0,0 +1,10 @@
+&usb {
+	dr_mode = "otg";
+	g-rx-fifo-size = <256>;
+	g-np-tx-fifo-size = <32>;
+	/*
+	 * According to dwc2 the sum of all device EP
+	 * fifo sizes shouldn't exceed 3776 bytes.
+	 */
+	g-tx-fifo-size = <256 256 512 512 512 768 768>;
+};
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 ARM: dts: bcm283x: Add generic USB PHY

In reply to Stefan Wahren

In order to use dwc2 in OTG or gadget mode the USB PHY should be specified. Since there is no bcm283x USB PHY driver use the generic one.

---
 arch/arm/boot/dts/bcm283x.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +6 -0
index 86a5db5..9a05cde 100644
@@ -589,6 +589,8 @@
 			#size-cells = <0>;
 			clocks = <&clk_usb>;
 			clock-names = "otg";
+			phys = <&usbphy>;
+			phy-names = "usb2-phy";
 		};
 
 		v3d: v3d at 7ec00000 {
@@ -624,4 +626,8 @@
 			clock-frequency = <480000000>;
 		};
 	};
+
+	usbphy: phy {
+		compatible = "usb-nop-xceiv";
+	};
 };
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 ARM: dts: bcm2835-rpi-zero: Enable OTG mode

In reply to Stefan Wahren

Since 635c21068cf ("usb: dwc2: gadget: Fix WARN_ON messages during FIFO init") the dwc2 driver is able to handle OTG and gadget mode for bcm2835. So enable this feature for the Raspberry Pi Zero.

---
 arch/arm/boot/dts/bcm2835-rpi-zero.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi-zero.dts +1 -1
index cc8b832..79a20d5 100644
@@ -12,7 +12,7 @@
 /dts-v1/;
 #include "bcm2835.dtsi"
 #include "bcm2835-rpi.dtsi"
-#include "bcm283x-rpi-usb-host.dtsi"
+#include "bcm283x-rpi-usb-otg.dtsi"
 
 / {
 	compatible = "raspberrypi,model-zero", "brcm,bcm2835";
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 ARM: bcm2835_defconfig: Enable serial & ethernet USB gadget support

In reply to Stefan Wahren

In order to use the serial and ethernet USB gadget support on Raspberry Zero, we also need to enable the PHY driver, kernel module and OTG support.

---
 arch/arm/configs/bcm2835_defconfig | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/configs/bcm2835_defconfig +8 -0
index 3ba8cd3..3ee9d78 100644
@@ -24,6 +24,8 @@ CONFIG_PROFILING=y
 CONFIG_OPROFILE=y
 CONFIG_JUMP_LABEL=y
 CONFIG_CC_STACKPROTECTOR_REGULAR=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
 CONFIG_ARCH_MULTI_V6=y
 CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM2835=y
@@ -86,8 +88,14 @@ CONFIG_SND=y
 CONFIG_SND_SOC=y
 CONFIG_SND_BCM2835_SOC_I2S=y
 CONFIG_USB=y
+CONFIG_USB_OTG=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_DWC2=y
+CONFIG_NOP_USB_XCEIV=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_ETH=m
+CONFIG_USB_ETH_EEM=y
+CONFIG_USB_G_SERIAL=m
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
Signature · 1 line
2.7.4
#5 lore raw

cover ARM: dts: bcm2835-rpi-zero: Enable OTG mode

In reply to Stefan Wahren
Quoted 12 lines

Stefan Wahren <[email protected]> hat am 21. Mai 2017 um 18:44 geschrieben:

This patch series enable OTG mode for Raspberry Pi Zero because dwc2 driver has been fixed now.

Patch 1 adds a new dtsi file to setup OTG mode (could also be used for boards like RPi Zero W or the Compute Module). The second patch adds the USB PHY and was part of Raspberry Pi Zero support patch series before split up [1]. The enabling of OTG mode of RPi Zero is done by patch number 3. The last patch updates the BCM2835 defconfig.

Quoted 8 lines

[1] - http://lists.infradead.org/pipermail/linux-rpi-kernel/2016-July/004153.html

Stefan Wahren (4):
ARM: dts: bcm283x: Add dtsi for OTG mode
ARM: dts: bcm283x: Add generic USB PHY
ARM: dts: bcm2835-rpi-zero: Enable OTG mode
ARM: bcm2835_defconfig: Enable serial & ethernet USB gadget support

No comments to this patch series?

Regards
Stefan

#6 lore raw

cover ARM: dts: bcm2835-rpi-zero: Enable OTG mode

Am 01.06.2017 um 10:38 schrieb Stefan Wahren:

Quoted 20 lines
Quoted 12 lines

Stefan Wahren <[email protected]> hat am 21. Mai 2017 um 18:44 geschrieben:

This patch series enable OTG mode for Raspberry Pi Zero because dwc2 driver has been fixed now.

Patch 1 adds a new dtsi file to setup OTG mode (could also be used for boards like RPi Zero W or the Compute Module). The second patch adds the USB PHY and was part of Raspberry Pi Zero support patch series before split up [1]. The enabling of OTG mode of RPi Zero is done by patch number 3. The last patch updates the BCM2835 defconfig.

Quoted 8 lines

[1] - http://lists.infradead.org/pipermail/linux-rpi-kernel/2016-July/004153.html

Stefan Wahren (4):
ARM: dts: bcm283x: Add dtsi for OTG mode
ARM: dts: bcm283x: Add generic USB PHY
ARM: dts: bcm2835-rpi-zero: Enable OTG mode
ARM: bcm2835_defconfig: Enable serial & ethernet USB gadget support

Quoted 4 lines

No comments to this patch series?

Regards
Stefan

@Eric

Should i merge them?

#7 lore raw

cover ARM: dts: bcm2835-rpi-zero: Enable OTG mode

Quoted 21 lines · Stefan Wahren

Am 01.06.2017 um 10:38 schrieb Stefan Wahren:

Quoted 20 lines
Quoted 20 lines

Stefan Wahren <[email protected]> hat am 21. Mai 2017 um 18:44 geschrieben:

This patch series enable OTG mode for Raspberry Pi Zero because dwc2 driver has been fixed now.

Patch 1 adds a new dtsi file to setup OTG mode (could also be used for boards like RPi Zero W or the Compute Module). The second patch adds the USB PHY and was part of Raspberry Pi Zero support patch series before split up [1]. The enabling of OTG mode of RPi Zero is done by patch number 3. The last patch updates the BCM2835 defconfig.

[1] - http://lists.infradead.org/pipermail/linux-rpi-kernel/2016-July/004153.html

Stefan Wahren (4):
ARM: dts: bcm283x: Add dtsi for OTG mode
ARM: dts: bcm283x: Add generic USB PHY
ARM: dts: bcm2835-rpi-zero: Enable OTG mode
ARM: bcm2835_defconfig: Enable serial & ethernet USB gadget support

Quoted 8 lines
Quoted 4 lines

No comments to this patch series?

Regards
Stefan

@Eric

Should i merge them?

I would have rebased my local branch on them, but I've merged them now.
Waiting for -next testing to come back, then I've got PR text ready to
send out.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170612/8c103534/attachment.sig>