RE: [PATCH v2 2/4] usb: renesas_usbhs: gadget: fix the behavior of pullup
Hi Morimoto-san, Hi shimoda-san From: Takeshi Kihara takeshi.kihara...@renesas.com This patch fixes an issue that this driver always enable the D+ pullup after it detected the VBUS connection even though this usb controller can control the D+ pullup timing by software. So, this driver should enable the D+ pullup after a gadget driver called usb_gadget_connect(). Signed-off-by: Takeshi Kihara takeshi.kihara...@renesas.com Signed-off-by: Kazuya Mizuguchi kazuya.mizuguchi...@renesas.com Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- (snip) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2d0903f..0d50be0 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -56,6 +56,8 @@ struct usbhsg_gpriv { #define USBHSG_STATUS_REGISTERD(1 1) #define USBHSG_STATUS_WEDGE(1 2) #define USBHSG_STATUS_SELF_POWERED (1 3) + + unsignedsoftconnect:1; }; We can re-use USBHSG_STATUS_xxx instead of new variable ? renesas_usb driver has usbhsg_status_xxx() macro. Thank you for the review. Yes, we can re-use that. So, I will fix this patch. Best regards, Yoshihiro Shimoda Best regards --- Kuninori Morimoto -- 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 v3] cdc-acm: ensure that termios get set when the port is activated
On Wed, Oct 29, 2014 at 08:53:14PM -0400, Jim Paris wrote: The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris j...@jtan.com --- Switched to Johan's suggestion of using a prototype rather than moving acm_tty_set_termios. This depends on his patch in order to get proper DTR handling. Thanks, Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..d2cd1b6d02a7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + Nit: Would you mind placing the prototype after all data declarations (i.e. below acm_table_lock)? static DEFINE_MUTEX(acm_table_lock); Thanks, Johan -- 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: cdc-acm: add device id for GW Instek AFG-2225
On Thu, 2014-10-30 at 02:19 +0100, Peter Stuge wrote: Oliver Neukum wrote: Then I guess I'll take no further action in kernel space. I for one would like the kernel messages to be less prominent, if they stay at all. I am removing them. Regards Oliver -- 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: cdc-acm: only raise DTR on transitions from B0
On Wed, 2014-10-29 at 16:58 +0100, Johan Hovold wrote: On Wed, Oct 29, 2014 at 11:56:02PM +0800, Greg Kroah-Hartman wrote: This should go to older kernels as well, right? Yes, if you want. It's fixing handling of B0, but I doubt many people care (hence the missing stable tag). Note that set_termios is currently not called during open() (but Jim's patch will be relying on this one). It may not hit many people, but whom it hits, it hits hard. It should go into stable. Regards Oliver -- 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: dogfooding fedora 21 - usb printers mtp devices
Hi, On 10/29/2014 11:32 PM, Alon Levy wrote: Hey, how are you? have you noticed problems with $SUBJECT? I have a continuously disconnecting printer. Using XHCI (T440p) getting a repeat of: [105574.775812] usblp 3-6:1.0: usblp0: USB Bidirectional printer dev 27 if 0 alt 0 proto 2 vid 0x03F0 pid 0x3F17 [105579.001841] usb 3-6: USB disconnect, device number 27 And with the MTP device (a sony player) there are multiple problems, but a recent regression is now the major one, from just not working correctly (could copy files but the device would not play them) now it never properly gets a configuration: https://github.com/alon/kernel-bug-reports/issues/1 I didn't manage to really google any of these properly, which is why I'm asking you, in case you have the cycles to give me some pointers. I'm not aware of any issues with such devices. For the printer problem you should probably send a detailed bug report to linux-usb linux-usb@vger.kernel.org For the mtp regression you should probably first try to pinpoint the cause, try downgrading the kernel to a known working f20 kernel, if that does not help, the cause likely is some userspace component (e.g. libmtp). Regards, Hans -- 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 v4 19/20] usb: dwc3: add support for AMD Nolan platform
This patch adds support for AMD Nolan (NL) FPGA and SoC platform. Cc: Jason Chang jason.ch...@amd.com Signed-off-by: Huang Rui ray.hu...@amd.com --- drivers/usb/dwc3/dwc3-pci.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index ada975f..257fb3f9e 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -145,6 +145,28 @@ static int dwc3_pci_probe(struct pci_dev *pci, res[1].name = dwc_usb3; res[1].flags= IORESOURCE_IRQ; + if (pci-vendor == PCI_VENDOR_ID_AMD + pci-device == PCI_DEVICE_ID_AMD_NL_USB) { + dwc3_pdata.has_lpm_erratum = true; + dwc3_pdata.lpm_nyet_threshold = 0xf; + + dwc3_pdata.u2exit_lfps_quirk = true; + dwc3_pdata.u2ss_inp3_quirk = true; + dwc3_pdata.req_p1p2p3_quirk = true; + dwc3_pdata.del_p1p2p3_quirk = true; + dwc3_pdata.del_phy_power_chg_quirk = true; + dwc3_pdata.lfps_filter_quirk = true; + dwc3_pdata.rx_detect_poll_quirk = true; + + dwc3_pdata.tx_de_emphasis_quirk = true; + dwc3_pdata.tx_de_emphasis = 1; + + /* FIXME these quirks should move when AMD NL taps out */ + dwc3_pdata.disable_scramble_quirk = true; + dwc3_pdata.dis_u3_susphy_quirk = true; + dwc3_pdata.dis_u2_susphy_quirk = true; + } + ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res)); if (ret) { dev_err(dev, couldn't add resources to dwc3 device\n); @@ -194,6 +216,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, { }/* Terminating Entry */ }; MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); -- 1.9.1 -- 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 v4 18/20] PCI: Prevent xHCI driver from claiming AMD Nolan USB3 DRD device
The AMD Nolan (NL) SoC contains a DesignWare USB3 Dual-Role Device that can be operated either as a USB Host or a USB Device. In the AMD NL platform, this device ([1022:7912]) has a class code of PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will claim it. But the dwc3 driver is a more specific driver for this device, and we'd prefer to use it instead of xhci. To prevent xhci from claiming the device, change the class code to 0x0c03fe, which the PCI r3.0 spec defines as USB device (not host controller). The dwc3 driver can then claim it based on its Vendor and Device ID. Suggested-by: Heikki Krogerus heikki.kroge...@linux.intel.com Acked-by: Bjorn Helgaas bhelg...@google.com Cc: Jason Chang jason.ch...@amd.com Signed-off-by: Huang Rui ray.hu...@amd.com --- drivers/pci/quirks.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 90acb32..ed6f89b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -379,6 +379,26 @@ static void quirk_ati_exploding_mce(struct pci_dev *dev) DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, quirk_ati_exploding_mce); /* + * In the AMD NL platform, this device ([1022:7912]) has a class code of + * PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will + * claim it. + * But the dwc3 driver is a more specific driver for this device, and we'd + * prefer to use it instead of xhci. To prevent xhci from claiming the + * device, change the class code to 0x0c03fe, which the PCI r3.0 spec + * defines as USB device (not host controller). The dwc3 driver can then + * claim it based on its Vendor and Device ID. + */ +static void quirk_amd_nl_class(struct pci_dev *pdev) +{ + /* +* Use 'USB Device' (0x0c03fe) instead of PCI header provided +*/ + pdev-class = 0x0c03fe; +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, + quirk_amd_nl_class); + +/* * Let's make the southbridge information explicit instead * of having to worry about people probing the ACPI areas, * for example.. (Yes, it happens, and if you read the wrong -- 1.9.1 -- 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 v4 17/20] PCI: Add support for AMD Nolan USB3 DRD
This patch adds PCI id for USB3 Dual-Role Device of AMD Nolan (NL) SoC. It will be used for PCI quirks and DWC3 device driver. Signed-off-by: Jason Chang jason.ch...@amd.com Signed-off-by: Huang Rui ray.hu...@amd.com Acked-by: Bjorn Helgaas bhelg...@google.com --- include/linux/pci_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 1fa99a3..5decad7 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -562,6 +562,7 @@ #define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 #define PCI_DEVICE_ID_AMD_8131_APIC0x7451 #define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 +#define PCI_DEVICE_ID_AMD_NL_USB 0x7912 #define PCI_DEVICE_ID_AMD_CS5535_IDE0x208F #define PCI_DEVICE_ID_AMD_CS5536_ISA0x2090 #define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 -- 1.9.1 -- 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 v4 20/20] usb: dwc3: make HIRD threshold configurable
HIRD threshold should be configurable by different platforms. From DesignWare databook: When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1. When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1. Signed-off-by: Huang Rui ray.hu...@amd.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ drivers/usb/dwc3/core.c| 17 + drivers/usb/dwc3/core.h| 6 ++ drivers/usb/dwc3/gadget.c | 6 +- drivers/usb/dwc3/platform_data.h | 3 +++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index feaf2c8..5b99755 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -34,6 +34,9 @@ Optional properties: LTSSM during USB3 Compliance mode. - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. + - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal + utmi_l1_suspend_n, false when asserts utmi_sleep_n + - snps,hird-threshold: HIRD threshold This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a28ed1c..f4172ab 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -729,6 +729,7 @@ static int dwc3_probe(struct platform_device *pdev) struct dwc3 *dwc; u8 lpm_nyet_threshold; u8 tx_de_emphasis; + u8 hird_threshold; int ret; @@ -790,12 +791,22 @@ static int dwc3_probe(struct platform_device *pdev) /* default to -3.5dB de-emphasis */ tx_de_emphasis = 1; + /* +* defalut to assert utmi_sleep_n and use maximum allowed HIRD +* threshold value of 0b1100 +*/ + hird_threshold = 12; + if (node) { dwc-maximum_speed = of_usb_get_maximum_speed(node); dwc-has_lpm_erratum = of_property_read_bool(node, snps,has-lpm-erratum); of_property_read_u8(node, snps,lpm-nyet-threshold, lpm_nyet_threshold); + dwc-is_utmi_l1_suspend = of_property_read_bool(node, + snps,is-utmi-l1-suspend); + of_property_read_u8(node, snps,hird-threshold, + hird_threshold); dwc-needs_fifo_resize = of_property_read_bool(node, tx-fifo-resize); @@ -831,6 +842,9 @@ static int dwc3_probe(struct platform_device *pdev) dwc-has_lpm_erratum = pdata-has_lpm_erratum; if (pdata-lpm_nyet_threshold) lpm_nyet_threshold = pdata-lpm_nyet_threshold; + dwc-is_utmi_l1_suspend = pdata-is_utmi_l1_suspend; + if (pdata-hird_threshold) + hird_threshold = pdata-hird_threshold; dwc-needs_fifo_resize = pdata-tx_fifo_resize; dwc-dr_mode = pdata-dr_mode; @@ -858,6 +872,9 @@ static int dwc3_probe(struct platform_device *pdev) dwc-lpm_nyet_threshold = lpm_nyet_threshold; dwc-tx_de_emphasis = tx_de_emphasis; + dwc-hird_threshold = hird_threshold + | (dwc-is_utmi_l1_suspend 4); + ret = dwc3_core_get_phy(dwc); if (ret) return ret; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 8b6c308..2c90139 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -675,12 +675,16 @@ struct dwc3_scratchpad_array { * @test_mode: true when we're entering a USB test mode * @test_mode_nr: test feature selector * @lpm_nyet_threshold: LPM NYET response threshold + * @hird_threshold: HIRD threshold * @delayed_status: true when gadget driver asks for delayed status * @ep0_bounced: true when we used bounce buffer * @ep0_expect_in: true when we expect a DATA IN transfer * @has_hibernation: true when dwc3 was configured with Hibernation * @has_lpm_erratum: true when core was configured with LPM Erratum. Note that * there's now way for software to detect this in runtime. + * @is_utmi_l1_suspend: the core asserts output signal + * 0 - utmi_sleep_n + * 1 - utmi_l1_suspend_n * @is_selfpowered: true when we are selfpowered * @is_fpga: true when we are using the FPGA board * @needs_fifo_resize: not all users might want fifo resizing,
[PATCH v4 16/20] usb: dwc3: add disable usb2 suspend phy quirk
This patch adds disable usb2 suspend phy quirk, and some special platforms can configure that if it is needed. Signed-off-by: Huang Rui ray.hu...@amd.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/dwc3/core.c| 7 +++ drivers/usb/dwc3/core.h| 2 ++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 3720fca..feaf2c8 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -33,6 +33,7 @@ Optional properties: - snps,tx_de_emphasis: the value driven to the PHY is controlled by the LTSSM during USB3 Compliance mode. - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. + - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index fdc715a..a28ed1c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -423,6 +423,10 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-revision DWC3_REVISION_194A) reg |= DWC3_GUSB2PHYCFG_SUSPHY; + /* FIXME will move FPGA flag when AMD NL taps out */ + if (dwc-dis_u2_susphy_quirk dwc-is_fpga) + reg = ~DWC3_GUSB2PHYCFG_SUSPHY; + dwc3_writel(dwc-regs, DWC3_GUSB2PHYCFG(0), reg); mdelay(100); @@ -815,6 +819,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,rx_detect_poll_quirk); dwc-dis_u3_susphy_quirk = of_property_read_bool(node, snps,dis_u3_susphy_quirk); + dwc-dis_u2_susphy_quirk = of_property_read_bool(node, + snps,dis_u2_susphy_quirk); dwc-tx_de_emphasis_quirk = of_property_read_bool(node, snps,tx_de_emphasis_quirk); @@ -838,6 +844,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-lfps_filter_quirk = pdata-lfps_filter_quirk; dwc-rx_detect_poll_quirk = pdata-rx_detect_poll_quirk; dwc-dis_u3_susphy_quirk = pdata-dis_u3_susphy_quirk; + dwc-dis_u2_susphy_quirk = pdata-dis_u2_susphy_quirk; dwc-tx_de_emphasis_quirk = pdata-tx_de_emphasis_quirk; if (pdata-tx_de_emphasis) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index be793f7..8b6c308 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -698,6 +698,7 @@ struct dwc3_scratchpad_array { * @lfps_filter_quirk: set if we enable LFPS filter quirk * @rx_detect_poll_quirk: set if we enable rx_detect to polling LFPS quirk * @dis_u3_susphy_quirk: set if we disable usb3 suspend phy + * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis @@ -820,6 +821,7 @@ struct dwc3 { unsignedlfps_filter_quirk:1; unsignedrx_detect_poll_quirk:1; unsigneddis_u3_susphy_quirk:1; + unsigneddis_u2_susphy_quirk:1; unsignedtx_de_emphasis_quirk:1; unsignedtx_de_emphasis:2; diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index 0f1d5ad..245300b 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -37,6 +37,7 @@ struct dwc3_platform_data { unsigned lfps_filter_quirk:1; unsigned rx_detect_poll_quirk:1; unsigned dis_u3_susphy_quirk:1; + unsigned dis_u2_susphy_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; -- 1.9.1 -- 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 v4 13/20] usb: dwc3: set SUSPHY bit for all cores
It is recommended to set USB3 and USB2 SUSPHY bits to '1' after the core initialization is completed above the dwc3 revision 1.94a. Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/core.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 11b0ab08..e02c3b0 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -374,6 +374,15 @@ static void dwc3_phy_setup(struct dwc3 *dwc) reg = dwc3_readl(dwc-regs, DWC3_GUSB3PIPECTL(0)); + /* +* Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY +* to '0' during coreConsultant configuration. So default value +* will be '0' when the core is reset. Application needs to set it +* to '1' after the core initialization is completed. +*/ + if (dwc-revision DWC3_REVISION_194A) + reg |= DWC3_GUSB3PIPECTL_SUSPHY; + if (dwc-u2ss_inp3_quirk) reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK; @@ -395,6 +404,21 @@ static void dwc3_phy_setup(struct dwc3 *dwc) dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); + + reg = dwc3_readl(dwc-regs, DWC3_GUSB2PHYCFG(0)); + + /* +* Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to +* '0' during coreConsultant configuration. So default value will +* be '0' when the core is reset. Application needs to set it to +* '1' after the core initialization is completed. +*/ + if (dwc-revision DWC3_REVISION_194A) + reg |= DWC3_GUSB2PHYCFG_SUSPHY; + + dwc3_writel(dwc-regs, DWC3_GUSB2PHYCFG(0), reg); + + mdelay(100); } /** -- 1.9.1 -- 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 v4 14/20] usb: dwc3: add Tx de-emphasis quirk
This patch adds Tx de-emphasis quirk, and the Tx de-emphasis value is configurable according to PIPE3 specification. Value Description 0 -6dB de-emphasis 1 -3.5dB de-emphasis 2 No de-emphasis 3 Reserved It can be configured on DT or platform data. Signed-off-by: Huang Rui ray.hu...@amd.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ drivers/usb/dwc3/core.c| 17 + drivers/usb/dwc3/core.h| 11 +++ drivers/usb/dwc3/platform_data.h | 3 +++ 4 files changed, 34 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 38bac28..a9e54ae 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -29,6 +29,9 @@ Optional properties: - snps,lfps_filter_quirk: when set core will filter LFPS reception. - snps,rx_detect_poll_quirk: when set core will disable a 400us delay to start Polling LFPS after RX.Detect. + - snps,tx_de_emphasis_quirk: when set core will set Tx de-emphasis value. + - snps,tx_de_emphasis: the value driven to the PHY is controlled by the + LTSSM during USB3 Compliance mode. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e02c3b0..b55fa5b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -401,6 +401,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-rx_detect_poll_quirk) reg |= DWC3_GUSB3PIPECTL_RX_DETOPOLL; + if (dwc-tx_de_emphasis_quirk) + reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc-tx_de_emphasis); + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); @@ -717,6 +720,7 @@ static int dwc3_probe(struct platform_device *pdev) struct resource *res; struct dwc3 *dwc; u8 lpm_nyet_threshold; + u8 tx_de_emphasis; int ret; @@ -775,6 +779,9 @@ static int dwc3_probe(struct platform_device *pdev) /* default to highest possible threshold */ lpm_nyet_threshold = 0xff; + /* default to -3.5dB de-emphasis */ + tx_de_emphasis = 1; + if (node) { dwc-maximum_speed = of_usb_get_maximum_speed(node); dwc-has_lpm_erratum = of_property_read_bool(node, @@ -802,6 +809,11 @@ static int dwc3_probe(struct platform_device *pdev) snps,lfps_filter_quirk); dwc-rx_detect_poll_quirk = of_property_read_bool(node, snps,rx_detect_poll_quirk); + + dwc-tx_de_emphasis_quirk = of_property_read_bool(node, + snps,tx_de_emphasis_quirk); + of_property_read_u8(node, snps,tx_de_emphasis, + tx_de_emphasis); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -819,6 +831,10 @@ static int dwc3_probe(struct platform_device *pdev) dwc-del_phy_power_chg_quirk = pdata-del_phy_power_chg_quirk; dwc-lfps_filter_quirk = pdata-lfps_filter_quirk; dwc-rx_detect_poll_quirk = pdata-rx_detect_poll_quirk; + + dwc-tx_de_emphasis_quirk = pdata-tx_de_emphasis_quirk; + if (pdata-tx_de_emphasis) + tx_de_emphasis = pdata-tx_de_emphasis; } /* default to superspeed if no maximum_speed passed */ @@ -826,6 +842,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-maximum_speed = USB_SPEED_SUPER; dwc-lpm_nyet_threshold = lpm_nyet_threshold; + dwc-tx_de_emphasis = tx_de_emphasis; ret = dwc3_core_get_phy(dwc); if (ret) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index eeef976..469ee13 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -185,6 +185,8 @@ #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) #define DWC3_GUSB3PIPECTL_LFPSFILT (1 9) #define DWC3_GUSB3PIPECTL_RX_DETOPOLL (1 8) +#define DWC3_GUSB3PIPECTL_TX_DEEPH_MASKDWC3_GUSB3PIPECTL_TX_DEEPH(3) +#define DWC3_GUSB3PIPECTL_TX_DEEPH(n) ((n) 1) /* Global TX Fifo Size Register */ #define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) 0x) @@ -695,6 +697,12 @@ struct dwc3_scratchpad_array { * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk * @lfps_filter_quirk: set if we enable LFPS filter quirk * @rx_detect_poll_quirk: set if we enable rx_detect to polling LFPS quirk + * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk + * @tx_de_emphasis: Tx de-emphasis value + * 0 -
[PATCH v4 10/20] usb: dwc3: add delay phy power change quirk
This patch adds delay PHY power change from P0 to P1/P2/P3 when link state changing from U0 to U1/U2/U3 respectively, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c| 6 ++ drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index a406bb5..216cc35 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -24,6 +24,8 @@ Optional properties: P1/P2/P3 transition sequence. - snps,del_p1p2p3_quirk: when set core will delay P1/P2/P3 until a certain amount of 8B10B errors occur. + - snps,del_phy_power_chg_quirk: when set core will delay PHY power change + from P0 to P1/P2/P3. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 4429de7..deceb7c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -383,6 +383,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-del_p1p2p3_quirk) reg |= DWC3_GUSB3PIPECTL_DEP1P2P3_EN; + if (dwc-del_phy_power_chg_quirk) + reg |= DWC3_GUSB3PIPECTL_DEPOCHANGE; + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); @@ -763,6 +766,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,req_p1p2p3_quirk); dwc-del_p1p2p3_quirk = of_property_read_bool(node, snps,del_p1p2p3_quirk); + dwc-del_phy_power_chg_quirk = of_property_read_bool(node, + snps,del_phy_power_chg_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -777,6 +782,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-u2ss_inp3_quirk = pdata-u2ss_inp3_quirk; dwc-req_p1p2p3_quirk = pdata-req_p1p2p3_quirk; dwc-del_p1p2p3_quirk = pdata-del_p1p2p3_quirk; + dwc-del_phy_power_chg_quirk = pdata-del_phy_power_chg_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 750e473..176f3f1 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -181,6 +181,7 @@ #define DWC3_GUSB3PIPECTL_DEP1P2P3(n) ((n) 19) #define DWC3_GUSB3PIPECTL_DEP1P2P3_MASKDWC3_GUSB3PIPECTL_DEP1P2P3(7) #define DWC3_GUSB3PIPECTL_DEP1P2P3_EN DWC3_GUSB3PIPECTL_DEP1P2P3(1) +#define DWC3_GUSB3PIPECTL_DEPOCHANGE (1 18) #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) /* Global TX Fifo Size Register */ @@ -689,6 +690,7 @@ struct dwc3_scratchpad_array { * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk * @req_p1p2p3_quirk: set if we enable request P1/P2/P3 quirk * @del_p1p2p3_quirk: set if we enable delay P1/P2/P3 quirk + * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -801,6 +803,7 @@ struct dwc3 { unsignedu2ss_inp3_quirk:1; unsignedreq_p1p2p3_quirk:1; unsigneddel_p1p2p3_quirk:1; + unsigneddel_phy_power_chg_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index a421cec..ae67151 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -33,4 +33,5 @@ struct dwc3_platform_data { unsigned u2ss_inp3_quirk:1; unsigned req_p1p2p3_quirk:1; unsigned del_p1p2p3_quirk:1; + unsigned del_phy_power_chg_quirk:1; }; -- 1.9.1 -- 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 v4 07/20] usb: dwc3: add P3 in U2 SS Inactive quirk
This patch adds P3 in U2 SS Inactive quirk, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/dwc3/core.c| 23 +++ drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 28 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 79ed37c..f714357 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -19,6 +19,7 @@ Optional properties: - snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled - snps,lpm-nyet-threshold: LPM NYET threshold - snps,u2exit_lfps_quirk: set if we want to enable U2Exit LFPS quirk + - snps,u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 6d1f09f..0a935cb 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -365,6 +365,24 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc) } /** + * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core + * @dwc: Pointer to our controller context structure + */ +static void dwc3_phy_setup(struct dwc3 *dwc) +{ + u32 reg; + + reg = dwc3_readl(dwc-regs, DWC3_GUSB3PIPECTL(0)); + + if (dwc-u2ss_inp3_quirk) + reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK; + + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); + + mdelay(100); +} + +/** * dwc3_core_init - Low-level initialization of DWC3 Core * @dwc: Pointer to our controller context structure * @@ -486,6 +504,8 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc3_writel(dwc-regs, DWC3_GCTL, reg); + dwc3_phy_setup(dwc); + ret = dwc3_alloc_scratch_buffers(dwc); if (ret) goto err1; @@ -731,6 +751,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,disable_scramble_quirk); dwc-u2exit_lfps_quirk = of_property_read_bool(node, snps,u2exit_lfps_quirk); + dwc-u2ss_inp3_quirk = of_property_read_bool(node, + snps,u2ss_inp3_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -742,6 +764,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-disable_scramble_quirk = pdata-disable_scramble_quirk; dwc-u2exit_lfps_quirk = pdata-u2exit_lfps_quirk; + dwc-u2ss_inp3_quirk = pdata-u2ss_inp3_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 45130a1..3843511 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -176,6 +176,7 @@ /* Global USB3 PIPE Control Register */ #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 31) +#define DWC3_GUSB3PIPECTL_U2SSINP3OK (1 29) #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) /* Global TX Fifo Size Register */ @@ -681,6 +682,7 @@ struct dwc3_scratchpad_array { * @three_stage_setup: set if we perform a three phase setup * @disable_scramble_quirk: set if we enable the disable scramble quirk * @u2exit_lfps_quirk: set if we enable U2Exit LFPS quirk + * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -790,6 +792,7 @@ struct dwc3 { unsigneddisable_scramble_quirk:1; unsignedu2exit_lfps_quirk:1; + unsignedu2ss_inp3_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index 3f21591..cf92c81 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -30,4 +30,5 @@ struct dwc3_platform_data { unsigned disable_scramble_quirk:1; unsigned has_lpm_erratum:1; unsigned u2exit_lfps_quirk:1; + unsigned u2ss_inp3_quirk:1; }; -- 1.9.1 -- 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 v4 11/20] usb: dwc3: add LFPS filter quirk
This patch adds LFPS filter quirk, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/dwc3/core.c| 6 ++ drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 216cc35..0647100 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -26,6 +26,7 @@ Optional properties: amount of 8B10B errors occur. - snps,del_phy_power_chg_quirk: when set core will delay PHY power change from P0 to P1/P2/P3. + - snps,lfps_filter_quirk: when set core will filter LFPS reception. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index deceb7c..ae7ff8f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -386,6 +386,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-del_phy_power_chg_quirk) reg |= DWC3_GUSB3PIPECTL_DEPOCHANGE; + if (dwc-lfps_filter_quirk) + reg |= DWC3_GUSB3PIPECTL_LFPSFILT; + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); @@ -768,6 +771,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,del_p1p2p3_quirk); dwc-del_phy_power_chg_quirk = of_property_read_bool(node, snps,del_phy_power_chg_quirk); + dwc-lfps_filter_quirk = of_property_read_bool(node, + snps,lfps_filter_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -783,6 +788,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-req_p1p2p3_quirk = pdata-req_p1p2p3_quirk; dwc-del_p1p2p3_quirk = pdata-del_p1p2p3_quirk; dwc-del_phy_power_chg_quirk = pdata-del_phy_power_chg_quirk; + dwc-lfps_filter_quirk = pdata-lfps_filter_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 176f3f1..cf9dd73 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -183,6 +183,7 @@ #define DWC3_GUSB3PIPECTL_DEP1P2P3_EN DWC3_GUSB3PIPECTL_DEP1P2P3(1) #define DWC3_GUSB3PIPECTL_DEPOCHANGE (1 18) #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) +#define DWC3_GUSB3PIPECTL_LFPSFILT (1 9) /* Global TX Fifo Size Register */ #define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) 0x) @@ -691,6 +692,7 @@ struct dwc3_scratchpad_array { * @req_p1p2p3_quirk: set if we enable request P1/P2/P3 quirk * @del_p1p2p3_quirk: set if we enable delay P1/P2/P3 quirk * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk + * @lfps_filter_quirk: set if we enable LFPS filter quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -804,6 +806,7 @@ struct dwc3 { unsignedreq_p1p2p3_quirk:1; unsigneddel_p1p2p3_quirk:1; unsigneddel_phy_power_chg_quirk:1; + unsignedlfps_filter_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index ae67151..dad0211 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -34,4 +34,5 @@ struct dwc3_platform_data { unsigned req_p1p2p3_quirk:1; unsigned del_p1p2p3_quirk:1; unsigned del_phy_power_chg_quirk:1; + unsigned lfps_filter_quirk:1; }; -- 1.9.1 -- 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 v4 12/20] usb: dwc3: add rx_detect to polling LFPS quirk
This patch adds RX_DETECT to Polling.LFPS control quirk, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c| 6 ++ drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 0647100..38bac28 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -27,6 +27,8 @@ Optional properties: - snps,del_phy_power_chg_quirk: when set core will delay PHY power change from P0 to P1/P2/P3. - snps,lfps_filter_quirk: when set core will filter LFPS reception. + - snps,rx_detect_poll_quirk: when set core will disable a 400us delay to start + Polling LFPS after RX.Detect. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index ae7ff8f..11b0ab08 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -389,6 +389,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-lfps_filter_quirk) reg |= DWC3_GUSB3PIPECTL_LFPSFILT; + if (dwc-rx_detect_poll_quirk) + reg |= DWC3_GUSB3PIPECTL_RX_DETOPOLL; + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); @@ -773,6 +776,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,del_phy_power_chg_quirk); dwc-lfps_filter_quirk = of_property_read_bool(node, snps,lfps_filter_quirk); + dwc-rx_detect_poll_quirk = of_property_read_bool(node, + snps,rx_detect_poll_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -789,6 +794,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-del_p1p2p3_quirk = pdata-del_p1p2p3_quirk; dwc-del_phy_power_chg_quirk = pdata-del_phy_power_chg_quirk; dwc-lfps_filter_quirk = pdata-lfps_filter_quirk; + dwc-rx_detect_poll_quirk = pdata-rx_detect_poll_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index cf9dd73..eeef976 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -184,6 +184,7 @@ #define DWC3_GUSB3PIPECTL_DEPOCHANGE (1 18) #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) #define DWC3_GUSB3PIPECTL_LFPSFILT (1 9) +#define DWC3_GUSB3PIPECTL_RX_DETOPOLL (1 8) /* Global TX Fifo Size Register */ #define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) 0x) @@ -693,6 +694,7 @@ struct dwc3_scratchpad_array { * @del_p1p2p3_quirk: set if we enable delay P1/P2/P3 quirk * @del_phy_power_chg_quirk: set if we enable delay phy power change quirk * @lfps_filter_quirk: set if we enable LFPS filter quirk + * @rx_detect_poll_quirk: set if we enable rx_detect to polling LFPS quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -807,6 +809,7 @@ struct dwc3 { unsigneddel_p1p2p3_quirk:1; unsigneddel_phy_power_chg_quirk:1; unsignedlfps_filter_quirk:1; + unsignedrx_detect_poll_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index dad0211..4a0f06b 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -35,4 +35,5 @@ struct dwc3_platform_data { unsigned del_p1p2p3_quirk:1; unsigned del_phy_power_chg_quirk:1; unsigned lfps_filter_quirk:1; + unsigned rx_detect_poll_quirk:1; }; -- 1.9.1 -- 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 v4 09/20] usb: dwc3: add delay P1/P2/P3 quirk
This patch adds delay P0 to P1/P2/P3 quirk for U2/U2/U3, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c| 6 ++ drivers/usb/dwc3/core.h| 5 + drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 9de11fd..a406bb5 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -22,6 +22,8 @@ Optional properties: - snps,u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk - snps,req_p1p2p3_quirk: when set, the core will always request for P1/P2/P3 transition sequence. + - snps,del_p1p2p3_quirk: when set core will delay P1/P2/P3 until a certain + amount of 8B10B errors occur. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e951984..4429de7 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -380,6 +380,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-req_p1p2p3_quirk) reg |= DWC3_GUSB3PIPECTL_REQP1P2P3; + if (dwc-del_p1p2p3_quirk) + reg |= DWC3_GUSB3PIPECTL_DEP1P2P3_EN; + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); @@ -758,6 +761,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,u2ss_inp3_quirk); dwc-req_p1p2p3_quirk = of_property_read_bool(node, snps,req_p1p2p3_quirk); + dwc-del_p1p2p3_quirk = of_property_read_bool(node, + snps,del_p1p2p3_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -771,6 +776,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-u2exit_lfps_quirk = pdata-u2exit_lfps_quirk; dwc-u2ss_inp3_quirk = pdata-u2ss_inp3_quirk; dwc-req_p1p2p3_quirk = pdata-req_p1p2p3_quirk; + dwc-del_p1p2p3_quirk = pdata-del_p1p2p3_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index cbb8593..750e473 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -178,6 +178,9 @@ #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 31) #define DWC3_GUSB3PIPECTL_U2SSINP3OK (1 29) #define DWC3_GUSB3PIPECTL_REQP1P2P3(1 24) +#define DWC3_GUSB3PIPECTL_DEP1P2P3(n) ((n) 19) +#define DWC3_GUSB3PIPECTL_DEP1P2P3_MASKDWC3_GUSB3PIPECTL_DEP1P2P3(7) +#define DWC3_GUSB3PIPECTL_DEP1P2P3_EN DWC3_GUSB3PIPECTL_DEP1P2P3(1) #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) /* Global TX Fifo Size Register */ @@ -685,6 +688,7 @@ struct dwc3_scratchpad_array { * @u2exit_lfps_quirk: set if we enable U2Exit LFPS quirk * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk * @req_p1p2p3_quirk: set if we enable request P1/P2/P3 quirk + * @del_p1p2p3_quirk: set if we enable delay P1/P2/P3 quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -796,6 +800,7 @@ struct dwc3 { unsignedu2exit_lfps_quirk:1; unsignedu2ss_inp3_quirk:1; unsignedreq_p1p2p3_quirk:1; + unsigneddel_p1p2p3_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index d3e6ec2..a421cec 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -32,4 +32,5 @@ struct dwc3_platform_data { unsigned u2exit_lfps_quirk:1; unsigned u2ss_inp3_quirk:1; unsigned req_p1p2p3_quirk:1; + unsigned del_p1p2p3_quirk:1; }; -- 1.9.1 -- 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 v4 08/20] usb: dwc3: add request P1/P2/P3 quirk
This patch adds request P1/P2/P3 quirk for U2/U2/U3, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c| 6 ++ drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index f714357..9de11fd 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -20,6 +20,8 @@ Optional properties: - snps,lpm-nyet-threshold: LPM NYET threshold - snps,u2exit_lfps_quirk: set if we want to enable U2Exit LFPS quirk - snps,u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk + - snps,req_p1p2p3_quirk: when set, the core will always request for + P1/P2/P3 transition sequence. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 0a935cb..e951984 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -377,6 +377,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-u2ss_inp3_quirk) reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK; + if (dwc-req_p1p2p3_quirk) + reg |= DWC3_GUSB3PIPECTL_REQP1P2P3; + dwc3_writel(dwc-regs, DWC3_GUSB3PIPECTL(0), reg); mdelay(100); @@ -753,6 +756,8 @@ static int dwc3_probe(struct platform_device *pdev) snps,u2exit_lfps_quirk); dwc-u2ss_inp3_quirk = of_property_read_bool(node, snps,u2ss_inp3_quirk); + dwc-req_p1p2p3_quirk = of_property_read_bool(node, + snps,req_p1p2p3_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -765,6 +770,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-disable_scramble_quirk = pdata-disable_scramble_quirk; dwc-u2exit_lfps_quirk = pdata-u2exit_lfps_quirk; dwc-u2ss_inp3_quirk = pdata-u2ss_inp3_quirk; + dwc-req_p1p2p3_quirk = pdata-req_p1p2p3_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 3843511..cbb8593 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -177,6 +177,7 @@ /* Global USB3 PIPE Control Register */ #define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 31) #define DWC3_GUSB3PIPECTL_U2SSINP3OK (1 29) +#define DWC3_GUSB3PIPECTL_REQP1P2P3(1 24) #define DWC3_GUSB3PIPECTL_SUSPHY (1 17) /* Global TX Fifo Size Register */ @@ -683,6 +684,7 @@ struct dwc3_scratchpad_array { * @disable_scramble_quirk: set if we enable the disable scramble quirk * @u2exit_lfps_quirk: set if we enable U2Exit LFPS quirk * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk + * @req_p1p2p3_quirk: set if we enable request P1/P2/P3 quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -793,6 +795,7 @@ struct dwc3 { unsigneddisable_scramble_quirk:1; unsignedu2exit_lfps_quirk:1; unsignedu2ss_inp3_quirk:1; + unsignedreq_p1p2p3_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index cf92c81..d3e6ec2 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -31,4 +31,5 @@ struct dwc3_platform_data { unsigned has_lpm_erratum:1; unsigned u2exit_lfps_quirk:1; unsigned u2ss_inp3_quirk:1; + unsigned req_p1p2p3_quirk:1; }; -- 1.9.1 -- 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 v4 05/20] usb: dwc3: add lpm erratum support
When parameter DWC_USB3_LPM_ERRATA_ENABLE is enabled in Advanced Configuration of coreConsultant, support of xHCI BESL Errata Dated 10/19/2011 is enabled in host mode. In device mode it adds the capability to send NYET response threshold based on the BESL value received in the LPM token, and the threshold is configurable for each SoC platform. This patch adds an entry that soc platform is able to define the lpm capacity with their own device tree or bus glue layer. [ ba...@ti.com : added devicetree documentation, spelled threshold completely, made sure threshold is only applied to proper core revisions. ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c| 16 +++- drivers/usb/dwc3/core.h| 26 +- drivers/usb/dwc3/gadget.c | 13 + drivers/usb/dwc3/platform_data.h | 3 +++ 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 8ec2256..2b0c1f2 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -16,6 +16,8 @@ Optional properties: - tx-fifo-resize: determines if the FIFO *has* to be reallocated. - snps,disable_scramble_quirk: true when SW should disable data scrambling. Only really useful for FPGA builds. + - snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled + - snps,lpm-nyet-threshold: LPM NYET threshold This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index fae095f..2ac96e4 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -654,6 +654,7 @@ static int dwc3_probe(struct platform_device *pdev) struct device_node *node = dev-of_node; struct resource *res; struct dwc3 *dwc; + u8 lpm_nyet_threshold; int ret; @@ -709,16 +710,27 @@ static int dwc3_probe(struct platform_device *pdev) */ res-start -= DWC3_GLOBALS_REGS_START; + /* default to highest possible threshold */ + lpm_nyet_threshold = 0xff; + if (node) { dwc-maximum_speed = of_usb_get_maximum_speed(node); + dwc-has_lpm_erratum = of_property_read_bool(node, + snps,has-lpm-erratum); + of_property_read_u8(node, snps,lpm-nyet-threshold, + lpm_nyet_threshold); - dwc-needs_fifo_resize = of_property_read_bool(node, tx-fifo-resize); + dwc-needs_fifo_resize = of_property_read_bool(node, + tx-fifo-resize); dwc-dr_mode = of_usb_get_dr_mode(node); dwc-disable_scramble_quirk = of_property_read_bool(node, snps,disable_scramble_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; + dwc-has_lpm_erratum = pdata-has_lpm_erratum; + if (pdata-lpm_nyet_threshold) + lpm_nyet_threshold = pdata-lpm_nyet_threshold; dwc-needs_fifo_resize = pdata-tx_fifo_resize; dwc-dr_mode = pdata-dr_mode; @@ -730,6 +742,8 @@ static int dwc3_probe(struct platform_device *pdev) if (dwc-maximum_speed == USB_SPEED_UNKNOWN) dwc-maximum_speed = USB_SPEED_SUPER; + dwc-lpm_nyet_threshold = lpm_nyet_threshold; + ret = dwc3_core_get_phy(dwc); if (ret) return ret; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 56bada6..34f1e08 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -246,16 +246,19 @@ #define DWC3_DCTL_TRGTULST_SS_INACT(DWC3_DCTL_TRGTULST(6)) /* These apply for core versions 1.94a and later */ -#define DWC3_DCTL_KEEP_CONNECT (1 19) -#define DWC3_DCTL_L1_HIBER_EN (1 18) -#define DWC3_DCTL_CRS (1 17) -#define DWC3_DCTL_CSS (1 16) +#define DWC3_DCTL_LPM_ERRATA_MASK DWC3_DCTL_LPM_ERRATA(0xf) +#define DWC3_DCTL_LPM_ERRATA(n)((n) 20) -#define DWC3_DCTL_INITU2ENA(1 12) -#define DWC3_DCTL_ACCEPTU2ENA (1 11) -#define DWC3_DCTL_INITU1ENA(1 10) -#define DWC3_DCTL_ACCEPTU1ENA (1 9) -#define DWC3_DCTL_TSTCTRL_MASK (0xf 1) +#define DWC3_DCTL_KEEP_CONNECT (1 19) +#define DWC3_DCTL_L1_HIBER_EN (1 18) +#define DWC3_DCTL_CRS (1 17) +#define DWC3_DCTL_CSS (1 16) + +#define DWC3_DCTL_INITU2ENA(1 12) +#define DWC3_DCTL_ACCEPTU2ENA (1 11) +#define DWC3_DCTL_INITU1ENA(1 10)
[PATCH v4 06/20] usb: dwc3: add U2Exit LFPS quirk
This patch adds U2Exit LFPS quirk, and some special platforms can configure that if it is needed. [ ba...@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/dwc3/core.c| 6 ++ drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 2b0c1f2..79ed37c 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -18,6 +18,7 @@ Optional properties: Only really useful for FPGA builds. - snps,has-lpm-erratum: true when DWC3 was configured with LPM Erratum enabled - snps,lpm-nyet-threshold: LPM NYET threshold + - snps,u2exit_lfps_quirk: set if we want to enable U2Exit LFPS quirk This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2ac96e4..6d1f09f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -470,6 +470,9 @@ static int dwc3_core_init(struct dwc3 *dwc) else reg = ~DWC3_GCTL_DISSCRAMBLE; + if (dwc-u2exit_lfps_quirk) + reg |= DWC3_GCTL_U2EXIT_LFPS; + /* * WORKAROUND: DWC3 revisions 1.90a have a bug * where the device can fail to connect at SuperSpeed @@ -726,6 +729,8 @@ static int dwc3_probe(struct platform_device *pdev) dwc-disable_scramble_quirk = of_property_read_bool(node, snps,disable_scramble_quirk); + dwc-u2exit_lfps_quirk = of_property_read_bool(node, + snps,u2exit_lfps_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-has_lpm_erratum = pdata-has_lpm_erratum; @@ -736,6 +741,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc-dr_mode = pdata-dr_mode; dwc-disable_scramble_quirk = pdata-disable_scramble_quirk; + dwc-u2exit_lfps_quirk = pdata-u2exit_lfps_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 34f1e08..45130a1 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -166,6 +166,7 @@ #define DWC3_GCTL_SCALEDOWN(n) ((n) 4) #define DWC3_GCTL_SCALEDOWN_MASK DWC3_GCTL_SCALEDOWN(3) #define DWC3_GCTL_DISSCRAMBLE (1 3) +#define DWC3_GCTL_U2EXIT_LFPS (1 2) #define DWC3_GCTL_GBLHIBERNATIONEN (1 1) #define DWC3_GCTL_DSBLCLKGTNG (1 0) @@ -679,6 +680,7 @@ struct dwc3_scratchpad_array { * @start_config_issued: true when StartConfig command has been issued * @three_stage_setup: set if we perform a three phase setup * @disable_scramble_quirk: set if we enable the disable scramble quirk + * @u2exit_lfps_quirk: set if we enable U2Exit LFPS quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -787,6 +789,7 @@ struct dwc3 { unsignedthree_stage_setup:1; unsigneddisable_scramble_quirk:1; + unsignedu2exit_lfps_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index e128308..3f21591 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -29,4 +29,5 @@ struct dwc3_platform_data { unsigned disable_scramble_quirk:1; unsigned has_lpm_erratum:1; + unsigned u2exit_lfps_quirk:1; }; -- 1.9.1 -- 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 v4 01/20] usb: dwc3: enable hibernation if to be supported
It enables hibernation if the function is set in coreConsultant. Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/core.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index fa396fc..5a47482 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -447,8 +447,14 @@ static int dwc3_core_init(struct dwc3 *dwc) reg = ~DWC3_GCTL_DSBLCLKGTNG; break; case DWC3_GHWPARAMS1_EN_PWROPT_HIB: - /* enable hibernation here */ dwc-nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4); + /* +* Enable hibernation here. +* +* Enabling this bit so that host-mode hibernation will +* work, device-mode hibernation is not implemented yet. +*/ + reg |= DWC3_GCTL_GBLHIBERNATIONEN; break; default: dev_dbg(dwc-dev, No power optimization available\n); -- 1.9.1 -- 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 v4 04/20] usb: dwc3: add disable scramble quirk
This patch adds disable scramble quirk, and it only needs to be enabled at FPGA board on some vendor platforms. [Note] In DesignWare databook, HW designer describes: disscramble = disable scramble Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++ drivers/usb/dwc3/core.c| 11 ++- drivers/usb/dwc3/core.h| 3 +++ drivers/usb/dwc3/platform_data.h | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 471366d..8ec2256 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -14,6 +14,8 @@ Optional properties: - phys: from the *Generic PHY* bindings - phy-names: from the *Generic PHY* bindings - tx-fifo-resize: determines if the FIFO *has* to be reallocated. + - snps,disable_scramble_quirk: true when SW should disable data scrambling. + Only really useful for FPGA builds. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index c8ae098..fae095f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -422,7 +422,6 @@ static int dwc3_core_init(struct dwc3 *dwc) reg = dwc3_readl(dwc-regs, DWC3_GCTL); reg = ~DWC3_GCTL_SCALEDOWN_MASK; - reg = ~DWC3_GCTL_DISSCRAMBLE; switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc-hwparams.hwparams1)) { case DWC3_GHWPARAMS1_EN_PWROPT_CLK: @@ -466,6 +465,11 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc-is_fpga = true; } + if (dwc-disable_scramble_quirk dwc-is_fpga) + reg |= DWC3_GCTL_DISSCRAMBLE; + else + reg = ~DWC3_GCTL_DISSCRAMBLE; + /* * WORKAROUND: DWC3 revisions 1.90a have a bug * where the device can fail to connect at SuperSpeed @@ -710,11 +714,16 @@ static int dwc3_probe(struct platform_device *pdev) dwc-needs_fifo_resize = of_property_read_bool(node, tx-fifo-resize); dwc-dr_mode = of_usb_get_dr_mode(node); + + dwc-disable_scramble_quirk = of_property_read_bool(node, + snps,disable_scramble_quirk); } else if (pdata) { dwc-maximum_speed = pdata-maximum_speed; dwc-needs_fifo_resize = pdata-tx_fifo_resize; dwc-dr_mode = pdata-dr_mode; + + dwc-disable_scramble_quirk = pdata-disable_scramble_quirk; } /* default to superspeed if no maximum_speed passed */ diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index f6ee623..56bada6 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -672,6 +672,7 @@ struct dwc3_scratchpad_array { * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround * @start_config_issued: true when StartConfig command has been issued * @three_stage_setup: set if we perform a three phase setup + * @disable_scramble_quirk: set if we enable the disable scramble quirk */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -776,6 +777,8 @@ struct dwc3 { unsignedsetup_packet_pending:1; unsignedstart_config_issued:1; unsignedthree_stage_setup:1; + + unsigneddisable_scramble_quirk:1; }; /* -- */ diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h index 7db34f0..9209d02 100644 --- a/drivers/usb/dwc3/platform_data.h +++ b/drivers/usb/dwc3/platform_data.h @@ -24,4 +24,6 @@ struct dwc3_platform_data { enum usb_device_speed maximum_speed; enum usb_dr_mode dr_mode; bool tx_fifo_resize; + + unsigned disable_scramble_quirk:1; }; -- 1.9.1 -- 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 v4 03/20] usb: dwc3: initialize platform data at pci glue layer
This patch initializes platform data at pci glue layer, and SoCs x86-based platform vendor is able to define their flags in platform data at bus glue layer. Then do some independent behaviors at dwc3 core level. Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/dwc3-pci.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index a36cf66..ada975f 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -25,6 +25,8 @@ #include linux/usb/otg.h #include linux/usb/usb_phy_generic.h +#include platform_data.h + /* FIXME define these in linux/pci_ids.h */ #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB30xabcd @@ -102,6 +104,9 @@ static int dwc3_pci_probe(struct pci_dev *pci, struct dwc3_pci *glue; int ret; struct device *dev = pci-dev; + struct dwc3_platform_data dwc3_pdata; + + memset(dwc3_pdata, 0x00, sizeof(dwc3_pdata)); glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); if (!glue) @@ -148,6 +153,10 @@ static int dwc3_pci_probe(struct pci_dev *pci, pci_set_drvdata(pci, glue); + ret = platform_device_add_data(dwc3, dwc3_pdata, sizeof(dwc3_pdata)); + if (ret) + goto err3; + dma_set_coherent_mask(dwc3-dev, dev-coherent_dma_mask); dwc3-dev.dma_mask = dev-dma_mask; -- 1.9.1 -- 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 v4 00/20] usb: dwc3: add support for AMD Nolan SoC
Hi, The series of patches add AMD Nolan (NL) SoC support for DesignWare USB3 OTG IP with PCI bus glue layer. This controller supported hibernation, LPM erratum and used the 2.80a IP version and amd own phy. Current implementation support both simulation and SoC platform. And already tested with gadget zero and msc tool. It works well on file storage gadget. These patches are generated on balbi/testing/next Changes from v3 - v4 - Add comment on hibernation patch - Fix typos of commit log and comments - Remove WARN_ON for temporary solution of FPGA board - Rename tx deemph to tx de-emphasis - Add documentation under Documentation/devicetree/bindings/usb/dwc3.txt - Check FPGA flag on usb3 and usb2 suspend phy quirk - Refine description of PCI quirk patch - Remove amd_nl_plat flag at dwc3 structure - Make HIRD threshold configurable Changes from v2 - v3 - Confirmed these quirks will be needed in product level - Move AMD configuration patch to the last one with all quirk flags - Make all quirks as 1-bit field instead of single-bits on a 32-bit variable - Add all quirks DeviceTree counterparts - Make LPM erratum configurable - Add PCI ID into pci_ids.h because it will be used both on PCI and DWC3 device driver. Changes from v1 - v2 - Remove dual role function temporarily - Add pci quirk to avoid to bind with xhci driver - Distinguish between simulation board and soc - Break down all the special quirks Patch 1: - Enable hibernation Patch 2: - Distinguish between simulation board and SoC Patch 3: - Initialize platform data at pci glue layer Patch 4 - 16: - Break down all the special quirks Patch 17: - Add PCI device ID of AMD NL USB3 DRD Patch 18: - Prevent xHCI driver from claiming AMD NL USB3 DRD device Patch 19: - Add support AMD NL USB3 DRD for dwc3 driver Patch 20: - Make HIRD threshold configurable Patch set already passed all the MSC testing on simulation board with low clock frequency, so the speed will slower than true SoC. Detailed result without verbose debug option is below: root@hr-bak:/home/ray/felipe/usb-tools# ./msc.sh -o /dev/sdb1 Starting test suite: 2014??? 10??? 30??? ? 15:42:32 CST test 0a: simple 4k read/write test 0: sent 3.91 MB read 7.43 MB/s write 6.45 MB/s ... success test 0b: simple 8k read/write test 0: sent 7.81 MB read 10.10 MB/s write 8.92 MB/s ... success test 0c: simple 16k read/write test 0: sent 15.62 MB read 15.22 MB/s write 12.02 MB/s ... success test 0d: simple 32k read/write test 0: sent 31.25 MB read 19.30 MB/s write 16.65 MB/s ... success test 0e: simple 64k read/write test 0: sent 62.50 MB read 22.43 MB/s write 16.04 MB/s ... success test 1: simple 1-sector read/write test 1: sent 500.00 kB read 1.27 MB/s write 1.04 MB/s ... success test 2: simple 8-sectors read/write test 2: sent 3.91 MB read 7.39 MB/s write 6.35 MB/s ... success test 3: simple 32-sectors read/write test 3: sent 15.62 MB read 15.26 MB/s write 12.42 MB/s ... success test 4: simple 64-sectors read/write test 4: sent 31.25 MB read 19.56 MB/s write 16.83 MB/s ... success test 5a: scatter/gather for 2-sectors buflen 4k test 5: sent1000.00 kB read 2.53 MB/s write 1.89 MB/s ... success test 5b: scatter/gather for 2-sectors buflen 8k test 5: sent1000.00 kB read 2.52 MB/s write 1.87 MB/s ... success test 5c: scatter/gather for 2-sectors buflen 16k test 5: sent1000.00 kB read 2.53 MB/s write 1.85 MB/s ... success test 5d: scatter/gather for 2-sectors buflen 32k test 5: sent1000.00 kB read 2.47 MB/s write 2.08 MB/s ... success test 5e: scatter/gather for 2-sectors buflen 64k test 5: sent1000.00 kB read 2.48 MB/s write 2.09 MB/s ... success test 6a: scatter/gather for 8-sectors buflen 4k test 6: sent 3.91 MB read 7.05 MB/s write 6.31 MB/s ... success test 6b: scatter/gather for 8-sectors buflen 8k test 6: sent 3.91 MB read 7.43 MB/s write 6.39 MB/s ... success test 6c: scatter/gather for 8-sectors buflen 16k test 6: sent 3.91 MB read 7.66 MB/s write 6.27 MB/s ... success test 6d: scatter/gather for 8-sectors buflen 32k test 6: sent 3.91 MB read 7.71 MB/s write 6.30 MB/s ... success test 6e: scatter/gather for 8-sectors buflen 64k test 6: sent 3.91 MB read 7.38 MB/s write 6.46 MB/s ... success test 7a: scatter/gather for 32-sectors buflen 16k test 7: sent 15.62 MB read 14.56 MB/s write 11.90 MB/s ... success test 7b: scatter/gather for 32-sectors buflen 32k test 7: sent 15.62 MB read 15.16 MB/s write 12.02 MB/s ... success test 7c: scatter/gather for 32-sectors buflen 64k test 7: sent 15.62 MB read 15.29 MB/s write 12.03 MB/s ... success test 8a: scatter/gather for 64-sectors buflen 32k test
[PATCH v4 02/20] usb: dwc3: add a flag to check if it is FPGA board
Some chip vendor is on pre-silicon phase, which needs to use the simulation board. It should have the same product and vendor id with the true SoC, but might have some minor different configurations. Below thread discussion proposes to find a method to distinguish between simulation board and SoC. http://marc.info/?l=linux-usbm=141194772206369w=2 In Advanced Configuration of coreConsultant, there is the parameter of DWC_USB_EN_FPGA. This bit has the function we need. And it would response as 7 bit of GHWPARAMS6 register. So it's able to check this functional bit to confirm if works on FPGA board. Reported-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/core.c | 6 ++ drivers/usb/dwc3/core.h | 5 + 2 files changed, 11 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 5a47482..c8ae098 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -460,6 +460,12 @@ static int dwc3_core_init(struct dwc3 *dwc) dev_dbg(dwc-dev, No power optimization available\n); } + /* check if current dwc3 is on simulation board */ + if (dwc-hwparams.hwparams6 DWC3_GHWPARAMS6_EN_FPGA) { + dev_dbg(dwc-dev, it is on FPGA board\n); + dwc-is_fpga = true; + } + /* * WORKAROUND: DWC3 revisions 1.90a have a bug * where the device can fail to connect at SuperSpeed diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index a715ee1..f6ee623 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -210,6 +210,9 @@ #define DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(n) (((n) (0x0f 13)) 13) #define DWC3_MAX_HIBER_SCRATCHBUFS 15 +/* Global HWPARAMS6 Register */ +#define DWC3_GHWPARAMS6_EN_FPGA(1 7) + /* Device Configuration Register */ #define DWC3_DCFG_DEVADDR(addr)((addr) 3) #define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f) @@ -662,6 +665,7 @@ struct dwc3_scratchpad_array { * @ep0_expect_in: true when we expect a DATA IN transfer * @has_hibernation: true when dwc3 was configured with Hibernation * @is_selfpowered: true when we are selfpowered + * @is_fpga: true when we are using the FPGA board * @needs_fifo_resize: not all users might want fifo resizing, flag it * @pullups_connected: true when Run/Stop bit is set * @resize_fifos: tells us it's ok to reconfigure our TxFIFO sizes. @@ -765,6 +769,7 @@ struct dwc3 { unsignedep0_expect_in:1; unsignedhas_hibernation:1; unsignedis_selfpowered:1; + unsignedis_fpga:1; unsignedneeds_fifo_resize:1; unsignedpullups_connected:1; unsignedresize_fifos:1; -- 1.9.1 -- 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 0/4] usb: renesas_usbhs: fixes this driver in gadget mode (part2)
If we tested this driver as gadget, some issues below happened: - Oops happened if g_audio. - A usb enumeration may fail if we do insmod during connected the usb cable. - A transaction will not finish if g_zero. - A usb enumeration may fail after we re-connected the usb cable. This patch serias fixes them. This patch serias is based on Felipe's usb.git / testing/fixes branch. (commit id: 9f2104db129512fd2ee086c8a616d296d1afbb75) Changes from v2: - Use USBHSG_STATUS_ instead of a new variable in patch 2. Changes from v1: - Rebase this patch serias for the latest testing/fixes branch. - Add From: in patch 1 and 2. - Add Cc: sta...@vger.kernel.org in patch 1. *** BLURB HERE *** Yoshihiro Shimoda (4): usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable() usb: renesas_usbhs: gadget: fix the behavior of pullup usb: renesas_usbhs: fix the timing of dcp_control_transfer_done usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE drivers/usb/renesas_usbhs/common.c |6 +++-- drivers/usb/renesas_usbhs/fifo.c | 34 ++-- drivers/usb/renesas_usbhs/fifo.h |1 + drivers/usb/renesas_usbhs/mod_gadget.c | 38 ++-- drivers/usb/renesas_usbhs/mod_host.c |2 +- drivers/usb/renesas_usbhs/pipe.c |8 +-- 6 files changed, 66 insertions(+), 23 deletions(-) -- 1.7.9.5 -- 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 2/4] usb: renesas_usbhs: gadget: fix the behavior of pullup
From: Takeshi Kihara takeshi.kihara...@renesas.com This patch fixes an issue that this driver always enable the D+ pullup after it detected the VBUS connection even though this usb controller can control the D+ pullup timing by software. So, this driver should enable the D+ pullup after a gadget driver called usb_gadget_connect(). Signed-off-by: Takeshi Kihara takeshi.kihara...@renesas.com Signed-off-by: Kazuya Mizuguchi kazuya.mizuguchi...@renesas.com Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/renesas_usbhs/common.c |6 -- drivers/usb/renesas_usbhs/mod_gadget.c | 30 +- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index b3b6813..7099f17 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -126,13 +126,15 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable) void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable) { u16 mask = DCFM | DRPD | DPRPU | HSE | USBE; - u16 val = DPRPU | HSE | USBE; + u16 val = HSE | USBE; /* * if enable * * - select Function mode -* - D+ Line Pull-up +* - D+ Line Pull-up is disabled +* When D+ Line Pull-up is enabled, +* calling usbhs_sys_function_pullup(,1) */ usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); } diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2d0903f..daecf74 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -56,6 +56,7 @@ struct usbhsg_gpriv { #define USBHSG_STATUS_REGISTERD(1 1) #define USBHSG_STATUS_WEDGE(1 2) #define USBHSG_STATUS_SELF_POWERED (1 3) +#define USBHSG_STATUS_SOFT_CONNECT (1 4) }; struct usbhsg_recip_handle { @@ -726,6 +727,25 @@ static struct usb_ep_ops usbhsg_ep_ops = { }; /* + * pullup control + */ +static int usbhsg_can_pullup(struct usbhs_priv *priv) +{ + struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); + + return gpriv-driver + usbhsg_status_has(gpriv, USBHSG_STATUS_SOFT_CONNECT); +} + +static void usbhsg_update_pullup(struct usbhs_priv *priv) +{ + if (usbhsg_can_pullup(priv)) + usbhs_sys_function_pullup(priv, 1); + else + usbhs_sys_function_pullup(priv, 0); +} + +/* * usb module start/end */ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) @@ -775,6 +795,7 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) * - usb module */ usbhs_sys_function_ctrl(priv, 1); + usbhsg_update_pullup(priv); /* * enable irq callback @@ -881,8 +902,15 @@ static int usbhsg_pullup(struct usb_gadget *gadget, int is_on) { struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); + unsigned long flags; - usbhs_sys_function_pullup(priv, is_on); + usbhs_lock(priv, flags); + if (is_on) + usbhsg_status_set(gpriv, USBHSG_STATUS_SOFT_CONNECT); + else + usbhsg_status_clr(gpriv, USBHSG_STATUS_SOFT_CONNECT); + usbhsg_update_pullup(priv); + usbhs_unlock(priv, flags); return 0; } -- 1.7.9.5 -- 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 1/4] usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
From: Kazuya Mizuguchi kazuya.mizuguchi...@renesas.com This patch fixes an issue that the NULL pointer dereference happens when we uses g_audio driver. Since the g_audio driver will call usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(), the uep-pipe of renesas usbhs driver will be NULL. So, this patch adds a condition to avoid the oops. Signed-off-by: Kazuya Mizuguchi kazuya.mizuguchi...@renesas.com Signed-off-by: Takeshi Kihara takeshi.kihara...@renesas.com Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com Cc: sta...@vger.kernel.org --- drivers/usb/renesas_usbhs/mod_gadget.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2d17c10..2d0903f 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep) struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); + if (!uep || !uep-pipe) + return -EINVAL; + usbhsg_pipe_disable(uep); usbhs_pipe_free(pipe); -- 1.7.9.5 -- 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/4] usb: renesas_usbhs: fix the timing of dcp_control_transfer_done
According to the datasheet, this driver should clear the INTSTS0.CTRT bit before this controller detects the next stage transition. Otherwise, the driver may not be able to clear the bit after the controller went to the next stage transition. After that, the driver will not be able to clear the INTSTS0.VALID, and a usb control transfer will not finish finally. If we use the testusb tool, it is easy to reproduce this issue: # testusb -a -t 10 Since the previous code handled a data stage and a status stage in the usbhsf_pio_try_push(), it may not clear the INTSTS0.CTRT at the right timing. So, this patch change the timing of usbhs_dcp_control_transfer_done() to the usbhsg_irq_ctrl_stage(). Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/renesas_usbhs/fifo.c | 16 drivers/usb/renesas_usbhs/mod_gadget.c |3 +++ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index b0c97a3..0e07925 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -577,14 +577,6 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done) usbhs_pipe_number(pipe), pkt-length, pkt-actual, *is_done, pkt-zero); - /* -* Transmission end -*/ - if (*is_done) { - if (usbhs_pipe_is_dcp(pipe)) - usbhs_dcp_control_transfer_done(pipe); - } - usbhsf_fifo_unselect(pipe, fifo); return 0; @@ -722,14 +714,6 @@ usbhs_fifo_read_end: usbhs_pipe_number(pipe), pkt-length, pkt-actual, *is_done, pkt-zero); - /* -* Transmission end -*/ - if (*is_done) { - if (usbhs_pipe_is_dcp(pipe)) - usbhs_dcp_control_transfer_done(pipe); - } - usbhs_fifo_read_busy: usbhsf_fifo_unselect(pipe, fifo); diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index daecf74..c46641a 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -485,6 +485,9 @@ static int usbhsg_irq_ctrl_stage(struct usbhs_priv *priv, case NODATA_STATUS_STAGE: pipe-handler = usbhs_ctrl_stage_end_handler; break; + case READ_STATUS_STAGE: + case WRITE_STATUS_STAGE: + usbhs_dcp_control_transfer_done(pipe); default: return ret; } -- 1.7.9.5 -- 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/4] usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE
Since the DCPCTR doesn't have the ACLRM bit, the usbus_pipe_clear() should not call the usbhsp_pipectrl_set() with ACLRM. So, this patch fixes this issue to add the usbhs_fifo_clear_dcp() in fifo.c because the controller needs the CFIFO to clear the the DCP PIPE. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/renesas_usbhs/fifo.c | 18 ++ drivers/usb/renesas_usbhs/fifo.h |1 + drivers/usb/renesas_usbhs/mod_gadget.c |2 +- drivers/usb/renesas_usbhs/mod_host.c |2 +- drivers/usb/renesas_usbhs/pipe.c |8 ++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 0e07925..9b48384 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -1160,6 +1160,24 @@ static void usbhsf_dma_complete(void *arg) usbhs_pipe_number(pipe), ret); } +void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe) +{ + struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); + struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); /* CFIFO */ + + /* clear DCP FIFO of transmission */ + if (usbhsf_fifo_select(pipe, fifo, 1) 0) + return; + usbhsf_fifo_clear(pipe, fifo); + usbhsf_fifo_unselect(pipe, fifo); + + /* clear DCP FIFO of reception */ + if (usbhsf_fifo_select(pipe, fifo, 0) 0) + return; + usbhsf_fifo_clear(pipe, fifo); + usbhsf_fifo_unselect(pipe, fifo); +} + /* * fifo init */ diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h index a168a17..79ad5f9 100644 --- a/drivers/usb/renesas_usbhs/fifo.h +++ b/drivers/usb/renesas_usbhs/fifo.h @@ -74,6 +74,7 @@ int usbhs_fifo_probe(struct usbhs_priv *priv); void usbhs_fifo_remove(struct usbhs_priv *priv); void usbhs_fifo_init(struct usbhs_priv *priv); void usbhs_fifo_quit(struct usbhs_priv *priv); +void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe); /* * packet info diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index c46641a..878334d 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -782,9 +782,9 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) /* * pipe initialize and enable DCP */ + usbhs_fifo_init(priv); usbhs_pipe_init(priv, usbhsg_dma_map_ctrl); - usbhs_fifo_init(priv); /* dcp init instead of usbhsg_ep_enable() */ dcp-pipe = usbhs_dcp_malloc(priv); diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 10e1ded..f0d3231 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c @@ -1474,9 +1474,9 @@ static int usbhsh_start(struct usbhs_priv *priv) /* * pipe initialize and enable DCP */ + usbhs_fifo_init(priv); usbhs_pipe_init(priv, usbhsh_dma_map_ctrl); - usbhs_fifo_init(priv); usbhsh_pipe_init_for_host(priv); /* diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 040bcef..007f45a 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c @@ -618,8 +618,12 @@ void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) void usbhs_pipe_clear(struct usbhs_pipe *pipe) { - usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); - usbhsp_pipectrl_set(pipe, ACLRM, 0); + if (usbhs_pipe_is_dcp(pipe)) { + usbhs_fifo_clear_dcp(pipe); + } else { + usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); + usbhsp_pipectrl_set(pipe, ACLRM, 0); + } } static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type) -- 1.7.9.5 -- 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 v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thursday 30 October 2014 18:08:26 Huang Rui wrote: It enables hibernation if the function is set in coreConsultant. Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Something went wrong with the Signed-off-by lines here. You should never add someone else's Signed-off-by below yours. I took a brief look at the entire series and the patches all look good to me, but you have made the same mistake with the Signed-off-by multiple times. Arnd -- 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/6] usb: chipidea: setup ci_hdrc_platform_data in core driver
Hello, This series introduce the ci_hdrc_get_platdata function to help setting up the ChipIdea internal ci_hdrc_platform_data structure. This helps avoiding duplicating code. This series comes from a duscission on Berlin's USB pacthes where it was asked to move the PHY phandle handling in the ChipIdea core[1]. With the introduction of the ci_hdrc_get_platdata function, the old ci_get_platdata function is removed. Changes in ChipIdea drivers have also been made. This series is needed for the Berlin USB support and has been tested with an updated version of the USB Berlin driver (not in mainline yet). Thanks, Antoine [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/292383.html Antoine Tenart (6): usb: chipidea: add a core function to setup ci_hdrc_platform_data usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_imx usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_msm usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_pci usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_zevio usb: chipidea: remove obsolete ci_get_platdata function drivers/usb/chipidea/ci_hdrc_imx.c | 14 ++-- drivers/usb/chipidea/ci_hdrc_msm.c | 10 ++- drivers/usb/chipidea/ci_hdrc_pci.c | 12 ++- drivers/usb/chipidea/ci_hdrc_zevio.c | 8 +- drivers/usb/chipidea/core.c | 146 --- include/linux/usb/chipidea.h | 2 + 6 files changed, 150 insertions(+), 42 deletions(-) -- 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 5/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_zevio
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com --- drivers/usb/chipidea/ci_hdrc_zevio.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_zevio.c b/drivers/usb/chipidea/ci_hdrc_zevio.c index 3bf6489ef5ec..d50a6d9038bd 100644 --- a/drivers/usb/chipidea/ci_hdrc_zevio.c +++ b/drivers/usb/chipidea/ci_hdrc_zevio.c @@ -25,12 +25,16 @@ static struct ci_hdrc_platform_data ci_hdrc_zevio_platdata = { static int ci_hdrc_zevio_probe(struct platform_device *pdev) { struct platform_device *ci_pdev; + struct ci_hdrc_platform_data *ci_pdata; dev_dbg(pdev-dev, ci_hdrc_zevio_probe\n); + ci_pdata = ci_hdrc_get_platdata(pdev-dev, ci_hdrc_zevio_platdata); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + ci_pdev = ci_hdrc_add_device(pdev-dev, - pdev-resource, pdev-num_resources, - ci_hdrc_zevio_platdata); + pdev-resource, pdev-num_resources, ci_pdata); if (IS_ERR(ci_pdev)) { dev_err(pdev-dev, ci_hdrc_add_device failed!\n); -- 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 4/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_pci
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com --- drivers/usb/chipidea/ci_hdrc_pci.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_pci.c b/drivers/usb/chipidea/ci_hdrc_pci.c index 241ae3444fde..d2ffc651b650 100644 --- a/drivers/usb/chipidea/ci_hdrc_pci.c +++ b/drivers/usb/chipidea/ci_hdrc_pci.c @@ -51,16 +51,22 @@ static struct ci_hdrc_platform_data penwell_pci_platdata = { static int ci_hdrc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - struct ci_hdrc_platform_data *platdata = (void *)id-driver_data; + struct ci_hdrc_platform_data *ci_pdata_default = + (void *)id-driver_data; + struct ci_hdrc_platform_data *ci_pdata; struct platform_device *plat_ci; struct resource res[3]; int retval = 0, nres = 2; - if (!platdata) { + if (!ci_pdata_default) { dev_err(pdev-dev, device doesn't provide driver data\n); return -ENODEV; } + ci_pdata = ci_hdrc_get_platdata(pdev-dev, ci_pdata_default); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + retval = pcim_enable_device(pdev); if (retval) return retval; @@ -80,7 +86,7 @@ static int ci_hdrc_pci_probe(struct pci_dev *pdev, res[1].start= pdev-irq; res[1].flags= IORESOURCE_IRQ; - plat_ci = ci_hdrc_add_device(pdev-dev, res, nres, platdata); + plat_ci = ci_hdrc_add_device(pdev-dev, res, nres, ci_pdata); if (IS_ERR(plat_ci)) { dev_err(pdev-dev, ci_hdrc_add_device failed!\n); return PTR_ERR(plat_ci); -- 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 1/6] usb: chipidea: add a core function to setup ci_hdrc_platform_data
Add a function into the chipidea core to help drivers setup the internal ci_hdrc_platform_data structure. This helps not duplicating common code. The ci_hdrc_get_platdata function only setup non filled members of the structure so that is is possible to give an already filled one. This is what the ci_pdata_default parameter is for. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com --- drivers/usb/chipidea/core.c | 129 +++ include/linux/usb/chipidea.h | 2 + 2 files changed, 131 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ba0ac2723098..0ad55c10a903 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -535,6 +535,135 @@ static int ci_get_platdata(struct device *dev, return 0; } +/* + * Getting a PHY or an USB PHY is optional: + * If no PHY or USB PHY is found, or if their subsystems aren't enabled, + * PHY and/or USB PHY will be set to NULL. Otherwise returns an error. + */ +static int ci_hdrc_get_phy(struct device *dev, + struct ci_hdrc_platform_data *ci_pdata) +{ + ci_pdata-phy = devm_phy_get(dev, usb); + ci_pdata-usb_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + + if (PTR_ERR(ci_pdata-phy) == -EPROBE_DEFER || + PTR_ERR(ci_pdata-usb_phy) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + if (IS_ERR(ci_pdata-phy)) { + if (PTR_ERR(ci_pdata-phy) == -ENOSYS || + PTR_ERR(ci_pdata-phy) == -ENODEV) { + ci_pdata-phy = NULL; + } else { + dev_err(dev, Could not get PHY: %ld\n, + PTR_ERR(ci_pdata-phy)); + return PTR_ERR(ci_pdata-phy); + } + } + + if (IS_ERR(ci_pdata-usb_phy)) { + if (PTR_ERR(ci_pdata-usb_phy) == -ENXIO || + PTR_ERR(ci_pdata-usb_phy) == -ENODEV) { + ci_pdata-usb_phy = NULL; + } else { + dev_err(dev, Could not get USB PHY: %ld\n, + PTR_ERR(ci_pdata-usb_phy)); + return PTR_ERR(ci_pdata-usb_phy); + } + } + + return 0; +} + +static int ci_hdrc_get_usb_phy_mode(struct device *dev, + struct ci_hdrc_platform_data *ci_pdata) +{ + if (!ci_pdata-phy_mode) + ci_pdata-phy_mode = of_usb_get_phy_mode(dev-of_node); + + if (!ci_pdata-dr_mode) + ci_pdata-dr_mode = of_usb_get_dr_mode(dev-of_node); + + if (of_usb_get_maximum_speed(dev-of_node) == USB_SPEED_FULL) + ci_pdata-flags |= CI_HDRC_FORCE_FULLSPEED; + + return 0; +} + +/* + * Getting a regulator is optional: + * If no regulator is found, or if the regulator subsystem isn't enabled, + * the regulator will be set to NULL. Otherwise returns an error. + */ +static int ci_hdrc_get_regulator(struct device *dev, +struct ci_hdrc_platform_data *ci_pdata) +{ + ci_pdata-reg_vbus = devm_regulator_get(dev, vbus); + + if (IS_ERR(ci_pdata-reg_vbus)) { + if (PTR_ERR(ci_pdata-reg_vbus) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + if (PTR_ERR(ci_pdata-reg_vbus) == -ENODEV) { + ci_pdata-reg_vbus = NULL; + } else { + dev_err(dev, Could not get regulator for vbus: %ld\n, + PTR_ERR(ci_pdata-reg_vbus)); + return PTR_ERR(ci_pdata-reg_vbus); + } + } + + return 0; +} + +struct ci_hdrc_platform_data *ci_hdrc_get_platdata(struct device *dev, + struct ci_hdrc_platform_data *ci_pdata_default) +{ + struct ci_hdrc_platform_data *ci_pdata; + int ret; + + if (!ci_pdata_default) { + ci_pdata = devm_kzalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); + if (!ci_pdata) + return ERR_PTR(-ENOMEM); + } else { + ci_pdata = ci_pdata_default; + } + + if (!ci_pdata-name) + ci_pdata-name = dev_name(dev); + + if (!ci_pdata-phy !ci_pdata-usb_phy) { + ret = ci_hdrc_get_phy(dev, ci_pdata); + if (ret) + return ERR_PTR(ret); + } + + if (ci_pdata-usb_phy) { + ret = ci_hdrc_get_usb_phy_mode(dev, ci_pdata); + if (ret) + return ERR_PTR(ret); + } + + if (ci_pdata-dr_mode == USB_DR_MODE_UNKNOWN) + ci_pdata-dr_mode = USB_DR_MODE_OTG; + + if (ci_pdata-dr_mode != USB_DR_MODE_PERIPHERAL) { + if (!ci_pdata-reg_vbus) { + ret = ci_hdrc_get_regulator(dev, ci_pdata); + if (ret) +
[PATCH 6/6] usb: chipidea: remove obsolete ci_get_platdata function
The addition of the ci_hdrc_get_platdata function makes the use of ci_get_platdata obsolete. Remove it. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com --- drivers/usb/chipidea/core.c | 41 - 1 file changed, 41 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 0ad55c10a903..8562a9c6154d 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -498,43 +498,6 @@ static irqreturn_t ci_irq(int irq, void *data) return ret; } -static int ci_get_platdata(struct device *dev, - struct ci_hdrc_platform_data *platdata) -{ - if (!platdata-phy_mode) - platdata-phy_mode = of_usb_get_phy_mode(dev-of_node); - - if (!platdata-dr_mode) - platdata-dr_mode = of_usb_get_dr_mode(dev-of_node); - - if (platdata-dr_mode == USB_DR_MODE_UNKNOWN) - platdata-dr_mode = USB_DR_MODE_OTG; - - if (platdata-dr_mode != USB_DR_MODE_PERIPHERAL) { - /* Get the vbus regulator */ - platdata-reg_vbus = devm_regulator_get(dev, vbus); - if (PTR_ERR(platdata-reg_vbus) == -EPROBE_DEFER) { - return -EPROBE_DEFER; - } else if (PTR_ERR(platdata-reg_vbus) == -ENODEV) { - /* no vbus regualator is needed */ - platdata-reg_vbus = NULL; - } else if (IS_ERR(platdata-reg_vbus)) { - dev_err(dev, Getting regulator error: %ld\n, - PTR_ERR(platdata-reg_vbus)); - return PTR_ERR(platdata-reg_vbus); - } - /* Get TPL support */ - if (!platdata-tpl_support) - platdata-tpl_support = - of_usb_host_tpl_support(dev-of_node); - } - - if (of_usb_get_maximum_speed(dev-of_node) == USB_SPEED_FULL) - platdata-flags |= CI_HDRC_FORCE_FULLSPEED; - - return 0; -} - /* * Getting a PHY or an USB PHY is optional: * If no PHY or USB PHY is found, or if their subsystems aren't enabled, @@ -673,10 +636,6 @@ struct platform_device *ci_hdrc_add_device(struct device *dev, struct platform_device *pdev; int id, ret; - ret = ci_get_platdata(dev, platdata); - if (ret) - return ERR_PTR(ret); - id = ida_simple_get(ci_ida, 0, 0, GFP_KERNEL); if (id 0) return ERR_PTR(id); -- 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 2/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_imx
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com --- drivers/usb/chipidea/ci_hdrc_imx.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 6f8b1b1045b5..25f3b465cb73 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -103,7 +103,8 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) static int ci_hdrc_imx_probe(struct platform_device *pdev) { struct ci_hdrc_imx_data *data; - struct ci_hdrc_platform_data pdata = { + struct ci_hdrc_platform_data *ci_pdata; + struct ci_hdrc_platform_data ci_pdata_default = { .name = dev_name(pdev-dev), .capoffset = DEF_CAPOFFSET, .flags = CI_HDRC_REQUIRE_TRANSCEIVER | @@ -114,6 +115,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) of_match_device(ci_hdrc_imx_dt_ids, pdev-dev); const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id-data; + ci_pdata = ci_hdrc_get_platdata(pdev-dev, ci_pdata_default); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL); if (!data) { dev_err(pdev-dev, Failed to allocate ci_hdrc-imx data!\n); @@ -147,10 +152,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) goto err_clk; } - pdata.usb_phy = data-phy; + ci_pdata-usb_phy = data-phy; if (imx_platform_flag-flags CI_HDRC_IMX_IMX28_WRITE_FIX) - pdata.flags |= CI_HDRC_IMX28_WRITE_FIX; + ci_pdata-flags |= CI_HDRC_IMX28_WRITE_FIX; ret = dma_coerce_mask_and_coherent(pdev-dev, DMA_BIT_MASK(32)); if (ret) @@ -166,8 +171,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) } data-ci_pdev = ci_hdrc_add_device(pdev-dev, - pdev-resource, pdev-num_resources, - pdata); + pdev-resource, pdev-num_resources, ci_pdata); if (IS_ERR(data-ci_pdev)) { ret = PTR_ERR(data-ci_pdev); dev_err(pdev-dev, -- 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 3/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_msm
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com --- drivers/usb/chipidea/ci_hdrc_msm.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 3edf969ed797..32eeab404911 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -55,10 +55,15 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { static int ci_hdrc_msm_probe(struct platform_device *pdev) { struct platform_device *plat_ci; + struct ci_hdrc_platform_data *ci_pdata; struct usb_phy *phy; dev_dbg(pdev-dev, ci_hdrc_msm_probe\n); + ci_pdata = ci_hdrc_get_platdata(pdev-dev, ci_hdrc_msm_platdata); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + /* * OTG(PHY) driver takes care of PHY initialization, clock management, * powering up VBUS, mapping of registers address space and power @@ -68,11 +73,10 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) if (IS_ERR(phy)) return PTR_ERR(phy); - ci_hdrc_msm_platdata.usb_phy = phy; + ci_pdata-usb_phy = phy; plat_ci = ci_hdrc_add_device(pdev-dev, - pdev-resource, pdev-num_resources, - ci_hdrc_msm_platdata); + pdev-resource, pdev-num_resources, ci_pdata); if (IS_ERR(plat_ci)) { dev_err(pdev-dev, ci_hdrc_add_device failed!\n); return PTR_ERR(plat_ci); -- 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: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: On Thursday 30 October 2014 18:08:26 Huang Rui wrote: It enables hibernation if the function is set in coreConsultant. Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Something went wrong with the Signed-off-by lines here. You should never add someone else's Signed-off-by below yours. I took a brief look at the entire series and the patches all look good to me, but you have made the same mistake with the Signed-off-by multiple times. Actually, this patch is applied at testing branch, so Felipe added his Signed-off-by. Please see: http://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/nextid=5c9669f92c9441d134f7776274e9afb71c246acc I just update some comment description in V4. Thanks, Rui -- 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/6] usb: chipidea: setup ci_hdrc_platform_data in core driver
On Thu, Oct 30, 2014 at 12:36:41PM +0100, Antoine Tenart wrote: Hello, This series introduce the ci_hdrc_get_platdata function to help setting up the ChipIdea internal ci_hdrc_platform_data structure. This helps avoiding duplicating code. This series comes from a duscission on Berlin's USB pacthes where it was asked to move the PHY phandle handling in the ChipIdea core[1]. With the introduction of the ci_hdrc_get_platdata function, the old ci_get_platdata function is removed. Changes in ChipIdea drivers have also been made. This series is needed for the Berlin USB support and has been tested with an updated version of the USB Berlin driver (not in mainline yet). Thanks, Antoine [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/292383.html Of course, this is the cover letter so it should be [PATCH 0/6]. This series depends on the generic PHY framework support in USB and CI: https://lkml.org/lkml/2014/10/28/807 Antoine -- Antoine Ténart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- 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: kobil_sct: Remove unused transfer buffer allocs
Hi Peter, Forgot to reply to this one. On Wed, Oct 22, 2014 at 07:40:20AM -0400, Peter Hurley wrote: On 10/19/2014 01:12 PM, Johan Hovold wrote: [ +CC: Jiri, Alan, linux-serial ] On Thu, Oct 16, 2014 at 02:09:29PM -0400, Peter Hurley wrote: On 10/16/2014 01:59 PM, Peter Hurley wrote: @@ -541,10 +531,6 @@ static int kobil_ioctl(struct tty_struct *tty, switch (cmd) { case TCFLSH: - transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); - if (!transfer_buffer) - return -ENOBUFS; - result = usb_control_msg(port-serial-dev, usb_sndctrlpipe(port-serial-dev, 0), SUSBCRequest_Misc, @@ -559,7 +545,6 @@ static int kobil_ioctl(struct tty_struct *tty, dev_dbg(port-dev, %s - Send reset_all_queues (FLUSH) URB returns: %i\n, __func__, result); - kfree(transfer_buffer); return (result 0) ? -EIO: 0; ^^^ Returning 0 is almost certainly wrong; no further processing for TCFLSH is performed. Indeed. Only this driver returns 0 (of all the tty drivers in mainline). Returning -ENOIOCTLCMD allows further processing to continue; especially the line discipline's input flushing, if TCIFLUSH/TCIOFLUSH. That doesn't seem like a very good idea, and only two *staging* drivers try to play such games (i.e. pretending not to implement the ioctl) as far as I can see. Well, returning EIONOCTLCMD is the standard method of ioctl passthrough from driver to line discipline. I disagree with you there. AFAICS only these two staging drivers are abusing the meaning of EIONOCTLCMD (unrecognised ioctl) to have the line discipline also act on the ioctl. Since driver 'input buffer' flushing is not currently supported by the core, this seems the only available workaround. That is true. But I doubt we should use these two staging drivers as a model for how this should be handled, if it's at all needed. The only non-staging tty driver which appears to implement TCFLSH, ipwireless, calls tty_perform_flush directly to flush the ldisc buffers. That doesn't seem right either. I'm not sure why ipwireless does this; I can only guess that it's a workaround for some line discipline that doesn't use n_tty_ioctl_helper(). Shouldn't this be fixed by removing TCFLSH from these tty drivers' ioctl callbacks and implementing flush_buffer()? The staging drivers also flush a device input buffer, which could be done in a new callback if at all needed. Yeah, that's why the Digi staging drivers are trapping TCFLSH; so they can clear input buffers on TCIFLUSH/TCIOFLUSH. I'd like to better understand the hardware and driver before extending the core interface; this driver may not even run. Agreed. For example, this driver clears its 'input buffer' for tcsetattr(TCSADRAIN or TCSAFLUSH). But that doesn't make sense considering that the flip buffers could have data in them that isn't flushed; the tty core doesn't dump the flip buffers because 'input processing' has not happened on that data. I think when/if these drivers are promoted is when/if the core interface should address this. Just my opinion, though :) I agree. Johan -- 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: kobil_sct: Remove unused transfer buffer allocs
On 10/30/2014 08:08 AM, Johan Hovold wrote: Hi Peter, Forgot to reply to this one. On Wed, Oct 22, 2014 at 07:40:20AM -0400, Peter Hurley wrote: On 10/19/2014 01:12 PM, Johan Hovold wrote: [ +CC: Jiri, Alan, linux-serial ] On Thu, Oct 16, 2014 at 02:09:29PM -0400, Peter Hurley wrote: On 10/16/2014 01:59 PM, Peter Hurley wrote: @@ -541,10 +531,6 @@ static int kobil_ioctl(struct tty_struct *tty, switch (cmd) { case TCFLSH: - transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); - if (!transfer_buffer) - return -ENOBUFS; - result = usb_control_msg(port-serial-dev, usb_sndctrlpipe(port-serial-dev, 0), SUSBCRequest_Misc, @@ -559,7 +545,6 @@ static int kobil_ioctl(struct tty_struct *tty, dev_dbg(port-dev, %s - Send reset_all_queues (FLUSH) URB returns: %i\n, __func__, result); - kfree(transfer_buffer); return (result 0) ? -EIO: 0; ^^^ Returning 0 is almost certainly wrong; no further processing for TCFLSH is performed. Indeed. Only this driver returns 0 (of all the tty drivers in mainline). Returning -ENOIOCTLCMD allows further processing to continue; especially the line discipline's input flushing, if TCIFLUSH/TCIOFLUSH. That doesn't seem like a very good idea, and only two *staging* drivers try to play such games (i.e. pretending not to implement the ioctl) as far as I can see. Well, returning EIONOCTLCMD is the standard method of ioctl passthrough from driver to line discipline. I disagree with you there. AFAICS only these two staging drivers are abusing the meaning of EIONOCTLCMD (unrecognised ioctl) to have the line discipline also act on the ioctl. Sorry, I wasn't as clear as I should have been here. My point was that every driver gets ioctl(TCFLSH) and returns ENOIOCTLCMD so that the line discipline will handle it. You're absolutely correct, in that, only these drivers (and ipwireless) doing anything with TCFLSH Since driver 'input buffer' flushing is not currently supported by the core, this seems the only available workaround. That is true. But I doubt we should use these two staging drivers as a model for how this should be handled, if it's at all needed. Right. My comments implied approval of the design, which I don't. The main problem with the existing design is that it allows for a significant variation in how ioctl(WHATEVER) is handled by various driver/ldisc combinations. That's a bad thing because it makes audit/review really time-consuming and makes changes prone to userspace regressions. Regards, Peter Hurley -- 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 RESEND V4 2/9] mailbox: Add NVIDIA Tegra XUSB mailbox driver
On Wed, Oct 29, 2014 at 11:02:36AM -0700, Andrew Bresticker wrote: [...] Maybe something like this patch would be more correct in handling this: diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index afcb430508ec..85691a7d8ca6 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -117,10 +117,11 @@ static void poll_txdone(unsigned long data) struct mbox_chan *chan = mbox-chans[i]; if (chan-active_req chan-cl) { - resched = true; txdone = chan-mbox-ops-last_tx_done(chan); if (txdone) tx_tick(chan, 0); + else + resched = true; } } ... but we still need to re-arm the timer if tx_tick() submits another message. Perhaps the better thing to do is to have msg_submit() arm the timer. I think we need both. If the last transmission isn't done yet we still want to keep polling. And we also want to poll if a new message is sent subsequently. Perhaps it would be as easy as moving the poll handling code from mbox_send_message() (if (chan-txdone_method == TXDONE_BY_POLL)) into msg_submit()? That has the additional advantage of being able to omit the polling when an error happens during the mbox' .send_data(). + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + mbox-regs = devm_ioremap(pdev-dev, res-start, resource_size(res)); + if (!mbox-regs) + return -ENOMEM; This doesn't look right. Upon closer inspection, the reason why you don't use devm_request_resource() is because these registers are shared with the XHCI controller. Perhaps a better design would be for the XHCI driver to expose the mailbox rather than split it off into a separate driver. Well that's what I had originally, but then it was suggested I make it a separate driver. Stephen also brought this up during review and suggested that some sort of MFD would be the best way to structure this, but was fine with the way I have it now. I can move this driver around (again) if you feel that strongly about it... We've had this discussion only recently about the memory controller driver. It used to be that there were separate drivers for the memory controller part and the IOMMU part. But that resulted in hilarious DT bindings. Granted, most of the issues had to do with unfortunate inter- leaving of register regions, but generally I think there's nothing wrong with exposing multiple interfaces from a single driver. The downside of course is that you have to choose which subsystem is the primary one and then get it merged via that tree. There's also a problem in that the driver is now in a different directory than the others, so a subsystem-wide change may not notice the out-of-place driver. But I think we have pretty good tools to help with this type of thing. Also, managing all the resources (regulators, clocks, resets, ...) that a hardware block requires is much easier to do in a single driver than spread over several. MFD could be an option somewhere halfway between the two but also has some downsides. Most importantly it isn't going to scale in the long run. diff --git a/include/soc/tegra/xusb.h b/include/soc/tegra/xusb.h new file mode 100644 index 000..cfe211d --- /dev/null +++ b/include/soc/tegra/xusb.h Perhaps this should really be named xusb-mbox.h? I'd prefer to leave it as xusb.h so that any other XUSB-related definitions can be left here. Okay, that makes sense given that the mbox really is part of the larger XUSB block. Thierry pgpLWf84m7vJo.pgp Description: PGP signature
Re: [PATCH usb 00/32] cleanup on resource check
On Thu, Oct 30, 2014 at 09:08:45AM +0530, Varka Bhadram wrote: On 10/30/2014 09:05 AM, Varka Bhadram wrote: Hi Balbi, On 10/30/2014 08:13 AM, Felipe Balbi wrote: Hi, On Thu, Oct 30, 2014 at 06:42:08AM +0530, Varka Bhadram wrote: On Thursday 30 October 2014 02:43 AM, Alan Stern wrote: On Wed, 29 Oct 2014, Varka Bhadram wrote: This series removes the duplication of sanity check for platform_get_resource() return resource. It will be checked with devm_ioremap_resource() This series based on usb/master. Varka Bhadram (32): host: ehci-atmel: remove duplicate check on resource host: ehci-exynos: remove duplicate check on resource host: ehci-fsl: remove duplicate check on resource dwc3: core: remove duplicate check on resource dwc3: dwc3-keystone: remove duplicate check on resource renesas_usbhs: common: remove duplicate check on resource phy: phy-rcar-usb: remove duplicate check on resource musb: musb_dsps: remove duplicate check on resource musb: musb_core: remove duplicate check on resource host: xhci-plat: remove duplicate check on resource host: uhci-platform: remove duplicate check on resource host: ohci-st: remove duplicate check on resource host: ohci-spear: remove duplicate check on resource host: ehci-sh: remove duplicate check on resource host: ohci-pxa27x: remove duplicate check on resource host: ohci-platform: remove duplicate check on resource host: ohci-octeon: remove duplicate check on resource host: ohci-jz4740: remove duplicate check on resource host: ohci-exynos: remove duplicate check on resource host: ohci-da8xx: remove duplicate check on resource host: ohci-at91: remove duplicate check on resource host: ehci-w90x900: remove duplicate check on resource host: ehci-tegra: remove duplicate check on resource host: ehci-st: remove duplicate check on resource host: ehci-spear: remove duplicate check on resource host: ehci-sead3: remove duplicate check on resource host: ehci-platform: remove duplicate check on resource host: ehci-orion: remove duplicate check on resource host: ehci-octeon: remove duplicate check on resource host: ehci-mxc: remove duplicate check on resource host: ehci-mv: remove duplicate check on resource host: ehci-msm: remove duplicate check on resource For all the ehci, ohci, and uhci changes: Acked-by: Alan Stern st...@rowland.harvard.edu Thanx for your ACK. I didn't look carefully at the others, but the dwc3-core patch (4/32) definitely seemed wrong. I don't find any wrong in the code. Really ? Look more carefuly static int dwc3_probe(struct platform_device *pdev) { struct device*dev = pdev-dev; struct dwc3_platform_data *pdata = dev_get_platdata(dev); struct device_node*node = dev-of_node; struct resource*res; struct dwc3*dwc; intret; void __iomem*regs; void*mem; mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL); if (!mem) return -ENOMEM; dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); dwc-mem = mem; dwc-dev = dev; res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(dev, missing IRQ\n); return -ENODEV; } dwc-xhci_resources[1].start = res-start; dwc-xhci_resources[1].end = res-end; dwc-xhci_resources[1].flags = res-flags; dwc-xhci_resources[1].name = res-name; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); /* * Request memory region but exclude xHCI regs, * since it will be requested by the xhci-plat driver. */ regs = devm_ioremap_resource(dev, res); because you moved this call here... if (IS_ERR(regs)) return PTR_ERR(regs); dwc-xhci_resources[0].start = res-start; dwc-xhci_resources[0].end = dwc-xhci_resources[0].start + DWC3_XHCI_REGS_END; dwc-xhci_resources[0].flags = res-flags; dwc-xhci_resources[0].name = res-name; res-start += DWC3_GLOBALS_REGS_START; ... before doing this, you're now ioremapping the entire space *INCLUDING* the XHCI address space, which means that you have just broken every single platform using this driver in host mode. In that case, i will drop this patch. Is other patches are fine except #04/32 patch..? Can i add you Ack..? And based on which tree i need to generate the patches.? I rebased all these patches on [1] of master branch. [1]: https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git patches that go through my tree means that I will apply them to my tree and send a pull request to Greg. Have a look at MAINTAINERS. -- balbi signature.asc Description: Digital signature
Re: [PATCH RESEND V4 4/9] pinctrl: tegra-xusb: Add USB PHY support
On Wed, Oct 29, 2014 at 12:43:36PM -0700, Andrew Bresticker wrote: diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c [...] + + for (i = 0; i TEGRA_XUSB_USB3_PHYS; i++) { + if (phy == padctl-phys[TEGRA_XUSB_PADCTL_USB3_P0 + i]) + break; You could simply return i here and then BUG_ON unconditionally. + } + BUG_ON(i == TEGRA_XUSB_USB3_PHYS); + + return i; +} Actually, thinking about it some more, perhaps making this a WARN_ON() and returning an error so that we can continue and propagate the error would be more useful. BUG_ON() will completely hang the kernel with no way out but rebooting. WARN_ON() will give a hint about something being wrong and returning an error will allow the kernel to continue to run, which might be the only way to diagnose and fix the problem, even if it means that USB 3.0 support will be disabled. I felt like BUG_ON is more appropriate here. Hitting this case means there's a bug in the PHY core or a driver has passed a bogus pointer and the stack dump produced by the BUG_ON should make it obvious as to what the issue is. I don't feel too strongly about it though. The problem with BUG_ON() is that you won't be able to go any further. So if this were to happen on a device with no serial you might not even get to a point where you actually see an error message. Handling this more gracefully by propagating the error code and failing .probe() does not seem overly complicated and the WARN_ON() output will hopefully still be noticed (it probably will be after the user can't get USB to work). Consider for example the case where a user has only one device to test and report bugs on. If we crash the device using BUG_ON() they may not be able to report a bug at all (or recover by reverting to some known good kernel version). A WARN_ON() will hopefully be enough to get noticed and unless users rely on XUSB for the root filesystem they'd still be able to open up a web browser and file a bug report with the oops attached. + u32 value, offset; + + padctl-usb3_ports[port].context_saved = true; What's the purpose of saving the context here? This seems to be triggered by a request from XUSB, but it's then restored when the PHY is powered on. How does that even happen? Won't the PHY stay powered all the time? Or shouldn't the context be saved when powering off the PHY? Right, context is saved when requested by the XUSB controller and restored on power on. This is used during runtime power-gating or LP0 where the PHYs are powered off and on and this context is lost. Neither of these are currently implemented by the host driver, however. As far as why the context is saved upon request and not at power off, I'm not sure. I've observed that these messages come in when a USB3.0 device is enumerated. Perhaps the XUSB controller is doing some sort of tuning. I see. Perhaps these values are calibrated by the firmware? In that case I guess it could redo the calibration. I'll see if I can find out why it is necessary to store this. @@ -936,6 +2098,18 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev) goto unregister; } + INIT_WORK(padctl-mbox_req_work, tegra_xusb_phy_mbox_work); + padctl-mbox_client.dev = pdev-dev; + padctl-mbox_client.tx_block = true; + padctl-mbox_client.tx_tout = 0; + padctl-mbox_client.rx_callback = tegra_xusb_phy_mbox_rx; + padctl-mbox_chan = mbox_request_channel(padctl-mbox_client, 0); + if (IS_ERR(padctl-mbox_chan)) { + err = PTR_ERR(padctl-mbox_chan); + dev_err(pdev-dev, failed to request mailbox: %d\n, err); + goto unregister; + } I think this should be done before the registering the PHY provider so that we don't expose one (even for only a very short time) before we haven't made sure that it can be used. Also, this effectively makes the mailbox mandatory, which means that the above code is going to break on older DTBs. So I think we have no choice but to make mailbox (and hence XUSB) support optional. I understand the need for binding stability, but it's not like these bindings have been around for very long (a release or two?) and this series has existed for almost the same amount of time. Are there really any DTBs out there that are going to break because of this? Every DTB created from a kernel version that has the original binding but not the one modified as part of this series is going to break. Last time I checked there weren't any exceptions to this rule. Note, though, that the rule is that existing functionality must not break. That is, SATA and PCIe should remain functional, so it should be fine if you just don't register any of the USB PHYs when the request for a mailbox channel fails. Something along these lines should do it:
Re: [PATCH RESEND V4 5/9] of: Add NVIDIA Tegra xHCI controller binding
On Wed, Oct 29, 2014 at 09:37:14AM -0700, Andrew Bresticker wrote: On Wed, Oct 29, 2014 at 2:43 AM, Thierry Reding thierry.red...@gmail.com wrote: On Tue, Oct 28, 2014 at 03:27:50PM -0700, Andrew Bresticker wrote: [...] diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt [...] +Optional properties: +--- +- vbus-{0,1,2}-supply: VBUS regulator for the corresponding UTMI pad. +- vddio-hsic-supply: VDDIO regulator for the HSIC pads. +- nvidia,usb3-port-{0,1}-lane: PCIe/SATA lane to which the corresponding USB3 + port is mapped. See dt-bindings/pinctrl/pinctrl-tegra-xusb.h for the list + of valid values. I dislike how we now need to provide a list of all pins in the header file, where previously we used strings for this. This could become very ugly if the set of pins changes in future generations of this IP block. Could we instead derive this from the pinmux nodes? For example you have this in the example below: usb3p0 { nvidia,lanes = pcie-0; ... }; Perhaps what we need is to either key off the node name or add another property, such as: nvidia,usb3-port = 0; This would match the nvidia,usb2-port property that you've added below. That is actually how I described the USB3 port to SS lane mapping originally, but in review of an earlier version of this series, Stephen suggested that I make it a separate, not pinconfig property since it wasn't a value written directly to the hardware. I'm fine with changing it back as the pinconfig property makes more sense to me as well. Hmm... I had considered it a mux option of the specific lane. If the function is usb3, it'd still need to be muxed to one of the ports. So it's additional information associated with the usb3 function. I did look through the driver changes and can't really make out which part of the code actually performs this assignment. Can you point me to it? Thierry pgpaADdjFNOFz.pgp Description: PGP signature
Re: [PATCHv6 1/8] usb: dwc2: Update the gadget driver to use common dwc2_hsotg structure
On Tue, Oct 28, 2014 at 06:25:42PM -0500, dingu...@opensource.altera.com wrote: From: Dinh Nguyen dingu...@opensource.altera.com Adds the gadget data structure and appropriate data structure pointers to the common dwc2_hsotg data structure. To keep the driver data dereference code looking clean, the gadget variable declares are only available for peripheral and dual-role mode. This is needed so that the dwc2_hsotg data structure can be used by the hcd and gadget drivers. Updates gadget.c to use the dwc2_hsotg data structure and gadget pointers that have been moved into the common dwc2_hsotg structure. Signed-off-by: Dinh Nguyen dingu...@opensource.altera.com Signed-off-by: Paul Zimmerman pa...@synopsys.com --- v5: Keep the changes to mininum and maintain hcd and gadget driver to build and work separately. Use IS_ENABLED() instead of #if defined v3: Updated with paulz's suggestion to avoid double pointers. v2: Left the function parameter name as 'hsotg' and just changed its type. --- drivers/usb/dwc2/core.h | 156 -- drivers/usb/dwc2/gadget.c | 145 +- 2 files changed, 154 insertions(+), 147 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 55c90c5..96c283d 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -84,7 +84,7 @@ static const char * const s3c_hsotg_supply_names[] = { */ #define EP0_MPS_LIMIT 64 -struct s3c_hsotg; +struct dwc2_hsotg; struct s3c_hsotg_req; /** @@ -130,7 +130,7 @@ struct s3c_hsotg_req; struct s3c_hsotg_ep { struct usb_ep ep; struct list_headqueue; - struct s3c_hsotg*parent; + struct dwc2_hsotg *parent; struct s3c_hsotg_req*req; struct dentry *debugfs; @@ -155,67 +155,6 @@ struct s3c_hsotg_ep { }; /** - * struct s3c_hsotg - driver state. - * @dev: The parent device supplied to the probe function - * @driver: USB gadget driver - * @phy: The otg phy transceiver structure for phy control. - * @uphy: The otg phy transceiver structure for old USB phy control. - * @plat: The platform specific configuration data. This can be removed once - * all SoCs support usb transceiver. - * @regs: The memory area mapped for accessing registers. - * @irq: The IRQ number we are using - * @supplies: Definition of USB power supplies - * @phyif: PHY interface width - * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. - * @num_of_eps: Number of available EPs (excluding EP0) - * @debug_root: root directrory for debugfs. - * @debug_file: main status file for debugfs. - * @debug_fifo: FIFO status file for debugfs. - * @ep0_reply: Request used for ep0 reply. - * @ep0_buff: Buffer for EP0 reply data, if needed. - * @ctrl_buff: Buffer for EP0 control requests. - * @ctrl_req: Request for EP0 control packets. - * @setup: NAK management for EP0 SETUP - * @last_rst: Time of last reset - * @eps: The endpoints being supplied to the gadget framework - */ -struct s3c_hsotg { - struct device*dev; - struct usb_gadget_driver *driver; - struct phy *phy; - struct usb_phy *uphy; - struct s3c_hsotg_plat*plat; - - spinlock_t lock; - - void __iomem*regs; - int irq; - struct clk *clk; - - struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; - - u32 phyif; - int fifo_mem; - unsigned intdedicated_fifos:1; - unsigned char num_of_eps; - u32 fifo_map; - - struct dentry *debug_root; - struct dentry *debug_file; - struct dentry *debug_fifo; - - struct usb_request *ep0_reply; - struct usb_request *ctrl_req; - u8 ep0_buff[8]; - u8 ctrl_buff[8]; - - struct usb_gadget gadget; - unsigned intsetup; - unsigned long last_rst; - struct s3c_hsotg_ep *eps; -}; - -/** * struct s3c_hsotg_req - data transfer request * @req: The USB gadget request * @queue: The list of requests for the endpoint this is queued for. @@ -229,6 +168,7 @@ struct s3c_hsotg_req { unsigned char mapped; }; +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) #define call_gadget(_hs, _entry) \ do { \ if ((_hs)-gadget.speed != USB_SPEED_UNKNOWN \ @@ -238,6 +178,9 @@ do { \ spin_lock(_hs-lock); \ } \ } while (0) +#else +#define call_gadget(_hs, _entry) do {} while (0) +#endif struct dwc2_hsotg; struct dwc2_host_chan; @@ -495,11 +438,13 @@ struct dwc2_hw_params { * struct dwc2_hsotg -
Re: [PATCHv6 2/8] usb: dwc2: Move gadget probe function into platform code
On Tue, Oct 28, 2014 at 06:25:43PM -0500, dingu...@opensource.altera.com wrote: From: Dinh Nguyen dingu...@opensource.altera.com This patch will aggregate the probing of gadget/hcd driver into platform.c. The gadget probe funtion is converted into gadget_init that is now only responsible for gadget only initialization. All the gadget resources is now s/resources is/resources are handled by platform.c Since the host workqueue will not get initialized if the driver is configured for peripheral mode only. Thus we need to check for wq_otg before calling queue_work(). this period character in the middle of the sentence doesn't make sense, perhaps a comma is what you want ? The sentence can be improved too: Since the host workqueue will not get initialized if the drier is configured for peripheral mode only, we add a check for wq_otg before calling queue_work(). Also, we move spin_lock_init to common location for both host and gadget that is either in platform.c or pci.c. We also ove suspend/resume code to common platform code, and update it to use the new PM API (struct dev_pm_ops). updating to dev_pm_ops should really be a separate patch. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 4/8] usb: dwc2: Update common interrupt handler to call gadget interrupt handler
Hi, On Tue, Oct 28, 2014 at 06:25:45PM -0500, dingu...@opensource.altera.com wrote: From: Dinh Nguyen dingu...@opensource.altera.com Make dwc2_handle_common_intr call the gadget interrupt function when operating in peripheral mode. Remove the spinlock functions in s3c_hsotg_irq as dwc2_handle_common_intr() already has the spinlocks. Move the registeration of the IRQ to common code for platform and PCI. Remove duplicate interrupt conditions that was in gadget, as those are handled by dwc2 common interrupt handler. Signed-off-by: Dinh Nguyen dingu...@opensource.altera.com Acked-by: Paul Zimmerman pa...@synopsys.com --- v5: remove individual devm_request_irq from gadget and hcd, and place a single devm_request_irq in platform and pci. v2: Keep interrupt handler for host and peripheral modes separate --- drivers/usb/dwc2/core.c | 10 drivers/usb/dwc2/core.h | 3 +++ drivers/usb/dwc2/core_intr.c | 3 +++ drivers/usb/dwc2/gadget.c| 57 ++-- drivers/usb/dwc2/pci.c | 6 + drivers/usb/dwc2/platform.c | 9 +++ 6 files changed, 23 insertions(+), 65 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index d926945..7605850b 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -458,16 +458,6 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq) /* Clear the SRP success bit for FS-I2c */ hsotg-srp_success = 0; - if (irq = 0) { - dev_dbg(hsotg-dev, registering common handler for irq%d\n, - irq); - retval = devm_request_irq(hsotg-dev, irq, - dwc2_handle_common_intr, IRQF_SHARED, - dev_name(hsotg-dev), hsotg); - if (retval) - return retval; - } - /* Enable common interrupts */ dwc2_enable_common_interrupts(hsotg); diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 80d29c7..ec70862 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -967,6 +967,7 @@ extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2); extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2); extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq); extern void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2); +irqreturn_t s3c_hsotg_irq(int irq, void *pw); #else static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) { return 0; } @@ -977,6 +978,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2) static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) { return 0; } static inline void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2) {} +static inline irqreturn_t s3c_hsotg_irq(int irq, void *pw) +{ return IRQ_HANDLED; } #endif #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index b176c2f..b0c14e0 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -474,6 +474,9 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) spin_lock(hsotg-lock); + if (dwc2_is_device_mode(hsotg)) + retval = s3c_hsotg_irq(irq, dev); + gintsts = dwc2_read_common_intr(hsotg); if (gintsts ~GINTSTS_PRTINT) retval = IRQ_HANDLED; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 19d1b03..202f8cc 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2257,14 +2257,13 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg) * @irq: The IRQ number triggered * @pw: The pw value when registered the handler. */ -static irqreturn_t s3c_hsotg_irq(int irq, void *pw) +irqreturn_t s3c_hsotg_irq(int irq, void *pw) why ? It would've been a lot easier to just make the IRQ line shared. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 5/8] usb: dwc2: Add call_gadget functions for perpheral mode interrupts
On Tue, Oct 28, 2014 at 06:25:46PM -0500, dingu...@opensource.altera.com wrote: From: Dinh Nguyen dingu...@opensource.altera.com Update the dwc2 wakeup and suspend interrupt functions to use call_gadget when the IP is in peripheral mode. it seems like you're actually fixing a bug here. Those calls weren't there before. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 6/8] usb: dwc2: gadget: Do not fail probe if there isn't a clock node
Hi, On Tue, Oct 28, 2014 at 06:25:47PM -0500, dingu...@opensource.altera.com wrote: From: Dinh Nguyen dingu...@opensource.altera.com Since the dwc2 hcd driver is currently not looking for a clock node during init, we should not completely fail if there isn't a clock provided. For dual-role mode, we will only fail init for a non-clock node error. We then update the HCD to only call gadget funtions if there is a proper clock node. Signed-off-by: Dinh Nguyen dingu...@opensource.altera.com --- v5: reworked to not access gadget functions from the hcd. --- drivers/usb/dwc2/core.h | 3 +-- drivers/usb/dwc2/core_intr.c | 9 ++--- drivers/usb/dwc2/hcd.c | 3 ++- drivers/usb/dwc2/platform.c | 19 +++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index ec70862..48120c8 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -660,6 +660,7 @@ struct dwc2_hsotg { #endif #endif /* CONFIG_USB_DWC2_HOST || CONFIG_USB_DWC2_DUAL_ROLE */ + struct clk *clk; #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) /* Gadget structures */ struct usb_gadget_driver *driver; @@ -667,8 +668,6 @@ struct dwc2_hsotg { struct usb_phy *uphy; struct s3c_hsotg_plat *plat; - struct clk *clk; - struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; u32 phyif; diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 1240875..1608037 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -339,7 +339,8 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) } /* Change to L0 state */ hsotg-lx_state = DWC2_L0; - call_gadget(hsotg, resume); + if (!IS_ERR(hsotg-clk)) + call_gadget(hsotg, resume); instead of exposing the clock detail to the entire driver, add IS_ERR() checks to resume and suspend instead. In fact, NULL is a valid clock, so you might as well: clk = clk_get(foo, bar); if (IS_ERR(clk)) dwc-clk = NULL; else dwc-clk = clk; Then you don't need any IS_ERR() checks sprinkled around the driver. @@ -400,7 +401,8 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) DSTS.Suspend Status=%d HWCFG4.Power Optimize=%d\n, !!(dsts DSTS_SUSPSTS), hsotg-hw_params.power_optimized); - call_gadget(hsotg, suspend); + if (!IS_ERR(hsotg-clk)) + call_gadget(hsotg, suspend); } else { if (hsotg-op_state == OTG_STATE_A_PERIPHERAL) { dev_dbg(hsotg-dev, a_peripheral-a_host\n); @@ -477,7 +479,8 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) spin_lock(hsotg-lock); if (dwc2_is_device_mode(hsotg)) - retval = s3c_hsotg_irq(irq, dev); + if (!IS_ERR(hsotg-clk)) + retval = s3c_hsotg_irq(irq, dev); wait a minute, if there is no clock we don't call the gadget interrupt handler ? Why ? Who will disable the IRQ line ? diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 44c609f..fa49c72 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -1371,7 +1371,8 @@ static void dwc2_conn_id_status_change(struct work_struct *work) hsotg-op_state = OTG_STATE_B_PERIPHERAL; dwc2_core_init(hsotg, false, -1); dwc2_enable_global_interrupts(hsotg); - s3c_hsotg_core_init(hsotg); + if (!IS_ERR(hsotg-clk)) + s3c_hsotg_core_init(hsotg); } else { /* A-Device connector (Host Mode) */ dev_dbg(hsotg-dev, connId A\n); diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 72f32f7..77c8417 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -217,8 +217,17 @@ static int dwc2_driver_probe(struct platform_device *dev) spin_lock_init(hsotg-lock); retval = dwc2_gadget_init(hsotg, irq); - if (retval) - return retval; + if (retval) { + /* + * We will not fail the driver initialization for dual-role + * if no clock node is supplied. However, all gadget + * functionality will be disabled if a clock node is not + * provided. Host functionality will continue. + * TO-DO: make clock node a requirement for the HCD. + */ + if (!IS_ERR(hsotg-clk)) + return retval; + } no here... this should have been taken care by dwc2_gadget_init() itself. -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: On Thursday 30 October 2014 18:08:26 Huang Rui wrote: It enables hibernation if the function is set in coreConsultant. Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Something went wrong with the Signed-off-by lines here. You should never add someone else's Signed-off-by below yours. I took a brief look at the entire series and the patches all look good to me, but you have made the same mistake with the Signed-off-by multiple times. there are no mistakes, I just asked Huang to resend what I had on my testing/next because it had not been sent to devicetree mailing list. -- balbi signature.asc Description: Digital signature
Re: [PATCH v3 1/4] usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
On Thu, Oct 30, 2014 at 07:30:16PM +0900, Yoshihiro Shimoda wrote: From: Kazuya Mizuguchi kazuya.mizuguchi...@renesas.com This patch fixes an issue that the NULL pointer dereference happens when we uses g_audio driver. Since the g_audio driver will call usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(), the uep-pipe of renesas usbhs driver will be NULL. So, this patch adds a condition to avoid the oops. Signed-off-by: Kazuya Mizuguchi kazuya.mizuguchi...@renesas.com Signed-off-by: Takeshi Kihara takeshi.kihara...@renesas.com Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com Cc: sta...@vger.kernel.org --- drivers/usb/renesas_usbhs/mod_gadget.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2d17c10..2d0903f 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep) struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); + if (!uep || !uep-pipe) how can uep ever be NULL ? Look at the definition of usbhsg_ep_to_uep(): #define usbhsg_ep_to_uep(e) container_of(e, struct usbhsg_uep, ep) how can a container_of() ever return NULL ? What you should check if ep (the argument to this function) being NULL. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 8/8] usb: dwc2: move usb_disabled() call to host driver only
On Wed, Oct 29, 2014 at 08:35:24AM -0500, Dinh Nguyen wrote: On 10/28/14, 8:26 PM, Paul Zimmerman wrote: From: dingu...@opensource.altera.com [mailto:dingu...@opensource.altera.com] Sent: Tuesday, October 28, 2014 4:26 PM Now that platform.c will get built for both Host and Gadget, if we leave the usb_disabled() call in platform.c, it results in the following build error when (!USB USB_GADGET) condition is met. ERROR: usb_disabled [drivers/usb/dwc2/dwc2_platform.ko] undefined! Since usb_disabled() is mostly used to disable USB host functionality, move the call the host portion for the DWC2 driver. Signed-off-by: Dinh Nguyen dingu...@opensource.altera.com --- drivers/usb/dwc2/hcd.c | 3 +++ drivers/usb/dwc2/platform.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index fa49c72..b741997 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2780,6 +2780,9 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, int i, num_channels; int retval; + if (usb_disabled()) + return -ENODEV; + dev_dbg(hsotg-dev, DWC OTG HCD INIT\n); /* Detect config values from hardware */ diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 77c8417..123cf54 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -157,9 +157,6 @@ static int dwc2_driver_probe(struct platform_device *dev) int retval; int irq; - if (usb_disabled()) - return -ENODEV; - match = of_match_device(dwc2_of_match_table, dev-dev); if (match match-data) { params = match-data; I'm confused. You are saying the build is broken until patch 8/8 is applied? As always, that is not acceptable. You need to fix the breakage at the point where it was introduced, not leave it broken until the last patch in the series. The build gets broken when patch 7/8 of is applied. That is the patch that finally allows platform.c to get built for host and gadget. I can fold this patch into patch 7/8. then you invert things, make $subject patch 7 (or even patch 1) and patch 7 becomes patch 8. -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thursday 30 October 2014 09:08:32 Felipe Balbi wrote: On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: On Thursday 30 October 2014 18:08:26 Huang Rui wrote: It enables hibernation if the function is set in coreConsultant. Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Something went wrong with the Signed-off-by lines here. You should never add someone else's Signed-off-by below yours. I took a brief look at the entire series and the patches all look good to me, but you have made the same mistake with the Signed-off-by multiple times. there are no mistakes, I just asked Huang to resend what I had on my testing/next because it had not been sent to devicetree mailing list. It's definitely a tricky question what the right Signed-off-by chain is in this case, I guess strictly speaking it could have been Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com which could correctly track where the patches went, but it's also somewhat silly. I would probably just have dropped the second Signed-off-by, so that the last S-o-b in the patch matches the From, as we expect. It's definitely good to know that Huang Rui was not faking your Signed-off-by but that you had actually provided it yourself. Arnd -- 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 v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thu, Oct 30, 2014 at 03:14:17PM +0100, Arnd Bergmann wrote: On Thursday 30 October 2014 09:08:32 Felipe Balbi wrote: On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: On Thursday 30 October 2014 18:08:26 Huang Rui wrote: It enables hibernation if the function is set in coreConsultant. Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Something went wrong with the Signed-off-by lines here. You should never add someone else's Signed-off-by below yours. I took a brief look at the entire series and the patches all look good to me, but you have made the same mistake with the Signed-off-by multiple times. there are no mistakes, I just asked Huang to resend what I had on my testing/next because it had not been sent to devicetree mailing list. It's definitely a tricky question what the right Signed-off-by chain is in this case, I guess strictly speaking it could have been Suggested-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Huang Rui ray.hu...@amd.com which could correctly track where the patches went, but it's also somewhat silly. somewhat ? You don't need to be so black and white. -- balbi signature.asc Description: Digital signature
Re: [PATCH] USB: simple: add Google simple serial SubClass support
On Wed, Oct 29, 2014 at 02:21:56PM -0700, Anton Staaf wrote: Add support for Google devices that export simple serial interfaces using the vendor specific SubClass/Protocol pair 0x50/0x01. Signed-off-by: Anton Staaf robot...@chromium.org --- drivers/usb/serial/usb-serial-simple.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index fb79775..85bb973 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c @@ -8,6 +8,7 @@ * Copyright (C) 2010 Zilogic Systems c...@zilogic.com * Copyright (C) 2013 Wei Shuai cpuw...@gmail.com * Copyright (C) 2013 Linux Foundation + * Copyright (C) 2014 Google, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version Based on advice from my lawyer, a change this size does not warrent a copyright notice at the top of a file. If your lawyers feel otherwise, please let me know and I will be glad to discuss it with them. So, care to resend this without this change to the file? thanks, greg k-h -- 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 v4] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris j...@jtan.com --- Moved prototype. Thanks, Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..d2cd1b6d02a7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + static DEFINE_MUTEX(acm_table_lock); /* @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 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: [PATCH v4] cdc-acm: ensure that termios get set when the port is activated
On Thu, Oct 30, 2014 at 10:45:38AM -0400, Jim Paris wrote: The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris j...@jtan.com --- Moved prototype. You seem to have posted the old version again. --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..d2cd1b6d02a7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + static DEFINE_MUTEX(acm_table_lock); Johan -- 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 v4-real] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris j...@jtan.com --- Johan Hovold wrote: On Thu, Oct 30, 2014 at 10:45:38AM -0400, Jim Paris wrote: Moved prototype. You seem to have posted the old version again. Doh. Fixed. Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..6c358c5e05ab 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS]; static DEFINE_MUTEX(acm_table_lock); +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + /* * acm_table accessors */ @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 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
Question r/e zero byte bulk transfer on musb gadget (causes kernel panic)
Hi All, I want to ask what the correct USB behavior should be for a gadget attempting to perform a zero byte transfer (note transfer, not transaction) on a bulk-in endpoint should be: Background: * Basically I've got a hacked up kernel; hardware is TI omap dm3730 (an overo gumstix board). * I use gadget fs (for which I've done major work to fix both gadgetfs and musb). * I connect the overo board to a windows/linux/osx pc via its OTG port. I discovered that by writing a zero length packet to a bulk in endpoint I can cause a kernel panic in musb - basically I think it is trying to setup a DMA transaction with a valid pointer of zero bytes and blowing up. I encountered this by writing a crappy user-land program (by accident). Now I don't believe I should be able to panic the kernel from my stupid user program; so I could easily short-cut this so that gadgetfs disallows zero byte writes. I could also pursue this lower so that musb does not allow 0 length transactions - however, my question is more basic than that: Are zero length transfers from a device to the PC on a bulk endpoint sensible? I can see a case where a zero length transfer would cause a read thread in the host to be interrupted. Does musb/gadgetfs need to correctly support zero byte transfers, or is this a non-sensible suggestion? Cheers, -Brett -- 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 v2 01/29] host: ehci-atmel: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-atmel.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index ec9f7b7..56a8850 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -107,22 +107,15 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto fail_request_resource; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto fail_request_resource; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + iclk = devm_clk_get(pdev-dev, ehci_clk); if (IS_ERR(iclk)) { dev_err(pdev-dev, Error getting interface clock\n); -- 1.7.9.5 -- 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 v2 02/29] host: ohci-da8xx: remove duplicate check on resource
From: Varka Bhadram var...@cdac.in Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-da8xx.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index df06be6..1c76999 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -313,16 +313,13 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver, return -ENOMEM; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) - return -ENODEV; - hcd-rsrc_start = mem-start; - hcd-rsrc_len = resource_size(mem); - hcd-regs = devm_ioremap_resource(pdev-dev, mem); if (IS_ERR(hcd-regs)) { error = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = mem-start; + hcd-rsrc_len = resource_size(mem); ohci_hcd_init(hcd_to_ohci(hcd)); -- 1.7.9.5 -- 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 v2 00/29] cleanup on resource check
From: Varka Bhadram var...@cdac.in This series removes the duplication of sanity check for platform_get_resource() return resource. It will be checked with devm_ioremap_resource() This entire series rebased on testing/fixes of [1]. [1]: http://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git changes since v1: - removed broken patches - added Ack of Alan Stern for all the ehci, ohci, and uhci changes. Varka Bhadram (29): host: ehci-atmel: remove duplicate check on resource host: ohci-da8xx: remove duplicate check on resource host: ehci-tegra: remove duplicate check on resource host: ehci-w90x900: remove duplicate check on resource host: ohci-at91: remove duplicate check on resource host: ohci-exynos: remove duplicate check on resource host: ohci-jz4740: remove duplicate check on resource host: ohci-octeon: remove duplicate check on resource host: ohci-platform: remove duplicate check on resource host: ohci-pxa27x: remove duplicate check on resource host: ehci-sh: remove duplicate check on resource host: ohci-spear: remove duplicate check on resource host: ehci-msm: remove duplicate check on resource host: ehci-mv: remove duplicate check on resource host: ehci-mxc: remove duplicate check on resource host: ehci-octeon: remove duplicate check on resource host: ehci-orion: remove duplicate check on resource host: ehci-platform: remove duplicate check on resource host: ehci-sead3: remove duplicate check on resource host: ehci-spear: remove duplicate check on resource host: uhci-platform: remove duplicate check on resource host: xhci-plat: remove duplicate check on resource musb: musb_core: remove duplicate check on resource musb: musb_dsps: remove duplicate check on resource phy: phy-rcar-usb: remove duplicate check on resource renesas_usbhs: common: remove duplicate check on resource dwc3: dwc3-keystone: remove duplicate check on resource host: ehci-fsl: remove duplicate check on resource host: ehci-exynos: remove duplicate check on resource drivers/usb/dwc3/dwc3-keystone.c |5 - drivers/usb/host/ehci-atmel.c | 13 +++-- drivers/usb/host/ehci-exynos.c | 11 +++ drivers/usb/host/ehci-fsl.c| 12 +++- drivers/usb/host/ehci-msm.c| 10 ++ drivers/usb/host/ehci-mv.c | 12 drivers/usb/host/ehci-mxc.c| 11 ++- drivers/usb/host/ehci-octeon.c | 12 +++- drivers/usb/host/ehci-orion.c | 10 +- drivers/usb/host/ehci-platform.c | 12 drivers/usb/host/ehci-sead3.c |5 ++--- drivers/usb/host/ehci-sh.c | 15 +++ drivers/usb/host/ehci-spear.c |9 ++--- drivers/usb/host/ehci-tegra.c | 10 +++--- drivers/usb/host/ehci-w90x900.c| 13 +++-- drivers/usb/host/ohci-at91.c | 11 +++ drivers/usb/host/ohci-da8xx.c |7 ++- drivers/usb/host/ohci-exynos.c | 10 ++ drivers/usb/host/ohci-jz4740.c | 13 +++-- drivers/usb/host/ohci-octeon.c | 12 +++- drivers/usb/host/ohci-platform.c | 13 - drivers/usb/host/ohci-pxa27x.c | 11 ++- drivers/usb/host/ohci-spear.c | 11 +++ drivers/usb/host/uhci-platform.c |7 --- drivers/usb/host/xhci-plat.c | 10 -- drivers/usb/musb/musb_core.c |4 ++-- drivers/usb/musb/musb_dsps.c |3 --- drivers/usb/phy/phy-rcar-usb.c |8 +++- drivers/usb/renesas_usbhs/common.c |3 ++- 29 files changed, 71 insertions(+), 212 deletions(-) -- 1.7.9.5 -- 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 v2 04/29] host: ehci-w90x900: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-w90x900.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index a9303af..4717bf2 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c @@ -42,27 +42,20 @@ static int usb_w90x900_probe(const struct hc_driver *driver, int retval = 0, irq; unsigned long val; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENXIO; - goto err1; - } - hcd = usb_create_hcd(driver, pdev-dev, w90x900 EHCI); if (!hcd) { retval = -ENOMEM; goto err1; } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err2; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); ehci = hcd_to_ehci(hcd); ehci-caps = hcd-regs; -- 1.7.9.5 -- 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 v2 05/29] host: ohci-at91: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index e49eb4f..90666ea 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -137,12 +137,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_dbg(dev, hcd probe: missing memory resource\n); - return -ENXIO; - } - irq = platform_get_irq(pdev, 0); if (irq 0) { dev_dbg(dev, hcd probe: missing irq resource\n); @@ -152,14 +146,15 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd = usb_create_hcd(driver, dev, at91); if (!hcd) return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); iclk = devm_clk_get(dev, ohci_clk); if (IS_ERR(iclk)) { -- 1.7.9.5 -- 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 v2 03/29] host: ehci-tegra: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-tegra.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index aaa0197..eb36b7a 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -460,18 +460,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) nvidia,needs-double-reset); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto cleanup_clk_en; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto cleanup_clk_en; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + ehci-caps = hcd-regs + 0x100; ehci-has_hostpc = soc_config-has_hostpc; -- 1.7.9.5 -- 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 v2 08/29] host: ohci-octeon: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c index 15af895..20d861b 100644 --- a/drivers/usb/host/ohci-octeon.c +++ b/drivers/usb/host/ohci-octeon.c @@ -120,12 +120,6 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - /* Ohci is a 32-bit device. */ ret = dma_coerce_mask_and_coherent(pdev-dev, DMA_BIT_MASK(32)); if (ret) @@ -135,14 +129,14 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg_base = devm_ioremap_resource(pdev-dev, res_mem); if (IS_ERR(reg_base)) { ret = PTR_ERR(reg_base); goto err1; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); ohci_octeon_hw_start(); -- 1.7.9.5 -- 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 v2 06/29] host: ohci-exynos: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-exynos.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index d28b658..f601952 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -156,19 +156,13 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto fail_io; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto fail_io; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); irq = platform_get_irq(pdev, 0); if (!irq) { -- 1.7.9.5 -- 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 v2 09/29] host: ohci-platform: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-platform.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 4369299..6c7f74b 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -149,12 +149,6 @@ static int ohci_platform_probe(struct platform_device *dev) return irq; } - res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res_mem) { - dev_err(dev-dev, no memory resource provided); - return -ENXIO; - } - hcd = usb_create_hcd(ohci_platform_hc_driver, dev-dev, dev_name(dev-dev)); if (!hcd) @@ -236,14 +230,15 @@ static int ohci_platform_probe(struct platform_device *dev) goto err_reset; } - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(dev-dev, res_mem); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto err_power; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); + err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_power; -- 1.7.9.5 -- 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 v2 07/29] host: ohci-jz4740: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-jz4740.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index c2c221a..8ddd8f5 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c @@ -153,13 +153,6 @@ static int jz4740_ohci_probe(struct platform_device *pdev) struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_err(pdev-dev, Failed to get platform resource\n); - return -ENOENT; - } - irq = platform_get_irq(pdev, 0); if (irq 0) { dev_err(pdev-dev, Failed to get platform irq\n); @@ -174,14 +167,14 @@ static int jz4740_ohci_probe(struct platform_device *pdev) jz4740_ohci = hcd_to_jz4740_hcd(hcd); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_free; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); jz4740_ohci-clk = devm_clk_get(pdev-dev, uhc); if (IS_ERR(jz4740_ohci-clk)) { -- 1.7.9.5 -- 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 v2 11/29] host: ehci-sh: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sh.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 9b9b9f5..4b2c3a7 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c @@ -86,15 +86,6 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) if (usb_disabled()) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - ret = -ENODEV; - goto fail_create_hcd; - } - irq = platform_get_irq(pdev, 0); if (irq = 0) { dev_err(pdev-dev, @@ -114,14 +105,14 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) goto fail_create_hcd; } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto fail_request_resource; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); priv = devm_kzalloc(pdev-dev, sizeof(struct ehci_sh_priv), GFP_KERNEL); -- 1.7.9.5 -- 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 v2 12/29] host: ohci-spear: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-spear.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 8d58766..4a54f9d 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -74,20 +74,15 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd-rsrc_start = pdev-resource[0].start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err_put_hcd; } + hcd-rsrc_start = pdev-resource[0].start; + hcd-rsrc_len = resource_size(res); + sohci_p = to_spear_ohci(hcd); sohci_p-clk = usbh_clk; -- 1.7.9.5 -- 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 v2 13/29] host: ehci-msm: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-msm.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 9dc2118..9db74ca 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -88,19 +88,13 @@ static int ehci_msm_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Unable to get memory resource\n); - ret = -ENODEV; - goto put_hcd; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); /* * OTG driver takes care of PHY initialization, clock management, -- 1.7.9.5 -- 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 v2 10/29] host: ohci-pxa27x: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-pxa27x.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e68f3d0..1339981 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -447,20 +447,13 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device return -ENOMEM; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) { - pr_err(no resource of IORESOURCE_MEM); - retval = -ENXIO; - goto err; - } - - hcd-rsrc_start = r-start; - hcd-rsrc_len = resource_size(r); - hcd-regs = devm_ioremap_resource(pdev-dev, r); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err; } + hcd-rsrc_start = r-start; + hcd-rsrc_len = resource_size(r); /* initialize struct pxa27x_ohci */ pxa_ohci = to_pxa27x_ohci(hcd); -- 1.7.9.5 -- 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 v2 16/29] host: ehci-octeon: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index 9051439..2d0c4bc 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c @@ -106,12 +106,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - /* * We can DMA from anywhere. But the descriptors must be in * the lower 4GB. @@ -125,14 +119,14 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res_mem-start; - hcd-rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res_mem); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res_mem-start; + hcd-rsrc_len = resource_size(res_mem); ehci_octeon_start(); -- 1.7.9.5 -- 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 v2 19/29] host: ehci-sead3: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); /* Root hub has integrated TT. */ hcd-has_tt = 1; -- 1.7.9.5 -- 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 v2 25/29] phy: phy-rcar-usb: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/phy/phy-rcar-usb.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-usb.c b/drivers/usb/phy/phy-rcar-usb.c index 33265a5..e9f3a93 100644 --- a/drivers/usb/phy/phy-rcar-usb.c +++ b/drivers/usb/phy/phy-rcar-usb.c @@ -195,11 +195,9 @@ static int rcar_usb_phy_probe(struct platform_device *pdev) return PTR_ERR(reg0); res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res1) { - reg1 = devm_ioremap_resource(dev, res1); - if (IS_ERR(reg1)) - return PTR_ERR(reg1); - } + reg1 = devm_ioremap_resource(dev, res1); + if (IS_ERR(reg1)) + return PTR_ERR(reg1); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { -- 1.7.9.5 -- 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 v2 22/29] host: xhci-plat: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/xhci-plat.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0c..e68b4ec 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -83,9 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if (irq 0) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; if (of_device_is_compatible(pdev-dev.of_node, marvell,armada-375-xhci) || @@ -109,15 +106,16 @@ static int xhci_plat_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + /* * Not all platforms have a clk so it is not an error if the * clock does not exists. -- 1.7.9.5 -- 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 v2 23/29] musb: musb_core: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/musb/musb_core.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b841ee0..55ebd4b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2080,10 +2080,10 @@ static int musb_probe(struct platform_device *pdev) struct resource *iomem; void __iomem*base; - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iomem || irq = 0) + if (irq = 0) return -ENODEV; + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, iomem); if (IS_ERR(base)) return PTR_ERR(base); -- 1.7.9.5 -- 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 v2 21/29] host: uhci-platform: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Also fix in accessing NULL if resource didn't get. Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/uhci-platform.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d..081330c 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -86,14 +86,15 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_rmr; } + + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + uhci = hcd_to_uhci(hcd); uhci-regs = hcd-regs; -- 1.7.9.5 -- 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 v2 27/29] dwc3: dwc3-keystone: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/dwc3/dwc3-keystone.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 7ec8495..dd8d2df 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -104,11 +104,6 @@ static int kdwc3_probe(struct platform_device *pdev) kdwc-dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, missing usbss resource\n); - return -EINVAL; - } - kdwc-usbss = devm_ioremap_resource(dev, res); if (IS_ERR(kdwc-usbss)) return PTR_ERR(kdwc-usbss); -- 1.7.9.5 -- 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 v2 15/29] host: ehci-mxc: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-mxc.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index dbe5e4e..c7a9b31 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -69,20 +69,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, Found HC with no register addr. Check setup!\n); - ret = -ENODEV; - goto err_alloc; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err_alloc; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); hcd-has_tt = 1; ehci = hcd_to_ehci(hcd); -- 1.7.9.5 -- 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 v2 29/29] host: ehci-exynos: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-exynos.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 7189f2e..c2777d2 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -188,20 +188,15 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Failed to get I/O memory\n); - err = -ENXIO; - goto fail_io; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { err = PTR_ERR(hcd-regs); goto fail_io; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + irq = platform_get_irq(pdev, 0); if (!irq) { dev_err(pdev-dev, Failed to get IRQ\n); -- 1.7.9.5 -- 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 v2 28/29] host: ehci-fsl: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-fsl.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 2d2ae8d..fb7bd0c 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -93,21 +93,15 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto err2; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err2; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); + pdata-regs = hcd-regs; if (pdata-power_budget) -- 1.7.9.5 -- 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 v2 24/29] musb: musb_dsps: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/musb/musb_dsps.c |3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 48bc09e..965c552 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -447,9 +447,6 @@ static int dsps_musb_init(struct musb *musb) int ret; r = platform_get_resource_byname(parent, IORESOURCE_MEM, control); - if (!r) - return -EINVAL; - reg_base = devm_ioremap_resource(dev, r); if (IS_ERR(reg_base)) return PTR_ERR(reg_base); -- 1.7.9.5 -- 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 v2 26/29] renesas_usbhs: common: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in --- drivers/usb/renesas_usbhs/common.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index b3b6813..3ffd552 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -497,8 +497,9 @@ static int usbhs_probe(struct platform_device *pdev) /* platform data */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res || !irq_res) { + if (!irq_res) { dev_err(pdev-dev, Not enough Renesas USB platform resources.\n); return -ENODEV; } -- 1.7.9.5 -- 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 v2 20/29] host: ehci-spear: remove duplicate check on resource
From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-spear.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1355ff0..34e1474 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -99,18 +99,13 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { retval = PTR_ERR(hcd-regs); goto err_put_hcd; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); sehci = to_spear_ehci(hcd); sehci-clk = usbh_clk; -- 1.7.9.5 -- 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 v7 1/7] usb: move the OTG state from the USB PHY to the OTG structure
On Tue, Oct 28, 2014 at 05:35:35PM +0100, Antoine Tenart wrote: Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com Acked-by: Peter Chen peter.c...@freescale.com Acked-by: Felipe Balbi ba...@ti.com --- drivers/phy/phy-omap-usb2.c | 8 +--- drivers/usb/chipidea/debug.c| 2 +- drivers/usb/chipidea/otg_fsm.c | 12 ++--- drivers/usb/common/usb-otg-fsm.c| 8 ++-- drivers/usb/host/ohci-omap.c| 2 +- drivers/usb/musb/am35x.c| 28 +-- drivers/usb/musb/blackfin.c | 18 +++ drivers/usb/musb/da8xx.c| 28 +-- drivers/usb/musb/davinci.c | 18 +++ drivers/usb/musb/musb_core.c| 94 ++--- drivers/usb/musb/musb_dsps.c| 26 +- drivers/usb/musb/musb_gadget.c | 36 +++--- drivers/usb/musb/musb_host.c| 8 ++-- drivers/usb/musb/musb_virthub.c | 22 - drivers/usb/musb/omap2430.c | 30 ++-- drivers/usb/musb/tusb6010.c | 40 drivers/usb/musb/ux500.c| 10 ++-- drivers/usb/phy/phy-ab8500-usb.c| 10 ++-- drivers/usb/phy/phy-fsl-usb.c | 10 ++-- drivers/usb/phy/phy-generic.c | 4 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 10 ++-- drivers/usb/phy/phy-msm-usb.c | 34 +++--- drivers/usb/phy/phy-mv-usb.c| 46 +- include/linux/usb/otg.h | 2 + include/linux/usb/phy.h | 1 - 25 files changed, 252 insertions(+), 255 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 8c842980834a..9f4093590f4c 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -80,11 +80,9 @@ static int omap_usb_start_srp(struct usb_otg *otg) static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) { - struct usb_phy *phy = otg-phy; - otg-host = host; if (!host) - phy-state = OTG_STATE_UNDEFINED; + otg-state = OTG_STATE_UNDEFINED; return 0; } @@ -92,11 +90,9 @@ static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) static int omap_usb_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) { - struct usb_phy *phy = otg-phy; - otg-gadget = gadget; if (!gadget) - phy-state = OTG_STATE_UNDEFINED; + otg-state = OTG_STATE_UNDEFINED; return 0; } diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 795d6538d630..8878eea38d44 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) /* -- State - */ seq_printf(s, OTG state: %s\n\n, - usb_otg_state_string(ci-transceiver-state)); + usb_otg_state_string(ci-transceiver-otg.state)); /* -- State Machine Variables - */ seq_printf(s, a_bus_drop: %d\n, fsm-a_bus_drop); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index caaabc58021e..8cb2508a6b71 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -328,7 +328,7 @@ static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) set_tmout(ci, indicator); /* only vbus fall below B_sess_vld in b_idle state */ - if (ci-transceiver-state == OTG_STATE_B_IDLE) + if (ci-fsm.otg-state == OTG_STATE_B_IDLE) ci_otg_queue_work(ci); } @@ -582,11 +582,11 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) * when there is no gadget class driver */ if (ci-fsm.id !(ci-driver) - ci-transceiver-state OTG_STATE_A_IDLE) + ci-fsm.otg-state OTG_STATE_A_IDLE) return 0; if (otg_statemachine(ci-fsm)) { - if (ci-transceiver-state == OTG_STATE_A_IDLE) { + if (ci-fsm.otg-state == OTG_STATE_A_IDLE) { /* * Further state change for cases: * a_idle to b_idle; or @@ -600,7 +600,7 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) ci_otg_queue_work(ci); if (ci-id_event) ci-id_event = false; - } else if (ci-transceiver-state == OTG_STATE_B_IDLE) { + } else if (ci-fsm.otg-state == OTG_STATE_B_IDLE) { if (ci-fsm.b_sess_vld) { ci-fsm.power_up = 0; /*
Re: [PATCH v7 2/7] usb: rename phy to usb_phy in OTG
On Tue, Oct 28, 2014 at 05:35:36PM +0100, Antoine Tenart wrote: This patch prepares the introduction of the generic PHY support in the USB OTG common functions. The USB PHY member of the OTG structure is renamed to 'usb_phy' and modifications are done in all drivers accessing it. Renaming this pointer will allow to keep the compatibility for USB PHY drivers. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com Acked-by: Felipe Balbi ba...@ti.com --- drivers/phy/phy-omap-usb2.c | 6 ++-- drivers/usb/chipidea/otg_fsm.c | 2 +- drivers/usb/phy/phy-ab8500-usb.c| 6 ++-- drivers/usb/phy/phy-fsl-usb.c | 13 drivers/usb/phy/phy-generic.c | 2 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +-- drivers/usb/phy/phy-isp1301-omap.c | 10 +++--- drivers/usb/phy/phy-msm-usb.c | 61 +++-- drivers/usb/phy/phy-mv-usb.c| 4 +-- drivers/usb/phy/phy-tahvo.c | 8 +++-- drivers/usb/phy/phy-ulpi.c | 6 ++-- include/linux/usb/otg.h | 2 +- 12 files changed, 65 insertions(+), 59 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 9f4093590f4c..32c3e86b4935 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) { - struct omap_usb *phy = phy_to_omapusb(otg-phy); + struct omap_usb *phy = phy_to_omapusb(otg-usb_phy); if (!phy-comparator) return -ENODEV; @@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) static int omap_usb_start_srp(struct usb_otg *otg) { - struct omap_usb *phy = phy_to_omapusb(otg-phy); + struct omap_usb *phy = phy_to_omapusb(otg-usb_phy); if (!phy-comparator) return -ENODEV; @@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev) otg-set_vbus = omap_usb_set_vbus; if (phy_data-flags OMAP_USB2_HAS_START_SRP) otg-start_srp = omap_usb_start_srp; - otg-phy= phy-phy; + otg-usb_phy= phy-phy; platform_set_drvdata(pdev, phy); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 8cb2508a6b71..d8490e758a74 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) return -ENOMEM; } - otg-phy = ci-transceiver; + otg-usb_phy = ci-transceiver; otg-gadget = ci-gadget; ci-fsm.otg = otg; ci-transceiver-otg = ci-fsm.otg; diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 2d5250143ce1..3a802fa7dae2 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg, if (!otg) return -ENODEV; - ab = phy_to_ab(otg-phy); + ab = phy_to_ab(otg-usb_phy); ab-phy.otg-gadget = gadget; @@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) if (!otg) return -ENODEV; - ab = phy_to_ab(otg-phy); + ab = phy_to_ab(otg-usb_phy); ab-phy.otg-host = host; @@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) ab-phy.set_power = ab8500_usb_set_power; ab-phy.otg-state = OTG_STATE_UNDEFINED; - otg-phy= ab-phy; + otg-usb_phy= ab-phy; otg-set_host = ab8500_usb_set_host; otg-set_peripheral = ab8500_usb_set_peripheral; diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 15d7a81eece5..b7f36b212422 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) { struct usb_otg *otg = fsm-otg; struct device *dev; - struct fsl_otg *otg_dev = container_of(otg-phy, struct fsl_otg, phy); + struct fsl_otg *otg_dev = + container_of(otg-usb_phy, struct fsl_otg, phy); u32 retval = 0; if (!otg-host) @@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) if (!otg) return -ENODEV; - otg_dev = container_of(otg-phy, struct fsl_otg, phy); + otg_dev = container_of(otg-usb_phy, struct fsl_otg, phy); if (otg_dev != fsl_otg_dev) return -ENODEV; @@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg, if (!otg) return -ENODEV; - otg_dev = container_of(otg-phy, struct fsl_otg, phy); + otg_dev =
Re: [PATCH v7 0/7] usb: add support for the generic PHY framework
Hi, On Tue, Oct 28, 2014 at 05:35:34PM +0100, Antoine Tenart wrote: The series can be found at: git://git.free-electrons.com:users/antoine-tenart/linux.git usb-phy Changes since v6: - rebased on top of v3.18-rc2 Changes since v5: - rebased on the latest version of Sergei's series[1] - fixed one modifiaction made in the wrong patch Changes since v4: - reworked the PHY handling in ci_hdrc_probe() - fixed a rebase error Changes since v3: - moved phy_exit() after phy_power_on() - fixed the PHY handling in ci_hdrc_probe() - some little fixes Changes since v2: - rebased the series on top of v3.17-rc1 - switched to devm_phy_get() to handle non DT cases - moved usb_otg into the ci_hdrc structure Changes since v1: - rebased the series on top of [2] (generic PHY support for HCD) - split s/phy/usb_phy/ renaming and generic PHY support in separate patches [1] https://www.mail-archive.com/linux-usb%40vger.kernel.org/msg48068.html Antoine Tenart (7): usb: move the OTG state from the USB PHY to the OTG structure usb: rename phy to usb_phy in OTG usb: add support to the generic PHY framework in OTG usb: allow to supply the PHY in the drivers when using HCD usb: rename transceiver and phy to usb_phy in ChipIdea usb: chipidea: move usb_otg into struct ci_hdrc usb: chipidea: add support to the generic PHY framework in ChipIdea quick question, who do you guys want this patchset to go through ? If it's me, I can take them no problem. -- balbi signature.asc Description: Digital signature
Re: [PATCH v7 1/7] usb: move the OTG state from the USB PHY to the OTG structure
On Thu, Oct 30, 2014 at 11:31:48AM -0500, Felipe Balbi wrote: On Tue, Oct 28, 2014 at 05:35:35PM +0100, Antoine Tenart wrote: Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. Signed-off-by: Antoine Tenart antoine.ten...@free-electrons.com Acked-by: Peter Chen peter.c...@freescale.com Acked-by: Felipe Balbi ba...@ti.com fails to apply: $ patch -p1 --dry-run patch.diff checking file drivers/phy/phy-omap-usb2.c checking file drivers/usb/chipidea/debug.c checking file drivers/usb/chipidea/otg_fsm.c checking file drivers/usb/common/usb-otg-fsm.c checking file drivers/usb/host/ohci-omap.c checking file drivers/usb/musb/am35x.c checking file drivers/usb/musb/blackfin.c checking file drivers/usb/musb/da8xx.c checking file drivers/usb/musb/davinci.c checking file drivers/usb/musb/musb_core.c checking file drivers/usb/musb/musb_dsps.c checking file drivers/usb/musb/musb_gadget.c Hunk #3 succeeded at 1791 (offset -1 lines). Hunk #4 succeeded at 1857 (offset -3 lines). Hunk #5 FAILED at 1945. Hunk #6 succeeded at 1968 (offset -7 lines). Hunk #7 succeeded at 1982 (offset -7 lines). Hunk #8 succeeded at 1994 (offset -7 lines). Hunk #9 succeeded at 2012 (offset -7 lines). Hunk #10 succeeded at 2043 (offset -7 lines). Hunk #11 succeeded at 2118 (offset -7 lines). 1 out of 11 hunks FAILED checking file drivers/usb/musb/musb_host.c checking file drivers/usb/musb/musb_virthub.c checking file drivers/usb/musb/omap2430.c Hunk #6 succeeded at 180 (offset 1 line). Hunk #7 succeeded at 192 (offset 1 line). Hunk #8 succeeded at 201 (offset 1 line). Hunk #9 succeeded at 266 (offset 1 line). Hunk #10 succeeded at 280 (offset 1 line). checking file drivers/usb/musb/tusb6010.c checking file drivers/usb/musb/ux500.c checking file drivers/usb/phy/phy-ab8500-usb.c checking file drivers/usb/phy/phy-fsl-usb.c checking file drivers/usb/phy/phy-generic.c checking file drivers/usb/phy/phy-gpio-vbus-usb.c checking file drivers/usb/phy/phy-msm-usb.c Hunk #13 succeeded at 1769 (offset -6 lines). checking file drivers/usb/phy/phy-mv-usb.c Hunk #5 succeeded at 715 (offset -2 lines). checking file include/linux/usb/otg.h checking file include/linux/usb/phy.h Please rebase on my testing/next and I'll take the series. When rebasing, then add Peter's Tested-by/Acked-by where they're missing. cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 20/20] usb: dwc3: make HIRD threshold configurable
On Thu, Oct 30, 2014 at 06:08:45PM +0800, Huang Rui wrote: HIRD threshold should be configurable by different platforms. From DesignWare databook: When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1. When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1. Signed-off-by: Huang Rui ray.hu...@amd.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ drivers/usb/dwc3/core.c| 17 + drivers/usb/dwc3/core.h| 6 ++ drivers/usb/dwc3/gadget.c | 6 +- drivers/usb/dwc3/platform_data.h | 3 +++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index feaf2c8..5b99755 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -34,6 +34,9 @@ Optional properties: LTSSM during USB3 Compliance mode. - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. + - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal + utmi_l1_suspend_n, false when asserts utmi_sleep_n + - snps,hird-threshold: HIRD threshold This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a28ed1c..f4172ab 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -729,6 +729,7 @@ static int dwc3_probe(struct platform_device *pdev) struct dwc3 *dwc; u8 lpm_nyet_threshold; u8 tx_de_emphasis; + u8 hird_threshold; int ret; @@ -790,12 +791,22 @@ static int dwc3_probe(struct platform_device *pdev) /* default to -3.5dB de-emphasis */ tx_de_emphasis = 1; + /* + * defalut to assert utmi_sleep_n and use maximum allowed HIRD default -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 19/20] usb: dwc3: add support for AMD Nolan platform
On Thu, Oct 30, 2014 at 06:08:44PM +0800, Huang Rui wrote: This patch adds support for AMD Nolan (NL) FPGA and SoC platform. Cc: Jason Chang jason.ch...@amd.com Signed-off-by: Huang Rui ray.hu...@amd.com --- drivers/usb/dwc3/dwc3-pci.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index ada975f..257fb3f9e 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -145,6 +145,28 @@ static int dwc3_pci_probe(struct pci_dev *pci, res[1].name = dwc_usb3; res[1].flags= IORESOURCE_IRQ; + if (pci-vendor == PCI_VENDOR_ID_AMD + pci-device == PCI_DEVICE_ID_AMD_NL_USB) { + dwc3_pdata.has_lpm_erratum = true; + dwc3_pdata.lpm_nyet_threshold = 0xf; + + dwc3_pdata.u2exit_lfps_quirk = true; + dwc3_pdata.u2ss_inp3_quirk = true; + dwc3_pdata.req_p1p2p3_quirk = true; + dwc3_pdata.del_p1p2p3_quirk = true; + dwc3_pdata.del_phy_power_chg_quirk = true; + dwc3_pdata.lfps_filter_quirk = true; + dwc3_pdata.rx_detect_poll_quirk = true; + + dwc3_pdata.tx_de_emphasis_quirk = true; + dwc3_pdata.tx_de_emphasis = 1; + + /* FIXME these quirks should move when AMD NL taps out */ do you mean ? /* * FIXME these quirks should be removed when AMD NL * tapes out */ -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 16/20] usb: dwc3: add disable usb2 suspend phy quirk
On Thu, Oct 30, 2014 at 06:08:41PM +0800, Huang Rui wrote: This patch adds disable usb2 suspend phy quirk, and some special platforms can configure that if it is needed. Signed-off-by: Huang Rui ray.hu...@amd.com --- Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/dwc3/core.c| 7 +++ drivers/usb/dwc3/core.h| 2 ++ drivers/usb/dwc3/platform_data.h | 1 + 4 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index 3720fca..feaf2c8 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -33,6 +33,7 @@ Optional properties: - snps,tx_de_emphasis: the value driven to the PHY is controlled by the LTSSM during USB3 Compliance mode. - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. + - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index fdc715a..a28ed1c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -423,6 +423,10 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc-revision DWC3_REVISION_194A) reg |= DWC3_GUSB2PHYCFG_SUSPHY; + /* FIXME will move FPGA flag when AMD NL taps out */ no need to mention AMD NL here. We still want to have is_fpga flag, just dwc3-pci will be patches once AMD NL tapes out. -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 14/20] usb: dwc3: add Tx de-emphasis quirk
On Thu, Oct 30, 2014 at 06:08:39PM +0800, Huang Rui wrote: This patch adds Tx de-emphasis quirk, and the Tx de-emphasis value is configurable according to PIPE3 specification. Value Description 0 -6dB de-emphasis 1 -3.5dB de-emphasis 2 No de-emphasis 3 Reserved It can be configured on DT or platform data. Signed-off-by: Huang Rui ray.hu...@amd.com doesn't apply: checking file Documentation/devicetree/bindings/usb/dwc3.txt checking file drivers/usb/dwc3/core.c Hunk #2 succeeded at 718 (offset -2 lines). Hunk #3 succeeded at 777 (offset -2 lines). Hunk #4 succeeded at 807 (offset -2 lines). Hunk #5 succeeded at 829 (offset -2 lines). Hunk #6 succeeded at 840 (offset -2 lines). checking file drivers/usb/dwc3/core.h Hunk #2 FAILED at 697. 1 out of 3 hunks FAILED checking file drivers/usb/dwc3/platform_data.h please rebase on testing/next -- balbi signature.asc Description: Digital signature
Re: [PATCH RESEND V4 2/9] mailbox: Add NVIDIA Tegra XUSB mailbox driver
On Thu, Oct 30, 2014 at 6:22 AM, Thierry Reding thierry.red...@gmail.com wrote: On Wed, Oct 29, 2014 at 11:02:36AM -0700, Andrew Bresticker wrote: [...] Maybe something like this patch would be more correct in handling this: diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index afcb430508ec..85691a7d8ca6 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -117,10 +117,11 @@ static void poll_txdone(unsigned long data) struct mbox_chan *chan = mbox-chans[i]; if (chan-active_req chan-cl) { - resched = true; txdone = chan-mbox-ops-last_tx_done(chan); if (txdone) tx_tick(chan, 0); + else + resched = true; } } ... but we still need to re-arm the timer if tx_tick() submits another message. Perhaps the better thing to do is to have msg_submit() arm the timer. I think we need both. If the last transmission isn't done yet we still want to keep polling. And we also want to poll if a new message is sent subsequently. Perhaps it would be as easy as moving the poll handling code from mbox_send_message() (if (chan-txdone_method == TXDONE_BY_POLL)) into msg_submit()? That has the additional advantage of being able to omit the polling when an error happens during the mbox' .send_data(). Yes, this is exactly what I've done :). -- 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 v2 19/29] host: ehci-sead3: remove duplicate check on resource
Hello. On 10/30/2014 06:52 PM, varkabhad...@gmail.com wrote: From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); Oops, this would blow up if 'res' is NULL. - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); So this is actually a fix, not a cleanup. WBR, Sergei -- 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 v2 19/29] host: ehci-sead3: remove duplicate check on resource
On 10/30/2014 08:08 PM, Sergei Shtylyov wrote: From: Varka Bhadram varkabhad...@gmail.com Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram var...@cdac.in Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -hcd-rsrc_start = res-start; -hcd-rsrc_len = resource_size(res); Oops, this would blow up if 'res' is NULL. - hcd-regs = devm_ioremap_resource(pdev-dev, res); if (IS_ERR(hcd-regs)) { ret = PTR_ERR(hcd-regs); goto err1; } +hcd-rsrc_start = res-start; +hcd-rsrc_len = resource_size(res); So this is actually a fix, not a cleanup. And the subject doesn't correctly describe what the patch does too... WBR, Sergei -- 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 RESEND V4 4/9] pinctrl: tegra-xusb: Add USB PHY support
On Thu, Oct 30, 2014 at 6:45 AM, Thierry Reding thierry.red...@gmail.com wrote: On Wed, Oct 29, 2014 at 12:43:36PM -0700, Andrew Bresticker wrote: diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c [...] + + for (i = 0; i TEGRA_XUSB_USB3_PHYS; i++) { + if (phy == padctl-phys[TEGRA_XUSB_PADCTL_USB3_P0 + i]) + break; You could simply return i here and then BUG_ON unconditionally. + } + BUG_ON(i == TEGRA_XUSB_USB3_PHYS); + + return i; +} Actually, thinking about it some more, perhaps making this a WARN_ON() and returning an error so that we can continue and propagate the error would be more useful. BUG_ON() will completely hang the kernel with no way out but rebooting. WARN_ON() will give a hint about something being wrong and returning an error will allow the kernel to continue to run, which might be the only way to diagnose and fix the problem, even if it means that USB 3.0 support will be disabled. I felt like BUG_ON is more appropriate here. Hitting this case means there's a bug in the PHY core or a driver has passed a bogus pointer and the stack dump produced by the BUG_ON should make it obvious as to what the issue is. I don't feel too strongly about it though. The problem with BUG_ON() is that you won't be able to go any further. So if this were to happen on a device with no serial you might not even get to a point where you actually see an error message. Handling this more gracefully by propagating the error code and failing .probe() does not seem overly complicated and the WARN_ON() output will hopefully still be noticed (it probably will be after the user can't get USB to work). Ok. @@ -936,6 +2098,18 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev) goto unregister; } + INIT_WORK(padctl-mbox_req_work, tegra_xusb_phy_mbox_work); + padctl-mbox_client.dev = pdev-dev; + padctl-mbox_client.tx_block = true; + padctl-mbox_client.tx_tout = 0; + padctl-mbox_client.rx_callback = tegra_xusb_phy_mbox_rx; + padctl-mbox_chan = mbox_request_channel(padctl-mbox_client, 0); + if (IS_ERR(padctl-mbox_chan)) { + err = PTR_ERR(padctl-mbox_chan); + dev_err(pdev-dev, failed to request mailbox: %d\n, err); + goto unregister; + } I think this should be done before the registering the PHY provider so that we don't expose one (even for only a very short time) before we haven't made sure that it can be used. Also, this effectively makes the mailbox mandatory, which means that the above code is going to break on older DTBs. So I think we have no choice but to make mailbox (and hence XUSB) support optional. I understand the need for binding stability, but it's not like these bindings have been around for very long (a release or two?) and this series has existed for almost the same amount of time. Are there really any DTBs out there that are going to break because of this? Every DTB created from a kernel version that has the original binding but not the one modified as part of this series is going to break. Last time I checked there weren't any exceptions to this rule. Note, though, that the rule is that existing functionality must not break. That is, SATA and PCIe should remain functional, so it should be fine if you just don't register any of the USB PHYs when the request for a mailbox channel fails. Something along these lines should do it: padctl-mbox_chan = mbox_request_channel(...); if (!IS_ERR(padctl-mbox_chan)) { err = tegra_xusb_padctl_setup_usb(...); ... } Ok. diff --git a/include/soc/tegra/xusb.h b/include/soc/tegra/xusb.h index cfe211d..149434f 100644 --- a/include/soc/tegra/xusb.h +++ b/include/soc/tegra/xusb.h @@ -10,6 +10,13 @@ #ifndef __SOC_TEGRA_XUSB_H__ #define __SOC_TEGRA_XUSB_H__ +#define TEGRA_XUSB_USB3_PHYS 2 +#define TEGRA_XUSB_UTMI_PHYS 3 +#define TEGRA_XUSB_HSIC_PHYS 2 +#define TEGRA_XUSB_NUM_USB_PHYS (TEGRA_XUSB_USB3_PHYS + TEGRA_XUSB_UTMI_PHYS + \ + TEGRA_XUSB_HSIC_PHYS) +#define TEGRA_XUSB_NUM_PHYS (TEGRA_XUSB_NUM_USB_PHYS + 2) /* + SATA PCIe */ These are really XUSB pad controller specific defines, why does anyone else need to know this? They're not pad controller specific. They're also used in the xHCI host driver. I keep thinking that there should be a way around this. Of course if both the XHCI and mailbox drivers were merged, then there'd be no need to expose this publicly at all. I'm not sure what you mean. They're SoC-specific constants that need to be shared amongst multiple drivers. It would make sense to place them in a shared header, does it not? -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of