Support UDC on Tegra 20/30/114/124
Subsystems (5)
v6 cover Support UDC on Tegra 20/30/114/124
Some time ago Thierry Reding sent out patches that enabled UDC on NVIDIA Tegra, unfortunately they haven't got enough traction to get into the kernel. I've rebased those patches and added a fix for the Ethernet USB Gadget on Tegra20, Marc Dietrich tested UDC driver on AC100 (Tegra20), Nicolas Chauvet on TK1 (Tegra124) and Michał Mirosław on TF300T (Tegra30). Like an original patchset, this series adds support for the peripheral mode only.
Changelog:
V6:
1) Moved 'SKB reserve' quirk setup from f_ncm to u_uther as per Felipe's suggestion.
V5:
1) Moved of_device_get_match_data() above clock enabling to not leave clock enabled in case of error. The SoC data matching function shouldn't ever fail, but let's assume that it could for consistency.
V4:
1) Used of_device_get_match_data() instead of of_match_node() to cleanup code a tad.
V3:
1) Specified platform flags directly in the SoC info as per Michał's suggestion.
V2:
1) Added comments to each of patched USB Ethernet gadget models.
2) Added explanatory comment about why usb_phy_set_suspend() invocation is necessary in tegra_udc_probe().
3) Dropped TrimSlice from patchset because it turned out that it uses USB1 controller for USB-to-SATA.
4) Moved tegra_defconfig patch before DT patches as per Stephen's suggestion.
5) Changed dr_mode to "peripheral" in DT patches since we don't support role mode switching for now.
Dmitry Osipenko (4):
usb: gadget: f_ncm/u_ether: Move 'SKB reserve' quirk setup to u_ether
usb: chipidea: udc: Support SKB alignment quirk
ARM: defconfig: tegra: Enable ChipIdea UDC driver
ARM: tegra: Enable UDC on AC100
Thierry Reding (4):
usb: chipidea: Add support for Tegra20/30/114/124
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 | 10 ++ arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 ++- arch/arm/boot/dts/tegra20-paz00.dts | 2 + arch/arm/boot/dts/tegra30-beaver.dts | 10 ++ arch/arm/configs/tegra_defconfig | 10 +- drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 155 ++++++++++++++++++++++++++++++ drivers/usb/chipidea/udc.c | 3 + drivers/usb/gadget/function/f_ncm.c | 2 - drivers/usb/gadget/function/u_ether.c | 2 +- drivers/usb/gadget/function/u_ether.h | 1 - include/linux/usb/chipidea.h | 1 + 12 files changed, 199 insertions(+), 10 deletions(-) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c
Signature · 1 line
2.13.3
A message that is not in the archive (sent off-list or not yet received): cover.1502879077.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v6 1/8 usb: gadget: f_ncm/u_ether: Move 'SKB reserve' quirk setup to u_ether
That quirk is required to make USB Ethernet gadget working on HW that can't cope with unaligned DMA. For some reason only f_ncm sets up that quirk, let's setup it directly in u_ether so other network models would have that quirk applied as well. All network models have been tested with ChipIdea UDC driver on NVIDIA Tegra20 SoC that require DMA to be aligned.
--- drivers/usb/gadget/function/f_ncm.c | 2 -- drivers/usb/gadget/function/u_ether.c | 2 +- drivers/usb/gadget/function/u_ether.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/usb/gadget/function/f_ncm.c +0 -2
@@ -925,8 +925,6 @@ static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)*/ ncm->port.is_zlp_ok =gadget_is_zlp_supported (cdev->gadget); - ncm->port.no_skb_reserve = -gadget_avoids_skb_reserve (cdev->gadget); ncm->port.cdc_filter =DEFAULT_FILTER ;DBG (cdev,"activate ncm\n" ); net =gether_connect (&ncm->port);
drivers/usb/gadget/function/u_ether.c +1 -1
@@ -1073,7 +1073,7 @@ struct net_device *gether_connect(struct gether *link)if (result ==0 ) { dev->zlp = link->is_zlp_ok; - dev->no_skb_reserve = link->no_skb_reserve; + dev->no_skb_reserve =gadget_avoids_skb_reserve (dev->gadget);DBG (dev,"qlen %d\n" ,qlen (dev->gadget, dev->qmult)); dev->header_len = link->header_len;
drivers/usb/gadget/function/u_ether.h +0 -1
@@ -64,7 +64,6 @@ struct gether {struct usb_ep *out_ep;bool is_zlp_ok; -bool no_skb_reserve;u16 cdc_filter;
Signature · 1 line
2.13.3
PATCH v6 2/8 usb: chipidea: udc: Support SKB alignment quirk
In reply to a message not in the archiveNVIDIA Tegra20 UDC can't cope with unaligned DMA and require a USB gadget quirk that avoids SKB buffer alignment to be set in order to make Ethernet Gadget working. Later Tegra generations do not require that quirk. Let's add a new platform data flag that allows to enable USB gadget quirk for platforms that require it.
--- drivers/usb/chipidea/udc.c | 3 +++ include/linux/usb/chipidea.h | 1 + 2 files changed, 4 insertions(+)
drivers/usb/chipidea/udc.c +3 -0
@@ -1896,6 +1896,9 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.name = ci->platdata->name; ci->gadget.otg_caps = otg_caps; +if (ci->platdata->flags &CI_HDRC_REQUIRES_ALIGNED_DMA ) + ci->gadget.quirk_avoids_skb_reserve =1 ; +if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support || otg_caps->adp_support)) ci->gadget.is_otg =1 ;
include/linux/usb/chipidea.h +1 -0
@@ -58,6 +58,7 @@ struct ci_hdrc_platform_data {#define CI_HDRC_OVERRIDE_TX_BURST BIT(10)#define CI_HDRC_OVERRIDE_RX_BURST BIT(11)#define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12)/* Glue layer manages phy */ +#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)enum usb_dr_mode dr_mode;#define CI_HDRC_CONTROLLER_RESET_EVENT 0#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
Signature · 1 line
2.13.3
PATCH v6 3/8 usb: chipidea: Add support for Tegra20/30/114/124
In reply to a message not in the archiveFrom: 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 | 155 +++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c
drivers/usb/chipidea/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_zevio.o obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o obj-$(CONFIG_USB_CHIPIDEA_OF) += usbmisc_imx.o ci_hdrc_imx.o +obj-$(CONFIG_USB_CHIPIDEA_OF) += ci_hdrc_tegra.o
drivers/usb/chipidea/ci_hdrc_tegra.c new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.13.3
A message that is not in the archive (sent off-list or not yet received): 2b091105e45234dca93051862e76e711acf482cc.1502879078.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v6 3/8] usb: chipidea: Add support for Tegra20/30/114/124
Peter, you've applied the v3 of this patch to your local tree and so it is already in linux-next. Don't you mind to pick up a newer version of the patch?
Signature · 1 line
Dmitry
A message that is not in the archive (sent off-list or not yet received): c294106c-8aa8-8438-9825-0d64b6cfc9ed-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v6 3/8] usb: chipidea: Add support for Tegra20/30/114/124
Quoted 3 lines · Dmitry Osipenko
Peter, you've applied the v3 of this patch to your local tree and so it is already in linux-next. Don't you mind to pick up a newer version of the patch?
Your patches are updated at my tree.
Signature · 2 lines
Best Regards, Peter Chen
Re: [PATCH v6 3/8] usb: chipidea: Add support for Tegra20/30/114/124
Quoted 7 lines · Peter Chen
Quoted 3 lines · Dmitry Osipenko
Peter, you've applied the v3 of this patch to your local tree and so it is already in linux-next. Don't you mind to pick up a newer version of the patch?
Your patches are updated at my tree.
Thank you very much!
Signature · 1 line
Dmitry
Re: [PATCH v6 3/8] usb: chipidea: Add support for Tegra20/30/114/124
In reply to a message not in the archiveQuoted 11 lines · Dmitry Osipenko
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.
Tested-by Michał Mirosław <[email protected]>Signed-off-by Thierry Reding <[email protected]>[[email protected]: rebased patches and added DMA alignment quirk for Tegra20]Signed-off-by Dmitry Osipenko <[email protected]>Acked-by Peter Chen <[email protected]>
Currently, I am seeing that system suspend on Tegra30/114/124 is broken on -next (looks like it broke starting with next-20170823). Bisect shows that is broke with this series and reverting this patch of top of tree does workaround the problem.
Looking a bit deeper, it appears that the boards are hanging when the set_phcd() function is called in the tegra phy driver to disable the phy clock. This function is called by usb_phy_set_suspend() in the chipidea driver.
Thierry, any thoughts?
Cheers
Jon
Signature · 1 line
nvpublic
A message that is not in the archive (sent off-list or not yet received): d62d98ec-ef73-7bb2-720f-82155871613a-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v6 3/8] usb: chipidea: Add support for Tegra20/30/114/124
Quoted 19 lines · Jon Hunter
Quoted 11 lines · Dmitry Osipenko
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.
Tested-by Michał Mirosław <[email protected]>Signed-off-by Thierry Reding <[email protected]>[[email protected]: rebased patches and added DMA alignment quirk for Tegra20]Signed-off-by Dmitry Osipenko <[email protected]>Acked-by Peter Chen <[email protected]>Currently, I am seeing that system suspend on Tegra30/114/124 is broken on -next (looks like it broke starting with next-20170823). Bisect shows that is broke with this series and reverting this patch of top of tree does workaround the problem.
Quoted 4 lines
Looking a bit deeper, it appears that the boards are hanging when the
set_phcd()function is called in the tegra phy driver to disable the phy clock. This function is called byusb_phy_set_suspend()in the chipidea driver.
As been discussed on IRC, this issue is caused by entering LPM twice: first time ChipIdea driver enters LPM and then Tegra's PHY does it too, touching registers that seems shouldn't be touched after entering LPM. As Thierry suggested, one possible and quick solution is to *not* set udc->data.usb_phy for Tegra30+.
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v6 4/8 ARM: defconfig: tegra: Enable ChipIdea UDC driver
In reply to a message not in the archiveSince NVIDIA Tegra is supported now by the ChipIdea USB driver, let's enable this driver in tegra_defconfig.
--- arch/arm/configs/tegra_defconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/configs/tegra_defconfig +5 -5
@@ -121,7 +121,6 @@ CONFIG_TOUCHSCREEN_WM97XX=y CONFIG_TOUCHSCREEN_STMPE=y CONFIG_INPUT_MISC=y # CONFIG_LEGACY_PTYS is not set -# CONFIG_DEVKMEM is not set CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y
@@ -220,6 +219,9 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_ACM=y CONFIG_USB_WDM=y CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=m +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_GADGET=m CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=16 CONFIG_MMC_SDHCI=y
@@ -249,8 +251,6 @@ CONFIG_RTC_DRV_TEGRA=y CONFIG_DMADEVICES=y CONFIG_TEGRA20_APB_DMA=y CONFIG_STAGING=y -CONFIG_SENSORS_ISL29018=y -CONFIG_SENSORS_ISL29028=y CONFIG_MFD_NVEC=y CONFIG_KEYBOARD_NVEC=y CONFIG_SERIO_NVEC_PS2=y
@@ -265,6 +265,8 @@ CONFIG_ARCH_TEGRA_124_SOC=y CONFIG_MEMORY=y CONFIG_IIO=y CONFIG_MPU3050_I2C=y +CONFIG_SENSORS_ISL29018=y +CONFIG_SENSORS_ISL29028=y CONFIG_AK8975=y CONFIG_PWM=y CONFIG_PWM_TEGRA=y
@@ -290,13 +292,11 @@ CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_PRINTK_TIME=y CONFIG_DEBUG_INFO=y -CONFIG_DEBUG_FS=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_SLAB=y CONFIG_DEBUG_VM=y CONFIG_DETECT_HUNG_TASK=y CONFIG_SCHEDSTATS=y -CONFIG_TIMER_STATS=y # CONFIG_DEBUG_PREEMPT is not set CONFIG_DEBUG_MUTEXES=y CONFIG_DEBUG_SG=y
Signature · 6 lines
2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v6 5/8 ARM: tegra: Enable UDC on Beaver
In reply to a message not in the archiveFrom: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra30-beaver.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/tegra30-beaver.dts +10 -0
@@ -1927,6 +1927,16 @@ non-removable; }; + usb@7d000000 { + compatible = "nvidia,tegra30-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d000000 { + status = "okay"; + }; + usb@7d004000 { status = "okay"; };
Signature · 1 line
2.13.3
PATCH v6 6/8 ARM: tegra: Enable UDC on Dalmore
In reply to a message not in the archiveFrom: Thierry Reding <[email protected]>
Override the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra114-dalmore.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/tegra114-dalmore.dts +10 -0
@@ -1122,6 +1122,16 @@ non-removable; }; + usb@7d000000 { + compatible = "nvidia,tegra114-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d000000 { + status = "okay"; + }; + usb@7d008000 { status = "okay"; };
Signature · 6 lines
2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v6 7/8 ARM: tegra: Enable UDC on Jetson TK1
In reply to a message not in the archiveFrom: 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/arm/boot/dts/tegra124-jetson-tk1.dts +11 -1
@@ -1722,7 +1722,7 @@ lanes { usb2-0 { - nvidia,function = "xusb"; + nvidia,function = "snps"; status = "okay"; };
@@ -1829,6 +1829,16 @@ }; }; + usb@7d000000 { + compatible = "nvidia,tegra124-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d000000 { + status = "okay"; + }; + /* mini-PCIe USB */ usb@7d004000 { status = "okay";
Signature · 1 line
2.13.3
PATCH v6 8/8 ARM: tegra: Enable UDC on AC100
In reply to a message not in the archiveOverride the compatible string of the first USB controller to enable device mode.
--- arch/arm/boot/dts/tegra20-paz00.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/tegra20-paz00.dts +2 -0
@@ -452,7 +452,9 @@ }; usb@c5000000 { + compatible = "nvidia,tegra20-udc"; status = "okay"; + dr_mode = "peripheral"; }; usb-phy@c5000000 {
Signature · 6 lines
2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html