Re: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option
Hi Felipe, On Wednesday 27 May 2015 12:09 AM, Felipe Balbi wrote: On Tue, May 26, 2015 at 11:37:17AM -0700, Arun Ramamurthy wrote: Hi On 15-05-26 07:19 AM, Felipe Balbi wrote: HI, On Mon, May 25, 2015 at 02:19:58PM -0700, Arun Ramamurthy wrote: On 15-05-14 05:52 PM, Felipe Balbi wrote: Hi, On Wed, Apr 22, 2015 at 04:04:10PM -0700, Arun Ramamurthy wrote: Most of the phy providers use select to enable GENERIC_PHY. Since select is only recommended when the config is not visible, GENERIC_PHY is changed an invisible option. To maintain consistency, all phy providers are changed to select GENERIC_PHY and all non-phy drivers use depends on when the phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic dependency, so it is left as select. Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com --- drivers/ata/Kconfig | 1 - drivers/media/platform/exynos4-is/Kconfig | 2 +- drivers/phy/Kconfig | 4 ++-- drivers/usb/host/Kconfig | 4 ++-- drivers/video/fbdev/exynos/Kconfig| 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 5f60155..6d2e881 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -301,7 +301,6 @@ config SATA_MV tristate Marvell SATA support depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST - select GENERIC_PHY help This option enables support for the Marvell Serial ATA family. Currently supports 88SX[56]0[48][01] PCI(-X) chips, diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index b7b2e47..b6f3eaa 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig @@ -31,7 +31,7 @@ config VIDEO_S5P_FIMC config VIDEO_S5P_MIPI_CSIS tristate S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver depends on REGULATOR - select GENERIC_PHY + depends on GENERIC_PHY help This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 receiver (MIPI-CSIS) devices. diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2962de2..edecdb1 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -5,7 +5,7 @@ menu PHY Subsystem config GENERIC_PHY - bool PHY Core + bool help Generic PHY support. @@ -72,7 +72,7 @@ config PHY_MIPHY365X config PHY_RCAR_GEN2 tristate Renesas R-Car generation 2 USB PHY driver depends on ARCH_SHMOBILE - depends on GENERIC_PHY + select GENERIC_PHY so some you changed from depends to select... help Support for USB PHY found on Renesas R-Car generation 2 SoCs. diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 5ad60e4..e2197e2 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -182,7 +182,7 @@ config USB_EHCI_HCD_SPEAR config USB_EHCI_HCD_STI tristate Support for ST STiHxxx on-chip EHCI USB controller depends on ARCH_STI OF - select GENERIC_PHY + depends on GENERIC_PHY while others you changed from select to depends. NAK. Felipe, I dont understand your concern, could you please explain it more detail? The logic behind the changes is that in cases where there was an explicit dependency, I changed it to depends on and in other cases I changed it to selects. Thanks Since GENERIC_PHY is visible from Kconfig, it would be much nicer to avoid select altogether. Felipe, after discussion with the maintainers, I have made GENERIC_PHY an invisible option as part of this change. Thanks Then, if the option is invisible, how can you depend on it ? It can never be selected by poking around in Kconfig. IMO, it's counterintuitive that you need to enable a PHY driver before you can see your EHCI/OHCI/whatever controller listed in Kconfig. If the controller requires PHY for it to be functional, it is okay to make the controller depend on PHY IMHO. We want to try and minimize the usage of 'select' wherever possible or else 'select' is the most intuitive way. The other option is just to leave the 'depends on' and let the user select PHY. Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] usb: Remove Vernier devices from lsusb and hid_ignore_list
On Thu, 28 May 2015, Greg KH wrote: On Thu, May 28, 2015 at 04:58:54PM +0200, Jiri Kosina wrote: On Thu, 21 May 2015, Dennis O'Brien wrote: From: Dennis O'Brien dennis.obr...@eqware.net Removes Vernier Software Technology devices from the ldusb driver and the hid_ignore_list table of the usbhid driver in the Linux tree. These devices will now be supported via the hidraw driver. A user space driver for these devices will be found in the Go! Software Development Kit from Vernier at http://www.vernier.com/downloads/software-development-kits/go-sdk/. These devices are also be supported by the LabQuest2 standalone interface shown at http://www.vernier.com/products/interfaces/labq2/ and the LoggerPro for Linux software shown at http://www.vernier.com/downloads/logger-pro-linux/. Given that the only thing this patch is in principle doing is dropping device support from ldusb driver, I am not applying it before getting Ack from Greg (or even seeing Greg merging it himself through his tree). Greg ... ? No objection from me: Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org But if you want me to take it in my tree, I can do that too, just provide an ack and I will do so. Thanks. That's fine, I'll take it. However, Dennis, the patch has been damaged by your mail client (it's line-wrapped). Could you please fix that and resend? I'll then take it through my tree. -- Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: USB3 external HDD not recognized [regression]
Hi again, Indeed doing echo 'on' | sudo tee /sys/bus/pci/devices/*/power/control fixes the problem: When I subsequently plug in the disk, it is recognized correctly. I confirmed this with an older kernel (the 3.16 Debian kernel, to be more precise). That's good to know, now I don't need to reboot to a different kernel anymore to do fast backups ;-) Is there any news on this? Any further information I can provide to help fix the issue? Kind regards, Ralf -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ehci_bus_suspend system halt
Hi On Thu, May 28, 2015 at 01:42:07PM -0400, Alan Stern wrote: On Thu, 28 May 2015, Michael Trimarchi wrote: Hi Alan we are working on a samsung exysnos5430 device and we have some problem during suspend. The only way to solve it seems this patch. We don't really know what could be the problem. Do you have any suggestion to debug it? diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index c254076..6b01784 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -289,14 +289,6 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) if (t1 != t2) { /* +* When suspend bit for PORT 1 is set, +* system halts when spin_unlock_irq() +* called--- why +*/ You didn't say what your problem was, but I guess your system halts. Are you certain the halt occurs when spin_unlock_irq() is called? Did you put printk statements before and after that statement? Maybe the halt actually occurs later. [ 97.522145] [c0] hub 1-2:1.0: hub_suspend [ 97.524798] [c0] usb usb2: usb auto-resume [ 97.528805] [c0] usb 1-2: unlink qh256-0001/ddd92700 start 1 [1/0 us] [ 97.535588] [c0] s2m-rtc s2m-rtc: s2m_rtc_read_time: 2015-05-29 12:48:36(0x20)PM [ 97.542667] [c0] exynos-ohci 1552.usb: resume root hub [ 97.548063] [c0] usb 1-2: usb suspend, wakeup 0 [ 97.552730] [c0] hub 1-0:1.0: hub_suspend [ 97.556862] [c0] s2m-rtc s2m-rtc: s2m_rtc_read_time: 2015-05-29 12:48:36(0x20)PM [ 97.563950] [c0] usb usb1: bus suspend, wakeup 0 [ 97.568541] [c0] s2m-rtc s2m-rtc: s2m_rtc_set_alarm: 2015-05-29 12:49:16(0x20)PM [ 97.575972] [c0] s5p-ehci 1551.usb: suspend root hub [ 97.581519] [c0] usb usb1: hcd_bus_suspend: __finished__ it happens later, where is not clear I have no idea why suspending port 1 should cause the system to halt. Does the same problem occur with runtime PM? Runtime PM is enabled by the driver of exynos does not support it. I have cross check with mainline but I don't see any important different with my kernel version. Michael Alan Stern + if (port == 0 (t1 0x01)) { + t2 = ~PORT_SUSPEND; + } + /* * On some controllers, Wake-On-Disconnect will * generate false wakeup signals until the bus * switches over to full-speed idle. For their -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option
Hi Kishon, Arun, On 05/29/2015 02:37 PM, Kishon Vijay Abraham I wrote: Tejun, Maxime, Sylwester, Kyungmin On Thursday 23 April 2015 04:34 AM, Arun Ramamurthy wrote: Most of the phy providers use select to enable GENERIC_PHY. Since select is only recommended when the config is not visible, GENERIC_PHY is changed an invisible option. To maintain consistency, all phy providers are changed to select GENERIC_PHY and all non-phy drivers use depends on when the phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic dependency, so it is left as select. Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com Need your ACK for this patch. For the STi part, you can add my: Acked-by: Maxime Coquelin maxime.coque...@st.com Regards, Maxime -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option
Tejun, Maxime, Sylwester, Kyungmin On Thursday 23 April 2015 04:34 AM, Arun Ramamurthy wrote: Most of the phy providers use select to enable GENERIC_PHY. Since select is only recommended when the config is not visible, GENERIC_PHY is changed an invisible option. To maintain consistency, all phy providers are changed to select GENERIC_PHY and all non-phy drivers use depends on when the phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic dependency, so it is left as select. Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com Need your ACK for this patch. Thanks Kishon --- drivers/ata/Kconfig | 1 - drivers/media/platform/exynos4-is/Kconfig | 2 +- drivers/phy/Kconfig | 4 ++-- drivers/usb/host/Kconfig | 4 ++-- drivers/video/fbdev/exynos/Kconfig| 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 5f60155..6d2e881 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -301,7 +301,6 @@ config SATA_MV tristate Marvell SATA support depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST - select GENERIC_PHY help This option enables support for the Marvell Serial ATA family. Currently supports 88SX[56]0[48][01] PCI(-X) chips, diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index b7b2e47..b6f3eaa 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig @@ -31,7 +31,7 @@ config VIDEO_S5P_FIMC config VIDEO_S5P_MIPI_CSIS tristate S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver depends on REGULATOR - select GENERIC_PHY + depends on GENERIC_PHY help This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 receiver (MIPI-CSIS) devices. diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2962de2..edecdb1 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -5,7 +5,7 @@ menu PHY Subsystem config GENERIC_PHY - bool PHY Core + bool help Generic PHY support. @@ -72,7 +72,7 @@ config PHY_MIPHY365X config PHY_RCAR_GEN2 tristate Renesas R-Car generation 2 USB PHY driver depends on ARCH_SHMOBILE - depends on GENERIC_PHY + select GENERIC_PHY help Support for USB PHY found on Renesas R-Car generation 2 SoCs. diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 5ad60e4..e2197e2 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -182,7 +182,7 @@ config USB_EHCI_HCD_SPEAR config USB_EHCI_HCD_STI tristate Support for ST STiHxxx on-chip EHCI USB controller depends on ARCH_STI OF - select GENERIC_PHY + depends on GENERIC_PHY select USB_EHCI_HCD_PLATFORM help Enable support for the on-chip EHCI controller found on @@ -409,7 +409,7 @@ config USB_OHCI_HCD_SPEAR config USB_OHCI_HCD_STI tristate Support for ST STiHxxx on-chip OHCI USB controller depends on ARCH_STI OF - select GENERIC_PHY + depends on GENERIC_PHY select USB_OHCI_HCD_PLATFORM help Enable support for the on-chip OHCI controller found on diff --git a/drivers/video/fbdev/exynos/Kconfig b/drivers/video/fbdev/exynos/Kconfig index 1f16b46..6c53894 100644 --- a/drivers/video/fbdev/exynos/Kconfig +++ b/drivers/video/fbdev/exynos/Kconfig @@ -16,7 +16,7 @@ if EXYNOS_VIDEO config EXYNOS_MIPI_DSI bool EXYNOS MIPI DSI driver support. - select GENERIC_PHY + depends on GENERIC_PHY help This enables support for MIPI-DSI device. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: DWC3 linux driver query
Hi Felipe, On Thu, May 28, 2015 at 7:41 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Thu, May 28, 2015 at 04:53:09PM +0530, sundeep subbaraya wrote: Hi Felipe and Paul, btw, Paul has left Synopys :-) ahh I see.. I am seeing an issue while testing iperf for USB ethernet gadget with dwc3 controller in 2.0 mode. After debugging I figured out that: 1. Network gadget queues say 3 requests. (for IN endpoint) 2. It turns out with req.no_interrupt flag, DWC3 driver issues START_TRANSFER with req0:IOC, req1, req2:LST 3. As per driver state machine, we get XFERNOTREADY then prepare these TRBs and issue start transfer. Make Endpoint state as Busy. 4. Endpoint state is set to free in XFERINPROGRESS or XFERCOMPLETE event. 5. The issue I see here is there are NAKs going to host (seen in analyzer) in between req0 and req2 hence XFERNOTREADY(Transfer Active) events in between XFERINPROGRESS and XFERCOMPLETE events. 6. As a result, EP is set as free in XFERINPROGRESS, since EP is free start transfer command is issued in XFERNOTREADY handler.The command fails since controller did not release the xfer resource yet. I feel controller behaviour is fine since it sends NAK and writes that event. Driver may have to be modified to make EP as free only in XFERCOMPLETE event handler (ofcourse not for Isoc). this sounds like the correct solution. Note I am testing on a platform which is very slow (the interface between DDR and core runs at 4Mhz). sweet :-) No it is not :) :). I struggled a lot while debugging :( Where as on Zynq (DWC3 in PL), a faster system compared to above one I hey, when will we see a glue layer for Zynq ? :-) we don't have hardware with 2.0 and 3.0 PHY together currently. I will write and test once the hardware is ready :) do not see any NAKs in between Start transfer command and XFERCOMPLETE event. What do you guys say? Do you agree linux driver has to be modified or Core should never issue NAKs in between Start transfer and XFERCOMPLETE? well, if we queued enough transfers, it shouldn't NAK. OTOH, we shouldn't allow for a new StartTransfer command until all pending requests have been transferred. Yes correct but the hardware design is very slow here so hitting this case A patch correcting DEPCMD status macros has been applied. Thank you Felipe for trace points in driver otherwise it would have taken very long time to figure out the root cause :) . yeah, those are really helpful :-) Below is the trace log:(enabled only for IN bulk endpoint) irq/97-dwc3-1308 [001] d... 553.713513: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Not Active irq/97-dwc3-1308 [001] d... 553.713768: dwc3_msg: ep1in-bulk: req ffc039a68580 dma 011c60a2 length 1558 IOC irq/97-dwc3-1308 [001] d... 553.714266: dwc3_msg: ep1in-bulk: req ffc039a687c0 dma 011c10a2 length 1558 irq/97-dwc3-1308 [001] d... 553.714753: dwc3_msg: ep1in-bulk: req ffc039a68700 dma 011c18a2 length 1558 last IOC irq/97-dwc3-1308 [001] d... 553.717768: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.718203: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.718412: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.718638: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.718837: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.719049: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.719248: dwc3_msg: ep1in-bulk XFERINPROGRESS irq/97-dwc3-1308 [001] d... 553.719520: dwc3_msg: request ffc039a68580 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.720225: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.720612: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.720826: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.721026: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.721243: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.721446: dwc3_msg: ep1in-bulk XFERCOMPLETE irq/97-dwc3-1308 [001] d... 553.721711: dwc3_msg: request ffc039a687c0 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.722411: dwc3_msg: request ffc039a68700 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.722910: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Not Active irq/97-dwc3-1308 [001] d... 553.723159: dwc3_msg: ep1in-bulk: req ffc039a68ac0 dma 398b18a2 length 1558 irq/97-dwc3-1308 [001] d... 553.723649: dwc3_msg: ep1in-bulk: req ffc039a68c40 dma 3a1ce8a2 length 1558 irq/97-dwc3-1308 [001] d... 553.724136: dwc3_msg: ep1in-bulk: req
Re: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option
On Fri, May 29, 2015 at 06:07:18PM +0530, Kishon Vijay Abraham I wrote: Tejun, Maxime, Sylwester, Kyungmin On Thursday 23 April 2015 04:34 AM, Arun Ramamurthy wrote: Most of the phy providers use select to enable GENERIC_PHY. Since select is only recommended when the config is not visible, GENERIC_PHY is changed an invisible option. To maintain consistency, all phy providers are changed to select GENERIC_PHY and all non-phy drivers use depends on when the phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic dependency, so it is left as select. Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com Need your ACK for this patch. For ATA part, Acked-by: Tejun Heo t...@kernel.org Thanks. -- tejun -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option
On 29/05/15 14:37, Kishon Vijay Abraham I wrote: Tejun, Maxime, Sylwester, Kyungmin On Thursday 23 April 2015 04:34 AM, Arun Ramamurthy wrote: Most of the phy providers use select to enable GENERIC_PHY. Since select is only recommended when the config is not visible, GENERIC_PHY is changed an invisible option. To maintain consistency, all phy providers are changed to select GENERIC_PHY and all non-phy drivers use depends on when the phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic dependency, so it is left as select. Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com Need your ACK for this patch. For drivers/media/platform/exynos4-is/Kconfig drivers/video/fbdev/exynos/Kconfig Acked-by: Sylwester Nawrocki s.nawro...@samsung.com -- Thanks, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error
On 26.05.2015 17:15, Roger Quadros wrote: From: Kishon Vijay Abraham I kis...@ti.com commit 3b8295d5cbf2 (usb: xhci: Fix suspend/resume when used with OTG core) removes assigning xhci-main_hcd from xhci_gen_setup and adds it in the probe of xhci-plat and xhci-pci. In the case of xhci-pci, xhci_mem_init is invoked before main_hcd is initialized in the probe causing a null pointer deferencing error when a PCIe usb controller card is plugged in. Fix it by initializing xhci-main_hcd in xhci_gen_setup and removing it from xhci_pci_probe(). Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Roger Quadros rog...@ti.com --- drivers/usb/host/xhci-pci.c |1 - drivers/usb/host/xhci.c |1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 11f16cb..67b9529 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -230,7 +230,6 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* USB 2.0 roothub is stored in the PCI device now. */ hcd = dev_get_drvdata(dev-dev); xhci = hcd_to_xhci(hcd); -xhci-main_hcd = hcd; xhci-shared_hcd = usb_create_shared_hcd(driver, dev-dev, pci_name(dev), hcd); if (!xhci-shared_hcd) { diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 397c0dd..b14f572 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4842,6 +4842,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) */ hcd-speed = HCD_USB2; hcd-self.root_hub-speed = USB_SPEED_HIGH; +xhci-main_hcd = hcd; /* * USB 2.0 roothub under xHCI has an integrated TT, * (rate matching hub) as opposed to having an OHCI/UHCI Thanks, As your original patch causing this isn't out yet I'll undo this part from your 5/5 patch. (prevent broken xhci for some unlucky bisecter) -Mathias -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ehci_bus_suspend system halt
Hi On Thu, May 28, 2015 at 01:42:07PM -0400, Alan Stern wrote: On Thu, 28 May 2015, Michael Trimarchi wrote: Hi Alan we are working on a samsung exysnos5430 device and we have some problem during suspend. The only way to solve it seems this patch. We don't really know what could be the problem. Do you have any suggestion to debug it? diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index c254076..6b01784 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -289,14 +289,6 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) if (t1 != t2) { /* +* When suspend bit for PORT 1 is set, +* system halts when spin_unlock_irq() +* called--- why +*/ Ok I have done a small change in my config. I have removed the ohci-exynos support from my config because. I have the hub connected to one port and the 3g connected to another port. With this setup I don't need FS/LS support at all and companion chip. With this config the problem disappear. Michael You didn't say what your problem was, but I guess your system halts. Are you certain the halt occurs when spin_unlock_irq() is called? Did you put printk statements before and after that statement? Maybe the halt actually occurs later. I have no idea why suspending port 1 should cause the system to halt. Does the same problem occur with runtime PM? Alan Stern + if (port == 0 (t1 0x01)) { + t2 = ~PORT_SUSPEND; + } + /* * On some controllers, Wake-On-Disconnect will * generate false wakeup signals until the bus * switches over to full-speed idle. For their -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] drivers:usb:fsl: Fix compilation error for fsl ehci drv
On Fri, 29 May 2015, Ramneek Mehresh wrote: Fix compilation error in fsl ehci drv because ehci_reset() and ehci_adjust_port_wakeup_flags() were not exported, and are used when PM is enabled Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Acked-by: Alan Stern st...@rowland.harvard.edu -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error
Mathias, On 29/05/15 16:19, Mathias Nyman wrote: On 26.05.2015 17:15, Roger Quadros wrote: From: Kishon Vijay Abraham I kis...@ti.com commit 3b8295d5cbf2 (usb: xhci: Fix suspend/resume when used with OTG core) removes assigning xhci-main_hcd from xhci_gen_setup and adds it in the probe of xhci-plat and xhci-pci. In the case of xhci-pci, xhci_mem_init is invoked before main_hcd is initialized in the probe causing a null pointer deferencing error when a PCIe usb controller card is plugged in. Fix it by initializing xhci-main_hcd in xhci_gen_setup and removing it from xhci_pci_probe(). Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Roger Quadros rog...@ti.com --- drivers/usb/host/xhci-pci.c |1 - drivers/usb/host/xhci.c |1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 11f16cb..67b9529 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -230,7 +230,6 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* USB 2.0 roothub is stored in the PCI device now. */ hcd = dev_get_drvdata(dev-dev); xhci = hcd_to_xhci(hcd); -xhci-main_hcd = hcd; xhci-shared_hcd = usb_create_shared_hcd(driver, dev-dev, pci_name(dev), hcd); if (!xhci-shared_hcd) { diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 397c0dd..b14f572 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4842,6 +4842,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) */ hcd-speed = HCD_USB2; hcd-self.root_hub-speed = USB_SPEED_HIGH; +xhci-main_hcd = hcd; /* * USB 2.0 roothub under xHCI has an integrated TT, * (rate matching hub) as opposed to having an OHCI/UHCI Thanks, As your original patch causing this isn't out yet I'll undo this part from your 5/5 patch. (prevent broken xhci for some unlucky bisecter) That is fine. Thanks. cheers, -roger -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/9] xhci features for usb next
Hi Greg These xhci patches for usb-next include Roger Quardros series allowing xhci to work nicely with OTG core. Other patches optimize resume time for xhci, and remove a common quirk that we can detect and handle by default. -Mathias Chris Bainbridge (1): usb: host: xhci: remove incorrect comment about mutex Mathias Nyman (3): xhci: optimize xhci bus resume time xhci: remove XHCI_TRUST_TX_LENGTH quirk and handle it as default xhci: Return correct number of tranferred bytes for stalled control endpoints Roger Quadros (5): usb: xhci: cleanup xhci_hcd allocation usb: xhci: plat: Create both HCDs before adding them usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly usb: xhci: fix xhci locking up during hcd remove usb: xhci: Fix suspend/resume when used with OTG core drivers/usb/host/xhci-hub.c | 65 ++-- drivers/usb/host/xhci-pci.c | 20 ++ drivers/usb/host/xhci-plat.c | 43 +++-- drivers/usb/host/xhci-ring.c | 29 ++-- drivers/usb/host/xhci.c | 44 -- drivers/usb/host/xhci.h | 21 +++--- 6 files changed, 124 insertions(+), 98 deletions(-) -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/9] usb: xhci: fix xhci locking up during hcd remove
From: Roger Quadros rog...@ti.com The problem seems to be that if a new device is detected while we have already removed the shared HCD, then many of the xhci operations (e.g. xhci_alloc_dev(), xhci_setup_device()) hang as command never completes. I don't think XHCI can operate without the shared HCD as we've already called xhci_halt() in xhci_only_stop_hcd() when shared HCD goes away. We need to prevent new commands from being queued not only when HCD is dying but also when HCD is halted. The following lockup was detected while testing the otg state machine. [ 178.199951] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [ 178.205799] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1 [ 178.214458] xhci-hcd xhci-hcd.0.auto: hcc params 0x0220f04c hci version 0x100 quirks 0x00010010 [ 178.223619] xhci-hcd xhci-hcd.0.auto: irq 400, io mem 0x4889 [ 178.230677] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 178.237796] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 178.245358] usb usb1: Product: xHCI Host Controller [ 178.250483] usb usb1: Manufacturer: Linux 4.0.0-rc1-00024-g6111320 xhci-hcd [ 178.257783] usb usb1: SerialNumber: xhci-hcd.0.auto [ 178.267014] hub 1-0:1.0: USB hub found [ 178.272108] hub 1-0:1.0: 1 port detected [ 178.278371] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [ 178.284171] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2 [ 178.294038] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003 [ 178.301183] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 178.308776] usb usb2: Product: xHCI Host Controller [ 178.313902] usb usb2: Manufacturer: Linux 4.0.0-rc1-00024-g6111320 xhci-hcd [ 178.321222] usb usb2: SerialNumber: xhci-hcd.0.auto [ 178.329061] hub 2-0:1.0: USB hub found [ 178.333126] hub 2-0:1.0: 1 port detected [ 178.567585] dwc3 4889.usb: usb_otg_start_host 0 [ 178.572707] xhci-hcd xhci-hcd.0.auto: remove, state 4 [ 178.578064] usb usb2: USB disconnect, device number 1 [ 178.586565] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered [ 178.592585] xhci-hcd xhci-hcd.0.auto: remove, state 1 [ 178.597924] usb usb1: USB disconnect, device number 1 [ 178.603248] usb 1-1: new high-speed USB device number 2 using xhci-hcd [ 190.597337] INFO: task kworker/u4:0:6 blocked for more than 10 seconds. [ 190.604273] Not tainted 4.0.0-rc1-00024-g6111320 #1058 [ 190.610228] echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. [ 190.618443] kworker/u4:0D c05c0ac0 0 6 2 0x [ 190.625120] Workqueue: usb_otg usb_otg_work [ 190.629533] [c05c0ac0] (__schedule) from [c05c10ac] (schedule+0x34/0x98) [ 190.636915] [c05c10ac] (schedule) from [c05c1318] (schedule_preempt_disabled+0xc/0x10) [ 190.645591] [c05c1318] (schedule_preempt_disabled) from [c05c23d0] (mutex_lock_nested+0x1ac/0x3fc) [ 190.655353] [c05c23d0] (mutex_lock_nested) from [c046cf8c] (usb_disconnect+0x3c/0x208) [ 190.664043] [c046cf8c] (usb_disconnect) from [c0470cf0] (_usb_remove_hcd+0x98/0x1d8) [ 190.672535] [c0470cf0] (_usb_remove_hcd) from [c0485da8] (usb_otg_start_host+0x50/0xf4) [ 190.681299] [c0485da8] (usb_otg_start_host) from [c04849a4] (otg_set_protocol+0x5c/0xd0) [ 190.690153] [c04849a4] (otg_set_protocol) from [c0484b88] (otg_set_state+0x170/0xbfc) [ 190.698735] [c0484b88] (otg_set_state) from [c0485740] (otg_statemachine+0x12c/0x470) [ 190.707326] [c0485740] (otg_statemachine) from [c0053c84] (process_one_work+0x1b4/0x4a0) [ 190.716162] [c0053c84] (process_one_work) from [c00540f8] (worker_thread+0x154/0x44c) [ 190.724742] [c00540f8] (worker_thread) from [c0058f88] (kthread+0xd4/0xf0) [ 190.732328] [c0058f88] (kthread) from [c000e810] (ret_from_fork+0x14/0x24) [ 190.739898] 5 locks held by kworker/u4:0/6: [ 190.744274] #0: (%susb_otg){.+.+.+}, at: [c0053bf4] process_one_work+0x124/0x4a0 [ 190.752799] #1: ((otgd-work)){+.+.+.}, at: [c0053bf4] process_one_work+0x124/0x4a0 [ 190.761326] #2: (otgd-fsm.lock){+.+.+.}, at: [c048562c] otg_statemachine+0x18/0x470 [ 190.769934] #3: (usb_bus_list_lock){+.+.+.}, at: [c0470ce8] _usb_remove_hcd+0x90/0x1d8 [ 190.778635] #4: (dev-mutex){..}, at: [c046cf8c] usb_disconnect+0x3c/0x208 [ 190.786700] INFO: task kworker/1:0:14 blocked for more than 10 seconds. [ 190.793633] Not tainted 4.0.0-rc1-00024-g6111320 #1058 [ 190.799567] echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. [ 190.807783] kworker/1:0 D c05c0ac0 014 2 0x [ 190.814457] Workqueue: usb_hub_wq hub_event [ 190.818866] [c05c0ac0] (__schedule) from [c05c10ac] (schedule+0x34/0x98) [ 190.826252] [c05c10ac] (schedule) from [c05c4e40] (schedule_timeout+0x13c/0x1ec) [ 190.834377] [c05c4e40] (schedule_timeout) from [c05c19f0] (wait_for_common+0xbc/0x150) [ 190.843062] [c05c19f0] (wait_for_common) from [bf068a3c]
[PATCH 7/9] xhci: remove XHCI_TRUST_TX_LENGTH quirk and handle it as default
Now including Renesas uPD720201 we got four xhci vendors that return Success instead of short transfer when there are still unstraferred bytes left. The driver anyway checks the untransferred bytes and suggest adding the quirk if needed, so we can as well make it default behavior and get rid of the quirk all together. Cc: Rodrigo Severo rodr...@fabricadeideias.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-pci.c | 3 --- drivers/usb/host/xhci-ring.c | 22 ++ drivers/usb/host/xhci.h | 2 -- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 4a4cb1d..3ebf182 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -103,7 +103,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) QUIRK: Fresco Logic revision %u has broken MSI implementation, pdev-revision); - xhci-quirks |= XHCI_TRUST_TX_LENGTH; } if (pdev-vendor == PCI_VENDOR_ID_NEC) @@ -117,7 +116,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci-quirks |= XHCI_AMD_PLL_FIX; if (pdev-vendor == PCI_VENDOR_ID_AMD) - xhci-quirks |= XHCI_TRUST_TX_LENGTH; if (pdev-vendor == PCI_VENDOR_ID_INTEL) { xhci-quirks |= XHCI_LPM_SUPPORT; @@ -152,7 +150,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) if (pdev-vendor == PCI_VENDOR_ID_ETRON pdev-device == PCI_DEVICE_ID_EJ168) { xhci-quirks |= XHCI_RESET_ON_RESUME; - xhci-quirks |= XHCI_TRUST_TX_LENGTH; xhci-quirks |= XHCI_BROKEN_STREAMS; } if (pdev-vendor == PCI_VENDOR_ID_RENESAS diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d7fd5ef..75d804b 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2009,8 +2009,8 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, frame-status = 0; break; } - if ((xhci-quirks XHCI_TRUST_TX_LENGTH)) - trb_comp_code = COMP_SHORT_TX; + /* If there is data remaining then this is a short transfer */ + trb_comp_code = COMP_SHORT_TX; case COMP_SHORT_TX: frame-status = td-urb-transfer_flags URB_SHORT_NOT_OK ? -EREMOTEIO : 0; @@ -2114,14 +2114,13 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, /* Double check that the HW transferred everything. */ if (event_trb != td-last_trb || EVENT_TRB_LEN(le32_to_cpu(event-transfer_len)) != 0) { - xhci_warn(xhci, WARN Successful completion - on short TX\n); + xhci_warn(xhci, WARN Successful completion on short TX\n); if (td-urb-transfer_flags URB_SHORT_NOT_OK) *status = -EREMOTEIO; else *status = 0; - if ((xhci-quirks XHCI_TRUST_TX_LENGTH)) - trb_comp_code = COMP_SHORT_TX; + /* If there's data remaining this is a short transfer */ + trb_comp_code = COMP_SHORT_TX; } else { *status = 0; } @@ -2282,13 +2281,12 @@ static int handle_tx_event(struct xhci_hcd *xhci, * transfer type */ case COMP_SUCCESS: - if (EVENT_TRB_LEN(le32_to_cpu(event-transfer_len)) == 0) - break; - if (xhci-quirks XHCI_TRUST_TX_LENGTH) + /* some hosts return success in short TX cases, check transfer +* length for unstransferred bytes. +*/ + if (EVENT_TRB_LEN(le32_to_cpu(event-transfer_len)) != 0) trb_comp_code = COMP_SHORT_TX; - else - xhci_warn_ratelimited(xhci, - WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n); + break; case COMP_SHORT_TX: break; case COMP_STOP: diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 11a231d..41e5cf4 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1,4 +1,3 @@ - /* * xHCI host controller driver * @@ -1553,7 +1552,6 @@ struct xhci_hcd { #define XHCI_RESET_ON_RESUME (1 7) #defineXHCI_SW_BW_CHECKING (1 8) #define XHCI_AMD_0x96_HOST (1 9) -#define XHCI_TRUST_TX_LENGTH (1 10)
[PATCH 9/9] usb: host: xhci: remove incorrect comment about mutex
From: Chris Bainbridge chris.bainbri...@gmail.com The comment stating that xhci_setup_device() is protected by the address mutex is not true since commit 6fecd4f2a58c (USB: separate usb_address0 mutexes for each bus) as xhci handles two buses. Signed-off-by: Chris Bainbridge chris.bainbri...@gmail.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e5568ba..afccda7 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3764,8 +3764,6 @@ disable_slot: /* * Issue an Address Device command and optionally send a corresponding * SetAddress request to the device. - * We should be protected by the usb_address0_mutex in hub_wq's hub_port_init, - * so we should only issue and wait on one address command at the same time. */ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, enum xhci_setup_dev setup) -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/9] usb: xhci: Fix suspend/resume when used with OTG core
From: Roger Quadros rog...@ti.com In the OTG case, the controller might not yet have been added or is removed before the system suspends. Assign xhci-main_hcd during probe to prevent NULL pointer de-reference in xhci_suspend/resume(). Use the hcd-state flag to check if HCD is halted and if that is so do nothing for xhci_suspend/resume(). [Only for xhci-plat devices, pci devices need it in gen_setup -Mathias] Signed-off-by: Roger Quadros rog...@ti.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-plat.c | 1 + drivers/usb/host/xhci.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 267787a..890ad9d 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -140,6 +140,7 @@ static int xhci_plat_probe(struct platform_device *pdev) xhci = hcd_to_xhci(hcd); xhci-clk = clk; + xhci-main_hcd = hcd; xhci-shared_hcd = usb_create_shared_hcd(driver, pdev-dev, dev_name(pdev-dev), hcd); if (!xhci-shared_hcd) { diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 8a7e319..e5568ba 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -891,6 +891,9 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) struct usb_hcd *hcd = xhci_to_hcd(xhci); u32 command; + if (!hcd-state) + return 0; + if (hcd-state != HC_STATE_SUSPENDED || xhci-shared_hcd-state != HC_STATE_SUSPENDED) return -EINVAL; @@ -977,6 +980,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) int retval = 0; boolcomp_timer_running = false; + if (!hcd-state) + return 0; + /* Wait a bit if either of the roothubs need to settle from the * transition into bus suspend. */ -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/9] xhci: optimize xhci bus resume time
We used to write the root port state changes in turn for every port, sleeping 20ms after every port state change. Suspended usb2 ports need two state changes, taking minimun 40ms per port. Now instead poll the Port Link State Change (PLC) bit as the state change to U0 will set this bit. Suspended usb2 ports still need the extra 20ms delay, but we now change all the port states at once so we only need to sleep 20ms once all together Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-hub.c | 65 ++--- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 0827d7c..e75c565 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1184,6 +1184,10 @@ int xhci_bus_resume(struct usb_hcd *hcd) struct xhci_bus_state *bus_state; u32 temp; unsigned long flags; + unsigned long port_was_suspended = 0; + bool need_usb2_u3_exit = false; + int slot_id; + int sret; max_ports = xhci_get_ports(hcd, port_array); bus_state = xhci-bus_state[hcd_index(hcd)]; @@ -1207,7 +1211,6 @@ int xhci_bus_resume(struct usb_hcd *hcd) /* Check whether need resume ports. If needed resume port and disable remote wakeup */ u32 temp; - int slot_id; temp = readl(port_array[port_index]); if (DEV_SUPERSPEED(temp)) @@ -1216,39 +1219,47 @@ int xhci_bus_resume(struct usb_hcd *hcd) temp = ~(PORT_RWC_BITS | PORT_WAKE_BITS); if (test_bit(port_index, bus_state-bus_suspended) (temp PORT_PLS_MASK)) { - if (DEV_SUPERSPEED(temp)) { - xhci_set_link_state(xhci, port_array, - port_index, XDEV_U0); - } else { + set_bit(port_index, port_was_suspended); + if (!DEV_SUPERSPEED(temp)) { xhci_set_link_state(xhci, port_array, port_index, XDEV_RESUME); - - spin_unlock_irqrestore(xhci-lock, flags); - msleep(20); - spin_lock_irqsave(xhci-lock, flags); - - xhci_set_link_state(xhci, port_array, - port_index, XDEV_U0); + need_usb2_u3_exit = true; } - /* wait for the port to enter U0 and report port link -* state change. -*/ - spin_unlock_irqrestore(xhci-lock, flags); - msleep(20); - spin_lock_irqsave(xhci-lock, flags); - - /* Clear PLC */ - xhci_test_and_clear_bit(xhci, port_array, port_index, - PORT_PLC); - - slot_id = xhci_find_slot_id_by_port(hcd, - xhci, port_index + 1); - if (slot_id) - xhci_ring_device(xhci, slot_id); } else writel(temp, port_array[port_index]); } + if (need_usb2_u3_exit) { + spin_unlock_irqrestore(xhci-lock, flags); + msleep(20); + spin_lock_irqsave(xhci-lock, flags); + } + + port_index = max_ports; + while (port_index--) { + if (!(port_was_suspended BIT(port_index))) + continue; + /* Clear PLC to poll it later after XDEV_U0 */ + xhci_test_and_clear_bit(xhci, port_array, port_index, PORT_PLC); + xhci_set_link_state(xhci, port_array, port_index, XDEV_U0); + } + + port_index = max_ports; + while (port_index--) { + if (!(port_was_suspended BIT(port_index))) + continue; + /* Poll and Clear PLC */ + sret = xhci_handshake(port_array[port_index], PORT_PLC, + PORT_PLC, 10 * 1000); + if (sret) + xhci_warn(xhci, port %d resume PLC timeout\n, + port_index); + xhci_test_and_clear_bit(xhci, port_array, port_index, PORT_PLC); + slot_id = xhci_find_slot_id_by_port(hcd, xhci, port_index + 1); + if (slot_id) + xhci_ring_device(xhci, slot_id); + } + (void) readl(xhci-op_regs-command); bus_state-next_statechange = jiffies + msecs_to_jiffies(5); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe
[PATCH 3/9] usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly
From: Roger Quadros rog...@ti.com Don't set xhci-shared_hcd to NULL in xhci_stop() as we have still not de-allocated it. It was resulting in a NULL pointer de-reference if usb_add/remove_hcd() is called repeatedly. We want repeated add/remove to work for the OTG use case. Signed-off-by: Roger Quadros rog...@ti.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 01118f7..8a7e319 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -660,12 +660,6 @@ static void xhci_only_stop_hcd(struct usb_hcd *hcd) spin_lock_irq(xhci-lock); xhci_halt(xhci); - - /* The shared_hcd is going to be deallocated shortly (the USB core only -* calls this function when allocation fails in usb_add_hcd(), or -* usb_remove_hcd() is called). So we need to unset xHCI's pointer. -*/ - xhci-shared_hcd = NULL; spin_unlock_irq(xhci-lock); } -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/9] xhci: Return correct number of tranferred bytes for stalled control endpoints
Fix the xhci driver from bluntly setting the transferred length to 0 if we get a STALL on anything else than the data stage of a control transfer. Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 75d804b..383f9ad 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1934,7 +1934,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, td-urb-actual_length = td-urb-transfer_buffer_length - EVENT_TRB_LEN(le32_to_cpu(event-transfer_len)); - else + else if (!td-urb_length_set) td-urb-actual_length = 0; return finish_td(xhci, td, event_trb, event, ep, status, false); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/9] usb: xhci: plat: Create both HCDs before adding them
From: Roger Quadros rog...@ti.com As xhci_hcd is now allocated by usb_create_hcd(), we don't need to add the primary HCD before creating the shared HCD. Creating the shared HCD before adding the primary HCD is particularly useful for the OTG use case so that we know at the OTG core if the HCD is in single configuration or dual (primary + shared) configuration. Signed-off-by: Roger Quadros rog...@ti.com [Mathias: rearranged to fit on top of the Marvell Armada 385 phy changes] Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-plat.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 0bc4309..267787a 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -136,21 +136,15 @@ static int xhci_plat_probe(struct platform_device *pdev) goto disable_clk; } - ret = usb_add_hcd(hcd, irq, IRQF_SHARED); - if (ret) - goto disable_clk; - device_wakeup_enable(hcd-self.controller); - /* USB 2.0 roothub is stored in the platform_device now. */ - hcd = platform_get_drvdata(pdev); xhci = hcd_to_xhci(hcd); xhci-clk = clk; xhci-shared_hcd = usb_create_shared_hcd(driver, pdev-dev, dev_name(pdev-dev), hcd); if (!xhci-shared_hcd) { ret = -ENOMEM; - goto dealloc_usb2_hcd; + goto disable_clk; } if ((node of_property_read_bool(node, usb3-lpm-capable)) || @@ -172,21 +166,26 @@ static int xhci_plat_probe(struct platform_device *pdev) goto put_usb3_hcd; } - ret = usb_add_hcd(xhci-shared_hcd, irq, IRQF_SHARED); + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_usb_phy; + ret = usb_add_hcd(xhci-shared_hcd, irq, IRQF_SHARED); + if (ret) + goto dealloc_usb2_hcd; + return 0; + +dealloc_usb2_hcd: + usb_remove_hcd(hcd); + disable_usb_phy: usb_phy_shutdown(hcd-usb_phy); put_usb3_hcd: usb_put_hcd(xhci-shared_hcd); -dealloc_usb2_hcd: - usb_remove_hcd(hcd); - disable_clk: if (!IS_ERR(clk)) clk_disable_unprepare(clk); @@ -205,9 +204,10 @@ static int xhci_plat_remove(struct platform_device *dev) usb_remove_hcd(xhci-shared_hcd); usb_phy_shutdown(hcd-usb_phy); - usb_put_hcd(xhci-shared_hcd); usb_remove_hcd(hcd); + usb_put_hcd(xhci-shared_hcd); + if (!IS_ERR(clk)) clk_disable_unprepare(clk); usb_put_hcd(hcd); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/9] usb: xhci: cleanup xhci_hcd allocation
From: Roger Quadros rog...@ti.com HCD core allocates memory for HCD private data in usb_create_[shared_]hcd() so make use of that mechanism to allocate the struct xhci_hcd. Introduce struct xhci_driver_overrides to provide the size of HCD private data and hc_driver operation overrides. As of now we only need to override the reset and start methods. Signed-off-by: Roger Quadros rog...@ti.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-pci.c | 17 - drivers/usb/host/xhci-plat.c | 18 ++ drivers/usb/host/xhci.c | 30 +- drivers/usb/host/xhci.h | 19 +-- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 2af32e2..4a4cb1d 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -45,6 +45,13 @@ static const char hcd_name[] = xhci_hcd; static struct hc_driver __read_mostly xhci_pci_hc_driver; +static int xhci_pci_setup(struct usb_hcd *hcd); + +static const struct xhci_driver_overrides xhci_pci_overrides __initconst = { + .extra_priv_size = sizeof(struct xhci_hcd), + .reset = xhci_pci_setup, +}; + /* called after powerup, by probe or system-pm wakeup */ static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev) { @@ -206,7 +213,6 @@ static int xhci_pci_setup(struct usb_hcd *hcd) if (!retval) return retval; - kfree(xhci); return retval; } @@ -247,11 +253,6 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) goto dealloc_usb2_hcd; } - /* Set the xHCI pointer before xhci_pci_setup() (aka hcd_driver.reset) -* is called by usb_add_hcd(). -*/ - *((struct xhci_hcd **) xhci-shared_hcd-hcd_priv) = xhci; - retval = usb_add_hcd(xhci-shared_hcd, dev-irq, IRQF_SHARED); if (retval) @@ -290,8 +291,6 @@ static void xhci_pci_remove(struct pci_dev *dev) /* Workaround for spurious wakeups at shutdown with HSW */ if (xhci-quirks XHCI_SPURIOUS_WAKEUP) pci_set_power_state(dev, PCI_D3hot); - - kfree(xhci); } #ifdef CONFIG_PM @@ -379,7 +378,7 @@ static struct pci_driver xhci_pci_driver = { static int __init xhci_pci_init(void) { - xhci_init_driver(xhci_pci_hc_driver, xhci_pci_setup); + xhci_init_driver(xhci_pci_hc_driver, xhci_pci_overrides); #ifdef CONFIG_PM xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend; xhci_pci_hc_driver.pci_resume = xhci_pci_resume; diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 783e819..0bc4309 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -26,6 +26,15 @@ static struct hc_driver __read_mostly xhci_plat_hc_driver; +static int xhci_plat_setup(struct usb_hcd *hcd); +static int xhci_plat_start(struct usb_hcd *hcd); + +static const struct xhci_driver_overrides xhci_plat_overrides __initconst = { + .extra_priv_size = sizeof(struct xhci_hcd), + .reset = xhci_plat_setup, + .start = xhci_plat_start, +}; + static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { /* @@ -147,11 +156,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if ((node of_property_read_bool(node, usb3-lpm-capable)) || (pdata pdata-usb3_lpm_capable)) xhci-quirks |= XHCI_LPM_SUPPORT; - /* -* Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset) -* is called by usb_add_hcd(). -*/ - *((struct xhci_hcd **) xhci-shared_hcd-hcd_priv) = xhci; if (HCC_MAX_PSA(xhci-hcc_params) = 4) xhci-shared_hcd-can_do_streams = 1; @@ -207,7 +211,6 @@ static int xhci_plat_remove(struct platform_device *dev) if (!IS_ERR(clk)) clk_disable_unprepare(clk); usb_put_hcd(hcd); - kfree(xhci); return 0; } @@ -271,8 +274,7 @@ MODULE_ALIAS(platform:xhci-hcd); static int __init xhci_plat_init(void) { - xhci_init_driver(xhci_plat_hc_driver, xhci_plat_setup); - xhci_plat_hc_driver.start = xhci_plat_start; + xhci_init_driver(xhci_plat_hc_driver, xhci_plat_overrides); return platform_driver_register(usb_xhci_driver); } module_init(xhci_plat_init); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ec8ac16..01118f7 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4832,10 +4832,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) hcd-self.no_stop_on_short = 1; if (usb_hcd_is_primary_hcd(hcd)) { - xhci = kzalloc(sizeof(struct xhci_hcd), GFP_KERNEL); - if (!xhci) - return -ENOMEM; - *((struct xhci_hcd **) hcd-hcd_priv) =
Re: [PATCH 7/9] xhci: remove XHCI_TRUST_TX_LENGTH quirk and handle it as default
On Fri, May 29, 2015 at 11:01 AM, Mathias Nyman mathias.ny...@linux.intel.com wrote: Now including Renesas uPD720201 we got four xhci vendors that return Success instead of short transfer when there are still unstraferred bytes left. The driver anyway checks the untransferred bytes and suggest adding the quirk if needed, so we can as well make it default behavior and get rid of the quirk all together. Cc: Rodrigo Severo rodr...@fabricadeideias.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-pci.c | 3 --- drivers/usb/host/xhci-ring.c | 22 ++ drivers/usb/host/xhci.h | 2 -- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 4a4cb1d..3ebf182 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -103,7 +103,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) QUIRK: Fresco Logic revision %u has broken MSI implementation, pdev-revision); - xhci-quirks |= XHCI_TRUST_TX_LENGTH; } if (pdev-vendor == PCI_VENDOR_ID_NEC) @@ -117,7 +116,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci-quirks |= XHCI_AMD_PLL_FIX; if (pdev-vendor == PCI_VENDOR_ID_AMD) - xhci-quirks |= XHCI_TRUST_TX_LENGTH; You should remove the whole if statement here, not only the XHCI_TRUST_TX_LENGTH setting. Rodrigo -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option
Hi, On Fri, May 29, 2015 at 05:04:38PM +0530, Kishon Vijay Abraham I wrote: Hi Felipe, On Wednesday 27 May 2015 12:09 AM, Felipe Balbi wrote: On Tue, May 26, 2015 at 11:37:17AM -0700, Arun Ramamurthy wrote: Hi On 15-05-26 07:19 AM, Felipe Balbi wrote: HI, On Mon, May 25, 2015 at 02:19:58PM -0700, Arun Ramamurthy wrote: On 15-05-14 05:52 PM, Felipe Balbi wrote: Hi, On Wed, Apr 22, 2015 at 04:04:10PM -0700, Arun Ramamurthy wrote: Most of the phy providers use select to enable GENERIC_PHY. Since select is only recommended when the config is not visible, GENERIC_PHY is changed an invisible option. To maintain consistency, all phy providers are changed to select GENERIC_PHY and all non-phy drivers use depends on when the phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic dependency, so it is left as select. Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com --- drivers/ata/Kconfig | 1 - drivers/media/platform/exynos4-is/Kconfig | 2 +- drivers/phy/Kconfig | 4 ++-- drivers/usb/host/Kconfig | 4 ++-- drivers/video/fbdev/exynos/Kconfig| 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 5f60155..6d2e881 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -301,7 +301,6 @@ config SATA_MV tristate Marvell SATA support depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST - select GENERIC_PHY help This option enables support for the Marvell Serial ATA family. Currently supports 88SX[56]0[48][01] PCI(-X) chips, diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index b7b2e47..b6f3eaa 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig @@ -31,7 +31,7 @@ config VIDEO_S5P_FIMC config VIDEO_S5P_MIPI_CSIS tristate S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver depends on REGULATOR - select GENERIC_PHY + depends on GENERIC_PHY help This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 receiver (MIPI-CSIS) devices. diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2962de2..edecdb1 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -5,7 +5,7 @@ menu PHY Subsystem config GENERIC_PHY - bool PHY Core + bool help Generic PHY support. @@ -72,7 +72,7 @@ config PHY_MIPHY365X config PHY_RCAR_GEN2 tristate Renesas R-Car generation 2 USB PHY driver depends on ARCH_SHMOBILE - depends on GENERIC_PHY + select GENERIC_PHY so some you changed from depends to select... help Support for USB PHY found on Renesas R-Car generation 2 SoCs. diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 5ad60e4..e2197e2 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -182,7 +182,7 @@ config USB_EHCI_HCD_SPEAR config USB_EHCI_HCD_STI tristate Support for ST STiHxxx on-chip EHCI USB controller depends on ARCH_STI OF - select GENERIC_PHY + depends on GENERIC_PHY while others you changed from select to depends. NAK. Felipe, I dont understand your concern, could you please explain it more detail? The logic behind the changes is that in cases where there was an explicit dependency, I changed it to depends on and in other cases I changed it to selects. Thanks Since GENERIC_PHY is visible from Kconfig, it would be much nicer to avoid select altogether. Felipe, after discussion with the maintainers, I have made GENERIC_PHY an invisible option as part of this change. Thanks Then, if the option is invisible, how can you depend on it ? It can never be selected by poking around in Kconfig. IMO, it's counterintuitive that you need to enable a PHY driver before you can see your EHCI/OHCI/whatever controller listed in Kconfig. If the controller requires PHY for it to be functional, it is okay to make the controller depend on PHY IMHO. We want to try and minimize the usage of 'select' wherever possible or else 'select' is the most intuitive way. The other option is just to leave the 'depends on' and let the user select PHY. How can you 'depend' on something that the user can't select by navigating through Kconfig ? -- balbi signature.asc Description: Digital signature
[PATCH v3 1/6] dt-bindings: Add Marvell PXA1928 USB and HSIC PHY bindings
Add PHY binding for Marvell PXA1928 SOC's USB and HSIC PHYs. Signed-off-by: Rob Herring r...@kernel.org Cc: Pawel Moll pawel.m...@arm.com Cc: Mark Rutland mark.rutl...@arm.com Cc: Ian Campbell ijc+devicet...@hellion.org.uk Cc: Kumar Gala ga...@codeaurora.org Cc: devicet...@vger.kernel.org --- .../devicetree/bindings/phy/pxa1928-usb-phy.txt| 18 ++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt diff --git a/Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt b/Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt new file mode 100644 index 000..660a13c --- /dev/null +++ b/Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt @@ -0,0 +1,18 @@ +* Marvell PXA1928 USB and HSIC PHYs + +Required properties: +- compatible: marvell,pxa1928-usb-phy or marvell,pxa1928-hsic-phy +- reg: base address and length of the registers +- clocks - A single clock. From common clock binding. +- #phys-cells: should be 0. From commmon phy binding. +- resets: reference to the reset controller + +Example: + + usbphy: phy@7000 { + compatible = marvell,pxa1928-usb-phy; + reg = 0x7000 0xe0; + clocks = apmu_clocks PXA1928_CLK_USB; + #phy-cells = 0; + }; + -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: DWC3 linux driver query
On Fri, May 29, 2015 at 07:01:16PM +0530, sundeep subbaraya wrote: Hi Felipe, On Thu, May 28, 2015 at 7:41 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Thu, May 28, 2015 at 04:53:09PM +0530, sundeep subbaraya wrote: Hi Felipe and Paul, btw, Paul has left Synopys :-) ahh I see.. I am seeing an issue while testing iperf for USB ethernet gadget with dwc3 controller in 2.0 mode. After debugging I figured out that: 1. Network gadget queues say 3 requests. (for IN endpoint) 2. It turns out with req.no_interrupt flag, DWC3 driver issues START_TRANSFER with req0:IOC, req1, req2:LST 3. As per driver state machine, we get XFERNOTREADY then prepare these TRBs and issue start transfer. Make Endpoint state as Busy. 4. Endpoint state is set to free in XFERINPROGRESS or XFERCOMPLETE event. 5. The issue I see here is there are NAKs going to host (seen in analyzer) in between req0 and req2 hence XFERNOTREADY(Transfer Active) events in between XFERINPROGRESS and XFERCOMPLETE events. 6. As a result, EP is set as free in XFERINPROGRESS, since EP is free start transfer command is issued in XFERNOTREADY handler.The command fails since controller did not release the xfer resource yet. I feel controller behaviour is fine since it sends NAK and writes that event. Driver may have to be modified to make EP as free only in XFERCOMPLETE event handler (ofcourse not for Isoc). this sounds like the correct solution. Note I am testing on a platform which is very slow (the interface between DDR and core runs at 4Mhz). sweet :-) No it is not :) :). I struggled a lot while debugging :( Where as on Zynq (DWC3 in PL), a faster system compared to above one I hey, when will we see a glue layer for Zynq ? :-) we don't have hardware with 2.0 and 3.0 PHY together currently. I will write and test once the hardware is ready :) do not see any NAKs in between Start transfer command and XFERCOMPLETE event. What do you guys say? Do you agree linux driver has to be modified or Core should never issue NAKs in between Start transfer and XFERCOMPLETE? well, if we queued enough transfers, it shouldn't NAK. OTOH, we shouldn't allow for a new StartTransfer command until all pending requests have been transferred. Yes correct but the hardware design is very slow here so hitting this case A patch correcting DEPCMD status macros has been applied. Thank you Felipe for trace points in driver otherwise it would have taken very long time to figure out the root cause :) . yeah, those are really helpful :-) Below is the trace log:(enabled only for IN bulk endpoint) irq/97-dwc3-1308 [001] d... 553.713513: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Not Active irq/97-dwc3-1308 [001] d... 553.713768: dwc3_msg: ep1in-bulk: req ffc039a68580 dma 011c60a2 length 1558 IOC irq/97-dwc3-1308 [001] d... 553.714266: dwc3_msg: ep1in-bulk: req ffc039a687c0 dma 011c10a2 length 1558 irq/97-dwc3-1308 [001] d... 553.714753: dwc3_msg: ep1in-bulk: req ffc039a68700 dma 011c18a2 length 1558 last IOC irq/97-dwc3-1308 [001] d... 553.717768: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.718203: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.718412: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.718638: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.718837: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.719049: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.719248: dwc3_msg: ep1in-bulk XFERINPROGRESS irq/97-dwc3-1308 [001] d... 553.719520: dwc3_msg: request ffc039a68580 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.720225: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.720612: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.720826: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.721026: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.721243: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.721446: dwc3_msg: ep1in-bulk XFERCOMPLETE irq/97-dwc3-1308 [001] d... 553.721711: dwc3_msg: request ffc039a687c0 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.722411: dwc3_msg: request ffc039a68700 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.722910: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Not Active irq/97-dwc3-1308 [001] d... 553.723159: dwc3_msg: ep1in-bulk: req ffc039a68ac0 dma 398b18a2 length 1558
Re: [PATCH] usb: gadget: nokia: Add mass storage driver to g_nokia
On Thu, May 28, 2015 at 11:40:07PM +0200, Pali Rohár wrote: On Thursday 28 May 2015 18:34:31 Felipe Balbi wrote: On Thu, May 28, 2015 at 04:59:18PM +0200, Pali Rohár wrote: On Thursday 28 May 2015 16:51:07 Krzysztof Opasiak wrote: On 05/28/2015 04:31 PM, Pali Rohár wrote: On Thursday 28 May 2015 16:27:44 Krzysztof Opasiak wrote: On 05/28/2015 09:47 AM, Pali Rohár wrote: On Saturday 31 January 2015 10:53:30 Pali Rohár wrote: This patch adds removable mass storage support to g_nokia gadget (for N900). It means that at runtime block device can be exported or unexported. So it does not export anything by default and thus allows to use MyDocs partition as before... Signed-off-by: Pali Rohár pali.ro...@gmail.com --- drivers/usb/gadget/legacy/Kconfig |1 + drivers/usb/gadget/legacy/nokia.c | 102 - 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/legacy/Kconfig b/drivers/usb/gadget/legacy/Kconfig index fd48ef3..36f6ba4 100644 --- a/drivers/usb/gadget/legacy/Kconfig +++ b/drivers/usb/gadget/legacy/Kconfig @@ -345,6 +345,7 @@ config USB_G_NOKIA select USB_F_OBEX select USB_F_PHONET select USB_F_ECM + select USB_F_MASS_STORAGE help The Nokia composite gadget provides support for acm, obex and phonet in only one composite gadget driver. diff --git a/drivers/usb/gadget/legacy/nokia.c b/drivers/usb/gadget/legacy/nokia.c index 9b8fd70..a09bb50 100644 --- a/drivers/usb/gadget/legacy/nokia.c +++ b/drivers/usb/gadget/legacy/nokia.c @@ -24,6 +24,7 @@ #include u_phonet.h #include u_ecm.h #include gadget_chips.h +#include f_mass_storage.h /* Defines */ @@ -34,6 +35,29 @@ USB_GADGET_COMPOSITE_OPTIONS(); USB_ETHERNET_MODULE_PARAMETERS(); +static struct fsg_module_parameters fsg_mod_data = { + .stall = 0, + .luns = 2, + .removable_count = 2, + .removable = { 1, 1, }, +}; + +FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data); + +#ifdef CONFIG_USB_GADGET_DEBUG_FILES + +static unsigned int fsg_num_buffers = CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS; + +#else + +/* + * Number of buffers we will use. + * 2 is usually enough for good buffering pipeline + */ +#define fsg_num_buffers CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS + +#endif /* CONFIG_USB_DEBUG */ + #define NOKIA_VENDOR_ID 0x0421 /* Nokia */ #define NOKIA_PRODUCT_ID 0x01c8 /* Nokia Gadget */ @@ -94,6 +118,8 @@ static struct usb_function *f_obex1_cfg2; static struct usb_function *f_obex2_cfg2; static struct usb_function *f_phonet_cfg1; static struct usb_function *f_phonet_cfg2; +static struct usb_function *f_msg_cfg1; +static struct usb_function *f_msg_cfg2; static struct usb_configuration nokia_config_500ma_driver = { @@ -117,6 +143,7 @@ static struct usb_function_instance *fi_ecm; static struct usb_function_instance *fi_obex1; static struct usb_function_instance *fi_obex2; static struct usb_function_instance *fi_phonet; +static struct usb_function_instance *fi_msg; static int __init nokia_bind_config(struct usb_configuration *c) { @@ -125,6 +152,8 @@ static int __init nokia_bind_config(struct usb_configuration *c) struct usb_function *f_obex1 = NULL; struct usb_function *f_ecm; struct usb_function *f_obex2 = NULL; + struct usb_function *f_msg; + struct fsg_opts *fsg_opts; int status = 0; int obex1_stat = -1; int obex2_stat = -1; @@ -160,6 +189,12 @@ static int __init nokia_bind_config(struct usb_configuration *c) goto err_get_ecm; } + f_msg = usb_get_function(fi_msg); + if (IS_ERR(f_msg)) { + status = PTR_ERR(f_msg); + goto err_get_msg; + } + if (!IS_ERR_OR_NULL(f_phonet)) { phonet_stat = usb_add_function(c, f_phonet); if (phonet_stat) @@ -187,21 +222,36 @@ static int __init nokia_bind_config(struct usb_configuration *c) pr_debug(could not bind ecm config %d\n, status); goto err_ecm; } + + fsg_opts = fsg_opts_from_func_inst(fi_msg); + + status = fsg_common_run_thread(fsg_opts-common); + if (status) + goto err_msg; + + status = usb_add_function(c, f_msg); + if (status) + goto err_msg; + if (c == nokia_config_500ma_driver) { f_acm_cfg1 =
[PATCH v3 5/6] usb: chipidea: allow multiple instances to use default ci_default_pdata
Currently, ci_default_pdata is common to all instances of the driver and gets modified by the core driver code. This is bad if there are multiple instances of the device with different settings such as the phy type. Fix this by making a copy of the default platform_data. Signed-off-by: Rob Herring r...@kernel.org Cc: Peter Chen peter.c...@freescale.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-usb@vger.kernel.org --- drivers/usb/chipidea/ci_hdrc_usb2.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index 45844c9..9eae1a1 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -25,7 +25,7 @@ struct ci_hdrc_usb2_priv { struct clk *clk; }; -static struct ci_hdrc_platform_data ci_default_pdata = { +static const struct ci_hdrc_platform_data ci_default_pdata = { .capoffset = DEF_CAPOFFSET, .flags = CI_HDRC_DISABLE_STREAMING, }; @@ -37,8 +37,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); int ret; - if (!ci_pdata) - ci_pdata = ci_default_pdata; + if (!ci_pdata) { + ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); + *ci_pdata = ci_default_pdata; /* struct copy */ + } priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/6] dt-bindings: Consolidate ChipIdea USB ci13xxx bindings
Combine the ChipIdea USB binding into a single document to reduce duplication and fragmentation. This marks use of the old PHY bindings as deprecated. Future compatible bindings should use generic PHY binding. Signed-off-by: Rob Herring r...@kernel.org Cc: Ivan T. Ivanov iiva...@mm-sol.com Cc: Peter Chen peter.c...@freescale.com Cc: Daniel Tang dt.ta...@gmail.com Cc: Pawel Moll pawel.m...@arm.com Cc: Mark Rutland mark.rutl...@arm.com Cc: Ian Campbell ijc+devicet...@hellion.org.uk Cc: Kumar Gala ga...@codeaurora.org Cc: devicet...@vger.kernel.org --- .../devicetree/bindings/usb/ci-hdrc-imx.txt| 35 -- .../devicetree/bindings/usb/ci-hdrc-qcom.txt | 17 --- .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 22 +- .../devicetree/bindings/usb/ci-hdrc-zevio.txt | 17 --- 4 files changed, 21 insertions(+), 70 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-zevio.txt diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt deleted file mode 100644 index 38a5480..000 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt +++ /dev/null @@ -1,35 +0,0 @@ -* Freescale i.MX ci13xxx usb controllers - -Required properties: -- compatible: Should be fsl,imx27-usb -- reg: Should contain registers location and length -- interrupts: Should contain controller interrupt -- fsl,usbphy: phandle of usb phy that connects to the port - -Recommended properies: -- phy_type: the type of the phy connected to the core. Should be one - of utmi, utmi_wide, ulpi, serial or hsic. Without this - property the PORTSC register won't be touched -- dr_mode: One of host, peripheral or otg. Defaults to otg - -Optional properties: -- fsl,usbmisc: phandler of non-core register device, with one argument - that indicate usb controller index -- vbus-supply: regulator for vbus -- disable-over-current: disable over current detect -- external-vbus-divider: enables off-chip resistor divider for Vbus -- maximum-speed: limit the maximum connection speed to full-speed. -- tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts - -Examples: -usb@02184000 { /* USB OTG */ - compatible = fsl,imx6q-usb, fsl,imx27-usb; - reg = 0x02184000 0x200; - interrupts = 0 43 0x04; - fsl,usbphy = usbphy1; - fsl,usbmisc = usbmisc 0; - disable-over-current; - external-vbus-divider; - maximum-speed = full-speed; - tpl-support; -}; diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt deleted file mode 100644 index f2899b5..000 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt +++ /dev/null @@ -1,17 +0,0 @@ -Qualcomm CI13xxx (Chipidea) USB controllers - -Required properties: -- compatible: should contain qcom,ci-hdrc -- reg: offset and length of the register set in the memory map -- interrupts: interrupt-specifier for the controller interrupt. -- usb-phy: phandle for the PHY device -- dr_mode: Should be peripheral - -Examples: - gadget@f9a55000 { - compatible = qcom,ci-hdrc; - reg = 0xf9a55000 0x400; - dr_mode = peripheral; - interrupts = 0 134 0; - usb-phy = usbphy0; - }; diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt index 27f8b1e..553e2fa 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt @@ -1,15 +1,35 @@ * USB2 ChipIdea USB controller for ci13xxx Required properties: -- compatible: should be chipidea,usb2 +- compatible: should be one of: + fsl,imx27-usb + lsi,zevio-usb + qcom,ci-hdrc + chipidea,usb2 - reg: base address and length of the registers - interrupts: interrupt for the USB controller +Recommended properies: +- phy_type: the type of the phy connected to the core. Should be one + of utmi, utmi_wide, ulpi, serial or hsic. Without this + property the PORTSC register won't be touched. +- dr_mode: One of host, peripheral or otg. Defaults to otg + +Deprecated properties: +- usb-phy: phandle for the PHY device. Use phys instead. +- fsl,usbphy: phandle of usb phy that connects to the port. Use phys instead. + Optional properties: - clocks: reference to the USB clock - phys: reference to the USB PHY - phy-names: should be usb-phy - vbus-supply: reference to the VBUS regulator +- maximum-speed: limit the maximum connection speed to full-speed. +- tpl-support: TPL (Targeted Peripheral List) feature for targeted hosts +- fsl,usbmisc: (FSL only) phandler of non-core register device, with one + argument
[PATCH v3 6/6] usb: chipidea: add work-around for Marvell HSIC PHY startup
The Marvell 28nm HSIC PHY requires the port to be forced to HS mode after the port power is applied. This is done using the test mode in the PORTSC register. As HSIC is always HS, this work-around should be safe to do with all HSIC PHYs and has been tested on i.MX6S. Signed-off-by: Rob Herring r...@kernel.org Tested-by: Peter Chen peter.c...@freescale.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-usb@vger.kernel.org --- drivers/usb/chipidea/host.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 21fe1a3..6cf87b8 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -37,12 +37,14 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd); struct ehci_ci_priv { struct regulator *reg_vbus; + struct ci_hdrc *ci; }; static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci-priv; + struct ci_hdrc *ci = priv-ci; struct device *dev = hcd-self.controller; int ret = 0; int port = HCS_N_PORTS(ehci-hcs_params); @@ -64,6 +66,15 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) return ret; } } + + if (enable (ci-platdata-phy_mode == USBPHY_INTERFACE_MODE_HSIC)) { + /* +* Marvell 28nm HSIC PHY requires forcing the port to HS mode. +* As HSIC is always HS, this should be safe for others. +*/ + hw_port_test_set(ci, 5); + hw_port_test_set(ci, 0); + } return 0; }; @@ -112,6 +123,7 @@ static int host_start(struct ci_hdrc *ci) priv = (struct ehci_ci_priv *)ehci-priv; priv-reg_vbus = NULL; + priv-ci = ci; if (ci-platdata-reg_vbus !ci_otg_is_fsm_mode(ci)) { if (ci-platdata-flags CI_HDRC_TURN_VBUS_EARLY_ON) { -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: dwc3: gadget: don't clear EP_BUSY too early
In case of non-Isochronous transfers, we don't want to clear DWC3_EP_BUSY flag until XferComplete event. That's because XferInProgress was only enabled so we can recycle TRBs and usb_requests quicker, but there are still other pending requests being transferred. In order to make sure we don't allow for another StartTransfer command while the HW is still processing other transfers, we must keep DWC3_EP_BUSY flag set and this what this patch does. Fixes: f3af36511e60 (usb: dwc3: gadget: always enable IOC on bulk/interrupt transfers) Cc: sta...@vger.kernel.org # v3.15+ Reported-by: sundeep subbaraya sundeep.l...@gmail.com Tested-by: sundeep subbaraya sundeep.l...@gmail.com Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/gadget.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 55b5edc19119..333a7c0078fc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1906,12 +1906,16 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc, { unsignedstatus = 0; int clean_busy; + u32 is_xfer_complete; + + is_xfer_complete = (event-endpoint_event == DWC3_DEPEVT_XFERCOMPLETE); if (event-status DEPEVT_STATUS_BUSERR) status = -ECONNRESET; clean_busy = dwc3_cleanup_done_reqs(dwc, dep, event, status); - if (clean_busy) + if (clean_busy (is_xfer_complete || + usb_endpoint_xfer_isoc(dep-endpoint.desc))) dep-flags = ~DWC3_EP_BUSY; /* -- 2.4.0.rc3 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/6] phy: add Marvell HSIC 28nm PHY
Add PHY driver for the Marvell HSIC 28nm PHY. This PHY is found in PXA1928 SOC. Signed-off-by: Rob Herring r...@kernel.org Cc: Kishon Vijay Abraham I kis...@ti.com --- drivers/phy/Kconfig | 10 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-pxa-28nm-hsic.c | 220 3 files changed, 231 insertions(+) create mode 100644 drivers/phy/phy-pxa-28nm-hsic.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 71409a1..7d56c44 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -52,6 +52,16 @@ config PHY_EXYNOS_MIPI_VIDEO Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P and EXYNOS SoCs. +config PHY_PXA_28NM_HSIC + tristate Marvell USB HSIC 28nm PHY Driver + select GENERIC_PHY + help + Enable this to support Marvell USB HSIC PHY driver for Marvell + SoC. This driver will do the PHY initialization and shutdown. + The PHY driver will be used by Marvell ehci driver. + + To compile this driver as a module, choose M here. + config PHY_PXA_28NM_USB2 tristate Marvell USB 2.0 28nm PHY Driver select GENERIC_PHY diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 8524307..2c16963 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_PHY_PXA_28NM_USB2)+= phy-pxa-28nm-usb2.o +obj-$(CONFIG_PHY_PXA_28NM_HSIC)+= phy-pxa-28nm-hsic.o obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_PHY_MIPHY28LP)+= phy-miphy28lp.o obj-$(CONFIG_PHY_MIPHY365X)+= phy-miphy365x.o diff --git a/drivers/phy/phy-pxa-28nm-hsic.c b/drivers/phy/phy-pxa-28nm-hsic.c new file mode 100644 index 000..234aacf --- /dev/null +++ b/drivers/phy/phy-pxa-28nm-hsic.c @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2015 Linaro, Ltd. + * Rob Herring r...@kernel.org + * + * Based on vendor driver: + * Copyright (C) 2013 Marvell Inc. + * Author: Chao Xie xiechao.m...@gmail.com + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include linux/delay.h +#include linux/slab.h +#include linux/of.h +#include linux/io.h +#include linux/err.h +#include linux/clk.h +#include linux/module.h +#include linux/platform_device.h +#include linux/phy/phy.h + +#define PHY_28NM_HSIC_CTRL 0x08 +#define PHY_28NM_HSIC_IMPCAL_CAL 0x18 +#define PHY_28NM_HSIC_PLL_CTRL01 0x1c +#define PHY_28NM_HSIC_PLL_CTRL20x20 +#define PHY_28NM_HSIC_INT 0x28 + +#define PHY_28NM_HSIC_PLL_SELLPFR_SHIFT26 +#define PHY_28NM_HSIC_PLL_FBDIV_SHIFT 0 +#define PHY_28NM_HSIC_PLL_REFDIV_SHIFT 9 + +#define PHY_28NM_HSIC_S2H_PU_PLL BIT(10) +#define PHY_28NM_HSIC_H2S_PLL_LOCK BIT(15) +#define PHY_28NM_HSIC_S2H_HSIC_EN BIT(7) +#define S2H_DRV_SE0_4RESUMEBIT(14) +#define PHY_28NM_HSIC_H2S_IMPCAL_DONE BIT(27) + +#define PHY_28NM_HSIC_CONNECT_INT BIT(1) +#define PHY_28NM_HSIC_HS_READY_INT BIT(2) + +struct mv_hsic_phy { + struct phy *phy; + struct platform_device *pdev; + void __iomem*base; + struct clk *clk; +}; + +static bool wait_for_reg(void __iomem *reg, u32 mask, unsigned long timeout) +{ + timeout += jiffies; + while (time_is_after_eq_jiffies(timeout)) { + if ((readl(reg) mask) == mask) + return true; + msleep(1); + } + return false; +} + +static int mv_hsic_phy_init(struct phy *phy) +{ + struct mv_hsic_phy *mv_phy = phy_get_drvdata(phy); + struct platform_device *pdev = mv_phy-pdev; + void __iomem *base = mv_phy-base; + + clk_prepare_enable(mv_phy-clk); + + /* Set reference clock */ + writel(0x1 PHY_28NM_HSIC_PLL_SELLPFR_SHIFT | + 0xf0 PHY_28NM_HSIC_PLL_FBDIV_SHIFT | + 0xd PHY_28NM_HSIC_PLL_REFDIV_SHIFT, + base + PHY_28NM_HSIC_PLL_CTRL01); + + /* Turn on PLL */ + writel(readl(base + PHY_28NM_HSIC_PLL_CTRL2) | + PHY_28NM_HSIC_S2H_PU_PLL, + base + PHY_28NM_HSIC_PLL_CTRL2); + + /* Make sure PHY PLL is locked */ + if
[PATCH v3 2/6] phy: Add Marvell USB 2.0 OTG 28nm PHY
Add driver for USB 28nm PHY found in Marvell PXA1928 SOC. Signed-off-by: Rob Herring r...@kernel.org Cc: Kishon Vijay Abraham I kis...@ti.com --- drivers/phy/Kconfig | 10 ++ drivers/phy/Makefile| 1 + drivers/phy/phy-pxa-28nm-usb2.c | 355 3 files changed, 366 insertions(+) create mode 100644 drivers/phy/phy-pxa-28nm-usb2.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a53bd5b..71409a1 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -52,6 +52,16 @@ config PHY_EXYNOS_MIPI_VIDEO Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P and EXYNOS SoCs. +config PHY_PXA_28NM_USB2 + tristate Marvell USB 2.0 28nm PHY Driver + select GENERIC_PHY + help + Enable this to support Marvell USB 2.0 PHY driver for Marvell + SoC. This driver will do the PHY initialization and shutdown. + The PHY driver will be used by Marvell udc/ehci/otg driver. + + To compile this driver as a module, choose M here. + config PHY_MVEBU_SATA def_bool y depends on ARCH_DOVE || MACH_DOVE || MACH_KIRKWOOD diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index f126251..8524307 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY)+= phy-armada375-usb2.o obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o +obj-$(CONFIG_PHY_PXA_28NM_USB2)+= phy-pxa-28nm-usb2.o obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_PHY_MIPHY28LP)+= phy-miphy28lp.o obj-$(CONFIG_PHY_MIPHY365X)+= phy-miphy365x.o diff --git a/drivers/phy/phy-pxa-28nm-usb2.c b/drivers/phy/phy-pxa-28nm-usb2.c new file mode 100644 index 000..37e9c8c --- /dev/null +++ b/drivers/phy/phy-pxa-28nm-usb2.c @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2015 Linaro, Ltd. + * Rob Herring r...@kernel.org + * + * Based on vendor driver: + * Copyright (C) 2013 Marvell Inc. + * Author: Chao Xie xiechao.m...@gmail.com + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include linux/delay.h +#include linux/slab.h +#include linux/of.h +#include linux/of_device.h +#include linux/io.h +#include linux/err.h +#include linux/clk.h +#include linux/module.h +#include linux/platform_device.h +#include linux/phy/phy.h + +/* USB PXA1928 PHY mapping */ +#define PHY_28NM_PLL_REG0 0x0 +#define PHY_28NM_PLL_REG1 0x4 +#define PHY_28NM_CAL_REG 0x8 +#define PHY_28NM_TX_REG0 0x0c +#define PHY_28NM_TX_REG1 0x10 +#define PHY_28NM_RX_REG0 0x14 +#define PHY_28NM_RX_REG1 0x18 +#define PHY_28NM_DIG_REG0 0x1c +#define PHY_28NM_DIG_REG1 0x20 +#define PHY_28NM_TEST_REG0 0x24 +#define PHY_28NM_TEST_REG1 0x28 +#define PHY_28NM_MOC_REG 0x2c +#define PHY_28NM_PHY_RESERVE 0x30 +#define PHY_28NM_OTG_REG 0x34 +#define PHY_28NM_CHRG_DET 0x38 +#define PHY_28NM_CTRL_REG0 0xc4 +#define PHY_28NM_CTRL_REG1 0xc8 +#define PHY_28NM_CTRL_REG2 0xd4 +#define PHY_28NM_CTRL_REG3 0xdc + +/* PHY_28NM_PLL_REG0 */ +#define PHY_28NM_PLL_READY BIT(31) + +#define PHY_28NM_PLL_SELLPFR_SHIFT 28 +#define PHY_28NM_PLL_SELLPFR_MASK (0x3 28) + +#define PHY_28NM_PLL_FBDIV_SHIFT 16 +#define PHY_28NM_PLL_FBDIV_MASK(0x1ff 16) + +#define PHY_28NM_PLL_ICP_SHIFT 8 +#define PHY_28NM_PLL_ICP_MASK (0x7 8) + +#define PHY_28NM_PLL_REFDIV_SHIFT 0 +#define PHY_28NM_PLL_REFDIV_MASK 0x7f + +/* PHY_28NM_PLL_REG1 */ +#define PHY_28NM_PLL_PU_BY_REG BIT(1) + +#define PHY_28NM_PLL_PU_PLLBIT(0) + +/* PHY_28NM_CAL_REG */ +#define PHY_28NM_PLL_PLLCAL_DONE BIT(31) + +#define PHY_28NM_PLL_IMPCAL_DONE BIT(23) + +#define PHY_28NM_PLL_KVCO_SHIFT16 +#define PHY_28NM_PLL_KVCO_MASK (0x7 16) + +#define PHY_28NM_PLL_CAL12_SHIFT 20 +#define
[PATCH v3 0/6] Marvell PXA1928 USB support
This series adds USB PHYs and EHCI host drivers for the Marvell PXA1928 SOC. The OTG block is based on ChipIdea and works with the chipidea,usb2 compatible driver as is just by adding the PHY driver. Yay! After more testing it turns out the EHCI host is also based on ChipIdea too. So this version uses the ChipIdea driver for both. A couple of fixes are needed to make the ChipIdea driver work with the PXA1928 EHCI host. Rob v3: - Clarify FSL only binding properties. - Add owner field to phy_ops. - Restructure split between PHY init/power_on and power_off/exit. - Fix PHY error path handling. - drop unrelated change in ci_hdrc_usb2.c. - Add Peter's tested-by. v2: - Use ChipIdea driver for EHCI host, dropping the Marvell specific EHCI driver - Consolidate ChipIdea bindings to single common doc. - rename phy driver files to phy-pxa-28nm-{usb2,hsic}.c - Simplified work-around for HSIC phy/controller handshake. Rob Herring (6): dt-bindings: Add Marvell PXA1928 USB and HSIC PHY bindings phy: Add Marvell USB 2.0 OTG 28nm PHY phy: add Marvell HSIC 28nm PHY dt-bindings: Consolidate ChipIdea USB ci13xxx bindings usb: chipidea: allow multiple instances to use default ci_default_pdata usb: chipidea: add work-around for Marvell HSIC PHY startup .../devicetree/bindings/phy/pxa1928-usb-phy.txt| 18 ++ .../devicetree/bindings/usb/ci-hdrc-imx.txt| 35 -- .../devicetree/bindings/usb/ci-hdrc-qcom.txt | 17 - .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 22 +- .../devicetree/bindings/usb/ci-hdrc-zevio.txt | 17 - drivers/phy/Kconfig| 20 ++ drivers/phy/Makefile | 2 + drivers/phy/phy-pxa-28nm-hsic.c| 220 + drivers/phy/phy-pxa-28nm-usb2.c| 355 + drivers/usb/chipidea/ci_hdrc_usb2.c| 8 +- drivers/usb/chipidea/host.c| 12 + 11 files changed, 653 insertions(+), 73 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/pxa1928-usb-phy.txt delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-imx.txt delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt delete mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-zevio.txt create mode 100644 drivers/phy/phy-pxa-28nm-hsic.c create mode 100644 drivers/phy/phy-pxa-28nm-usb2.c -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: DWC3 linux driver query
Hi, On Fri, May 29, 2015 at 8:35 PM, Felipe Balbi ba...@ti.com wrote: On Fri, May 29, 2015 at 07:01:16PM +0530, sundeep subbaraya wrote: Hi Felipe, On Thu, May 28, 2015 at 7:41 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Thu, May 28, 2015 at 04:53:09PM +0530, sundeep subbaraya wrote: Hi Felipe and Paul, btw, Paul has left Synopys :-) ahh I see.. I am seeing an issue while testing iperf for USB ethernet gadget with dwc3 controller in 2.0 mode. After debugging I figured out that: 1. Network gadget queues say 3 requests. (for IN endpoint) 2. It turns out with req.no_interrupt flag, DWC3 driver issues START_TRANSFER with req0:IOC, req1, req2:LST 3. As per driver state machine, we get XFERNOTREADY then prepare these TRBs and issue start transfer. Make Endpoint state as Busy. 4. Endpoint state is set to free in XFERINPROGRESS or XFERCOMPLETE event. 5. The issue I see here is there are NAKs going to host (seen in analyzer) in between req0 and req2 hence XFERNOTREADY(Transfer Active) events in between XFERINPROGRESS and XFERCOMPLETE events. 6. As a result, EP is set as free in XFERINPROGRESS, since EP is free start transfer command is issued in XFERNOTREADY handler.The command fails since controller did not release the xfer resource yet. I feel controller behaviour is fine since it sends NAK and writes that event. Driver may have to be modified to make EP as free only in XFERCOMPLETE event handler (ofcourse not for Isoc). this sounds like the correct solution. Note I am testing on a platform which is very slow (the interface between DDR and core runs at 4Mhz). sweet :-) No it is not :) :). I struggled a lot while debugging :( Where as on Zynq (DWC3 in PL), a faster system compared to above one I hey, when will we see a glue layer for Zynq ? :-) we don't have hardware with 2.0 and 3.0 PHY together currently. I will write and test once the hardware is ready :) do not see any NAKs in between Start transfer command and XFERCOMPLETE event. What do you guys say? Do you agree linux driver has to be modified or Core should never issue NAKs in between Start transfer and XFERCOMPLETE? well, if we queued enough transfers, it shouldn't NAK. OTOH, we shouldn't allow for a new StartTransfer command until all pending requests have been transferred. Yes correct but the hardware design is very slow here so hitting this case A patch correcting DEPCMD status macros has been applied. Thank you Felipe for trace points in driver otherwise it would have taken very long time to figure out the root cause :) . yeah, those are really helpful :-) Below is the trace log:(enabled only for IN bulk endpoint) irq/97-dwc3-1308 [001] d... 553.713513: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Not Active irq/97-dwc3-1308 [001] d... 553.713768: dwc3_msg: ep1in-bulk: req ffc039a68580 dma 011c60a2 length 1558 IOC irq/97-dwc3-1308 [001] d... 553.714266: dwc3_msg: ep1in-bulk: req ffc039a687c0 dma 011c10a2 length 1558 irq/97-dwc3-1308 [001] d... 553.714753: dwc3_msg: ep1in-bulk: req ffc039a68700 dma 011c18a2 length 1558 last IOC irq/97-dwc3-1308 [001] d... 553.717768: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.718203: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.718412: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.718638: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.718837: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.719049: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.719248: dwc3_msg: ep1in-bulk XFERINPROGRESS irq/97-dwc3-1308 [001] d... 553.719520: dwc3_msg: request ffc039a68580 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.720225: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.720612: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.720826: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.721026: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Active irq/97-dwc3-1308 [001] d... 553.721243: dwc3_msg: ep1in-bulk EP BUSY irq/97-dwc3-1308 [001] d... 553.721446: dwc3_msg: ep1in-bulk XFERCOMPLETE irq/97-dwc3-1308 [001] d... 553.721711: dwc3_msg: request ffc039a687c0 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.722411: dwc3_msg: request ffc039a68700 from ep1in-bulk completed 1558/1558 === 0 irq/97-dwc3-1308 [001] d... 553.722910: dwc3_msg: ep1in-bulk XFERNOTREADY.Transfer Not Active irq/97-dwc3-1308 [001] d... 553.723159: