usb: chipidea: Add support for Tegra20 through Tegra124
Subsystems (4)
cover usb: chipidea: Add support for Tegra20 through Tegra124
From: Thierry Reding <[email protected]>
All Tegra SoC generations from Tegra20 through Tegra124 have a ChipIdea USB device controller. This set of patches adds very rudimentary support for it to the existing ChipIdea driver and enables them on the set of boards that I could easily test on.
I'm sending this out as RFC because I'm not sure yet how to merge this. While the driver seems to work fine (tested by exporting a USB driver or eMMC via the mass storage function) I don't yet understand how to make the driver switch between host and device modes dynamically. It might be useful to get this merged before, but I'd like to have some feedback on this, because doing so would mean that we need to use device mode on the devices where it's enabled and can't use the USBD port in host mode.
Thierry
Thierry Reding (5):
usb: chipidea: Add support for Tegra20/30/114/124
ARM: tegra: Enable UDC on TrimSlice
ARM: tegra: Enable UDC on Beaver
ARM: tegra: Enable UDC on Dalmore
ARM: tegra: Enable UDC on Jetson TK1
arch/arm/boot/dts/tegra114-dalmore.dts | 11 +++ arch/arm/boot/dts/tegra124-jetson-tk1.dts | 13 +++- arch/arm/boot/dts/tegra20-trimslice.dts | 3 + arch/arm/boot/dts/tegra30-beaver.dts | 11 +++ drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 109 ++++++++++++++++++++++++++++++ 6 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c
Signature · 1 line
2.8.3
RFC 1/5 usb: chipidea: Add support for Tegra20/30/114/124
From: Thierry Reding <[email protected]>
All of these Tegra SoC generations have a ChipIdea UDC IP block that can be used for device mode communication with a host. Implement rudimentary support that doesn't allow switching between host and device modes.
--- drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 109 +++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c
drivers/usb/chipidea/Makefile +1 -0
@@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_usb2.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_msm.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_zevio.o +obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_tegra.o obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o
drivers/usb/chipidea/ci_hdrc_tegra.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.8.3
RFC 2/5 ARM: tegra: Enable UDC on TrimSlice
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra20-trimslice.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/tegra20-trimslice.dts +3 -0
@@ -336,11 +336,14 @@ }; usb@c5000000 { + compatible = "nvidia,tegra20-udc"; status = "okay"; + dr_mode = "otg"; }; usb-phy@c5000000 { status = "okay"; + dr_mode = "otg"; vbus-supply = <&vbus_reg>; };
Signature · 1 line
2.8.3
RFC 3/5 ARM: tegra: Enable UDC on Beaver
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra30-beaver.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/tegra30-beaver.dts +11 -0
@@ -1935,6 +1935,17 @@ non-removable; }; + usb@7d000000 { + compatible = "nvidia,tegra30-udc"; + status = "okay"; + dr_mode = "otg"; + }; + + usb-phy@7d000000 { + status = "okay"; + dr_mode = "otg"; + }; + usb@7d004000 { status = "okay"; };
Signature · 1 line
2.8.3
RFC 4/5 ARM: tegra: Enable UDC on Dalmore
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra114-dalmore.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/tegra114-dalmore.dts +11 -0
@@ -1122,6 +1122,17 @@ non-removable; }; + usb@7d000000 { + compatible = "nvidia,tegra114-udc"; + status = "okay"; + dr_mode = "otg"; + }; + + usb-phy@7d000000 { + status = "okay"; + dr_mode = "otg"; + }; + usb@7d008000 { status = "okay"; };
Signature · 1 line
2.8.3
RFC 5/5 ARM: tegra: Enable UDC on Jetson TK1
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra124-jetson-tk1.dts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/tegra124-jetson-tk1.dts +12 -1
@@ -1726,7 +1726,7 @@ lanes { usb2-0 { - nvidia,function = "xusb"; + nvidia,function = "snps"; status = "okay"; };
@@ -1833,6 +1833,17 @@ }; }; + usb@0,7d000000 { + compatible = "nvidia,tegra124-udc"; + status = "okay"; + dr_mode = "otg"; + }; + + usb-phy@0,7d000000 { + status = "okay"; + dr_mode = "otg"; + }; + /* mini-PCIe USB */ usb@0,7d004000 { status = "okay";
Signature · 1 line
2.8.3
Re: [RFC 1/5] usb: chipidea: Add support for Tegra20/30/114/124
In reply to Thierry RedingQuoted 5 lines · Thierry Reding
From: Thierry Reding <[email protected]>
All of these Tegra SoC generations have a ChipIdea UDC IP block that can be used for device mode communication with a host. Implement rudimentary support that doesn't allow switching between host and device modes.
Are you sure this is correct for Tegra20? I ask because for the /host/ mode driver, there's a "has_hostpc" flag which is set to false for Tegra20 and true for all other SoCs. In the U-Boot device mode driver (if not in the kernel driver; I didn't check), there's a concept of "has hostpc" too. I might expect that flag to be set the same way for both drivers. That said, I /think/ the host and device HW are unrelated, so it's possible has_hostpc might be set differently for them. Unfortunately, we haven't enabled the device mode driver for any Tegra20 system in U-Boot so I can't tell whether we should enable has_hostpc for Tegra20's device mode driver.
Still, if this code works then I guess it's likely correct...
Re: [RFC 1/5] usb: chipidea: Add support for Tegra20/30/114/124
Quoted 18 lines · Stephen Warren
Quoted 5 lines · Thierry Reding
From: Thierry Reding <[email protected]>
All of these Tegra SoC generations have a ChipIdea UDC IP block that can be used for device mode communication with a host. Implement rudimentary support that doesn't allow switching between host and device modes.
Are you sure this is correct for Tegra20? I ask because for the /host/ mode driver, there's a "
has_hostpc" flag which is set to false for Tegra20 and true for all other SoCs. In the U-Boot device mode driver (if not in the kernel driver; I didn't check), there's a concept of "has hostpc" too. I might expect that flag to be set the same way for both drivers. That said, I /think/ the host and device HW are unrelated, so it's possiblehas_hostpcmight be set differently for them. Unfortunately, we haven't enabled the device mode driver for any Tegra20 system in U-Boot so I can't tell whether we should enablehas_hostpcfor Tegra20's device mode driver.
Quoted 1 line
Still, if this code works then I guess it's likely correct...
On the other hand, it looks like the kernel device mode driver might auto-detect this; in core.c:hw_device_init(), I see:
reg = hw_read(ci, CAP_HCCPARAMS, HCCPARAMS_LEN) >>
__ffs(HCCPARAMS_LEN);
ci->hw_bank.lpm = reg;... and in host.c:host_start(), I see:
ehci->has_hostpc = ci->hw_bank.lpm;
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
All Tegra SoC generations from Tegra20 through Tegra124 have a ChipIdea USB device controller. This set of patches adds very rudimentary support for it to the existing ChipIdea driver and enables them on the set of boards that I could easily test on.
Quoted 8 lines
I'm sending this out as RFC because I'm not sure yet how to merge this. While the driver seems to work fine (tested by exporting a USB driver or eMMC via the mass storage function) I don't yet understand how to make the driver switch between host and device modes dynamically. It might be useful to get this merged before, but I'd like to have some feedback on this, because doing so would mean that we need to use device mode on the devices where it's enabled and can't use the USBD port in host mode.
Chipidea driver supports many ways to switch between host and device mode. It can support switching with/without disconnecting cable.
Most of cases need to disconnect cable (Micro-AB) to switch between host and device mode, I just take this as an example:
Using ID pin which is at Micro-B receptacle on the board to determine host (ID = 0) or device (ID = 1 )mode.
- ID pin connects to CPU, and ID interrupt and value can be get through register OTGSC.
- ID pin does not connect to CPU, and there is a dedicated GPIO for ID.
Signature · 2 lines
Best Regards, Peter Chen
Re: [RFC 4/5] ARM: tegra: Enable UDC on Dalmore
In reply to Thierry RedingQuoted 19 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
Signed-off-by Thierry Reding <[email protected]>--- arch/arm/boot/dts/tegra114-dalmore.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/arm/boot/dts/tegra114-dalmore.dts +1
-0@@ -1122,6 +1122,17 @@ non-removable; }; + usb@7d000000 {
arch/arm/boot/dts/tegra114-dalmore.dts line 1135
Quoted 10 lines
arch/arm/boot/dts/tegra114-dalmore.dts +10
-0+ compatible = "nvidia,tegra114-udc"; + status = "okay"; + dr_mode = "otg"; + }; + + usb-phy@7d000000 { + status = "okay"; + dr_mode = "otg"; + }; +
It is a USB PHY node, you don't need to set dr_mode for it.
Signature · 2 lines
Best Regards, Peter Chen