Meson GXL/GXM USB host mode support
Subsystems (2)
Martin Blumenstingl
reviewerv2 cover Meson GXL/GXM USB host mode support
the goal of this series is to enable USB host mode on Meson GXL and GXM. there are four dependencies to get this working:
1. "improvements and fixes for the phy-meson-gxl-usb2 driver" from [0] (this is already queued for v4.17 and part of linux-next)
2. "DWC3 support for Amlogic Meson AXG and GXL SoCs from" [1] (this is also queued for v4.17 and part of linux-next)
3. "initialize (multiple) PHYs for a HCD" from [3] (this is also queued for v4.17 and part of linux-next)
4. "Meson GXL USB3 PHY driver" from [3] (this is also queued for v4.17 and part of linux-next)
there is a soft dependency on the following series (currently dependency #3 from above breaks suspend on some TI SoCs, so there's a risk that #3 will get reverted if the following series doesn't fix it):
5. "fix HCD PHY suspend handling" from [4] (not queued for v4.17 yet)
select boards get USB enabled. I have tested this myself successfully on:
- Khadas VIM (GXL S905X)
- Le Potato (GXL S905X)
- Khadas VIM2 (GXM S912)
- a board which is similar to P230 (GXL S905D)
a user on IRC reported that Nexbox A95X (S905X) support is working fine as well.
changes since RFC v1 at [5]:
- rebased on top of Kevin's v4.17/dt64 branch (c339f0e29ce9f9 "ARM64:
dts: meson-gx: make efuse read-only")
- dropped RFC prefix because this was also tested and confirmed working by a user on IRC on his Nexbox A95X (S905X)
[0] https://lkml.kernel.org/r/20180128202245.25021-1-martin.blumenstingl at googlemail.com
[1] https://lkml.kernel.org/r/20180211211517.5846-1-martin.blumenstingl at googlemail.com
[2] https://lkml.kernel.org/r/20180303214309.25643-1-martin.blumenstingl at googlemail.com
[3] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006707.html
[4] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006847.html
[5] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006711.html
Martin Blumenstingl (7):
ARM64: dts: meson-gxl: add USB host support
ARM64: dts: meson-gxm: add GXM specific USB host configuration
ARM64: dts: meson-gxl-s905x-p212: enable the USB controller
ARM64: dts: meson-gx-p23x-q20x: enable the USB controller
ARM64: dts: meson-gxl-s905x-libretech-cc: enable the USB controller
ARM64: dts: meson-gxl-nexbox-a95x: enable the USB controller
ARM64: dts: meson-gxm-khadas-vim2: enable the USB controller
.../arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 4 ++ .../dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 12 +++++ .../dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | 4 ++ .../boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | 4 ++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 61 ++++++++++++++++++++++ .../boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 4 ++ arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 17 ++++++ 7 files changed, 106 insertions(+)
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 1/7 ARM64: dts: meson-gxl: add USB host support
This adds USB host support to the Meson GXL SoC. A dwc3 controller is used for host-mode, while a dwc2 controller (not added in this patch because I could not get it working) is used for device-mode only.
The dwc3 controller's internal roothub has two USB2 ports enabled but no USB3 port. Each of the ports is supplied by a separate PHY. The USB pins are connected to the SoC's USBHOST_A and USBOTG_B pins.
Due to the way the roothub works internally the USB PHYs are left enabled. When the dwc3 controller is disabled the PHY is never powered on so it does not draw any extra power. However, when the dwc3 host controller is enabled then all PHYs also have to be enabled, otherwise USB devices will not be detected (regardless of whether they are plugged into an enabled port or not). This means that only the dwc3 controller has to be enabled on boards with USB support (instead of requiring all boards to enable the PHYs additionally with the chance of forgetting to enable one and breaking all other ports with that as well).
This also adds the USB3 PHY which currently only does some basic initialization. That however is required because without it high-speed devices (like USB thumb drives) do not work on some devices (probably because the bootloader does not configure the USB3 PHY registers).
--- arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +61 -0
@@ -20,6 +20,67 @@ no-map; }; }; + + soc { + usb0: usb at c9000000 { + status = "disabled"; + compatible = "amlogic,meson-gxl-dwc3"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + clocks = <&clkc CLKID_USB>; + clock-names = "usb_general"; + resets = <&reset RESET_USB_OTG>; + reset-names = "usb_otg"; + + dwc3: dwc3 at c9000000 { + compatible = "snps,dwc3"; + reg = <0x0 0xc9000000 0x0 0x100000>; + interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>; + dr_mode = "host"; + maximum-speed = "high-speed"; + snps,dis_u2_susphy_quirk; + phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>; + }; + }; + }; +}; + +&apb { + usb2_phy0: phy at 78000 { + compatible = "amlogic,meson-gxl-usb2-phy"; + #phy-cells = <0>; + reg = <0x0 0x78000 0x0 0x20>; + clocks = <&clkc CLKID_USB>; + clock-names = "phy"; + resets = <&reset RESET_USB_OTG>; + reset-names = "phy"; + status = "okay"; + }; + + usb2_phy1: phy at 78020 { + compatible = "amlogic,meson-gxl-usb2-phy"; + #phy-cells = <0>; + reg = <0x0 0x78020 0x0 0x20>; + clocks = <&clkc CLKID_USB>; + clock-names = "phy"; + resets = <&reset RESET_USB_OTG>; + reset-names = "phy"; + status = "okay"; + }; + + usb3_phy: phy at 78080 { + compatible = "amlogic,meson-gxl-usb3-phy"; + #phy-cells = <0>; + reg = <0x0 0x78080 0x0 0x20>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clkc CLKID_USB>, <&clkc_AO CLKID_AO_CEC_32K>; + clock-names = "phy", "peripheral"; + resets = <&reset RESET_USB_OTG>, <&reset RESET_USB_OTG>; + reset-names = "phy", "peripheral"; + status = "okay"; + }; }; ðmac {
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 2/7 ARM64: dts: meson-gxm: add GXM specific USB host configuration
In reply to Martin BlumenstinglThe USB configuration on GXM is slightly different than on GXL. The dwc3 controller's internal hub has three USB2 ports (instead of 2 on GXL) along with a dedicated USB2 PHY for this port. However, it seems that there are no pins on GXM which would allow connecting the third port to a physical USB port.
Passing the third PHY is required though, because without it none of the other USB ports is working (this seems to be a limitation of how the internal USB hub works, if one PHY is disabled then no USB port works).
--- arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxm.dtsi +17 -0
@@ -80,6 +80,19 @@ }; }; +&apb { + usb2_phy2: phy at 78040 { + compatible = "amlogic,meson-gxl-usb2-phy"; + #phy-cells = <0>; + reg = <0x0 0x78040 0x0 0x20>; + clocks = <&clkc CLKID_USB>; + clock-names = "phy"; + resets = <&reset RESET_USB_OTG>; + reset-names = "phy"; + status = "okay"; + }; +}; + &clkc_AO { compatible = "amlogic,meson-gxm-aoclkc", "amlogic,meson-gx-aoclkc"; };
@@ -100,3 +113,7 @@ &hdmi_tx { compatible = "amlogic,meson-gxm-dw-hdmi", "amlogic,meson-gx-dw-hdmi"; }; + +&dwc3 { + phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>, <&usb2_phy2>; +};
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 3/7 ARM64: dts: meson-gxl-s905x-p212: enable the USB controller
In reply to Martin BlumenstinglAll boards based on the P212 reference design (the P212 reference board itself and the Khadas VIM) have USB connectors (in case of the Khadas VIM the first port is exposed through the USB Type-C connector, the second port is connected to a 4-port USB hub).
This enables the USB controller on these boards to make the USB ports actually usable.
--- arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +4 -0
@@ -185,3 +185,7 @@ pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; }; + +&usb0 { + status = "okay"; +};
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 4/7 ARM64: dts: meson-gx-p23x-q20x: enable the USB controller
In reply to Martin BlumenstinglAll S905D (GXL) and S912 (GXM) reference boards (namely these are P230, P231, Q200 and Q201) provide USB connectors.
This enables the USB controller on these boards to make the USB ports actually usable.
--- arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +4 -0
@@ -212,3 +212,7 @@ pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; }; + +&usb0 { + status = "okay"; +};
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 5/7 ARM64: dts: meson-gxl-s905x-libretech-cc: enable the USB controller
In reply to Martin BlumenstinglThe LibreTech CC ("Le Potato") board provides four USB connectors. These are provided by a hub which is connected to the SoC's USB controller.
Enable the SoC's USB controller to make the USB ports usable. Also turn on the HDMI_5V regulator when powering on the PHY because (even though it's not shown in the schematics) HDMI_5V also supplies the USB VBUS.
--- arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +12 -0
@@ -271,3 +271,15 @@ pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; }; + +&usb0 { + status = "okay"; +}; + +&usb2_phy0 { + /* + * even though the schematics don't show it: + * HDMI_5V is also used as supply for the USB VBUS. + */ + phy-supply = <&hdmi_5v>; +};
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 6/7 ARM64: dts: meson-gxl-nexbox-a95x: enable the USB controller
In reply to Martin BlumenstinglThe Nexbox A95X provides two USB ports. Enable the SoC's USB controller on this board to make these USB ports usable.
--- arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts +4 -0
@@ -215,3 +215,7 @@ pinctrl-0 = <&uart_ao_a_pins>; pinctrl-names = "default"; }; + +&usb0 { + status = "okay"; +};
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerPATCH v2 7/7 ARM64: dts: meson-gxm-khadas-vim2: enable the USB controller
In reply to Martin BlumenstinglThe Khadas VIM2 board connects the dwc3 controller to an internal 4-port USB hub which. Two of these ports are accessible directly soldered to the board, while the other two are accessible through the 40-pin "GPIO" header.
--- arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +4 -0
@@ -412,3 +412,7 @@ status = "okay"; vref-supply = <&vddio_ao18>; }; + +&usb0 { + status = "okay"; +};
Signature · 1 line
2.16.3
Martin Blumenstingl
reviewerv2 cover Meson GXL/GXM USB host mode support
In reply to Martin BlumenstinglQuoted 6 lines · Martin Blumenstingl
the goal of this series is to enable USB host mode on Meson GXL and GXM. there are four dependencies to get this working:
1. "improvements and fixes for the phy-meson-gxl-usb2 driver" from [0] (this is already queued for v4.17 and part of linux-next)
2. "DWC3 support for Amlogic Meson AXG and GXL SoCs from" [1] (this is also queued for v4.17 and part of linux-next)
Quoted 8 lines
3. "initialize (multiple) PHYs for a HCD" from [3] (this is also queued for v4.17 and part of linux-next)
4. "Meson GXL USB3 PHY driver" from [3] (this is also queued for v4.17 and part of linux-next)
there is a soft dependency on the following series (currently dependency #3 from above breaks suspend on some TI SoCs, so there's a risk that #3 will get reverted if the following series doesn't fix it):
5. "fix HCD PHY suspend handling" from [4] (not queued for v4.17 yet)
I just re-sent the series for dependency #5 in version 4: [0] version 4 includes a Tested-by and Reviewed-by of the Mediatek and TI USB maintainers. so chances are good that all pre-conditions for this (USB on GXL/GXM devicetree) series will make it into v4.17
Quoted 44 lines
select boards get USB enabled. I have tested this myself successfully on:
- Khadas VIM (GXL S905X)
- Le Potato (GXL S905X)
- Khadas VIM2 (GXM S912)
- a board which is similar to P230 (GXL S905D)a user on IRC reported that Nexbox A95X (S905X) support is working fine as well.
changes since RFC v1 at [5]:
- rebased on top of Kevin's v4.17/dt64 branch (c339f0e29ce9f9"ARM64:
dts: meson-gx: make efuse read-only")
- dropped RFC prefix because this was also tested and confirmed working by a user on IRC on his Nexbox A95X (S905X)[0] https://lkml.kernel.org/r/20180128202245.25021-1-martin.blumenstingl at googlemail.com
[1] https://lkml.kernel.org/r/20180211211517.5846-1-martin.blumenstingl at googlemail.com
[2] https://lkml.kernel.org/r/20180303214309.25643-1-martin.blumenstingl at googlemail.com
[3] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006707.html
[4] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006847.html
[5] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006711.htmlMartin Blumenstingl (7):
ARM64: dts: meson-gxl: add USB host support
ARM64: dts: meson-gxm: add GXM specific USB host configuration
ARM64: dts: meson-gxl-s905x-p212: enable the USB controller
ARM64: dts: meson-gx-p23x-q20x: enable the USB controller
ARM64: dts: meson-gxl-s905x-libretech-cc: enable the USB controller
ARM64: dts: meson-gxl-nexbox-a95x: enable the USB controller
ARM64: dts: meson-gxm-khadas-vim2: enable the USB controller.../arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 4 ++ .../dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 12 +++++ .../dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | 4 ++ .../boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | 4 ++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 61 ++++++++++++++++++++++ .../boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 4 ++ arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 17 ++++++ 7 files changed, 106 insertions(+)
Quoted 3 lines
--
2.16.3
Regards
Martin
[0] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006882.html
v2 cover Meson GXL/GXM USB host mode support
Quoted 16 lines · Martin Blumenstingl
Quoted 6 lines · Martin Blumenstingl
the goal of this series is to enable USB host mode on Meson GXL and GXM. there are four dependencies to get this working:
1. "improvements and fixes for the phy-meson-gxl-usb2 driver" from [0] (this is already queued for v4.17 and part of linux-next)
2. "DWC3 support for Amlogic Meson AXG and GXL SoCs from" [1] (this is also queued for v4.17 and part of linux-next)Quoted 8 lines
3. "initialize (multiple) PHYs for a HCD" from [3] (this is also queued for v4.17 and part of linux-next)
4. "Meson GXL USB3 PHY driver" from [3] (this is also queued for v4.17 and part of linux-next)
there is a soft dependency on the following series (currently dependency #3 from above breaks suspend on some TI SoCs, so there's a risk that #3 will get reverted if the following series doesn't fix it):
5. "fix HCD PHY suspend handling" from [4] (not queued for v4.17 yet)
Quoted 4 lines
I just re-sent the series for dependency #5 in version 4: [0] version 4 includes a Tested-by and Reviewed-by of the Mediatek and TI USB maintainers. so chances are good that all pre-conditions for this (USB on GXL/GXM devicetree) series will make it into v4.17
Hi,
I think these should go into 4.17 anyway since the DT nodes are conform to all bindings.
Neil
Quoted 56 lines
Quoted 45 lines
select boards get USB enabled. I have tested this myself successfully on:
- Khadas VIM (GXL S905X)
- Le Potato (GXL S905X)
- Khadas VIM2 (GXM S912)
- a board which is similar to P230 (GXL S905D)a user on IRC reported that Nexbox A95X (S905X) support is working fine as well.
changes since RFC v1 at [5]:
- rebased on top of Kevin's v4.17/dt64 branch (c339f0e29ce9f9"ARM64:
dts: meson-gx: make efuse read-only")
- dropped RFC prefix because this was also tested and confirmed working by a user on IRC on his Nexbox A95X (S905X)[0] https://lkml.kernel.org/r/20180128202245.25021-1-martin.blumenstingl at googlemail.com
[1] https://lkml.kernel.org/r/20180211211517.5846-1-martin.blumenstingl at googlemail.com
[2] https://lkml.kernel.org/r/20180303214309.25643-1-martin.blumenstingl at googlemail.com
[3] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006707.html
[4] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006847.html
[5] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006711.htmlMartin Blumenstingl (7):
ARM64: dts: meson-gxl: add USB host support
ARM64: dts: meson-gxm: add GXM specific USB host configuration
ARM64: dts: meson-gxl-s905x-p212: enable the USB controller
ARM64: dts: meson-gx-p23x-q20x: enable the USB controller
ARM64: dts: meson-gxl-s905x-libretech-cc: enable the USB controller
ARM64: dts: meson-gxl-nexbox-a95x: enable the USB controller
ARM64: dts: meson-gxm-khadas-vim2: enable the USB controller.../arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 4 ++ .../dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 12 +++++ .../dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | 4 ++ .../boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | 4 ++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 61 ++++++++++++++++++++++ .../boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 4 ++ arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 17 ++++++ 7 files changed, 106 insertions(+)Quoted 3 lines
--
2.16.3Regards
Martin[0] http://lists.infradead.org/pipermail/linux-amlogic/2018-March/006882.html
Kevin Hilman
maintainerv2 cover Meson GXL/GXM USB host mode support
Quoted 17 lines · Neil Armstrong
Quoted 16 lines · Martin Blumenstingl
Quoted 14 lines · Martin Blumenstingl
the goal of this series is to enable USB host mode on Meson GXL and GXM. there are four dependencies to get this working:
1. "improvements and fixes for the phy-meson-gxl-usb2 driver" from [0] (this is already queued for v4.17 and part of linux-next)
2. "DWC3 support for Amlogic Meson AXG and GXL SoCs from" [1] (this is also queued for v4.17 and part of linux-next)
3. "initialize (multiple) PHYs for a HCD" from [3] (this is also queued for v4.17 and part of linux-next)
4. "Meson GXL USB3 PHY driver" from [3] (this is also queued for v4.17 and part of linux-next)
there is a soft dependency on the following series (currently dependency #3 from above breaks suspend on some TI SoCs, so there's a risk that #3 will get reverted if the following series doesn't fix it):
5. "fix HCD PHY suspend handling" from [4] (not queued for v4.17 yet)
Quoted 9 lines
Quoted 4 lines
I just re-sent the series for dependency #5 in version 4: [0] version 4 includes a Tested-by and Reviewed-by of the Mediatek and TI USB maintainers. so chances are good that all pre-conditions for this (USB on GXL/GXM devicetree) series will make it into v4.17
Hi,
I think these should go into 4.17 anyway since the DT nodes are conform to all bindings.
I've queued these, and will first attempt to get them early in v4.17-rc. If that doesn't work, They'll be first in the queue for v4.18/dt64.
Kevin