Skip to contentSkip to conversation

arm64: dts: exynos: Enable USB for E850-96 board

PATCH Applied Sam Protsenko 2 participants 7 messages Aug 25, 2023 – Sep 11, 2023

Subsystems (3)
lore
Share & tools
lore

Sam Protsenko

author maintainer
#0 lore raw

v2 cover arm64: dts: exynos: Enable USB for E850-96 board

This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.

Changes in v2:
- Removed already applied patches from the patch series
- Rebased on top of latest linux-next
- Put ranges after compatible in usbdrd node (patch #1)

Sam Protsenko (8):
dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
usb: dwc3: exynos: Add support for Exynos850 variant
phy: exynos5-usbdrd: Make it possible to pass custom phy ops
phy: exynos5-usbdrd: Add 26MHz ref clk support
phy: exynos5-usbdrd: Add Exynos850 support
arm64: dts: exynos: Enable USB in Exynos850
arm64: dts: exynos: Enable USB support on E850-96 board

 .../bindings/phy/samsung,usb3-drd-phy.yaml    |   1 +
 .../bindings/usb/samsung,exynos-dwc3.yaml     |  16 ++
 .../boot/dts/exynos/exynos850-e850-96.dts     |  58 ++++++
 arch/arm64/boot/dts/exynos/exynos850.dtsi     |  30 +++
 drivers/phy/samsung/phy-exynos5-usbdrd.c      | 182 +++++++++++++++++-
 drivers/usb/dwc3/dwc3-exynos.c                |   9 +
 6 files changed, 294 insertions(+), 2 deletions(-)
Signature · 7 lines
2.39.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#1 lore raw

PATCH v2 1/2 arm64: dts: exynos: Enable USB in Exynos850

Add USB controller and USB PHY controller nodes for Exynos850 SoC.

The USB controller has next features:
- Dual Role Device (DRD) controller
- DWC3 compatible
- Supports USB 2.0 host and USB 2.0 device interfaces
- Supports full-speed (12 Mbps) and high-speed (480 Mbps) modes with USB device 2.0 interface
- Supports on-chip USB PHY transceiver
- Supports up to 16 bi-directional endpoints (that includes control endpoint 0)
- Complies with xHCI 1.00 specification

Only USB 2.0 is supported in Exynos850, so only UTMI+ PHY interface is specified in "phys" property (index 0) and PIPE3 is omitted (index 1).

---
Changes in v2:
- Put ranges after compatible in usbdrd node

 arch/arm64/boot/dts/exynos/exynos850.dtsi | 30 +++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/exynos/exynos850.dtsi +30 -0
index aa077008b3be..53104e65b9c6 100644
@@ -570,6 +570,36 @@ sysreg_cmgp: syscon@11c20000 {
 			clocks = <&cmu_cmgp CLK_GOUT_SYSREG_CMGP_PCLK>;
 		};
 
+		usbdrd: usb@13600000 {
+			compatible = "samsung,exynos850-dwusb3";
+			ranges = <0x0 0x13600000 0x10000>;
+			clocks = <&cmu_hsi CLK_GOUT_USB_BUS_EARLY_CLK>,
+				 <&cmu_hsi CLK_GOUT_USB_REF_CLK>;
+			clock-names = "bus_early", "ref";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			status = "disabled";
+
+			usbdrd_dwc3: usb@0 {
+				compatible = "snps,dwc3";
+				reg = <0x0 0x10000>;
+				interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
+				phys = <&usbdrd_phy 0>;
+				phy-names = "usb2-phy";
+			};
+		};
+
+		usbdrd_phy: phy@135d0000 {
+			compatible = "samsung,exynos850-usbdrd-phy";
+			reg = <0x135d0000 0x100>;
+			clocks = <&cmu_hsi CLK_GOUT_USB_PHY_ACLK>,
+				 <&cmu_hsi CLK_GOUT_USB_PHY_REF_CLK>;
+			clock-names = "phy", "ref";
+			samsung,pmu-syscon = <&pmu_system_controller>;
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+
 		usi_uart: usi@138200c0 {
 			compatible = "samsung,exynos850-usi";
 			reg = <0x138200c0 0x20>;
Signature · 7 lines
2.39.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#2 lore raw

PATCH v2 2/2 arm64: dts: exynos: Enable USB support on E850-96 board

In reply to Sam Protsenko

The E850-96 board has a micro-USB socket and two USB 2.0 host sockets. The USB role (host or peripheral) is selected automatically depending on micro-USB cable attachment state:
- micro-USB cable is attached: USB device role
- micro-USB cable is detached: USB host role

USB can't act simultaneously as a device and a host, because Exynos850 SoC has only one USB controller and there are no external USB controllers on the E850-96 board. So the USB switch chip (specifically TS3USB221A) connects SoC USB lines either to micro-USB connector or to USB hub chip (LAN9514), w.r.t. micro-USB cable attachment state.

When USB works in the host role, Ethernet capability becomes available too, as the LAN9514 chip (providing USB hub) also enables Ethernet PHY and Ethernet MAC.

Dynamic role switching is done in gpio-usb-b-connector, using current micro-USB VBUS line level as a trigger:
- VBUS=high: SoC USB lines are wired to micro-USB socket
- VBUS=low: SoC USB lines are wired to USB hub chip

In order to make USB host functional when the board was booted with micro-USB cable disconnected, role-switch-default-mode = "host" is used.

One can use E850-96 board schematics [1] to figure out how exactly all related USB hardware connections and lines reflect into corresponding device tree definitions.

As PMIC regulators are not implemented yet, we rely on USB LDOs being already enabled in the bootloader. A dummy regulator is provided to "usbdrd" vdd nodes for now.

[1] https://www.96boards.org/documentation/consumer/e850-96b/hardware-docs/

---
Changes in v2:
- none

 .../boot/dts/exynos/exynos850-e850-96.dts     | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/exynos/exynos850-e850-96.dts +58 -0
index 6ed38912507f..8d733361ef82 100644
@@ -29,6 +29,22 @@ chosen {
 		stdout-path = &serial_0;
 	};
 
+	connector {
+		compatible = "gpio-usb-b-connector", "usb-b-connector";
+		label = "micro-USB";
+		type = "micro";
+		vbus-supply = <&reg_usb_host_vbus>;
+		id-gpios = <&gpa0 0 GPIO_ACTIVE_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&micro_usb_det_pins>;
+
+		port {
+			usb_dr_connector: endpoint {
+				remote-endpoint = <&usb1_drd_sw>;
+			};
+		};
+	};
+
 	/*
 	 * RAM: 4 GiB (eMCP):
 	 *   - 2 GiB at 0x80000000
@@ -111,6 +127,20 @@ bt_active_led: led-5 {
 		};
 	};
 
+	/* TODO: Remove this once PMIC is implemented  */
+	reg_dummy: regulator-0 {
+		compatible = "regulator-fixed";
+		regulator-name = "dummy_reg";
+	};
+
+	reg_usb_host_vbus: regulator-1 {
+		compatible = "regulator-fixed";
+		regulator-name = "usb_host_vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		gpio = <&gpa3 5 GPIO_ACTIVE_LOW>;
+	};
+
 	/*
 	 * RTC clock (XrtcXTI); external, must be 32.768 kHz.
 	 *
@@ -172,6 +202,12 @@ key_volup_pins: key-volup-pins {
 		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
 		samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
 	};
+
+	micro_usb_det_pins: micro-usb-det-pins {
+		samsung,pins = "gpa0-0";
+		samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
+		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+	};
 };
 
 &rtc {
@@ -186,6 +222,28 @@ &serial_0 {
 	pinctrl-0 = <&uart1_pins>;
 };
 
+&usbdrd {
+	status = "okay";
+	vdd10-supply = <&reg_dummy>;
+	vdd33-supply = <&reg_dummy>;
+};
+
+&usbdrd_dwc3 {
+	dr_mode = "otg";
+	usb-role-switch;
+	role-switch-default-mode = "host";
+
+	port {
+		usb1_drd_sw: endpoint {
+			remote-endpoint = <&usb_dr_connector>;
+		};
+	};
+};
+
+&usbdrd_phy {
+	status = "okay";
+};
+
 &usi_uart {
 	samsung,clkreq-on; /* needed for UART mode */
 	status = "okay";
Signature · 1 line
2.39.2
#3 lore raw
In reply to Sam Protsenko
Quoted 6 lines · Sam Protsenko

This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.

Changes in v2:

Thank you for the patch. Looks good.
It is too late in the cycle for me to pick it up. I will take it after the merge window.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#4 lore raw
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Sam Protsenko

This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.

Quoted 6 lines
Quoted 1 line

Changes in v2:

Thank you for the patch. Looks good.
It is too late in the cycle for me to pick it up. I will take it after the merge window.

Thanks, Krzysztof! So we can expect these to get into v6.6, correct? Also, I'm trying to keep track of all my patches, so please let me know if you are going to apply this series to your trees soon, and which exactly (I presume krzk/linux-dt.git/for-next?).

Quoted 3 lines

Best regards,
Krzysztof

#5 lore raw
Quoted 9 lines · Sam Protsenko
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Sam Protsenko

This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Changes in v2:

Thank you for the patch. Looks good.
It is too late in the cycle for me to pick it up. I will take it after the merge window.

Thanks, Krzysztof! So we can expect these to get into v6.6, correct?

No, this is v6.6 merge window and it already started. I will take it after, thus v6.7.

Quoted 3 lines

Also, I'm trying to keep track of all my patches, so please let me know if you are going to apply this series to your trees soon, and which exactly (I presume krzk/linux-dt.git/for-next?).

I always send confirmation of applied patches with reference to repo and commit (although not branch).

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw
In reply to Sam Protsenko
Quoted 11 lines · Sam Protsenko

This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.

Changes in v2:
- Removed already applied patches from the patch series
- Rebased on top of latest linux-next
- Put ranges after compatible in usbdrd node (patch #1)

[...]

Applied, thanks!

[1/2] arm64: dts: exynos: Enable USB in Exynos850

      https://git.kernel.org/krzk/linux/c/2f911ca41e519dc5986f9483d3e15df4802b64f5
[2/2] arm64: dts: exynos: Enable USB support on E850-96 board
      https://git.kernel.org/krzk/linux/c/f2951ee8f7bcdb3844ffe6e54b0601ad8fa58640

Best regards,

Signature · 6 lines
Krzysztof Kozlowski <[email protected]>

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel