[PATCH v2] usb: gadget: Add the console support for usb-to-serial port
It dose not work when we want to use the usb-to-serial port based on one usb gadget as a console. Thus this patch adds the console initialization to support this request. To avoid the re-entrance when transferring data with usb endpoint, it introduces a kthread to do the IO transmission. Signed-off-by: Baolin Wang --- drivers/usb/gadget/Kconfig |6 + drivers/usb/gadget/function/u_serial.c | 258 2 files changed, 264 insertions(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 33834aa..be5aab9 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -127,6 +127,12 @@ config USB_GADGET_STORAGE_NUM_BUFFERS a module parameter as well. If unsure, say 2. +config U_SERIAL_CONSOLE + bool "Serial gadget console support" + depends on USB_G_SERIAL + help + It supports the serial gadget can be used as a console. + source "drivers/usb/gadget/udc/Kconfig" # diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index f7771d8..6af145f 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "u_serial.h" @@ -79,6 +81,7 @@ */ #define QUEUE_SIZE 16 #define WRITE_BUF_SIZE 8192/* TX only */ +#define GS_CONSOLE_BUF_SIZE8192 /* circular buffer */ struct gs_buf { @@ -88,6 +91,17 @@ struct gs_buf { char*buf_put; }; +/* console info */ +struct gscons_info { + struct gs_port *port; + struct task_struct *console_thread; + struct gs_buf con_buf; + /* protect the buf and busy flag */ + spinlock_t con_lock; + int req_busy; + struct usb_request *console_req; +}; + /* * The port structure holds info for each port, one for each minor number * (and thus for each /dev/ node). @@ -1023,6 +1037,246 @@ static const struct tty_operations gs_tty_ops = { static struct tty_driver *gs_tty_driver; +#ifdef CONFIG_U_SERIAL_CONSOLE + +static struct gscons_info gscons_info; +static struct console gserial_cons; + +static struct usb_request *gs_request_new(struct usb_ep *ep) +{ + struct usb_request *req = usb_ep_alloc_request(ep, GFP_ATOMIC); + if (!req) + return NULL; + + req->buf = kmalloc(ep->maxpacket, GFP_ATOMIC); + if (!req->buf) { + usb_ep_free_request(ep, req); + return NULL; + } + + return req; +} + +static void gs_request_free(struct usb_request *req, struct usb_ep *ep) +{ + if (!req) + return; + + kfree(req->buf); + usb_ep_free_request(ep, req); +} + +static void gs_complete_out(struct usb_ep *ep, struct usb_request *req) +{ + struct gscons_info *info = &gscons_info; + + switch (req->status) { + default: + pr_warn("%s: unexpected %s status %d\n", + __func__, ep->name, req->status); + case 0: + /* normal completion */ + spin_lock(&info->con_lock); + info->req_busy = 0; + spin_unlock(&info->con_lock); + + wake_up_process(info->console_thread); + break; + case -ESHUTDOWN: + /* disconnect */ + pr_vdebug("%s: %s shutdown\n", __func__, ep->name); + break; + } +} + +static int gs_console_connect(int port_num) +{ + struct gscons_info *info = &gscons_info; + struct gs_port *port; + struct usb_ep *ep; + + if (port_num != gserial_cons.index) { + pr_err("%s: port num [%d] is not support console\n", + __func__, port_num); + return -ENXIO; + } + + port = ports[port_num].port; + ep = port->port_usb->in; + if (!info->console_req) { + info->console_req = gs_request_new(ep); + if (!info->console_req) + return -ENOMEM; + info->console_req->complete = gs_complete_out; + } + + info->port = port; + spin_lock(&info->con_lock); + info->req_busy = 0; + spin_unlock(&info->con_lock); + pr_vdebug("port[%d] console connect!\n", port_num); + return 0; +} + +static void gs_console_disconnect(struct usb_ep *ep) +{ + struct gscons_info *info = &gscons_info; + struct usb_request *req = info->console_req; + + gs_request_free(req, ep); + info->console_req = NULL; +} + +static int gs_console_thread(void *data) +{ + struct gscons_info *info = &gscons_info; + struct gs_port *port; + struct usb_request *req; + struct usb_ep *ep; + int xfer, ret, count, size; + + do { + port = info->port; + set_
[Linux USB] enable/disable individual ports
Hi, I have a libusb (USB-2.0_ tree with the following layout: HOST (USB 2.0) -> 5 port hub (master) -> 5 x 10 port hub -> 50 x USB devices It is a 50 unit mobile device charger and also enables USB data comms to the individual devices. Each node is independently powered. The devices are all the same model/make. I know this is a relative corner case for USB 2.0 standard but that is another story. Is it possible to reset the ports on the 5 port hub (master) individually with libusb or some other system level command? Here's the scenario: When I insert usb devices with the entire chain connected I see varying results for the number of devices detected by the HOST. Sometimes 15 are detected, sometimes 34, 22, 5, etc... However If I disconnect the cables for the 10 port hubs to the 5 port master hub before I insert all the devices and then connect each 10 port hub one at a time with a delay to ensure all the devices on that hub are detected all 50 devices are detected on the host. So I would like to know if there is a method to disable/enable the ports on the 5 port master without resetting the entire bus or causing the sub nodes/hubs to "bounce" their connections. -- Patrick Shirkey Boost Hardware Ltd -- 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: Not enough host controller resources for new device state
On Sat, November 21, 2015 9:35 am, Peter Stuge wrote: > Patrick Shirkey wrote: >> > You essentially have to educate yourself on silicon level (ie. what >> > hardware IP is being used in which consumer products) to sustain a >> > dependency on 127 possible devices per bus. >> > >> > I guess you'll find that there are only very few xHCI IPs out there, >> > probably just three or four. I wouldn't be surprised if they all have >> > the same, or similar, limitations. >> >> Is there anything I can do at the system level to avoid disabling xHCI >> at >> the BIOS level? > > Unfortunately not. The number of supported devices is now very much > hardwired in the host controller hardware. Each connected device > requires its own set of registers in xHCI, so when there is a limit > it is a hard limit. > > That's a bit of a let down as it seems to make it even more difficult to rely on USB for my specific use case in the future. In case anyone else comes across this thread do you mind giving a little more detail on why xHCI overrides EHCI and why it is not possible to disable or work around xHCI at the system level? -- Patrick Shirkey Boost Hardware Ltd -- 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 v12 0/3] Mediatek xHCI support
Hi, On Fri, 2015-11-20 at 13:20 +0200, Mathias Nyman wrote: > On 17.11.2015 11:18, Chunfeng Yun wrote: > > From 577f68d9c0ca1531d5f9cae0dcbea2ba116c8551 Mon Sep 17 00:00:00 2001 > > From: Chunfeng Yun > > Date: Tue, 17 Nov 2015 17:09:05 +0800 > > Subject: [PATCH v12 0/3] Mediatek xHCI support > > > > The patch supports MediaTek's xHCI controller. > > > > There are some differences from xHCI spec: > > 1. The interval is specified in 250 * 8ns increments for Interrupt > > Moderation > > Interval(IMODI) of the Interrupter Moderation(IMOD) register, it is 8 times > > as > > much as that defined in xHCI spec. > > > > 2. For the value of TD Size in Normal TRB, MTK's xHCI controller defines a > > number of packets that remain to be transferred for a TD after processing > > all > > Max packets in all previous TRBs,that means don't include the current TRB's, > > but in xHCI spec it includes the current ones. > > > > 3. To minimize the scheduling effort for synchronous endpoints in xHC, the > > MTK > > architecture defines some extra SW scheduling parameters for HW. According > > to > > these parameters provided by SW, the xHC can easily decide whether a > > synchronous endpoint should be scheduled in a specific uFrame. The extra SW > > scheduling parameters are put into reserved DWs in Slot and Endpoint > > Context. > > And a bandwidth scheduler algorithm is added to support such feature. > > > > A usb3.0 phy driver is also added which used by mt65xx SoCs platform, it > > supports two usb2.0 ports and one usb3.0 port. > > > > Added to my tree, I'll send it forward to Greg shortly > > Fixed the documentation "wakeup_deb_p0" -> "wakeup_deb_p1" typo as well Thank you very much. > > -Mathias > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port
Hi, Tim Bird writes: > On 11/16/2015 09:21 AM, Felipe Balbi wrote: >> >> Hi, >> >> Peter Chen writes: >>> On Wed, Nov 11, 2015 at 09:48:00AM -0800, Tim Bird wrote: On 11/10/2015 07:14 PM, Peter Chen wrote: > On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote: >> This fixes a bug where if you disconnect and re-connect the USB cable, >> the gadget driver stops working. >> >> Add support for async_irq to wake up driver from low power mode. >> Without this, the power management code never calls resume. >> Also, have the phy driver kick the gadget driver (chipidea otg) >> by having the chipidea driver register with it, for vbus connect >> notifications. >> >> Signed-off-by: Tim Bird >> --- >> drivers/usb/chipidea/udc.c| 6 ++ >> drivers/usb/phy/phy-msm-usb.c | 16 >> include/linux/usb/msm_hsusb.h | 1 + >> 3 files changed, 23 insertions(+) >> >> I just wanna know how you guys want this to be handled ? Through my tree >> or chipidea's ? Or do we break the dependencies between the changes ? > > I'm fine with splitting it up. I'm sending a new series with 3 patches > right after this message. Do both trees go to linux-next? I have my fixes and next branches both on next. Not sure about chipidea. -- balbi signature.asc Description: PGP signature
Re: [PATCH RESEND 1/2] usb: dwc2: Make PHY optional
Hi, Stefan Wahren writes: > Hi, > > Am 20.11.2015 um 18:18 schrieb Felipe Balbi: >> >> Hi, >> >> Stefan Wahren writes: >>> Hi Felipe, >>> >>> Am 20.11.2015 um 16:27 schrieb Felipe Balbi: Hi, Stefan Wahren writes: > Hi Felipe, > > Am 19.11.2015 um 20:54 schrieb Felipe Balbi: >> >> Hi John, >> >> John Youn writes: >>> Fixes commit 09a75e85 >>> "usb: dwc2: refactor common low-level hw code to platform.c" >> >> these two lines should be placed ... >> >>> >>> The above commit consolidated the low-level phy access into a common >>> location. This change introduced a check from the gadget requiring >>> that a PHY is specified. This requirement never existed on the host >>> side and broke some platforms when it was moved into platform.c. >>> >>> The gadget doesn't require the PHY either so remove the check. >>> >> >> ... here with the following format: >> >> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level >> hw code to platform.c") >> >> Just is just FYI, as I have already applied another version ;-) >> > > thanks but > > https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/fixes > > seems to miss ("usb: dwc2: fix kernel oops during driver probe") This is what you gent for sending fixes and non-fixes in the same series :-) Also, this has been broken for a long time, you didn't include a "Fixes: foo-bar-baz", you didn't Cc stable (seems like the regression is from v3.19). It gets pretty difficult for me to apply patches properly if you can't send them in a way I can understand what to do with them. If you want patches to get into -rc, send the bare minimum patches needed to fix the problem and do NOT make them depend on anything else. >>> >>> i'm sorry about that. I should have added the fixes tag to all the patches. >>> >>> I tought it wasn't a candidate for Cc stable, since the issue wasn't >>> reproducable before. >>> >>> The intention of the series was to get USB working for 4.4 for >>> bcm2835. >> >> okay, in that case, can you make sure testing/fixes and testing/next >> contain all your pending patches? > > testing/fixes looks good but > > testing/next misses ("usb: dwc2: fix kernel oops during driver probe") > > Is there a conflict? I'm not keeping the same patch on two different branches ;-) fixes has stuff for current -rc while next has stuff for the next merge window. Eventually, I'll merge Linus' tags into next and all will be good. cheers -- balbi signature.asc Description: PGP signature
Re: [PATCH RESEND 1/2] usb: dwc2: Make PHY optional
Hi, Am 20.11.2015 um 18:18 schrieb Felipe Balbi: Hi, Stefan Wahren writes: Hi Felipe, Am 20.11.2015 um 16:27 schrieb Felipe Balbi: Hi, Stefan Wahren writes: Hi Felipe, Am 19.11.2015 um 20:54 schrieb Felipe Balbi: Hi John, John Youn writes: Fixes commit 09a75e85 "usb: dwc2: refactor common low-level hw code to platform.c" these two lines should be placed ... The above commit consolidated the low-level phy access into a common location. This change introduced a check from the gadget requiring that a PHY is specified. This requirement never existed on the host side and broke some platforms when it was moved into platform.c. The gadget doesn't require the PHY either so remove the check. ... here with the following format: Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") Just is just FYI, as I have already applied another version ;-) thanks but https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/fixes seems to miss ("usb: dwc2: fix kernel oops during driver probe") This is what you gent for sending fixes and non-fixes in the same series :-) Also, this has been broken for a long time, you didn't include a "Fixes: foo-bar-baz", you didn't Cc stable (seems like the regression is from v3.19). It gets pretty difficult for me to apply patches properly if you can't send them in a way I can understand what to do with them. If you want patches to get into -rc, send the bare minimum patches needed to fix the problem and do NOT make them depend on anything else. i'm sorry about that. I should have added the fixes tag to all the patches. I tought it wasn't a candidate for Cc stable, since the issue wasn't reproducable before. The intention of the series was to get USB working for 4.4 for bcm2835. okay, in that case, can you make sure testing/fixes and testing/next contain all your pending patches? testing/fixes looks good but testing/next misses ("usb: dwc2: fix kernel oops during driver probe") Is there a conflict? Thanks -- 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 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port
Add support for async_irq to wake up driver from low power mode. Without this, the power management code never calls resume. Remove a spurious interrupt enable in the driver resume function. Signed-off-by: Tim Bird --- drivers/usb/phy/phy-msm-usb.c | 17 - include/linux/usb/msm_hsusb.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index e40a071..04fb056 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -648,7 +648,6 @@ skip_phy_resume: if (motg->async_int) { motg->async_int = 0; pm_runtime_put(phy->dev); - enable_irq(motg->irq); } dev_info(phy->dev, "USB exited from low power mode\n"); @@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev) return motg->irq; } + motg->async_irq = platform_get_irq_byname(pdev, "async"); + if (motg->async_irq < 0) { + dev_err(&pdev->dev, "platform_get_irq for async irq failed\n"); + motg->async_irq = 0; + } + regs[0].supply = "vddcx"; regs[1].supply = "v3p3"; regs[2].supply = "v1p8"; @@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev) goto disable_ldo; } + if (motg->async_irq) { + ret = devm_request_irq(&pdev->dev, motg->async_irq, + msm_otg_irq, IRQF_TRIGGER_RISING, + "msm_otg", motg); + if (ret) { + dev_err(&pdev->dev, "request irq failed (ASYNC INT)\n"); + goto disable_ldo; + } + } + phy->init = msm_phy_init; phy->set_power = msm_otg_set_power; phy->notify_disconnect = msm_phy_notify_disconnect; diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 8c8f685..08c67a3 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -164,6 +164,7 @@ struct msm_otg { struct usb_phy phy; struct msm_otg_platform_data *pdata; int irq; + int async_irq; struct clk *clk; struct clk *pclk; struct clk *core_clk; -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
Add optional async_irq to msm_hsusb binding doc. Signed-off-by: Tim Bird --- Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt index 8654a3e..2d13c1c 100644 --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt @@ -23,7 +23,12 @@ Required properties: "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY - regs: Offset and length of the register set in the memory map -- interrupts: interrupt-specifier for the OTG interrupt. +- interrupts: interrupt-specifier for the OTG interrupts + +- interrupt-names: Should contain the following: + "core"USB core interrupt + "async" Asynchronous interrupt to wake up from low power mode +(optional) - clocks: A list of phandle + clock-specifier pairs for the clocks listed in clock-names @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node: usb@f9a55000 { compatible = "qcom,usb-otg-snps"; reg = <0xf9a55000 0x400>; -interrupts = <0 134 0>; +interrupts = <0 134 0>, <0 140 0>; +interrupt-names = "core", "async"; dr_mode = "peripheral"; clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>, -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/3] usb: chipidea: register driver as a peripheral with the phy
Register the chipidea driver with the phy, so that the phy driver can kick the gadget driver when it resumes from low power. The phy-msm-usb (Qualcomm) driver requires this in order to recover gadget operation after you disconnect the USB cable and reconnect it. Signed-off-by: Tim Bird --- drivers/usb/chipidea/udc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8223fe7..06234cd 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.ep0 = &ci->ep0in->ep; + if (ci->usb_phy) { + retval = otg_set_peripheral(ci->usb_phy->otg, &ci->gadget); + if (retval) + goto destroy_eps; + } + retval = usb_add_gadget_udc(dev, &ci->gadget); if (retval) goto destroy_eps; -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
On 11/20/2015 03:22 PM, Arnd Bergmann wrote: > On Friday 20 November 2015 15:20:39 Tim Bird wrote: >> +- interrupt-names: Should contain the following: >> + "core"USB core interrupt >> + "async" Asynchronous interrupt to wake up from low power mode >> +(optional) >> >> - clocks: A list of phandle + clock-specifier pairs for the >> clocks listed in clock-names >> @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node: >> usb@f9a55000 { >> compatible = "qcom,usb-otg-snps"; >> reg = <0xf9a55000 0x400>; >> -interrupts = <0 134 0>; >> +interrupts = <0 134 0>, <0 140 0>; >> +interrupt-names = "core_irq", "async_irq"; >> dr_mode = "peripheral"; >> >> > > Now the example doesn't match the documentation any more. Arrgh. I'm an idiot. V4 coming RSN. -- Tim -- 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 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
On Friday 20 November 2015 15:20:39 Tim Bird wrote: > +- interrupt-names: Should contain the following: > + "core"USB core interrupt > + "async" Asynchronous interrupt to wake up from low power mode > +(optional) > > - clocks: A list of phandle + clock-specifier pairs for the > clocks listed in clock-names > @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node: > usb@f9a55000 { > compatible = "qcom,usb-otg-snps"; > reg = <0xf9a55000 0x400>; > -interrupts = <0 134 0>; > +interrupts = <0 134 0>, <0 140 0>; > +interrupt-names = "core_irq", "async_irq"; > dr_mode = "peripheral"; > > Now the example doesn't match the documentation any more. 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 v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
On 11/20/2015 03:20 PM, Tim Bird wrote: > Add optional async_irq to msm_hsusb binding doc. > > Signed-off-by: Tim Bird > Acked-by: Rob Herring I probably should have taken this Acked-by by Rob off. Sorry about that. -- Tim > --- > Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt > b/Documentation/devicetree/bindings/usb/msm-hsusb.txt > index 8654a3e..bb2b304 100644 > --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt > +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt > @@ -23,7 +23,12 @@ Required properties: >"qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY > > - regs: Offset and length of the register set in the memory map > -- interrupts: interrupt-specifier for the OTG interrupt. > +- interrupts: interrupt-specifier for the OTG interrupts > + > +- interrupt-names: Should contain the following: > + "core"USB core interrupt > + "async" Asynchronous interrupt to wake up from low power mode > +(optional) > > - clocks: A list of phandle + clock-specifier pairs for the > clocks listed in clock-names > @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node: > usb@f9a55000 { > compatible = "qcom,usb-otg-snps"; > reg = <0xf9a55000 0x400>; > -interrupts = <0 134 0>; > +interrupts = <0 134 0>, <0 140 0>; > +interrupt-names = "core_irq", "async_irq"; > dr_mode = "peripheral"; > > clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>, > -- 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/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port
Add support for async_irq to wake up driver from low power mode. Without this, the power management code never calls resume. Remove a spurious interrupt enable in the driver resume function. Signed-off-by: Tim Bird --- drivers/usb/phy/phy-msm-usb.c | 17 - include/linux/usb/msm_hsusb.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index e40a071..04fb056 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -648,7 +648,6 @@ skip_phy_resume: if (motg->async_int) { motg->async_int = 0; pm_runtime_put(phy->dev); - enable_irq(motg->irq); } dev_info(phy->dev, "USB exited from low power mode\n"); @@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev) return motg->irq; } + motg->async_irq = platform_get_irq_byname(pdev, "async"); + if (motg->async_irq < 0) { + dev_err(&pdev->dev, "platform_get_irq for async irq failed\n"); + motg->async_irq = 0; + } + regs[0].supply = "vddcx"; regs[1].supply = "v3p3"; regs[2].supply = "v1p8"; @@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev) goto disable_ldo; } + if (motg->async_irq) { + ret = devm_request_irq(&pdev->dev, motg->async_irq, + msm_otg_irq, IRQF_TRIGGER_RISING, + "msm_otg", motg); + if (ret) { + dev_err(&pdev->dev, "request irq failed (ASYNC INT)\n"); + goto disable_ldo; + } + } + phy->init = msm_phy_init; phy->set_power = msm_otg_set_power; phy->notify_disconnect = msm_phy_notify_disconnect; diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 8c8f685..08c67a3 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -164,6 +164,7 @@ struct msm_otg { struct usb_phy phy; struct msm_otg_platform_data *pdata; int irq; + int async_irq; struct clk *clk; struct clk *pclk; struct clk *core_clk; -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
Add optional async_irq to msm_hsusb binding doc. Signed-off-by: Tim Bird Acked-by: Rob Herring --- Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt index 8654a3e..bb2b304 100644 --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt @@ -23,7 +23,12 @@ Required properties: "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY - regs: Offset and length of the register set in the memory map -- interrupts: interrupt-specifier for the OTG interrupt. +- interrupts: interrupt-specifier for the OTG interrupts + +- interrupt-names: Should contain the following: + "core"USB core interrupt + "async" Asynchronous interrupt to wake up from low power mode +(optional) - clocks: A list of phandle + clock-specifier pairs for the clocks listed in clock-names @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node: usb@f9a55000 { compatible = "qcom,usb-otg-snps"; reg = <0xf9a55000 0x400>; -interrupts = <0 134 0>; +interrupts = <0 134 0>, <0 140 0>; +interrupt-names = "core_irq", "async_irq"; dr_mode = "peripheral"; clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>, -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/3] usb: chipidea: register driver as a peripheral with the phy
Register the chipidea driver with the phy, so that the phy driver can kick the gadget driver when it resumes from low power. The phy-msm-usb (Qualcomm) driver requires this in order to recover gadget operation after you disconnect the USB cable and reconnect it. Signed-off-by: Tim Bird --- drivers/usb/chipidea/udc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8223fe7..06234cd 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.ep0 = &ci->ep0in->ep; + if (ci->usb_phy) { + retval = otg_set_peripheral(ci->usb_phy->otg, &ci->gadget); + if (retval) + goto destroy_eps; + } + retval = usb_add_gadget_udc(dev, &ci->gadget); if (retval) goto destroy_eps; -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
On 11/20/2015 02:44 PM, Arnd Bergmann wrote: > On Friday 20 November 2015 14:37:16 Tim Bird wrote: >> +- interrupt-names: Should contain the following: >> + "core_irq"USB core interrupt >> + "async_irq" Asynchronous interrupt to wake up from low power mode >> +(optional) >> >> > > Sorry for the bike-shedding but how about just naming them "core" and "async"? > > The redundant "_irq" postfix seems a little redundant. OK - look for v3 RSN(tm) (Real Soon Now) -- Tim P.S. This is a cynical ploy to get me to automate my patch release process, isn't it? :-) -- 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 v5 2/2] usb: dwc2: host: Clear interrupts before handling them
On 11/20/2015 9:06 AM, Douglas Anderson wrote: > In general it is wise to clear interrupts before processing them. If > you don't do that, you can get: > 1. Interrupt happens > 2. You look at system state and process interrupt > 3. A new interrupt happens > 4. You clear interrupt without processing it. > > This patch was actually a first attempt to fix missing device insertions > as described in (usb: dwc2: host: Fix missing device insertions) and it > did solve some of the signal bouncing problems but not all of > them (which is why I submitted the other patch). Specifically, this > patch itself would sometimes change: > 1. hardware sees connect > 2. hardware sees disconnect > 3. hardware sees connect > 4. dwc2_port_intr() - clears connect interrupt > 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() > > ...to: > 1. hardware sees connect > 2. hardware sees disconnect > 3. dwc2_port_intr() - clears connect interrupt > 4. hardware sees connect > 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() > > ...but with different timing then sometimes we'd still miss cable > insertions. > > In any case, though this patch doesn't fix any (known) problems, it > still seems wise as a general policy to clear interrupt before handling > them. > > Note that for dwc2_handle_usb_port_intr(), instead of moving the clear > of PRTINT to the beginning of the function we remove it completely. The > only way to clear PRTINT is to clear the sources that set it in the > first place. > > Signed-off-by: Douglas Anderson > --- > Changes in v5: > - Rebased upon testing/next from 15-11-20. > - Fixed missing reset as found by code inspection during rebase. > - Now atop fix for missing spinlock in reset. > - Dropped John Youn's ack / tested by since there's a bugfix now. > > Changes in v4: > - Don't replace dwc2_writel with writel (Antti Seppälä). > - Update description to explain why we remove PRTINT clear. > > Changes in v3: > - Don't (uselessly) clear the PRTINT anymore (Felipe Balbi). > > drivers/usb/dwc2/core_intr.c | 49 > +--- > drivers/usb/dwc2/hcd_intr.c | 18 > 2 files changed, 32 insertions(+), 35 deletions(-) > > diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c > index 61601d16e233..d85c5c9f96c1 100644 > --- a/drivers/usb/dwc2/core_intr.c > +++ b/drivers/usb/dwc2/core_intr.c > @@ -86,9 +86,6 @@ static void dwc2_handle_usb_port_intr(struct dwc2_hsotg > *hsotg) > hprt0 &= ~HPRT0_ENA; > dwc2_writel(hprt0, hsotg->regs + HPRT0); > } > - > - /* Clear interrupt */ > - dwc2_writel(GINTSTS_PRTINT, hsotg->regs + GINTSTS); > } > > /** > @@ -98,11 +95,11 @@ static void dwc2_handle_usb_port_intr(struct dwc2_hsotg > *hsotg) > */ > static void dwc2_handle_mode_mismatch_intr(struct dwc2_hsotg *hsotg) > { > - dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", > - dwc2_is_host_mode(hsotg) ? "Host" : "Device"); > - > /* Clear interrupt */ > dwc2_writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS); > + > + dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", > + dwc2_is_host_mode(hsotg) ? "Host" : "Device"); > } > > /** > @@ -276,9 +273,13 @@ static void dwc2_handle_otg_intr(struct dwc2_hsotg > *hsotg) > */ > static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg) > { > - u32 gintmsk = dwc2_readl(hsotg->regs + GINTMSK); > + u32 gintmsk; > + > + /* Clear interrupt */ > + dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS); > > /* Need to disable SOF interrupt immediately */ > + gintmsk = dwc2_readl(hsotg->regs + GINTMSK); > gintmsk &= ~GINTSTS_SOF; > dwc2_writel(gintmsk, hsotg->regs + GINTMSK); > > @@ -295,9 +296,6 @@ static void dwc2_handle_conn_id_status_change_intr(struct > dwc2_hsotg *hsotg) > queue_work(hsotg->wq_otg, &hsotg->wf_otg); > spin_lock(&hsotg->lock); > } > - > - /* Clear interrupt */ > - dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS); > } > > /** > @@ -315,12 +313,12 @@ static void dwc2_handle_session_req_intr(struct > dwc2_hsotg *hsotg) > { > int ret; > > - dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n", > - hsotg->lx_state); > - > /* Clear interrupt */ > dwc2_writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS); > > + dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n", > + hsotg->lx_state); > + > if (dwc2_is_device_mode(hsotg)) { > if (hsotg->lx_state == DWC2_L2) { > ret = dwc2_exit_hibernation(hsotg, true); > @@ -347,6 +345,10 @@ static void dwc2_handle_session_req_intr(struct > dwc2_hsotg *hsotg) > static void dwc2_handle_wakeup_detecte
Re: [PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
On Friday 20 November 2015 14:37:16 Tim Bird wrote: > +- interrupt-names: Should contain the following: > + "core_irq"USB core interrupt > + "async_irq" Asynchronous interrupt to wake up from low power mode > +(optional) > > Sorry for the bike-shedding but how about just naming them "core" and "async"? The redundant "_irq" postfix seems a little redundant. 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 v5 1/2] usb: dwc2: host: Add missing spinlock in dwc2_hcd_reset_func()
On 11/20/2015 9:06 AM, Douglas Anderson wrote: > The dwc2_hcd_reset_func() function is only ever called directly by a > delayed work function. As such no locks are already held when the > function is called. > > Doing a read-modify-write of CPU registers and setting fields in the > main hsotg data structure is a bad idea without locks. Let's add > locks. > > The bug was found by code inspection only. It turns out that the > dwc2_hcd_reset_func() is only ever called today if the > "host_support_fs_ls_low_power" parameter is enabled and no code in > mainline enables that parameter. Thus no known issues in mainline are > fixed by this patch, but it's still probably wise to fix the function. > > Signed-off-by: Douglas Anderson > --- > Changes in v5: > - New for v5 of the series > > drivers/usb/dwc2/hcd.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index 42b6c5127618..e8924cecc83a 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -2357,13 +2357,19 @@ static void dwc2_hcd_reset_func(struct work_struct > *work) > { > struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg, > reset_work.work); > + unsigned long flags; > u32 hprt0; > > dev_dbg(hsotg->dev, "USB RESET function called\n"); > + > + spin_lock_irqsave(&hsotg->lock, flags); > + > hprt0 = dwc2_read_hprt0(hsotg); > hprt0 &= ~HPRT0_RST; > dwc2_writel(hprt0, hsotg->regs + HPRT0); > hsotg->flags.b.port_reset_change = 1; > + > + spin_unlock_irqrestore(&hsotg->lock, flags); > } > > /* > Acked-by: John Youn John -- 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 v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
Hello. On 11/21/2015 01:37 AM, Tim Bird wrote: Add optional async_irq to msm_hsusb binding doc. Signed-off-by: Tim Bird Acked-by: Rob Herring --- Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt index 8654a3e..7ba1dff 100644 --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt @@ -23,7 +23,12 @@ Required properties: "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY - regs: Offset and length of the register set in the memory map -- interrupts: interrupt-specifier for the OTG interrupt. +- interrupts: interrupt-specifier for the OTG interrupts + +- interrupt-names: Should contain the following: + "core_irq"USB core interrupt + "async_irq" Asynchronous interrupt to wake up from low power mode I think the "_irq" part can be dropped... [...] MBR, 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
[PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb
Add optional async_irq to msm_hsusb binding doc. Signed-off-by: Tim Bird Acked-by: Rob Herring --- Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt index 8654a3e..7ba1dff 100644 --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt @@ -23,7 +23,12 @@ Required properties: "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY - regs: Offset and length of the register set in the memory map -- interrupts: interrupt-specifier for the OTG interrupt. +- interrupts: interrupt-specifier for the OTG interrupts + +- interrupt-names: Should contain the following: + "core_irq"USB core interrupt + "async_irq" Asynchronous interrupt to wake up from low power mode +(optional) - clocks: A list of phandle + clock-specifier pairs for the clocks listed in clock-names @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node: usb@f9a55000 { compatible = "qcom,usb-otg-snps"; reg = <0xf9a55000 0x400>; -interrupts = <0 134 0>; +interrupts = <0 134 0>, <0 140 0>; +interrupt-names = "core_irq", "async_irq"; dr_mode = "peripheral"; clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>, -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] usb: chipidea: register driver as a peripheral with the phy
Register the chipidea driver with the phy, so that the phy driver can kick the gadget driver when it resumes from low power. The phy-msm-usb (Qualcomm) driver requires this in order to recover gadget operation after you disconnect the USB cable and reconnect it. Signed-off-by: Tim Bird --- drivers/usb/chipidea/udc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8223fe7..06234cd 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.ep0 = &ci->ep0in->ep; + if (ci->usb_phy) { + retval = otg_set_peripheral(ci->usb_phy->otg, &ci->gadget); + if (retval) + goto destroy_eps; + } + retval = usb_add_gadget_udc(dev, &ci->gadget); if (retval) goto destroy_eps; -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port
Add support for async_irq to wake up driver from low power mode. Without this, the power management code never calls resume. Remove a spurious interrupt enable in the driver resume function. Signed-off-by: Tim Bird --- drivers/usb/phy/phy-msm-usb.c | 17 - include/linux/usb/msm_hsusb.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index e40a071..db6297c 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -648,7 +648,6 @@ skip_phy_resume: if (motg->async_int) { motg->async_int = 0; pm_runtime_put(phy->dev); - enable_irq(motg->irq); } dev_info(phy->dev, "USB exited from low power mode\n"); @@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev) return motg->irq; } + motg->async_irq = platform_get_irq_byname(pdev, "async_irq"); + if (motg->async_irq < 0) { + dev_err(&pdev->dev, "platform_get_irq for async_irq failed\n"); + motg->async_irq = 0; + } + regs[0].supply = "vddcx"; regs[1].supply = "v3p3"; regs[2].supply = "v1p8"; @@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev) goto disable_ldo; } + if (motg->async_irq) { + ret = devm_request_irq(&pdev->dev, motg->async_irq, + msm_otg_irq, IRQF_TRIGGER_RISING, + "msm_otg", motg); + if (ret) { + dev_err(&pdev->dev, "request irq failed (ASYNC INT)\n"); + goto disable_ldo; + } + } + phy->init = msm_phy_init; phy->set_power = msm_otg_set_power; phy->notify_disconnect = msm_phy_notify_disconnect; diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 8c8f685..08c67a3 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -164,6 +164,7 @@ struct msm_otg { struct usb_phy phy; struct msm_otg_platform_data *pdata; int irq; + int async_irq; struct clk *clk; struct clk *pclk; struct clk *core_clk; -- 1.8.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port
On 11/16/2015 09:21 AM, Felipe Balbi wrote: > > Hi, > > Peter Chen writes: >> On Wed, Nov 11, 2015 at 09:48:00AM -0800, Tim Bird wrote: >>> >>> >>> On 11/10/2015 07:14 PM, Peter Chen wrote: On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote: > This fixes a bug where if you disconnect and re-connect the USB cable, > the gadget driver stops working. > > Add support for async_irq to wake up driver from low power mode. > Without this, the power management code never calls resume. > Also, have the phy driver kick the gadget driver (chipidea otg) > by having the chipidea driver register with it, for vbus connect > notifications. > > Signed-off-by: Tim Bird > --- > drivers/usb/chipidea/udc.c| 6 ++ > drivers/usb/phy/phy-msm-usb.c | 16 > include/linux/usb/msm_hsusb.h | 1 + > 3 files changed, 23 insertions(+) > > I just wanna know how you guys want this to be handled ? Through my tree > or chipidea's ? Or do we break the dependencies between the changes ? I'm fine with splitting it up. I'm sending a new series with 3 patches right after this message. Do both trees go to linux-next? -- Tim -- 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: Not enough host controller resources for new device state
Patrick Shirkey wrote: > > You essentially have to educate yourself on silicon level (ie. what > > hardware IP is being used in which consumer products) to sustain a > > dependency on 127 possible devices per bus. > > > > I guess you'll find that there are only very few xHCI IPs out there, > > probably just three or four. I wouldn't be surprised if they all have > > the same, or similar, limitations. > > Is there anything I can do at the system level to avoid disabling xHCI at > the BIOS level? Unfortunately not. The number of supported devices is now very much hardwired in the host controller hardware. Each connected device requires its own set of registers in xHCI, so when there is a limit it is a hard limit. //Peter -- 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 RESEND v2 1/2] usb: phy: correct the am335x phy header filename
The filename of am35x-phy-control.h is confusing. The header is used by the am335x phy driver, but the filename refers to am35x. Even worse there is indeed another device called am35x but it does not use this header at all. Signed-off-by: Bin Liu --- v2: no change drivers/usb/phy/phy-am335x-control.c | 2 +- drivers/usb/phy/{am35x-phy-control.h => phy-am335x-control.h} | 0 drivers/usb/phy/phy-am335x.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename drivers/usb/phy/{am35x-phy-control.h => phy-am335x-control.h} (100%) diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index 7b3035f..23fca51 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -4,7 +4,7 @@ #include #include #include -#include "am35x-phy-control.h" +#include "phy-am335x-control.h" struct am335x_control_usb { struct device *dev; diff --git a/drivers/usb/phy/am35x-phy-control.h b/drivers/usb/phy/phy-am335x-control.h similarity index 100% rename from drivers/usb/phy/am35x-phy-control.h rename to drivers/usb/phy/phy-am335x-control.h diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c index 90b67a4..8b6139d 100644 --- a/drivers/usb/phy/phy-am335x.c +++ b/drivers/usb/phy/phy-am335x.c @@ -9,7 +9,7 @@ #include #include -#include "am35x-phy-control.h" +#include "phy-am335x-control.h" #include "phy-generic.h" struct am335x_phy { -- 1.8.4 -- 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 RESEND v2 2/2] usb: phy: phy-am335x: bypass first VBUS sensing for host-only mode
To prevent VBUS contention, the am335x MUSB phy senses VBUS first before transitioning to host mode. However, for host-only mode, VBUS could be directly tied to 5V power rail which could prevent MUSB transitions to host mode. This change receives dr_mode of the controller then bypass the first VBUS sensing for host-only mode, so that MUSB can work in host mode event if VBUS is tied to 5V. Signed-off-by: Bin Liu --- v2: move in drivers/usb/phy/phy-am335x.c change from patch 1/3. fix module dependency, had compile error when CONFIG_USB_OTG undefined. drivers/usb/Kconfig | 2 +- drivers/usb/phy/phy-am335x-control.c | 14 +++--- drivers/usb/phy/phy-am335x-control.h | 8 +--- drivers/usb/phy/phy-am335x.c | 15 ++- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 5b625e2..b33e00b 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -32,7 +32,7 @@ if USB_SUPPORT config USB_COMMON tristate default y - depends on USB || USB_GADGET || USB_OTG + depends on USB || USB_GADGET || USB_OTG || AM335X_PHY_USB config USB_ARCH_HAS_HCD def_bool y diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index 23fca51..42a1afe 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "phy-am335x-control.h" struct am335x_control_usb { @@ -58,7 +59,8 @@ static void am335x_phy_wkup(struct phy_control *phy_ctrl, u32 id, bool on) spin_unlock(&usb_ctrl->lock); } -static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, bool on) +static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, + enum usb_dr_mode dr_mode, bool on) { struct am335x_control_usb *usb_ctrl; u32 val; @@ -80,8 +82,14 @@ static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, bool on) val = readl(usb_ctrl->phy_reg + reg); if (on) { - val &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN); - val |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN; + if (dr_mode == USB_DR_MODE_HOST) { + val &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN | + USBPHY_OTGVDET_EN); + val |= USBPHY_OTGSESSEND_EN; + } else { + val &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN); + val |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN; + } } else { val |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; } diff --git a/drivers/usb/phy/phy-am335x-control.h b/drivers/usb/phy/phy-am335x-control.h index b96594d..e86b316 100644 --- a/drivers/usb/phy/phy-am335x-control.h +++ b/drivers/usb/phy/phy-am335x-control.h @@ -2,13 +2,15 @@ #define _AM335x_PHY_CONTROL_H_ struct phy_control { - void (*phy_power)(struct phy_control *phy_ctrl, u32 id, bool on); + void (*phy_power)(struct phy_control *phy_ctrl, u32 id, + enum usb_dr_mode dr_mode, bool on); void (*phy_wkup)(struct phy_control *phy_ctrl, u32 id, bool on); }; -static inline void phy_ctrl_power(struct phy_control *phy_ctrl, u32 id, bool on) +static inline void phy_ctrl_power(struct phy_control *phy_ctrl, u32 id, + enum usb_dr_mode dr_mode, bool on) { - phy_ctrl->phy_power(phy_ctrl, id, on); + phy_ctrl->phy_power(phy_ctrl, id, dr_mode, on); } static inline void phy_ctrl_wkup(struct phy_control *phy_ctrl, u32 id, bool on) diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c index 8b6139d..39b424f 100644 --- a/drivers/usb/phy/phy-am335x.c +++ b/drivers/usb/phy/phy-am335x.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "phy-am335x-control.h" #include "phy-generic.h" @@ -16,13 +17,14 @@ struct am335x_phy { struct usb_phy_generic usb_phy_gen; struct phy_control *phy_ctrl; int id; + enum usb_dr_mode dr_mode; }; static int am335x_init(struct usb_phy *phy) { struct am335x_phy *am_phy = dev_get_drvdata(phy->dev); - phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, true); + phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, true); return 0; } @@ -30,7 +32,7 @@ static void am335x_shutdown(struct usb_phy *phy) { struct am335x_phy *am_phy = dev_get_drvdata(phy->dev); - phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, false); + phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false); } static int am335x_phy_probe(struct platform_device *pdev) @@ -46,12 +48,15 @@ static int am335x_phy_probe(struct platform_device *pdev) am_phy->phy_ctrl = am335x_get_phy_control(dev); if (!am_phy->phy_ctrl) return -
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
Hi, John Youn writes: > On 11/20/2015 1:38 PM, Bin Liu wrote: >> hi, >> >> On 11/20/2015 03:35 PM, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Bin Liu writes: >>> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); >>>bool of_usb_host_tpl_support(struct device_node *np); >>>int of_usb_update_otg_caps(struct device_node *np, >>> struct usb_otg_caps *otg_caps); >>>#else >>> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >>> +{ >>> + return USB_DR_MODE_UNKNOWN; >>> +} >>>static inline bool of_usb_host_tpl_support(struct device_node *np) >>>{ >>> return false; >>> >> >> >> Hi Felipe, >> >> This commit in your testing/next causes compilation error: >> >> /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: >> error: redefinition of ‘of_usb_get_dr_mode_by_phy’ >>enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >> ^ >> In file included from >> /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: >> /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: >> previous definition of ‘of_usb_get_dr_mode_by_phy’ was here >>enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >> ^ >> make[4]: *** [drivers/usb/common/common.o] Error 1 >> >> > > > I'm on non-OF config. > > Looks like the #ifdef CONFIG_OF should encompass the new function > in the .c file. > Thanks John for pointing it out. Felipe, Do you want me to send v6 or you will fix it in your tree? >>> >>> send me an incremental diff which I can meld into original patch. >>> >> >> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c >> index a11bb15..e6ec125 100644 >> --- a/drivers/usb/common/common.c >> +++ b/drivers/usb/common/common.c >> @@ -131,6 +131,7 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) >> } >> EXPORT_SYMBOL_GPL(usb_get_dr_mode); >> >> +#ifdef CONFIG_OF >> /** >>* of_usb_get_dr_mode_by_phy - Get dual role mode for the controller >> device >>* which is associated with the given phy device_node >> @@ -171,7 +172,6 @@ finish: >> } >> EXPORT_SYMBOL_GPL(of_usb_get_dr_mode_by_phy); >> >> -#ifdef CONFIG_OF >> /** >>* of_usb_host_tpl_support - to get if Targeted Peripheral List is >> supported >>* for given targeted hosts (non-PC hosts) > > I just tried the same and this fixes it. cool, thanks to both of you. Applied to original patch. -- balbi signature.asc Description: PGP signature
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
On 11/20/2015 1:38 PM, Bin Liu wrote: > hi, > > On 11/20/2015 03:35 PM, Felipe Balbi wrote: >> >> Hi, >> >> Bin Liu writes: >> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); >>bool of_usb_host_tpl_support(struct device_node *np); >>int of_usb_update_otg_caps(struct device_node *np, >> struct usb_otg_caps *otg_caps); >>#else >> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >> +{ >> +return USB_DR_MODE_UNKNOWN; >> +} >>static inline bool of_usb_host_tpl_support(struct device_node *np) >>{ >> return false; >> > > > Hi Felipe, > > This commit in your testing/next causes compilation error: > > /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: > redefinition of ‘of_usb_get_dr_mode_by_phy’ >enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > ^ > In file included from > /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: > /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: > previous definition of ‘of_usb_get_dr_mode_by_phy’ was here >enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > ^ > make[4]: *** [drivers/usb/common/common.o] Error 1 > > I'm on non-OF config. Looks like the #ifdef CONFIG_OF should encompass the new function in the .c file. >>> >>> Thanks John for pointing it out. >>> >>> Felipe, >>> >>> Do you want me to send v6 or you will fix it in your tree? >> >> send me an incremental diff which I can meld into original patch. >> > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c > index a11bb15..e6ec125 100644 > --- a/drivers/usb/common/common.c > +++ b/drivers/usb/common/common.c > @@ -131,6 +131,7 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) > } > EXPORT_SYMBOL_GPL(usb_get_dr_mode); > > +#ifdef CONFIG_OF > /** >* of_usb_get_dr_mode_by_phy - Get dual role mode for the controller > device >* which is associated with the given phy device_node > @@ -171,7 +172,6 @@ finish: > } > EXPORT_SYMBOL_GPL(of_usb_get_dr_mode_by_phy); > > -#ifdef CONFIG_OF > /** >* of_usb_host_tpl_support - to get if Targeted Peripheral List is > supported >* for given targeted hosts (non-PC hosts) > > I just tried the same and this fixes it. Regards, John -- 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 v5] usb: of: add an api to get dr_mode by the phy node
hi, On 11/20/2015 03:35 PM, Felipe Balbi wrote: Hi, Bin Liu writes: +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); bool of_usb_host_tpl_support(struct device_node *np); int of_usb_update_otg_caps(struct device_node *np, struct usb_otg_caps *otg_caps); #else +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) +{ + return USB_DR_MODE_UNKNOWN; +} static inline bool of_usb_host_tpl_support(struct device_node *np) { return false; Hi Felipe, This commit in your testing/next causes compilation error: /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: redefinition of ‘of_usb_get_dr_mode_by_phy’ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) ^ In file included from /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: previous definition of ‘of_usb_get_dr_mode_by_phy’ was here enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) ^ make[4]: *** [drivers/usb/common/common.o] Error 1 I'm on non-OF config. Looks like the #ifdef CONFIG_OF should encompass the new function in the .c file. Thanks John for pointing it out. Felipe, Do you want me to send v6 or you will fix it in your tree? send me an incremental diff which I can meld into original patch. diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index a11bb15..e6ec125 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -131,6 +131,7 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev) } EXPORT_SYMBOL_GPL(usb_get_dr_mode); +#ifdef CONFIG_OF /** * of_usb_get_dr_mode_by_phy - Get dual role mode for the controller device * which is associated with the given phy device_node @@ -171,7 +172,6 @@ finish: } EXPORT_SYMBOL_GPL(of_usb_get_dr_mode_by_phy); -#ifdef CONFIG_OF /** * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported * for given targeted hosts (non-PC hosts) -- 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: whci-hcd: add check for dma mapping error
qset_fill_page_list() do not check for dma mapping errors. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/usb/host/whci/qset.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c index dc31c425ce01..9f1c0538b211 100644 --- a/drivers/usb/host/whci/qset.c +++ b/drivers/usb/host/whci/qset.c @@ -377,6 +377,10 @@ static int qset_fill_page_list(struct whc *whc, struct whc_std *std, gfp_t mem_f if (std->pl_virt == NULL) return -ENOMEM; std->dma_addr = dma_map_single(whc->wusbhc.dev, std->pl_virt, pl_len, DMA_TO_DEVICE); + if (dma_mapping_error(whc->wusbhc.dev, std->dma_addr)) { + kfree(std->pl_virt); + return -EFAULT; + } for (p = 0; p < std->num_pointers; p++) { std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr); -- 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
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
Hi, Bin Liu writes: +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); bool of_usb_host_tpl_support(struct device_node *np); int of_usb_update_otg_caps(struct device_node *np, struct usb_otg_caps *otg_caps); #else +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) +{ + return USB_DR_MODE_UNKNOWN; +} static inline bool of_usb_host_tpl_support(struct device_node *np) { return false; >>> >>> >>> Hi Felipe, >>> >>> This commit in your testing/next causes compilation error: >>> >>> /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: >>> redefinition of ‘of_usb_get_dr_mode_by_phy’ >>> enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >>>^ >>> In file included from >>> /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: >>> /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: previous >>> definition of ‘of_usb_get_dr_mode_by_phy’ was here >>> enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >>>^ >>> make[4]: *** [drivers/usb/common/common.o] Error 1 >>> >>> >> >> >> I'm on non-OF config. >> >> Looks like the #ifdef CONFIG_OF should encompass the new function >> in the .c file. >> > > Thanks John for pointing it out. > > Felipe, > > Do you want me to send v6 or you will fix it in your tree? send me an incremental diff which I can meld into original patch. -- balbi signature.asc Description: PGP signature
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
Hi, On 11/20/2015 03:24 PM, John Youn wrote: On 11/20/2015 1:19 PM, John Youn wrote: On 11/3/2015 9:49 AM, Bin Liu wrote: Some USB phy drivers have different handling for the controller in each dr_mode. But the phy driver does not have visibility to the dr_mode of the controller. This adds an api to return the dr_mode of the controller which associates the given phy node. Signed-off-by: Bin Liu --- v5: - to simplify the code, add usb_get_dr_mode_from_string() to query dr_mode from string v4: - iterating all phy nodes in the associated controller - add of_node_put() to decrement refcount v3: search controller node from dt root, as the phy and controller nodes might not have the same parent. v2: move drivers/usb/phy/phy-am335x.c changes into patch 3/3. drivers/usb/common/common.c | 60 - include/linux/usb/of.h | 5 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 673d530..a11bb15 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -17,6 +17,7 @@ #include #include #include +#include const char *usb_otg_state_string(enum usb_otg_state state) { @@ -106,23 +107,70 @@ static const char *const usb_dr_modes[] = { [USB_DR_MODE_OTG] = "otg", }; +static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) + if (!strcmp(usb_dr_modes[i], str)) + return i; + + return USB_DR_MODE_UNKNOWN; +} + enum usb_dr_mode usb_get_dr_mode(struct device *dev) { const char *dr_mode; - int err, i; + int err; err = device_property_read_string(dev, "dr_mode", &dr_mode); if (err < 0) return USB_DR_MODE_UNKNOWN; - for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) - if (!strcmp(dr_mode, usb_dr_modes[i])) - return i; - - return USB_DR_MODE_UNKNOWN; + return usb_get_dr_mode_from_string(dr_mode); } EXPORT_SYMBOL_GPL(usb_get_dr_mode); +/** + * of_usb_get_dr_mode_by_phy - Get dual role mode for the controller device + * which is associated with the given phy device_node + * @np:Pointer to the given phy device_node + * + * In dts a usb controller associates with phy devices. The function gets + * the string from property 'dr_mode' of the controller associated with the + * given phy device node, and returns the correspondig enum usb_dr_mode. + */ +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) +{ + struct device_node *controller = NULL; + struct device_node *phy; + const char *dr_mode; + int index; + int err; + + do { + controller = of_find_node_with_property(controller, "phys"); + index = 0; + do { + phy = of_parse_phandle(controller, "phys", index); + of_node_put(phy); + if (phy == phy_np) + goto finish; + index++; + } while (phy); + } while (controller); + +finish: + err = of_property_read_string(controller, "dr_mode", &dr_mode); + of_node_put(controller); + + if (err < 0) + return USB_DR_MODE_UNKNOWN; + + return usb_get_dr_mode_from_string(dr_mode); +} +EXPORT_SYMBOL_GPL(of_usb_get_dr_mode_by_phy); + #ifdef CONFIG_OF /** * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h index c3fe9e4..3805757 100644 --- a/include/linux/usb/of.h +++ b/include/linux/usb/of.h @@ -12,10 +12,15 @@ #include #if IS_ENABLED(CONFIG_OF) +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); bool of_usb_host_tpl_support(struct device_node *np); int of_usb_update_otg_caps(struct device_node *np, struct usb_otg_caps *otg_caps); #else +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) +{ + return USB_DR_MODE_UNKNOWN; +} static inline bool of_usb_host_tpl_support(struct device_node *np) { return false; Hi Felipe, This commit in your testing/next causes compilation error: /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: redefinition of ‘of_usb_get_dr_mode_by_phy’ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) ^ In file included from /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: previous definition of ‘of_usb_get_dr_mode_by_phy’ was here enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) ^ make[4]: *** [drivers/usb/common/common.o] Error 1 I'm
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
Hi, John Youn writes: >> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >> +{ >> +return USB_DR_MODE_UNKNOWN; >> +} >> static inline bool of_usb_host_tpl_support(struct device_node *np) >> { >> return false; >> > > > Hi Felipe, > > This commit in your testing/next causes compilation error: > > /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: > redefinition of ‘of_usb_get_dr_mode_by_phy’ > enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > ^ > In file included from > /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: > /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: previous > definition of ‘of_usb_get_dr_mode_by_phy’ was here > enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > ^ > make[4]: *** [drivers/usb/common/common.o] Error 1 I just recompiled here and it built fine. Got a defconfig I can use here? regards -- balbi signature.asc Description: PGP signature
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
On 11/20/2015 1:19 PM, John Youn wrote: > On 11/3/2015 9:49 AM, Bin Liu wrote: >> Some USB phy drivers have different handling for the controller in each >> dr_mode. But the phy driver does not have visibility to the dr_mode of >> the controller. >> >> This adds an api to return the dr_mode of the controller which >> associates the given phy node. >> >> Signed-off-by: Bin Liu >> --- >> v5: - to simplify the code, add usb_get_dr_mode_from_string() to query >> dr_mode from string >> >> v4: - iterating all phy nodes in the associated controller >> - add of_node_put() to decrement refcount >> >> v3: search controller node from dt root, as the phy and controller nodes >> might not have the same parent. >> >> v2: move drivers/usb/phy/phy-am335x.c changes into patch 3/3. >> >> drivers/usb/common/common.c | 60 >> - >> include/linux/usb/of.h | 5 >> 2 files changed, 59 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c >> index 673d530..a11bb15 100644 >> --- a/drivers/usb/common/common.c >> +++ b/drivers/usb/common/common.c >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> >> const char *usb_otg_state_string(enum usb_otg_state state) >> { >> @@ -106,23 +107,70 @@ static const char *const usb_dr_modes[] = { >> [USB_DR_MODE_OTG] = "otg", >> }; >> >> +static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str) >> +{ >> +int i; >> + >> +for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) >> +if (!strcmp(usb_dr_modes[i], str)) >> +return i; >> + >> +return USB_DR_MODE_UNKNOWN; >> +} >> + >> enum usb_dr_mode usb_get_dr_mode(struct device *dev) >> { >> const char *dr_mode; >> -int err, i; >> +int err; >> >> err = device_property_read_string(dev, "dr_mode", &dr_mode); >> if (err < 0) >> return USB_DR_MODE_UNKNOWN; >> >> -for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) >> -if (!strcmp(dr_mode, usb_dr_modes[i])) >> -return i; >> - >> -return USB_DR_MODE_UNKNOWN; >> +return usb_get_dr_mode_from_string(dr_mode); >> } >> EXPORT_SYMBOL_GPL(usb_get_dr_mode); >> >> +/** >> + * of_usb_get_dr_mode_by_phy - Get dual role mode for the controller device >> + * which is associated with the given phy device_node >> + * @np: Pointer to the given phy device_node >> + * >> + * In dts a usb controller associates with phy devices. The function gets >> + * the string from property 'dr_mode' of the controller associated with the >> + * given phy device node, and returns the correspondig enum usb_dr_mode. >> + */ >> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >> +{ >> +struct device_node *controller = NULL; >> +struct device_node *phy; >> +const char *dr_mode; >> +int index; >> +int err; >> + >> +do { >> +controller = of_find_node_with_property(controller, "phys"); >> +index = 0; >> +do { >> +phy = of_parse_phandle(controller, "phys", index); >> +of_node_put(phy); >> +if (phy == phy_np) >> +goto finish; >> +index++; >> +} while (phy); >> +} while (controller); >> + >> +finish: >> +err = of_property_read_string(controller, "dr_mode", &dr_mode); >> +of_node_put(controller); >> + >> +if (err < 0) >> +return USB_DR_MODE_UNKNOWN; >> + >> +return usb_get_dr_mode_from_string(dr_mode); >> +} >> +EXPORT_SYMBOL_GPL(of_usb_get_dr_mode_by_phy); >> + >> #ifdef CONFIG_OF >> /** >> * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported >> diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h >> index c3fe9e4..3805757 100644 >> --- a/include/linux/usb/of.h >> +++ b/include/linux/usb/of.h >> @@ -12,10 +12,15 @@ >> #include >> >> #if IS_ENABLED(CONFIG_OF) >> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); >> bool of_usb_host_tpl_support(struct device_node *np); >> int of_usb_update_otg_caps(struct device_node *np, >> struct usb_otg_caps *otg_caps); >> #else >> +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) >> +{ >> +return USB_DR_MODE_UNKNOWN; >> +} >> static inline bool of_usb_host_tpl_support(struct device_node *np) >> { >> return false; >> > > > Hi Felipe, > > This commit in your testing/next causes compilation error: > > /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: > redefinition of ‘of_usb_get_dr_mode_by_phy’ > enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > ^ > In file included from > /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: > /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:
Re: [PATCH v5] usb: of: add an api to get dr_mode by the phy node
On 11/3/2015 9:49 AM, Bin Liu wrote: > Some USB phy drivers have different handling for the controller in each > dr_mode. But the phy driver does not have visibility to the dr_mode of > the controller. > > This adds an api to return the dr_mode of the controller which > associates the given phy node. > > Signed-off-by: Bin Liu > --- > v5: - to simplify the code, add usb_get_dr_mode_from_string() to query > dr_mode from string > > v4: - iterating all phy nodes in the associated controller > - add of_node_put() to decrement refcount > > v3: search controller node from dt root, as the phy and controller nodes > might not have the same parent. > > v2: move drivers/usb/phy/phy-am335x.c changes into patch 3/3. > > drivers/usb/common/common.c | 60 > - > include/linux/usb/of.h | 5 > 2 files changed, 59 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c > index 673d530..a11bb15 100644 > --- a/drivers/usb/common/common.c > +++ b/drivers/usb/common/common.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > const char *usb_otg_state_string(enum usb_otg_state state) > { > @@ -106,23 +107,70 @@ static const char *const usb_dr_modes[] = { > [USB_DR_MODE_OTG] = "otg", > }; > > +static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str) > +{ > + int i; > + > + for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) > + if (!strcmp(usb_dr_modes[i], str)) > + return i; > + > + return USB_DR_MODE_UNKNOWN; > +} > + > enum usb_dr_mode usb_get_dr_mode(struct device *dev) > { > const char *dr_mode; > - int err, i; > + int err; > > err = device_property_read_string(dev, "dr_mode", &dr_mode); > if (err < 0) > return USB_DR_MODE_UNKNOWN; > > - for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) > - if (!strcmp(dr_mode, usb_dr_modes[i])) > - return i; > - > - return USB_DR_MODE_UNKNOWN; > + return usb_get_dr_mode_from_string(dr_mode); > } > EXPORT_SYMBOL_GPL(usb_get_dr_mode); > > +/** > + * of_usb_get_dr_mode_by_phy - Get dual role mode for the controller device > + * which is associated with the given phy device_node > + * @np: Pointer to the given phy device_node > + * > + * In dts a usb controller associates with phy devices. The function gets > + * the string from property 'dr_mode' of the controller associated with the > + * given phy device node, and returns the correspondig enum usb_dr_mode. > + */ > +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > +{ > + struct device_node *controller = NULL; > + struct device_node *phy; > + const char *dr_mode; > + int index; > + int err; > + > + do { > + controller = of_find_node_with_property(controller, "phys"); > + index = 0; > + do { > + phy = of_parse_phandle(controller, "phys", index); > + of_node_put(phy); > + if (phy == phy_np) > + goto finish; > + index++; > + } while (phy); > + } while (controller); > + > +finish: > + err = of_property_read_string(controller, "dr_mode", &dr_mode); > + of_node_put(controller); > + > + if (err < 0) > + return USB_DR_MODE_UNKNOWN; > + > + return usb_get_dr_mode_from_string(dr_mode); > +} > +EXPORT_SYMBOL_GPL(of_usb_get_dr_mode_by_phy); > + > #ifdef CONFIG_OF > /** > * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported > diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h > index c3fe9e4..3805757 100644 > --- a/include/linux/usb/of.h > +++ b/include/linux/usb/of.h > @@ -12,10 +12,15 @@ > #include > > #if IS_ENABLED(CONFIG_OF) > +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np); > bool of_usb_host_tpl_support(struct device_node *np); > int of_usb_update_otg_caps(struct device_node *np, > struct usb_otg_caps *otg_caps); > #else > +enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) > +{ > + return USB_DR_MODE_UNKNOWN; > +} > static inline bool of_usb_host_tpl_support(struct device_node *np) > { > return false; > Hi Felipe, This commit in your testing/next causes compilation error: /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:143:18: error: redefinition of ‘of_usb_get_dr_mode_by_phy’ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np) ^ In file included from /home/johnyoun/linux/linux-usb/drivers/usb/common/common.c:18:0: /home/johnyoun/linux/linux-usb/include/linux/usb/of.h:20:18: note: previous definition of ‘of_usb_get_dr_mode_by_phy’ was here enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np)
[PATCH v2] hid: usbhid: hid-core: fix recursive deadlock
The critical section protected by usbhid->lock in hid_ctrl() is too big and because of this it causes a recursive deadlock. "Too big" means the case statement and the call to hid_input_report() do not need to be protected by the spinlock (no URB operations are done inside them). The deadlock happens because in certain rare cases drivers try to grab the lock while handling the ctrl irq which grabs the lock before them as described above. For example newer wacom tablets like 056a:033c try to reschedule proximity reads from wacom_intuos_schedule_prox_event() calling hid_hw_request() -> usbhid_request() -> usbhid_submit_report() which tries to grab the usbhid lock already held by hid_ctrl(). There are two ways to get out of this deadlock: 1. Make the drivers work "around" the ctrl critical region, in the wacom case for ex. by delaying the scheduling of the proximity read request itself to a workqueue. 2. Shrink the critical region so the usbhid lock protects only the instructions which modify usbhid state, calling hid_input_report() with the spinlock unlocked, allowing the device driver to grab the lock first, finish and then grab the lock afterwards in hid_ctrl(). This patch implements the 2nd solution. Signed-off-by: Ioan-Adrian Ratiu --- drivers/hid/usbhid/hid-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 36712e9..5dd426f 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -477,8 +477,6 @@ static void hid_ctrl(struct urb *urb) struct usbhid_device *usbhid = hid->driver_data; int unplug = 0, status = urb->status; - spin_lock(&usbhid->lock); - switch (status) { case 0: /* success */ if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN) @@ -498,6 +496,8 @@ static void hid_ctrl(struct urb *urb) hid_warn(urb->dev, "ctrl urb status %d received\n", status); } + spin_lock(&usbhid->lock); + if (unplug) { usbhid->ctrltail = usbhid->ctrlhead; } else { -- 2.6.3 -- 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] hid: usbhid: hid-core: fix recursive deadlock
On Thu, 19 Nov 2015 22:34:18 +0100 (CET) Jiri Kosina wrote: > Could you please reformulate the changelog in this respect and resubmit? Yes, of course, I tried to reformulate the problem and solution as clear and succint as I could in v2, which I'll send shortly. Thank you very much for your patience and feedback. -- 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: [linux-sunxi] [PATCH 2/5] phy-sun4i-usb: Add support for the host usb-phys found on the H3 SoC
On Sun, 2015-11-15 at 20:46 +0100, Hans de Goede wrote: > From: Reinder de Haan > > Note this commit only adds support for phys 1-3, phy 0, the otg phy, > is > not yet (fully) supported after this commit. This patch seems to be causing following compile warning: In file included from include/linux/io.h:25:0, from drivers/phy/phy-sun4i-usb.c:28: drivers/phy/phy-sun4i-usb.c: In function 'sun4i_usb_phy_write': ./arch/arm/include/asm/io.h:94:2: warning: 'phyctl' may be used uninitialized in this function [-Wmaybe-uni nitialized] asm volatile("strb %1, %0" ^ drivers/phy/phy-sun4i-usb.c:172:8: note: 'phyctl' was declared here void *phyctl; > > Signed-off-by: Reinder de Haan > Signed-off-by: Hans de Goede > --- > .../devicetree/bindings/phy/sun4i-usb-phy.txt | 1 + > drivers/phy/phy-sun4i-usb.c| 67 > +- > 2 files changed, 53 insertions(+), 15 deletions(-) > > diff --git a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt > b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt > index 0cebf74..95736d7 100644 > --- a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt > +++ b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt > @@ -9,6 +9,7 @@ Required properties: > * allwinner,sun7i-a20-usb-phy > * allwinner,sun8i-a23-usb-phy > * allwinner,sun8i-a33-usb-phy > + * allwinner,sun8i-h3-usb-phy > - reg : a list of offset + length pairs > - reg-names : > * "phy_ctrl" > diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i- > usb.c > index b12964b..17f97ab 100644 > --- a/drivers/phy/phy-sun4i-usb.c > +++ b/drivers/phy/phy-sun4i-usb.c > @@ -46,6 +46,9 @@ > #define REG_PHYBIST 0x08 > #define REG_PHYTUNE 0x0c > #define REG_PHYCTL_A33 0x10 > +#define REG_PHY_UNK_H3 0x20 > + > +#define REG_PMU_UNK_H3 0x10 > > #define PHYCTL_DATA BIT(7) > > @@ -79,7 +82,7 @@ > #define PHY_DISCON_TH_SEL0x2a > #define PHY_SQUELCH_DETECT 0x3c > > -#define MAX_PHYS 3 > +#define MAX_PHYS 4 > > /* > * Note do not raise the debounce time, we must report Vusb high > within 100ms > @@ -88,12 +91,19 @@ > #define DEBOUNCE_TIMEmsecs_to_jiffies(50) > #define POLL_TIMEmsecs_to_jiffies(250) > > +enum sun4i_usb_phy_type { > + sun4i_a10_phy, > + sun8i_a33_phy, > + sun8i_h3_phy > +}; > + > struct sun4i_usb_phy_data { > + struct device *dev; > void __iomem *base; > struct mutex mutex; > int num_phys; > u32 disc_thresh; > - bool has_a33_phyctl; > + enum sun4i_usb_phy_type type; > struct sun4i_usb_phy { > struct phy *phy; > void __iomem *pmu; > @@ -164,12 +174,18 @@ static void sun4i_usb_phy_write(struct > sun4i_usb_phy *phy, u32 addr, u32 data, > > mutex_lock(&phy_data->mutex); > > - if (phy_data->has_a33_phyctl) { > + switch (phy_data->type) { > + case sun4i_a10_phy: > + phyctl = phy_data->base + REG_PHYCTL_A10; > + break; > + case sun8i_a33_phy: > phyctl = phy_data->base + REG_PHYCTL_A33; > /* A33 needs us to set phyctl to 0 explicitly */ > writel(0, phyctl); > - } else { > - phyctl = phy_data->base + REG_PHYCTL_A10; > + break; > + case sun8i_h3_phy: > + dev_err(phy_data->dev, "H3 usb_phy_write is not > supported\n"); > + break; > } > > for (i = 0; i < len; i++) { > @@ -230,6 +246,7 @@ static int sun4i_usb_phy_init(struct phy *_phy) > struct sun4i_usb_phy *phy = phy_get_drvdata(_phy); > struct sun4i_usb_phy_data *data = > to_sun4i_usb_phy_data(phy); > int ret; > + u32 val; > > ret = clk_prepare_enable(phy->clk); > if (ret) > @@ -241,15 +258,26 @@ static int sun4i_usb_phy_init(struct phy *_phy) > return ret; > } > > - /* Enable USB 45 Ohm resistor calibration */ > - if (phy->index == 0) > - sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1); > + if (data->type == sun8i_h3_phy) { > + if (phy->index == 0) { > + val = readl(data->base + REG_PHY_UNK_H3); > + writel(val & ~1, data->base + > REG_PHY_UNK_H3); > + } > + > + val = readl(phy->pmu + REG_PMU_UNK_H3); > + writel(val & ~2, phy->pmu + REG_PMU_UNK_H3); > + } else { > + /* Enable USB 45 Ohm resistor calibration */ > + if (phy->index == 0) > + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, > 0x01, 1); > > - /* Adjust PHY's magnitude and rate */ > - sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE, 0x14, 5); > + /* Adjust PHY's magnitude and rate */ > + sun4i_usb
[PATCH 3/4] USB: EHCI: enhance "async" debugfs output
This patch enhances the "async" debugfs file in ehci-hcd by printing out several additional fields in the hardware-accessible data structures. These fields are important for determining the hardware's view of the async schedule, in particular, the addresses of the current and next qTDs for each QH along with the start address of each qTD's data buffer. Signed-off-by: Alan Stern --- [as1789] drivers/usb/host/ehci-dbg.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) Index: usb-4.3/drivers/usb/host/ehci-dbg.c === --- usb-4.3.orig/drivers/usb/host/ehci-dbg.c +++ usb-4.3/drivers/usb/host/ehci-dbg.c @@ -436,7 +436,8 @@ static void qh_lines ( scratch = hc32_to_cpup(ehci, &hw->hw_info1); hw_curr = (mark == '*') ? hc32_to_cpup(ehci, &hw->hw_current) : 0; temp = scnprintf (next, size, - "qh/%p dev%d %cs ep%d %08x %08x (%08x%c %s nak%d)", + "qh/%p dev%d %cs ep%d %08x %08x (%08x%c %s nak%d)" + " [cur %08x next %08x buf[0] %08x]", qh, scratch & 0x007f, speed_char (scratch), (scratch >> 8) & 0x000f, @@ -444,7 +445,10 @@ static void qh_lines ( hc32_to_cpup(ehci, &hw->hw_token), mark, (cpu_to_hc32(ehci, QTD_TOGGLE) & hw->hw_token) ? "data1" : "data0", - (hc32_to_cpup(ehci, &hw->hw_alt_next) >> 1) & 0x0f); + (hc32_to_cpup(ehci, &hw->hw_alt_next) >> 1) & 0x0f, + hc32_to_cpup(ehci, &hw->hw_current), + hc32_to_cpup(ehci, &hw->hw_qtd_next), + hc32_to_cpup(ehci, &hw->hw_buf[0])); size -= temp; next += temp; @@ -464,7 +468,8 @@ static void qh_lines ( mark = '/'; } temp = snprintf (next, size, - "\n\t%p%c%s len=%d %08x urb %p", + "\n\t%p%c%s len=%d %08x urb %p" + " [td %08x buf[0] %08x]", td, mark, ({ char *tmp; switch ((scratch>>8)&0x03) { case 0: tmp = "out"; break; @@ -474,7 +479,9 @@ static void qh_lines ( } tmp;}), (scratch >> 16) & 0x7fff, scratch, - td->urb); + td->urb, + (u32) td->qtd_dma, + hc32_to_cpup(ehci, &td->hw_buf[0])); if (size < temp) temp = size; size -= temp; -- 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/4] USB: EHCI: warn on unexpectedly active QH
This patch adds a new warning message to ehci-hcd. The warning is triggered whenever the driver finds that the hardware has set the Active bit in a QH at a time when the driver expects the QH to be completely idle. Such bugs have been observed by users in the past, and since they can lead to serious problems (such as inability to unlink an URB that never completes), it would be good to know about them when they occur. This won't fix these bugs; that's a bigger job for a later patch. But success isn't guaranteed, since this depends on aspects of the hardware which are not documented in the EHCI spec or for which the spec's recommendations are clearly unworkable. It therefore seems worthwhile to check for these bugs proactively. Signed-off-by: Alan Stern Reported-by: Michael Reutman --- [as1790] drivers/usb/host/ehci-q.c |9 +++-- drivers/usb/host/ehci.h |1 + 2 files changed, 8 insertions(+), 2 deletions(-) Index: usb-4.3/drivers/usb/host/ehci.h === --- usb-4.3.orig/drivers/usb/host/ehci.h +++ usb-4.3/drivers/usb/host/ehci.h @@ -439,6 +439,7 @@ struct ehci_qh { unsigneddequeue_during_giveback:1; unsignedexception:1;/* got a fault, or an unlink was requested */ + unsignedshould_be_inactive:1; }; /*-*/ Index: usb-4.3/drivers/usb/host/ehci-q.c === --- usb-4.3.orig/drivers/usb/host/ehci-q.c +++ usb-4.3/drivers/usb/host/ehci-q.c @@ -132,10 +132,14 @@ qh_refresh (struct ehci_hcd *ehci, struc * qtd is updated in qh_completions(). Update the QH * overlay here. */ - if (qh->hw->hw_token & ACTIVE_BIT(ehci)) + if (qh->hw->hw_token & ACTIVE_BIT(ehci)) { qh->hw->hw_qtd_next = qtd->hw_next; - else + if (qh->should_be_inactive) + ehci_warn(ehci, "qh %p should be inactive!\n", qh); + } else { qh_update(ehci, qh, qtd); + } + qh->should_be_inactive = 0; } /*-*/ @@ -438,6 +442,7 @@ qh_completions (struct ehci_hcd *ehci, s (hw->hw_token & ACTIVE_BIT(ehci))) { token = hc32_to_cpu(ehci, hw->hw_token); hw->hw_token &= ~ACTIVE_BIT(ehci); + qh->should_be_inactive = 1; /* An unlink may leave an incomplete * async transaction in the TT buffer. -- 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/4] USB: limit usbfs snooping of URB contents
The usbfs_snoop facility can be very useful for debugging problems involving usbfs. However, it always prints out the entire contents of every URB. When dealing with large quantities of data, this can be less than helpful. This patch ameliorates the situation by adding a module parameter to usbcore for controlling the maximum number of bytes to print when snooping an URB. This makes debugging much easier. For backward compatibility, the default value is set unreasonably high. Signed-off-by: Alan Stern --- [as1787] Documentation/kernel-parameters.txt |4 drivers/usb/core/devio.c|9 - 2 files changed, 12 insertions(+), 1 deletion(-) Index: usb-4.3/Documentation/kernel-parameters.txt === --- usb-4.3.orig/Documentation/kernel-parameters.txt +++ usb-4.3/Documentation/kernel-parameters.txt @@ -3832,6 +3832,10 @@ bytes respectively. Such letter suffixes usbcore.usbfs_snoop= [USB] Set to log all usbfs traffic (default 0 = off). + usbcore.usbfs_snoop_max= + [USB] Maximum number of bytes to snoop in each URB + (default = 65536). + usbcore.blinkenlights= [USB] Set to cycle leds on hubs (default 0 = off). Index: usb-4.3/drivers/usb/core/devio.c === --- usb-4.3.orig/drivers/usb/core/devio.c +++ usb-4.3/drivers/usb/core/devio.c @@ -100,6 +100,11 @@ static bool usbfs_snoop; module_param(usbfs_snoop, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs traffic"); +static unsigned usbfs_snoop_max = 65536; +module_param(usbfs_snoop_max, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(usbfs_snoop_max, + "maximum number of bytes to print while snooping"); + #define snoop(dev, format, arg...) \ do {\ if (usbfs_snoop)\ @@ -392,6 +397,7 @@ static void snoop_urb(struct usb_device ep, t, d, length, timeout_or_status); } + data_len = min(data_len, usbfs_snoop_max); if (data && data_len > 0) { print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, 32, 1, data, data_len, 1); @@ -402,7 +408,8 @@ static void snoop_urb_data(struct urb *u { int i, size; - if (!usbfs_snoop) + len = min(len, usbfs_snoop_max); + if (!usbfs_snoop || len == 0) return; if (urb->num_sgs == 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/4] USB: add usbfs snooping for REAP and DISCARD
This patch improves the usbfs_snoop debugging facility by adding messages for a couple of significant events which, up to now, have not been logged. The events are reaping and discarding (i.e., cancelling) an URB. The debugging messages include the userspace address of the URB being reaped or discarded. The reaping messages have to be added in four places, in order to handle blocking and non-blocking reaps in both normal and 32-bit compatibility mode. Signed-off-by: Alan Stern --- [as1788] drivers/usb/core/devio.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) Index: usb-4.3/drivers/usb/core/devio.c === --- usb-4.3.orig/drivers/usb/core/devio.c +++ usb-4.3/drivers/usb/core/devio.c @@ -1716,8 +1716,12 @@ static struct async *reap_as(struct usb_ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) { struct async *as = reap_as(ps); + if (as) { - int retval = processcompl(as, (void __user * __user *)arg); + int retval; + + snoop(&ps->dev->dev, "reap %p\n", as->userurb); + retval = processcompl(as, (void __user * __user *)arg); free_async(as); return retval; } @@ -1733,6 +1737,7 @@ static int proc_reapurbnonblock(struct u as = async_getcompleted(ps); if (as) { + snoop(&ps->dev->dev, "reap %p\n", as->userurb); retval = processcompl(as, (void __user * __user *)arg); free_async(as); } else { @@ -1859,8 +1864,12 @@ static int processcompl_compat(struct as static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) { struct async *as = reap_as(ps); + if (as) { - int retval = processcompl_compat(as, (void __user * __user *)arg); + int retval; + + snoop(&ps->dev->dev, "reap %p\n", as->userurb); + retval = processcompl_compat(as, (void __user * __user *)arg); free_async(as); return retval; } @@ -1876,6 +1885,7 @@ static int proc_reapurbnonblock_compat(s as = async_getcompleted(ps); if (as) { + snoop(&ps->dev->dev, "reap %p\n", as->userurb); retval = processcompl_compat(as, (void __user * __user *)arg); free_async(as); } else { @@ -2280,7 +2290,7 @@ static long usbdev_do_ioctl(struct file #endif case USBDEVFS_DISCARDURB: - snoop(&dev->dev, "%s: DISCARDURB\n", __func__); + snoop(&dev->dev, "%s: DISCARDURB %p\n", __func__, p); ret = proc_unlinkurb(ps, p); break; -- 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: Not enough host controller resources for new device state
On Sat, November 21, 2015 3:46 am, Peter Stuge wrote: > Patrick Shirkey wrote: >> I have read various forum posts and some of the archive from this list >> about the following error message: >> >> Not enough host controller resources for new device state >> >> Some people have had success with disabling XHCI at the BIOS level. >> >> That seems to be an unnecessary work around to me given we are >> progressing >> towards USB4 in the not too distant future. >> >> Is there a definitive explanation other than "no one had time/resources >> to >> work on this issue yet" why we cannot have more than 30 odd devices >> connected with XHCI enabled? > > Yes. > > The xHCI standard (not USB 3, but the standard that SuperSpeed > capable hardware on the PC side - host controllers - implement) > introduced an allowance for host controllers to support a significantly > smaller number of attached devices than described in the USB 2.0 spec. > > Some non-EHCI high speed capable host controllers in embedded systems > are known to have such aribtrary limitations too, but the Intel xHCI > implementation was the first I encountered in desktop/laptop hardware. > > Did hardware vendors decide in the standards bodies that users will > now have to choose between SuperSpeed and 127 possible devices? > Thanks for your detailed reply. I will have to take your lead on that. It would be nice if we were "able" to choose rather than "had" to choose. > >> I am available to assist with debugging this issue if there is a way to >> make it work. > > You essentially have to educate yourself on silicon level (ie. what > hardware IP is being used in which consumer products) to sustain a > dependency on 127 possible devices per bus. > > I guess you'll find that there are only very few xHCI IPs out there, > probably just three or four. I wouldn't be surprised if they all have > the same, or similar, limitations. > > Is there anything I can do at the system level to avoid disabling xHCI at the BIOS level? -- Patrick Shirkey Boost Hardware Ltd -- 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: dwc2: add support of hi6220
"Herrero, Gregory" writes: > Hi Felipe, > > I just realized this patch miss "dma_desc_fs_enable" property in > params_hi6220. (drivers/usb/dwc2/platform.c:57) > > You need to apply this patch: > > diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > index d5102c4..2dfdae3 100644 > --- a/drivers/usb/dwc2/platform.c > +++ b/drivers/usb/dwc2/platform.c > @@ -59,6 +59,7 @@ static const struct dwc2_core_params params_hi6220 = { > .otg_ver= 0,/* 1.3 */ > .dma_enable = 1, > .dma_desc_enable= 0, > + .dma_desc_fs_enable = 0, > .speed = 0,/* High Speed */ > .enable_dynamic_fifo= 1, > .en_multiple_tx_fifo= 1, > > > Note that it is needed due to below patch. > "usb: dwc2: host: enable descriptor dma for fs devices" done, thanks. -- balbi signature.asc Description: PGP signature
Re: [PATCH RESEND 1/2] usb: dwc2: Make PHY optional
Hi, Stefan Wahren writes: > Hi Felipe, > > Am 20.11.2015 um 16:27 schrieb Felipe Balbi: >> >> Hi, >> >> Stefan Wahren writes: >>> Hi Felipe, >>> >>> Am 19.11.2015 um 20:54 schrieb Felipe Balbi: Hi John, John Youn writes: > Fixes commit 09a75e85 > "usb: dwc2: refactor common low-level hw code to platform.c" these two lines should be placed ... > > The above commit consolidated the low-level phy access into a common > location. This change introduced a check from the gadget requiring > that a PHY is specified. This requirement never existed on the host > side and broke some platforms when it was moved into platform.c. > > The gadget doesn't require the PHY either so remove the check. > ... here with the following format: Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") Just is just FYI, as I have already applied another version ;-) >>> >>> thanks but >>> >>> https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/fixes >>> >>> seems to miss ("usb: dwc2: fix kernel oops during driver probe") >> >> This is what you gent for sending fixes and non-fixes in the same series >> :-) >> >> Also, this has been broken for a long time, you didn't include a "Fixes: >> foo-bar-baz", you didn't Cc stable (seems like the regression is from >> v3.19). It gets pretty difficult for me to apply patches properly if you >> can't send them in a way I can understand what to do with them. >> >> If you want patches to get into -rc, send the bare minimum patches >> needed to fix the problem and do NOT make them depend on anything else. > > i'm sorry about that. I should have added the fixes tag to all the patches. > > I tought it wasn't a candidate for Cc stable, since the issue wasn't > reproducable before. > > The intention of the series was to get USB working for 4.4 for > bcm2835. okay, in that case, can you make sure testing/fixes and testing/next contain all your pending patches? Thanks -- balbi signature.asc Description: PGP signature
[PATCH v5 2/2] usb: dwc2: host: Clear interrupts before handling them
In general it is wise to clear interrupts before processing them. If you don't do that, you can get: 1. Interrupt happens 2. You look at system state and process interrupt 3. A new interrupt happens 4. You clear interrupt without processing it. This patch was actually a first attempt to fix missing device insertions as described in (usb: dwc2: host: Fix missing device insertions) and it did solve some of the signal bouncing problems but not all of them (which is why I submitted the other patch). Specifically, this patch itself would sometimes change: 1. hardware sees connect 2. hardware sees disconnect 3. hardware sees connect 4. dwc2_port_intr() - clears connect interrupt 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() ...to: 1. hardware sees connect 2. hardware sees disconnect 3. dwc2_port_intr() - clears connect interrupt 4. hardware sees connect 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() ...but with different timing then sometimes we'd still miss cable insertions. In any case, though this patch doesn't fix any (known) problems, it still seems wise as a general policy to clear interrupt before handling them. Note that for dwc2_handle_usb_port_intr(), instead of moving the clear of PRTINT to the beginning of the function we remove it completely. The only way to clear PRTINT is to clear the sources that set it in the first place. Signed-off-by: Douglas Anderson --- Changes in v5: - Rebased upon testing/next from 15-11-20. - Fixed missing reset as found by code inspection during rebase. - Now atop fix for missing spinlock in reset. - Dropped John Youn's ack / tested by since there's a bugfix now. Changes in v4: - Don't replace dwc2_writel with writel (Antti Seppälä). - Update description to explain why we remove PRTINT clear. Changes in v3: - Don't (uselessly) clear the PRTINT anymore (Felipe Balbi). drivers/usb/dwc2/core_intr.c | 49 +--- drivers/usb/dwc2/hcd_intr.c | 18 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 61601d16e233..d85c5c9f96c1 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -86,9 +86,6 @@ static void dwc2_handle_usb_port_intr(struct dwc2_hsotg *hsotg) hprt0 &= ~HPRT0_ENA; dwc2_writel(hprt0, hsotg->regs + HPRT0); } - - /* Clear interrupt */ - dwc2_writel(GINTSTS_PRTINT, hsotg->regs + GINTSTS); } /** @@ -98,11 +95,11 @@ static void dwc2_handle_usb_port_intr(struct dwc2_hsotg *hsotg) */ static void dwc2_handle_mode_mismatch_intr(struct dwc2_hsotg *hsotg) { - dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", -dwc2_is_host_mode(hsotg) ? "Host" : "Device"); - /* Clear interrupt */ dwc2_writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS); + + dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", +dwc2_is_host_mode(hsotg) ? "Host" : "Device"); } /** @@ -276,9 +273,13 @@ static void dwc2_handle_otg_intr(struct dwc2_hsotg *hsotg) */ static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg) { - u32 gintmsk = dwc2_readl(hsotg->regs + GINTMSK); + u32 gintmsk; + + /* Clear interrupt */ + dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS); /* Need to disable SOF interrupt immediately */ + gintmsk = dwc2_readl(hsotg->regs + GINTMSK); gintmsk &= ~GINTSTS_SOF; dwc2_writel(gintmsk, hsotg->regs + GINTMSK); @@ -295,9 +296,6 @@ static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg) queue_work(hsotg->wq_otg, &hsotg->wf_otg); spin_lock(&hsotg->lock); } - - /* Clear interrupt */ - dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS); } /** @@ -315,12 +313,12 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) { int ret; - dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n", - hsotg->lx_state); - /* Clear interrupt */ dwc2_writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS); + dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n", + hsotg->lx_state); + if (dwc2_is_device_mode(hsotg)) { if (hsotg->lx_state == DWC2_L2) { ret = dwc2_exit_hibernation(hsotg, true); @@ -347,6 +345,10 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) { int ret; + + /* Clear interrupt */ + dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS); + dev_dbg(hsotg->dev, "++Resume or Remote Wakeup Detected Interrupt++\n"); dev_dbg(hsotg-
[PATCH v5 1/2] usb: dwc2: host: Add missing spinlock in dwc2_hcd_reset_func()
The dwc2_hcd_reset_func() function is only ever called directly by a delayed work function. As such no locks are already held when the function is called. Doing a read-modify-write of CPU registers and setting fields in the main hsotg data structure is a bad idea without locks. Let's add locks. The bug was found by code inspection only. It turns out that the dwc2_hcd_reset_func() is only ever called today if the "host_support_fs_ls_low_power" parameter is enabled and no code in mainline enables that parameter. Thus no known issues in mainline are fixed by this patch, but it's still probably wise to fix the function. Signed-off-by: Douglas Anderson --- Changes in v5: - New for v5 of the series drivers/usb/dwc2/hcd.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 42b6c5127618..e8924cecc83a 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2357,13 +2357,19 @@ static void dwc2_hcd_reset_func(struct work_struct *work) { struct dwc2_hsotg *hsotg = container_of(work, struct dwc2_hsotg, reset_work.work); + unsigned long flags; u32 hprt0; dev_dbg(hsotg->dev, "USB RESET function called\n"); + + spin_lock_irqsave(&hsotg->lock, flags); + hprt0 = dwc2_read_hprt0(hsotg); hprt0 &= ~HPRT0_RST; dwc2_writel(hprt0, hsotg->regs + HPRT0); hsotg->flags.b.port_reset_change = 1; + + spin_unlock_irqrestore(&hsotg->lock, flags); } /* -- 2.6.0.rc2.230.g3dd15c0 -- 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 2/2] usb: dwc2: host: Clear interrupts before handling them
Hi, On Fri, Nov 20, 2015 at 8:49 AM, Doug Anderson wrote: > Felipe, > > On Fri, Nov 20, 2015 at 7:40 AM, Felipe Balbi wrote: >> >> Hi, >> >> Douglas Anderson writes: >>> In general it is wise to clear interrupts before processing them. If >>> you don't do that, you can get: >>> 1. Interrupt happens >>> 2. You look at system state and process interrupt >>> 3. A new interrupt happens >>> 4. You clear interrupt without processing it. >>> >>> This patch was actually a first attempt to fix missing device insertions >>> as described in (usb: dwc2: host: Fix missing device insertions) and it >>> did solve some of the signal bouncing problems but not all of >>> them (which is why I submitted the other patch). Specifically, this >>> patch itself would sometimes change: >>> 1. hardware sees connect >>> 2. hardware sees disconnect >>> 3. hardware sees connect >>> 4. dwc2_port_intr() - clears connect interrupt >>> 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() >>> >>> ...to: >>> 1. hardware sees connect >>> 2. hardware sees disconnect >>> 3. dwc2_port_intr() - clears connect interrupt >>> 4. hardware sees connect >>> 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() >>> >>> ...but with different timing then sometimes we'd still miss cable >>> insertions. >>> >>> In any case, though this patch doesn't fix any (known) problems, it >>> still seems wise as a general policy to clear interrupt before handling >>> them. >>> >>> Note that for dwc2_handle_usb_port_intr(), instead of moving the clear >>> of PRTINT to the beginning of the function we remove it completely. The >>> only way to clear PRTINT is to clear the sources that set it in the >>> first place. >>> >>> Signed-off-by: Douglas Anderson >>> Acked-by: John Youn >>> Tested-by: John Youn >> >> $ patch -p1 --dry-run < patch.diff >> checking file drivers/usb/dwc2/core_intr.c >> checking file drivers/usb/dwc2/hcd_intr.c >> Hunk #4 FAILED at 365. >> Hunk #5 succeeded at 388 (offset 11 lines). >> 1 out of 5 hunks FAILED >> >> Care to rebase on top of my testing/next ? > > No problem. > > ...though when I did that, I actually found (by code inspection) a bug > in the original patch, so I guess it's a good thing it didn't apply... > ...and then that led me to another bug that was pre-existing. I'll > send up two new patches shortly. I'll remove John's Ack and Tested > tags from the patch since it contains a change. > > It looks like you already landed part 1 of this series (usb: dwc2: > host: Fix missing device insertions) so I won't resend that. Ah, OK. Now I see why nobody found these problems in testing. The code path is completely disabled by all current parameters as checked in to mainline. In any case, it's good to fix. -Doug -- 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: Not enough host controller resources for new device state
Patrick Shirkey wrote: > I have read various forum posts and some of the archive from this list > about the following error message: > > Not enough host controller resources for new device state > > Some people have had success with disabling XHCI at the BIOS level. > > That seems to be an unnecessary work around to me given we are progressing > towards USB4 in the not too distant future. > > Is there a definitive explanation other than "no one had time/resources to > work on this issue yet" why we cannot have more than 30 odd devices > connected with XHCI enabled? Yes. The xHCI standard (not USB 3, but the standard that SuperSpeed capable hardware on the PC side - host controllers - implement) introduced an allowance for host controllers to support a significantly smaller number of attached devices than described in the USB 2.0 spec. Some non-EHCI high speed capable host controllers in embedded systems are known to have such aribtrary limitations too, but the Intel xHCI implementation was the first I encountered in desktop/laptop hardware. Did hardware vendors decide in the standards bodies that users will now have to choose between SuperSpeed and 127 possible devices? > I am available to assist with debugging this issue if there is a way to > make it work. You essentially have to educate yourself on silicon level (ie. what hardware IP is being used in which consumer products) to sustain a dependency on 127 possible devices per bus. I guess you'll find that there are only very few xHCI IPs out there, probably just three or four. I wouldn't be surprised if they all have the same, or similar, limitations. //Peter -- 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 2/2] usb: dwc2: host: Clear interrupts before handling them
Felipe, On Fri, Nov 20, 2015 at 7:40 AM, Felipe Balbi wrote: > > Hi, > > Douglas Anderson writes: >> In general it is wise to clear interrupts before processing them. If >> you don't do that, you can get: >> 1. Interrupt happens >> 2. You look at system state and process interrupt >> 3. A new interrupt happens >> 4. You clear interrupt without processing it. >> >> This patch was actually a first attempt to fix missing device insertions >> as described in (usb: dwc2: host: Fix missing device insertions) and it >> did solve some of the signal bouncing problems but not all of >> them (which is why I submitted the other patch). Specifically, this >> patch itself would sometimes change: >> 1. hardware sees connect >> 2. hardware sees disconnect >> 3. hardware sees connect >> 4. dwc2_port_intr() - clears connect interrupt >> 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() >> >> ...to: >> 1. hardware sees connect >> 2. hardware sees disconnect >> 3. dwc2_port_intr() - clears connect interrupt >> 4. hardware sees connect >> 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() >> >> ...but with different timing then sometimes we'd still miss cable >> insertions. >> >> In any case, though this patch doesn't fix any (known) problems, it >> still seems wise as a general policy to clear interrupt before handling >> them. >> >> Note that for dwc2_handle_usb_port_intr(), instead of moving the clear >> of PRTINT to the beginning of the function we remove it completely. The >> only way to clear PRTINT is to clear the sources that set it in the >> first place. >> >> Signed-off-by: Douglas Anderson >> Acked-by: John Youn >> Tested-by: John Youn > > $ patch -p1 --dry-run < patch.diff > checking file drivers/usb/dwc2/core_intr.c > checking file drivers/usb/dwc2/hcd_intr.c > Hunk #4 FAILED at 365. > Hunk #5 succeeded at 388 (offset 11 lines). > 1 out of 5 hunks FAILED > > Care to rebase on top of my testing/next ? No problem. ...though when I did that, I actually found (by code inspection) a bug in the original patch, so I guess it's a good thing it didn't apply... ...and then that led me to another bug that was pre-existing. I'll send up two new patches shortly. I'll remove John's Ack and Tested tags from the patch since it contains a change. It looks like you already landed part 1 of this series (usb: dwc2: host: Fix missing device insertions) so I won't resend that. -Doug -- 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 v6 4/4] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
On Fri, 20 Nov 2015, Marek Szyprowski wrote: > From: Ruslan Bilovol > > Change behavior during registration of gadgets and > gadget drivers in udc-core. Instead of previous > approach when for successful probe of usb gadget driver > at least one usb gadget should be already registered > use another one where gadget drivers and gadgets > can be registered in udc-core independently. > > Independent registration of gadgets and gadget drivers > is useful for built-in into kernel gadget and gadget > driver case - because it's possible that gadget is > really probed only on late_init stage (due to deferred > probe) whereas gadget driver's probe is silently failed > on module_init stage due to no any UDC added. > > Also it is useful for modules case - now there is no > difference what module to insert first: gadget module > or gadget driver one. > > Tested-by: Maxime Ripard > Signed-off-by: Ruslan Bilovol > [simplified code as requested by Alan Stern and Felipe Balbi] > Signed-off-by: Marek Szyprowski ... > @@ -475,9 +492,16 @@ void usb_del_gadget_udc(struct usb_gadget *gadget) > list_del(&udc->list); > mutex_unlock(&udc_lock); > > - if (udc->driver) > + if (udc->driver) { > + struct usb_gadget_driver *driver = udc->driver; > + > usb_gadget_remove_driver(udc); > > + mutex_lock(&udc_lock); > + list_add(&driver->pending, &gadget_driver_pending_list); > + mutex_unlock(&udc_lock); > + } It looks like there is a race here with usb_gadget_unregister_driver(). Would it be okay to hold the udc_lock mutex throughout the whole "if" statement? Alan Stern -- 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
Fw: [Bug 108201] New: Can connect with Huawei E3131-s2 (Hi-Link) 3G modem only after reboot.
Appears to be a cdc_ether driver bug. See Bugzilla for more followup info Begin forwarded message: Date: Fri, 20 Nov 2015 11:11:26 + From: "bugzilla-dae...@bugzilla.kernel.org" To: "shemmin...@linux-foundation.org" Subject: [Bug 108201] New: Can connect with Huawei E3131-s2 (Hi-Link) 3G modem only after reboot. https://bugzilla.kernel.org/show_bug.cgi?id=108201 Bug ID: 108201 Summary: Can connect with Huawei E3131-s2 (Hi-Link) 3G modem only after reboot. Product: Networking Version: 2.5 Kernel Version: 4.1.12-1-default Hardware: x86-64 OS: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: Other Assignee: shemmin...@linux-foundation.org Reporter: cameron...@poczta.fm Regression: No When I start (boot) the system from shutdown state I can't connect to Internet because there is no network connection in pop-up network plasma menu (close to clock in right bottom of the screen) in new openSUSE Leap 42.1 with KDE 5. When I shutdown the laptop and start again (boot again) it still doesn't connect (no connection available), but if I restart (reboot) the system the connection works (shows in plasma networking pop-up menu). >From what I can see in journalctl when I boot the laptop for the 1st time the system recognizes this modem as memory stick and there are errors in journalctl: NetworkManager[878]: (eth1): failed to find device 4 'eth1' with udev NetworkManager[878]: (eth1): new Ethernet device (carrier: OFF, driver: 'cdc_ether', ifindex: 4) kernel: cdc_ether 3-1:1.0 eth1: register 'cdc_ether' at usb-:00:12.2-1, CDC Ethernet Device, 58:2c:80:13:92:63 kernel: usbcore: registered new interface driver cdc_ether NetworkManager[878]: (eth1): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2] kernel: cdc_ether 3-1:1.0 eth1: kevent 12 may have been dropped NetworkManager[878]: (eth1): link connected NetworkManager[878]: (eth1): device state change: unavailable -> disconnected (reason 'none') [20 30 0] ...but when I reboot the laptop the system recognizes it as modem strait away and there are no "failed" nor "dropped" messages. I will attach 2 files with journalctl from the 1st boot and the reboot. I have always been installing the Huawei E3131-s2 (Hi-Link) from Linux driver attached in the modem's internal memory and it always worked, but now when I reinstalled the openSUSE system to newer version 42.1 there was an "failed" error with runmbbservice so I deactivated it. Anyway, the connection did not work either. Another thing - when I unplug the modem and plug it back in it fails again and the connection vanishes (doesn't show up when I plug modem back) and I have to reboot the system to be able to connect to the Internet. I is annoying to always boot the system and reboot in order to connect t the Internet :( So, can anyone fix this please? -- You are receiving this mail because: You are the assignee for the bug. -- 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: Not enough host controller resources for new device state
On Fri, 20 Nov 2015, Patrick Shirkey wrote: > Hi, > > I have read various forum posts and some of the archive from this list > about the following error message: > > Not enough host controller resources for new device state > > Some people have had success with disabling XHCI at the BIOS level. > > That seems to be an unnecessary work around to me given we are progressing > towards USB4 in the not too distant future. > > Is there a definitive explanation other than "no one had time/resources to > work on this issue yet" why we cannot have more than 30 odd devices > connected with XHCI enabled? The error message seems straightforward enough. Each new device requires some resources to be present in the xHCI controller, and the controller has a limited amount of resources. Eventually they get exhausted. As far as I can see, the only way to fix this is to get a controller capable of handling more devices. Or to get multiple controllers. > In my case I would like to use the full 128 ports on the USB bus. The > gives me a practical limit of 100 mobile devices and 20 something ports > for chaining usb hubs together. > > I am available to assist with debugging this issue if there is a way to > make it work. It sounds like this is impossible with the hardware you have. Alan Stern -- 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 1/2] usb: dwc2: Make PHY optional
Hi Felipe, Am 20.11.2015 um 16:27 schrieb Felipe Balbi: Hi, Stefan Wahren writes: Hi Felipe, Am 19.11.2015 um 20:54 schrieb Felipe Balbi: Hi John, John Youn writes: Fixes commit 09a75e85 "usb: dwc2: refactor common low-level hw code to platform.c" these two lines should be placed ... The above commit consolidated the low-level phy access into a common location. This change introduced a check from the gadget requiring that a PHY is specified. This requirement never existed on the host side and broke some platforms when it was moved into platform.c. The gadget doesn't require the PHY either so remove the check. ... here with the following format: Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") Just is just FYI, as I have already applied another version ;-) thanks but https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/fixes seems to miss ("usb: dwc2: fix kernel oops during driver probe") This is what you gent for sending fixes and non-fixes in the same series :-) Also, this has been broken for a long time, you didn't include a "Fixes: foo-bar-baz", you didn't Cc stable (seems like the regression is from v3.19). It gets pretty difficult for me to apply patches properly if you can't send them in a way I can understand what to do with them. If you want patches to get into -rc, send the bare minimum patches needed to fix the problem and do NOT make them depend on anything else. i'm sorry about that. I should have added the fixes tag to all the patches. I tought it wasn't a candidate for Cc stable, since the issue wasn't reproducable before. The intention of the series was to get USB working for 4.4 for bcm2835. and https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/next seems to miss ("usb: dwc2: Return errors from PHY") in my queue Maybe i forgot to mention that the patch series needs to be applied complete to fix the regression. if you have dependencies within the series, let me know now. There a no dependencies within the series. Thanks Stefan -- 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: dwc2: add support of hi6220
Hi Felipe, I just realized this patch miss "dma_desc_fs_enable" property in params_hi6220. (drivers/usb/dwc2/platform.c:57) You need to apply this patch: diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index d5102c4..2dfdae3 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -59,6 +59,7 @@ static const struct dwc2_core_params params_hi6220 = { .otg_ver= 0,/* 1.3 */ .dma_enable = 1, .dma_desc_enable= 0, + .dma_desc_fs_enable = 0, .speed = 0,/* High Speed */ .enable_dynamic_fifo= 1, .en_multiple_tx_fifo= 1, Note that it is needed due to below patch. "usb: dwc2: host: enable descriptor dma for fs devices" Regards, Gregory On Fri, Nov 20, 2015 at 04:34:13PM +0100, Felipe Balbi wrote: > > Hi, > > John Youn writes: > > On 11/19/2015 11:04 AM, Felipe Balbi wrote: > >> > >> Hi, > >> > >> Zhangfei Gao writes: > >>> Support hisilicon,hi6220-usb for HiKey board > >>> > >>> Signed-off-by: Zhangfei Gao > >> > >> doesn't apply: > >> > >> Applying: usb: dwc2: add support of hi6220 > >> error: drivers/usb/dwc2/platform.c: does not match index > >> Patch failed at 0001 usb: dwc2: add support of hi6220 > >> The copy of the patch that failed is found in: > >> workspace/linux/.git/rebase-apply/patch > >> When you have resolved this problem, run "git am --continue". > >> If you prefer to skip this patch, run "git am --skip" instead. > >> To restore the original branch and stop patching, run "git am --abort". > >> > >> Care to rebase on my testing/next and also collect John's and Rob's ack ? > >> > > > > > > That's weird. I just sync'd to your testing/next and it seems to > > apply fine. > > > > Same with the series from Gregory Herrero. > > > > Any chance it's something to do with your local repo? > > odd. Seems like it works if I apply manually with git am, but fails if I > pipe message from emacs to git am. Oh well, let me try again. > > -- > balbi -- 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: Udoo support for chipidea
On Fri, 20 Nov 2015, Peter Chen wrote: > > > > Hi Alan, we have several designs that the on-board HUB need to > > > > be reset by gpio pin and its clock is also from the board or > > > > the SoC. Any suggestions how to add these platform information > > > > for HUB device? > > > > > > How about putting it in the device tree? > > > http://www.firmware.org/1275/bindings/usb/usb-1_0.ps > > > clocks and reset-gpios properties could be added to the USB hub node. > > > > Something like this is necessary. Instead of making the hub driver > > take care of the reset gpio and the clock, I suggest you make the host > > controller's platform driver do these things. > > > > This is because USB hubs are generic devices, not specific to any > > platform and (usually) hot-pluggable. Associating platform-specific > > data with a hub is out of the ordinary, and it deserves to be handled > > by platform-specific code -- there is no such code in the hub driver. > > > > If this on-board HUB is special, its reset pin needs to be toggled > after power on, no matter for Intel or ARM platforms, how we handle > it? It is not feasible we add this for all platform drivers. I don't know. Probably it should be handled the same way as any other hardware with special requirements. Are you saying that it would be better to modify the hub driver than to modify all the platform drivers? If you can figure out a way to make it work, then maybe -- I don't see how to do it. Alan Stern -- 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-storage: Fix scsi-sd failure "Invalid field in cdb" for USB adapter JMicron
On Fri, 20 Nov 2015, Dmitry Katsubo wrote: > From: Dmitry Katsubo > > The patch extends the family of SATA-to-USB JMicron adapters that need > FUA to be disabled and applies the same policy for uas driver. > See details in http://unix.stackexchange.com/questions/237204/ > > Signed-off-by: Dmitry Katsubo > Tested-by: Dmitry Katsubo > --- > The change is trivial, however it spans also to JMicron adapter with > bcdDevice 1.15, which I haven't tested. Nevertheless it is very likely > that it is buggy as well. Patch was applied and tested on Debian Jessie > 4.2.5-1~bpo8+1. There is a checkpatch warning, but it is caused by original > source code formatting. Acked-by: Alan Stern Greg, please apply this. Dmitry, do you want this be applied to the -stable kernels too? Alan Stern -- 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 2/4] usb: dwc3: qcom: Configure TCSR phy mux register
On Fri, Nov 20, 2015 at 09:06:33AM -0600, Felipe Balbi wrote: > > Hi, > > Andy Gross writes: > > This patch adds automatic configuration of the TCSR phy mux register based > > on > > the syscon-tcsr devicetree entry. This configuration is optional, as some > > platforms may not require the mux selection. > > > > Signed-off-by: Andy Gross > > just when I find a way to make a generic dwc3-of-simple.c glue layer :-p > > I can, certainly drop my patches but I need more details on the syscon > usage below. > > > --- > > drivers/usb/dwc3/dwc3-qcom.c | 25 + > > 1 file changed, 25 insertions(+) > > > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > > index 0880260..fcf264c 100644 > > --- a/drivers/usb/dwc3/dwc3-qcom.c > > +++ b/drivers/usb/dwc3/dwc3-qcom.c > > @@ -17,6 +17,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > struct dwc3_qcom { > > struct device *dev; > > @@ -30,6 +32,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > > { > > struct device_node *node = pdev->dev.of_node; > > struct dwc3_qcom *qdwc; > > + struct regmap *regmap; > > + u32 mux_offset; > > + u32 mux_bit; > > int ret; > > > > qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL); > > @@ -58,6 +63,26 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > > qdwc->sleep_clk = NULL; > > } > > > > + /* look for tcsr and if present, provision it */ > > + regmap = syscon_regmap_lookup_by_phandle(node, "syscon-tcsr"); > > + if (!IS_ERR(regmap)) { > > + if (of_property_read_u32_index(node, "syscon-tcsr", 1, > > + &mux_offset)) { > > + dev_err(qdwc->dev, "missing USB TCSR mux offset\n"); > > + return -EINVAL; > > + } > > + if (of_property_read_u32_index(node, "syscon-tcsr", 2, > > + &mux_bit)) { > > + dev_err(qdwc->dev, "missing USB TCSR mux bit\n"); > > + return -EINVAL; > > + } > > + > > + regmap_update_bits(regmap, mux_offset, BIT(mux_bit), > > + BIT(mux_bit)); > > what is tcsr and what does it ? It also seems to be optional, why's that ? > > -- > balbi The syscon is to set the mux selection for the phys. Our hardware has a steering mux between hsic and dwc3 and setting this to 1 steers the phys to the right controller. It is optional because not all platforms appear to have this stupidity. -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- 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 4/4] Documentation: usb: dwc3: qcom: Add TCSR mux usage
On Fri, Nov 20, 2015 at 09:08:46AM -0600, Felipe Balbi wrote: > > Hi, > > Andy Gross writes: > > This patch adds documentation for the optional syscon-tcsr property in the > > Qualcomm DWC3 node. The syscon-tcsr specifies the register and bit used to > > configure the TCSR USB phy mux register. > > > > Signed-off-by: Andy Gross > > --- > > Documentation/devicetree/bindings/usb/qcom,dwc3.txt | 11 +++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > > b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > > index ca164e7..dfa222d 100644 > > --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > > +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > > @@ -8,6 +8,10 @@ Required properties: > >"core" Master/Core clock, have to be >= 125 MHz for SS > > operation and >= 60MHz for HS operation > > > > +Optional properties: > > +- syscon-tcsr Specifies TCSR handle, register offset, and bit > > position for > > + configuring the phy mux setting. > > oh, it's a PHY mux ? I don't think it should be part of any dwc3-* glue > layer then. By the time we reach dwc3, the mux should be properly > configured. > > Kishon, any ideas ? > > -- > balbi The only issue with putting it at the phy layer is that i'd have redundant syscon entries for each pair of phys, unless i group them somehow in dt. The only other issue I can think of is that in the downstream kernels, they do this before messing with the configuration of the dwc3. So long as the phys do their thing before the dwc3 (phys latched before config), we're ok. -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- 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 v2 2/4] Documentation: usb: gadget-testing: add description for depth of queue
Hi, Peter Chen writes: > On Thu, Nov 19, 2015 at 12:24:28PM -0600, Felipe Balbi wrote: >> >> Hi, >> >> Peter Chen writes: >> > Add both bulk and iso depth of queue for sourcesink. >> > >> > Signed-off-by: Peter Chen >> > --- >> > Documentation/usb/gadget-testing.txt | 2 ++ >> > 1 file changed, 2 insertions(+) >> > >> > diff --git a/Documentation/usb/gadget-testing.txt >> > b/Documentation/usb/gadget-testing.txt >> > index b24d3ef..84b3d10 100644 >> > --- a/Documentation/usb/gadget-testing.txt >> > +++ b/Documentation/usb/gadget-testing.txt >> > @@ -579,6 +579,8 @@ The SOURCESINK function provides these attributes in >> > its function directory: >> >isoc_mult - 0..2 (hs/ss only) >> >isoc_maxburst - 0..15 (ss only) >> >bulk_buflen - buffer length >> > + bulk_qlen - depth of queue for bulk >> > + iso_qlen- depth of queue for iso >> >> doesn't apply for me: >> >> Applying: Documentation: usb: gadget-testing: add description for depth of >> queue >> error: patch failed: Documentation/usb/gadget-testing.txt:579 >> error: Documentation/usb/gadget-testing.txt: patch does not apply >> Patch failed at 0001 Documentation: usb: gadget-testing: add description for >> depth of queue >> The copy of the patch that failed is found in: >> workspace/linux/.git/rebase-apply/patch >> When you have resolved this problem, run "git am --continue". >> If you prefer to skip this patch, run "git am --skip" instead. >> To restore the original branch and stop patching, run "git am --abort". >> >> Care to rebase on my testing/next ? >> >> Note that patch 1 is already applied. When rebasing, please collect >> Krzysztof's Reviewed-by ;-) >> > > I find the first three has already been applied, thanks for doing that. > But the patch 4/4 has not applied, do you need me to re-send it after > adding Krzysztof's Reviewed-by? just applied. Turns out it was emacs acting up. -- balbi signature.asc Description: PGP signature
Re: [PATCH v4 2/2] usb: dwc2: host: Clear interrupts before handling them
Hi, Douglas Anderson writes: > In general it is wise to clear interrupts before processing them. If > you don't do that, you can get: > 1. Interrupt happens > 2. You look at system state and process interrupt > 3. A new interrupt happens > 4. You clear interrupt without processing it. > > This patch was actually a first attempt to fix missing device insertions > as described in (usb: dwc2: host: Fix missing device insertions) and it > did solve some of the signal bouncing problems but not all of > them (which is why I submitted the other patch). Specifically, this > patch itself would sometimes change: > 1. hardware sees connect > 2. hardware sees disconnect > 3. hardware sees connect > 4. dwc2_port_intr() - clears connect interrupt > 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() > > ...to: > 1. hardware sees connect > 2. hardware sees disconnect > 3. dwc2_port_intr() - clears connect interrupt > 4. hardware sees connect > 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect() > > ...but with different timing then sometimes we'd still miss cable > insertions. > > In any case, though this patch doesn't fix any (known) problems, it > still seems wise as a general policy to clear interrupt before handling > them. > > Note that for dwc2_handle_usb_port_intr(), instead of moving the clear > of PRTINT to the beginning of the function we remove it completely. The > only way to clear PRTINT is to clear the sources that set it in the > first place. > > Signed-off-by: Douglas Anderson > Acked-by: John Youn > Tested-by: John Youn $ patch -p1 --dry-run < patch.diff checking file drivers/usb/dwc2/core_intr.c checking file drivers/usb/dwc2/hcd_intr.c Hunk #4 FAILED at 365. Hunk #5 succeeded at 388 (offset 11 lines). 1 out of 5 hunks FAILED Care to rebase on top of my testing/next ? -- balbi signature.asc Description: PGP signature
Re: [PATCH] HID: usbhid: add Logitech G710+ keyboard quirk NOGET
On Fri, Nov 20, 2015 at 12:51:39AM -0600, Jimmy Berry wrote: > On Thu, Nov 19, 2015 at 6:26 PM, Greg KH wrote: > > On Tue, Nov 17, 2015 at 12:40:12AM -0600, Jimmy Berry wrote: > >> Without quirk keyboard repeats '6' until volume control is used since it > >> indicates the key is pressed without ever releasing. > >> > >> Signed-off-by: Jimmy Berry > >> --- > >> drivers/hid/hid-ids.h | 1 + > >> drivers/hid/usbhid/hid-quirks.c | 1 + > >> 2 files changed, 2 insertions(+) > > > > Please use scripts/get_maintainer.pl to find the right people to cc: and > > the correct mailing list for your patch (hint, it's not me...) > > Thats exactly what I did. Perhaps the output needs to be tweaked. I > debated sending to linux-input, but the description seemed to fit too > well. > > --- > Jiri Kosina (maintainer:HID CORE LAYER) > linux-in...@vger.kernel.org (open list:HID CORE LAYER) > linux-ker...@vger.kernel.org (open list) > linux-usb@vger.kernel.org (open list:USB HID/HIDBP DRIVERS (USB > KEYBOARDS, MICE, REM...) > --- > > Note the "USB HID" and "USB KEYBOARDS" sections. That happens to be > exactly what this patch is against. Either way, I'll assume it is > instead linux-input to which you wish me to send the patch. Yes, the list goes from the most specific to the least. Jiri is the maintainer in charge of the code, linux-input is the place for the developers of the code, and then it gets more and more "generic". 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
Re: [PATCH RESEND 1/2] usb: dwc2: Make PHY optional
Hi, Stefan Wahren writes: > Hi Felipe, > > Am 19.11.2015 um 20:54 schrieb Felipe Balbi: >> >> Hi John, >> >> John Youn writes: >>> Fixes commit 09a75e85 >>> "usb: dwc2: refactor common low-level hw code to platform.c" >> >> these two lines should be placed ... >> >>> >>> The above commit consolidated the low-level phy access into a common >>> location. This change introduced a check from the gadget requiring >>> that a PHY is specified. This requirement never existed on the host >>> side and broke some platforms when it was moved into platform.c. >>> >>> The gadget doesn't require the PHY either so remove the check. >>> >> >> ... here with the following format: >> >> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level >> hw code to platform.c") >> >> Just is just FYI, as I have already applied another version ;-) >> > > thanks but > > https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/fixes > > seems to miss ("usb: dwc2: fix kernel oops during driver probe") This is what you gent for sending fixes and non-fixes in the same series :-) Also, this has been broken for a long time, you didn't include a "Fixes: foo-bar-baz", you didn't Cc stable (seems like the regression is from v3.19). It gets pretty difficult for me to apply patches properly if you can't send them in a way I can understand what to do with them. If you want patches to get into -rc, send the bare minimum patches needed to fix the problem and do NOT make them depend on anything else. > and > > https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/next > > seems to miss ("usb: dwc2: Return errors from PHY") in my queue > Maybe i forgot to mention that the patch series needs to be applied > complete to fix the regression. if you have dependencies within the series, let me know now. -- balbi signature.asc Description: PGP signature
Re: [PATCH] usb: dwc2: add support of hi6220
Hi, John Youn writes: > On 11/19/2015 11:04 AM, Felipe Balbi wrote: >> >> Hi, >> >> Zhangfei Gao writes: >>> Support hisilicon,hi6220-usb for HiKey board >>> >>> Signed-off-by: Zhangfei Gao >> >> doesn't apply: >> >> Applying: usb: dwc2: add support of hi6220 >> error: drivers/usb/dwc2/platform.c: does not match index >> Patch failed at 0001 usb: dwc2: add support of hi6220 >> The copy of the patch that failed is found in: >> workspace/linux/.git/rebase-apply/patch >> When you have resolved this problem, run "git am --continue". >> If you prefer to skip this patch, run "git am --skip" instead. >> To restore the original branch and stop patching, run "git am --abort". >> >> Care to rebase on my testing/next and also collect John's and Rob's ack ? >> > > > That's weird. I just sync'd to your testing/next and it seems to > apply fine. > > Same with the series from Gregory Herrero. > > Any chance it's something to do with your local repo? odd. Seems like it works if I apply manually with git am, but fails if I pipe message from emacs to git am. Oh well, let me try again. -- balbi signature.asc Description: PGP signature
Re: [PATCH 4/4] Documentation: usb: dwc3: qcom: Add TCSR mux usage
Hi, Andy Gross writes: > This patch adds documentation for the optional syscon-tcsr property in the > Qualcomm DWC3 node. The syscon-tcsr specifies the register and bit used to > configure the TCSR USB phy mux register. > > Signed-off-by: Andy Gross > --- > Documentation/devicetree/bindings/usb/qcom,dwc3.txt | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > index ca164e7..dfa222d 100644 > --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > @@ -8,6 +8,10 @@ Required properties: >"core" Master/Core clock, have to be >= 125 MHz for SS > operation and >= 60MHz for HS operation > > +Optional properties: > +- syscon-tcsrSpecifies TCSR handle, register offset, and bit > position for > + configuring the phy mux setting. oh, it's a PHY mux ? I don't think it should be part of any dwc3-* glue layer then. By the time we reach dwc3, the mux should be properly configured. Kishon, any ideas ? -- balbi signature.asc Description: PGP signature
Re: [PATCH 2/4] usb: dwc3: qcom: Configure TCSR phy mux register
Hi, Andy Gross writes: > This patch adds automatic configuration of the TCSR phy mux register based on > the syscon-tcsr devicetree entry. This configuration is optional, as some > platforms may not require the mux selection. > > Signed-off-by: Andy Gross just when I find a way to make a generic dwc3-of-simple.c glue layer :-p I can, certainly drop my patches but I need more details on the syscon usage below. > --- > drivers/usb/dwc3/dwc3-qcom.c | 25 + > 1 file changed, 25 insertions(+) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 0880260..fcf264c 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -17,6 +17,8 @@ > #include > #include > #include > +#include > +#include > > struct dwc3_qcom { > struct device *dev; > @@ -30,6 +32,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > { > struct device_node *node = pdev->dev.of_node; > struct dwc3_qcom *qdwc; > + struct regmap *regmap; > + u32 mux_offset; > + u32 mux_bit; > int ret; > > qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL); > @@ -58,6 +63,26 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > qdwc->sleep_clk = NULL; > } > > + /* look for tcsr and if present, provision it */ > + regmap = syscon_regmap_lookup_by_phandle(node, "syscon-tcsr"); > + if (!IS_ERR(regmap)) { > + if (of_property_read_u32_index(node, "syscon-tcsr", 1, > +&mux_offset)) { > + dev_err(qdwc->dev, "missing USB TCSR mux offset\n"); > + return -EINVAL; > + } > + if (of_property_read_u32_index(node, "syscon-tcsr", 2, > +&mux_bit)) { > + dev_err(qdwc->dev, "missing USB TCSR mux bit\n"); > + return -EINVAL; > + } > + > + regmap_update_bits(regmap, mux_offset, BIT(mux_bit), > +BIT(mux_bit)); what is tcsr and what does it ? It also seems to be optional, why's that ? -- balbi signature.asc Description: PGP signature
Re: [PATCH] ARM: dts: sun8i-h3-orangepi-plus: Enable USB host controllers
Hi, On 17-11-15 17:12, Jens Kuske wrote: Enable the 2 USB host controllers used on the Orange Pi Plus and add the necessary regulators. Signed-off-by: Reinder de Haan Signed-off-by: Hans de Goede Signed-off-by: Jens Kuske --- Hi Hans, with these regulators USB works on the Orange Pi Plus too. I don't know if adding the regulators in the dts is okay, since most regulators are defined in the sunxi-common-regulators.dtsi, but we use different pins. Thanks, I've added this to my sunxi-wip branch for now. Regards, Hans p.s. Any progress on getting the "core" H3 kernel support upstream ? Given Arnd's remarks about how we should not hard-code the indices in the clk driver + the very KISS nature of the change to 1 parent-clk per gate setup I still believe that that one is best. Maxime ? Chen-Yu ? It would be really good to be able to move forward with this, how do you want to proceed ? Jens arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 44 1 file changed, 44 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts index e67df59..1cb6c66 100644 --- a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts @@ -58,6 +58,35 @@ chosen { stdout-path = "serial0:115200n8"; }; + + reg_usb3_vbus: usb3-vbus { + compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&usb3_vbus_pin_a>; + regulator-name = "usb3-vbus"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + regulator-boot-on; + enable-active-high; + gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>; + }; +}; + +&ehci1 { + status = "okay"; +}; + +&ehci3 { + status = "okay"; +}; + +&pio { + usb3_vbus_pin_a: usb3_vbus_pin@0 { + allwinner,pins = "PG11"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; }; &mmc0 { @@ -70,8 +99,23 @@ status = "okay"; }; +®_usb1_vbus { + gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; status = "okay"; }; + +&usb1_vbus_pin_a { + allwinner,pins = "PG13"; +}; + +&usbphy { + usb1_vbus-supply = <®_usb1_vbus>; + usb3_vbus-supply = <®_usb3_vbus>; + status = "okay"; +}; -- 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 4/4] Documentation: usb: dwc3: qcom: Add TCSR mux usage
On Fri, Nov 20, 2015 at 02:35:09AM -0600, Andy Gross wrote: > This patch adds documentation for the optional syscon-tcsr property in the > Qualcomm DWC3 node. The syscon-tcsr specifies the register and bit used to > configure the TCSR USB phy mux register. > > Signed-off-by: Andy Gross Acked-by: Rob Herring > --- > Documentation/devicetree/bindings/usb/qcom,dwc3.txt | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > index ca164e7..dfa222d 100644 > --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt > @@ -8,6 +8,10 @@ Required properties: >"core" Master/Core clock, have to be >= 125 MHz for SS > operation and >= 60MHz for HS operation > > +Optional properties: > +- syscon-tcsrSpecifies TCSR handle, register offset, and bit > position for > + configuring the phy mux setting. > + > Optional clocks: >"iface"System bus AXI clock. Not present on all platforms >"sleep"Sleep clock, used when USB3 core goes into low > @@ -22,6 +26,11 @@ Documentation/devicetree/bindings/phy/qcom,dwc3-usb-phy.txt > > Example device nodes: > > + tcsr: syscon@1a40 { > + compatible = "qcom,tcsr-ipq8064", "syscon"; > + reg = <0x1a40 0x100>; > + }; > + > hs_phy: phy@100f8800 { > compatible = "qcom,dwc3-hs-usb-phy"; > reg = <0x100f8800 0x30>; > @@ -51,6 +60,8 @@ Example device nodes: > > ranges; > > + syscon-tcsr = <&tcsr 0xb0 0x1>; > + > status = "ok"; > > dwc3@1000 { > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > hosted by The Linux Foundation > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- 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/12] usb: xhci: add sysfs file for xHCI debug port
On 17.11.2015 08:38, Lu Baolu wrote: This patch adds a sysfs file for users to check 1) whether the debug capability is implemented by hardware; 2) if supported, which state does it stay at. With a host that supports debug port, a file named "debug_port_state" will be created under the device sysfs directory. Reading this file will show users the state (disabled, enabled or configured) of the debug port. With a host that does NOT support debug port, "debug_port_state" file won't be created. Signed-off-by: Lu Baolu --- .../ABI/testing/sysfs-bus-pci-drivers-xhci_hcd | 23 +++ drivers/usb/host/Makefile | 2 +- drivers/usb/host/xhci-ext-caps.h | 14 +++- drivers/usb/host/xhci-sysfs.c | 80 ++ drivers/usb/host/xhci.c| 4 ++ drivers/usb/host/xhci.h| 4 ++ 6 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd create mode 100644 drivers/usb/host/xhci-sysfs.c diff --git a/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd b/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd new file mode 100644 index 000..dd3e722 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd @@ -0,0 +1,23 @@ +What: /sys/bus/pci/drivers/xhci_hcd/.../debug_port_state +Date: November 2015 +KernelVersion: 4.3.0 +Contact: Lu Baolu +Description: + This file is designed for users to check the state of a + USB3 debug port. On a machine which supports USB3 debug + port, this file will be created. Reading this file will + show the state (disabled, enabled or configured) of the + debug port. On a machine that doesn't support USB3 debug + port, this file doesn't exist. + + The state of a debug port could be: + 1) disabled: The debug port is not enabled and the root + port has been switched to xHCI host as a normal + root port. + 2) enabled: The debug port is enabled. The debug port + has been assigned to debug capability. The debug + capability is able to handle the control requests + defined in USB3 spec. + 3) configured: The debug port has been enumerated by the + debug host as a debug device. The debug port is + in use now. How much will this sysfs file be used, It looks more like debugging info needed while developing xhci debug port capability. Would it be enough to add something like "supports DbC" in one of the dev_info() lines at xhci driver load if capability is supported? This sysfs file will only be visible after xhci is loaded. I understood that we would like to use the debug port capability even if xhci driver is not used, or then for earlyprintk before xhci is loaded. diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index e7558ab..810c304 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -12,7 +12,7 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o xhci-hcd-y := xhci.o xhci-mem.o xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o -xhci-hcd-y += xhci-trace.o +xhci-hcd-y += xhci-trace.o xhci-sysfs.o xhci-plat-hcd-y := xhci-plat.o ifneq ($(CONFIG_USB_XHCI_MVEBU), ) diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index 9fe3225..12c87e5 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h @@ -49,8 +49,15 @@ #define XHCI_EXT_CAPS_PM 3 #define XHCI_EXT_CAPS_VIRT4 #define XHCI_EXT_CAPS_ROUTE 5 -/* IDs 6-9 reserved */ +#define XHCI_EXT_CAPS_LOCALMEM 6 +/* IDs 7-9 reserved */ #define XHCI_EXT_CAPS_DEBUG 10 +/* IDs 192-255 vendor specific */ +#define XHCI_EXT_CAPS_VEN_START192 +#define XHCI_EXT_CAPS_VEN_END 255 The CAPS_VEN_END is probably not needed, all capabilities end at 255 (8 bit) Perhaps just use the EXT_MAX_CAPID defined later +#define XHCI_EXT_CAPS_VENDOR(p)(((p) >= XHCI_EXT_CAPS_VEN_START) && \ + ((p) <= XHCI_EXT_CAPS_VEN_END)) +#define XHCI_EXT_MAX_CAPID XHCI_EXT_CAPS_VEN_END /* USB Legacy Support Capability - section 7.1.1 */ #define XHCI_HC_BIOS_OWNED(1 << 16) #define XHCI_HC_OS_OWNED (1 << 24) @@ -73,6 +80,11 @@ #define XHCI_HLC (1 << 19) #define XHCI_BLC (1 << 20) +/* Debug capability - section 7.6.8 */ +#define XHCI_DBC_DCCTRL0x20 +#define XHCI_DBC_DCCTRL_DCR(1 << 0) +#defineXHCI_DBC_DCCTRL_DCE (1 << 31) + /* command register values to disable interrupts and halt the HC */ /* start/stop HC execution - do not write unless HC is halted*/ #define XHCI_CMD_RUN (1 <<
Re: [PATCH v2 1/2] cdc_acm: Ignore Infineon Flash Loader utility
On Fri, Nov 20, 2015 at 02:40:55PM +0100, Jonas Jonsson wrote: > On Thu, Nov 19, 2015 at 11:46:20AM +0100, Johan Hovold wrote: > > On Mon, Nov 16, 2015 at 01:34:14PM +0100, Jonas Jonsson wrote: > > > Some modems, such as the Telit UE910, are using an Infineon Flash Loader > > > utility. It has two interfaces, 2/2/0 (Abstract Modem) and 10/0/0 (CDC > > > Data). The latter can be used as a serial interface to upgrade the > > > firmware of the modem. However, that isn't possible when the cdc-acm > > > driver takes control of the device. > > > > Could you expand the commit message with some more information from the > > thread were Daniele explained how the flash loader works here? > > Specifically, that the device looks like a CDC-ACM device but really is > > not until after the flash loader has timed out. > Sure, I'll include parts of the mail from Daniele since it was a very good > explanation. Just remember to give credits in case you end up quoting someone. 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 v2 2/2] USB: serial: Another Infineon flash loader USB ID
On Thu, Nov 19, 2015 at 11:54:06AM +0100, Johan Hovold wrote: > On Mon, Nov 16, 2015 at 01:34:15PM +0100, Jonas Jonsson wrote: > > This has been seen on a Telit UE910 modem. > > Please expand this message as well and mention why this is not a CDC > device so we do not forget. Sure. > > + { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, 0x0a) } > > Please use USB_CLASS_CDC_DATA here. Indeed. Thanks /Jonas -- 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 v2 1/2] cdc_acm: Ignore Infineon Flash Loader utility
On Thu, Nov 19, 2015 at 11:46:20AM +0100, Johan Hovold wrote: > On Mon, Nov 16, 2015 at 01:34:14PM +0100, Jonas Jonsson wrote: > > Some modems, such as the Telit UE910, are using an Infineon Flash Loader > > utility. It has two interfaces, 2/2/0 (Abstract Modem) and 10/0/0 (CDC > > Data). The latter can be used as a serial interface to upgrade the > > firmware of the modem. However, that isn't possible when the cdc-acm > > driver takes control of the device. > > Could you expand the commit message with some more information from the > thread were Daniele explained how the flash loader works here? > Specifically, that the device looks like a CDC-ACM device but really is > not until after the flash loader has timed out. Sure, I'll include parts of the mail from Daniele since it was a very good explanation. /Jonas -- 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: [linux-sunxi] [PATCH 1/5] clk: sunxi: Add support for the H3 usb phy clocks
On Mon, Nov 16, 2015 at 10:36:02AM +0800, Chen-Yu Tsai wrote: > On Mon, Nov 16, 2015 at 3:46 AM, Hans de Goede wrote: > > From: Reinder de Haan > > > > The H3 has a usb-phy clk register which is similar to that of earlier > > SoCs, but with support for a larger number of phys. So we can simply add > > a new set of clk-data and a new compatible and be done with it. > > > > Signed-off-by: Reinder de Haan > > Signed-off-by: Hans de Goede > > Acked-by: Chen-Yu Tsai Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
Re: [linux-sunxi] Re: [PATCH 2/2] ehci-platform: Add support for controllers with multiple reset lines
On Wed, Nov 18, 2015 at 11:38:17AM +0100, Hans de Goede wrote: > Hi, > > On 18-11-15 10:46, Philipp Zabel wrote: > >Hi Hans, > > > >Am Montag, den 16.11.2015, 18:13 +0100 schrieb Hans de Goede: > >>On 16-11-15 18:01, Philipp Zabel wrote: > >>>If there are two devices sharing the same reset line that is initially > >>>held asserted, do the two drivers somehow have to synchronize before > >>>releasing the reset together? > >> > >>Not to my knowledge, I suggest that we simply treat this same as > >>regulators / clocks where the first one to enable it actually gets > >>it enabled (de-asserted in case of a reset), and the last one > >>to disable (assert) it (so dropping the usage counter back to 0) leads > >>to it being asserted again. > >> > >>This seems to work well enough for clocks / regulators and phys, and > >>at least for my use-case it should work fine for the shared reset too > >>(I will test to make sure of course). > >> > >>So from my pov a simple counter should suffice, does that work for you ? > > > >I don't quite understand what counting will help with, then. The first > >driver to call reset_control_deassert will deassert the reset, whether > >you count or not. > >But if the two drivers have deasserted an initially asserted reset, a > >reset_control_assert for one of them will silently fail. > > Correct, which is what we want, although I would not call it silently > fail I would call it a nop as it is intended. > > >I fear the deassertion count maps well to the case where resets are used > >just like clocks (when inactive modules are kept in reset), but I'm not > >sure this is useful in the case of resets that are kept deasserted most > >of the time, only to be asserted for a short pulse. Maybe we have to > >differentiate between the two cases? > > Ack. I think that the "just like clocks" case is the more common one, and > it seems to me that the short-pulse case should use reset_control_reset. > > Maybe we need to provide a default implementation of reset_control_reset which > does the pulse when no implementation is provided by the driver ? > > Although that brings the question with it what to do with the deassert_count > in > that case, as some drivers may also use that for the initial deassert... I > guess > we could document to not do that if you want to assure that no other drivers > muck with the reset-line ... > > Hmm, this is getting messy pretty quickly. New proposal: > > 1) Add a concept of shared resets, adding: reset_control_get_shared and >devm_reset_control_get_shared functions, which set a shared bool >in struct reset_control Maybe we can simply be a bit more generic and add a version taking flags as an argument, the fact that the reset line is shared being one of these flags. I guess both these versions have the issue that eventually every driver might use the shared variant (since we'd need to use it if one board or SoC is using a shared reset line, pretty much the same situation than for the interrupts), which would reduce the effectiveness of reset_control_get would not be able to catch exclusive use of the reset line. > 2) Add int refcnt to struct reset_controller_dev, which gets >incremented/decremented on reset_control_get/reset_control_put >do a BUG_ON on refcnt == 1 in the get functions when the non-shared >variant gets called (this is optional but probably a good extra >check) > > 3) Do the whole deassert_count thingy only when the shared bool is true > > 4) Make reset_control_reset fail (BUG_ON) if the shared bool is true I don't think silently failing (at least from the driver point of view) is the right approach. You've used clocks as an example, but there's a quite significant difference between clocks and reset lines: you never really care if the clock is actually disabled or not while when you want to put the device in reset, you usually expect it to be actually reset when the function returns (to deal with unrecoverable hardware errors for example). And drivers can always ignore the return code if they don't care. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
Re: [PATCH v12 0/3] Mediatek xHCI support
On 17.11.2015 11:18, Chunfeng Yun wrote: From 577f68d9c0ca1531d5f9cae0dcbea2ba116c8551 Mon Sep 17 00:00:00 2001 From: Chunfeng Yun Date: Tue, 17 Nov 2015 17:09:05 +0800 Subject: [PATCH v12 0/3] Mediatek xHCI support The patch supports MediaTek's xHCI controller. There are some differences from xHCI spec: 1. The interval is specified in 250 * 8ns increments for Interrupt Moderation Interval(IMODI) of the Interrupter Moderation(IMOD) register, it is 8 times as much as that defined in xHCI spec. 2. For the value of TD Size in Normal TRB, MTK's xHCI controller defines a number of packets that remain to be transferred for a TD after processing all Max packets in all previous TRBs,that means don't include the current TRB's, but in xHCI spec it includes the current ones. 3. To minimize the scheduling effort for synchronous endpoints in xHC, the MTK architecture defines some extra SW scheduling parameters for HW. According to these parameters provided by SW, the xHC can easily decide whether a synchronous endpoint should be scheduled in a specific uFrame. The extra SW scheduling parameters are put into reserved DWs in Slot and Endpoint Context. And a bandwidth scheduler algorithm is added to support such feature. A usb3.0 phy driver is also added which used by mt65xx SoCs platform, it supports two usb2.0 ports and one usb3.0 port. Added to my tree, I'll send it forward to Greg shortly Fixed the documentation "wakeup_deb_p0" -> "wakeup_deb_p1" typo as well -Mathias -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND v2 2/4] usb: dwc2: host: avoid usage of dma_alloc_coherent with irqs disabled
Use Streaming DMA mappings to handle cache coherency of frame list and descriptor list. Cache are always flushed before controller access it or before cpu access it. Acked-by: John Youn Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.c | 3 ++ drivers/usb/dwc2/core.h | 2 + drivers/usb/dwc2/hcd.c | 4 +- drivers/usb/dwc2/hcd.h | 4 ++ drivers/usb/dwc2/hcd_ddma.c | 106 ++-- 5 files changed, 94 insertions(+), 25 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 5568d9c..542c9e6 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -1934,6 +1934,9 @@ void dwc2_hc_start_transfer_ddma(struct dwc2_hsotg *hsotg, dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num)); + dma_sync_single_for_device(hsotg->dev, chan->desc_list_addr, + chan->desc_list_sz, DMA_TO_DEVICE); + hc_dma = (u32)chan->desc_list_addr & HCDMA_DMA_ADDR_MASK; /* Always start from first descriptor */ diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index fd4c236..e7cc542 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -685,6 +685,7 @@ struct dwc2_hregs_backup { * @otg_port: OTG port number * @frame_list: Frame list * @frame_list_dma: Frame list DMA address + * @frame_list_sz: Frame list size * * These are for peripheral mode: * @@ -804,6 +805,7 @@ struct dwc2_hsotg { u8 otg_port; u32 *frame_list; dma_addr_t frame_list_dma; + u32 frame_list_sz; #ifdef DEBUG u32 frrem_samples; diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 45b1c6a..03cbca3 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -880,8 +880,10 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) */ chan->multi_count = dwc2_hb_mult(qh->maxp); - if (hsotg->core_params->dma_desc_enable > 0) + if (hsotg->core_params->dma_desc_enable > 0) { chan->desc_list_addr = qh->desc_list_dma; + chan->desc_list_sz = qh->desc_list_sz; + } dwc2_hc_init(hsotg, chan); chan->qh = qh; diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h index 2e5e9d9..6e82266 100644 --- a/drivers/usb/dwc2/hcd.h +++ b/drivers/usb/dwc2/hcd.h @@ -107,6 +107,7 @@ struct dwc2_qh; * @qh: QH for the transfer being processed by this channel * @hc_list_entry: For linking to list of host channels * @desc_list_addr: Current QH's descriptor list DMA address + * @desc_list_sz: Current QH's descriptor list size * * This structure represents the state of a single host channel when acting in * host mode. It contains the data items needed to transfer packets to an @@ -159,6 +160,7 @@ struct dwc2_host_chan { struct dwc2_qh *qh; struct list_head hc_list_entry; dma_addr_t desc_list_addr; + u32 desc_list_sz; }; struct dwc2_hcd_pipe_info { @@ -251,6 +253,7 @@ enum dwc2_transaction_type { * schedule * @desc_list: List of transfer descriptors * @desc_list_dma: Physical address of desc_list + * @desc_list_sz: Size of descriptors list * @n_bytes:Xfer Bytes array. Each element corresponds to a transfer * descriptor and indicates original XferSize value for the * descriptor @@ -284,6 +287,7 @@ struct dwc2_qh { struct list_head qh_list_entry; struct dwc2_hcd_dma_desc *desc_list; dma_addr_t desc_list_dma; + u32 desc_list_sz; u32 *n_bytes; unsigned tt_buffer_dirty:1; }; diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c index f98c7e91..85d7816 100644 --- a/drivers/usb/dwc2/hcd_ddma.c +++ b/drivers/usb/dwc2/hcd_ddma.c @@ -87,22 +87,23 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, gfp_t flags) { - qh->desc_list = dma_alloc_coherent(hsotg->dev, - sizeof(struct dwc2_hcd_dma_desc) * - dwc2_max_desc_num(qh), &qh->desc_list_dma, - flags); + qh->desc_list_sz = sizeof(struct dwc2_hcd_dma_desc) * + dwc2_max_desc_num(qh); + qh->desc_list = kzalloc(qh->desc_list_sz, flags | GFP_DMA); if (!qh->desc_list) return -ENOMEM; - memset(qh->desc_list, 0, - sizeof(struct dwc2_hcd_dma_desc) * dwc2_max_desc_num(qh)); + qh->desc_list_dma = dma_map_single(hsotg->dev, qh->desc_list, + qh->desc_list_sz, + DMA_TO_DEVICE); qh->n_bytes = kzalloc(s
[PATCH RESEND v2 3/4] usb: dwc2: host: fix descriptor list address masking
From: Mian Yousaf Kaukab Masks for HCDMA.CTD and HCDMA.DMAAddr are incorrect. As we always start from first descriptor, no need to mask the address anyway. Acked-by: John Youn Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.c | 10 +++--- drivers/usb/dwc2/hw.h | 4 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 542c9e6..97de855 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -1905,7 +1905,6 @@ void dwc2_hc_start_transfer_ddma(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan) { u32 hcchar; - u32 hc_dma; u32 hctsiz = 0; if (chan->do_ping) @@ -1937,14 +1936,11 @@ void dwc2_hc_start_transfer_ddma(struct dwc2_hsotg *hsotg, dma_sync_single_for_device(hsotg->dev, chan->desc_list_addr, chan->desc_list_sz, DMA_TO_DEVICE); - hc_dma = (u32)chan->desc_list_addr & HCDMA_DMA_ADDR_MASK; + dwc2_writel(chan->desc_list_addr, hsotg->regs + HCDMA(chan->hc_num)); - /* Always start from first descriptor */ - hc_dma &= ~HCDMA_CTD_MASK; - dwc2_writel(hc_dma, hsotg->regs + HCDMA(chan->hc_num)); if (dbg_hc(chan)) - dev_vdbg(hsotg->dev, "Wrote %08x to HCDMA(%d)\n", -hc_dma, chan->hc_num); + dev_vdbg(hsotg->dev, "Wrote %pad to HCDMA(%d)\n", +&chan->desc_list_addr, chan->hc_num); hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); hcchar &= ~HCCHAR_MULTICNT_MASK; diff --git a/drivers/usb/dwc2/hw.h b/drivers/usb/dwc2/hw.h index 553f246..281b57b 100644 --- a/drivers/usb/dwc2/hw.h +++ b/drivers/usb/dwc2/hw.h @@ -769,10 +769,6 @@ #define TSIZ_XFERSIZE_SHIFT0 #define HCDMA(_ch) HSOTG_REG(0x0514 + 0x20 * (_ch)) -#define HCDMA_DMA_ADDR_MASK(0x1f << 11) -#define HCDMA_DMA_ADDR_SHIFT 11 -#define HCDMA_CTD_MASK (0xff << 3) -#define HCDMA_CTD_SHIFT3 #define HCDMAB(_ch)HSOTG_REG(0x051c + 0x20 * (_ch)) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH RESEND v2 4/4] usb: dwc2: host: use kmem cache to allocate descriptors
Kmem caches help to get correct boundary for descriptor buffers which need to be 512 bytes aligned for dwc2 controller. Two kmem caches are needed for generic descriptors and for hs isochronous descriptors which doesn't have same size. Acked-by: John Youn Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.h | 4 drivers/usb/dwc2/hcd.c | 50 - drivers/usb/dwc2/hcd_ddma.c | 20 -- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index e7cc542..baee2bc 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -686,6 +686,8 @@ struct dwc2_hregs_backup { * @frame_list: Frame list * @frame_list_dma: Frame list DMA address * @frame_list_sz: Frame list size + * @desc_gen_cache: Kmem cache for generic descriptors + * @desc_hsisoc_cache: Kmem cache for hs isochronous descriptors * * These are for peripheral mode: * @@ -806,6 +808,8 @@ struct dwc2_hsotg { u32 *frame_list; dma_addr_t frame_list_dma; u32 frame_list_sz; + struct kmem_cache *desc_gen_cache; + struct kmem_cache *desc_hsisoc_cache; #ifdef DEBUG u32 frrem_samples; diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 03cbca3..e3cd5dd 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3145,6 +3145,47 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) if (!hsotg->status_buf) goto error3; + /* +* Create kmem caches to handle descriptor buffers in descriptor +* DMA mode. +* Alignment must be set to 512 bytes. +*/ + if (hsotg->core_params->dma_desc_enable || + hsotg->core_params->dma_desc_fs_enable) { + hsotg->desc_gen_cache = kmem_cache_create("dwc2-gen-desc", + sizeof(struct dwc2_hcd_dma_desc) * + MAX_DMA_DESC_NUM_GENERIC, 512, SLAB_CACHE_DMA, + NULL); + if (!hsotg->desc_gen_cache) { + dev_err(hsotg->dev, + "unable to create dwc2 generic desc cache\n"); + + /* +* Disable descriptor dma mode since it will not be +* usable. +*/ + hsotg->core_params->dma_desc_enable = 0; + hsotg->core_params->dma_desc_fs_enable = 0; + } + + hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc", + sizeof(struct dwc2_hcd_dma_desc) * + MAX_DMA_DESC_NUM_HS_ISOC, 512, 0, NULL); + if (!hsotg->desc_hsisoc_cache) { + dev_err(hsotg->dev, + "unable to create dwc2 hs isoc desc cache\n"); + + kmem_cache_destroy(hsotg->desc_gen_cache); + + /* +* Disable descriptor dma mode since it will not be +* usable. +*/ + hsotg->core_params->dma_desc_enable = 0; + hsotg->core_params->dma_desc_fs_enable = 0; + } + } + hsotg->otg_port = 1; hsotg->frame_list = NULL; hsotg->frame_list_dma = 0; @@ -3168,7 +3209,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) */ retval = usb_add_hcd(hcd, irq, IRQF_SHARED); if (retval < 0) - goto error3; + goto error4; device_wakeup_enable(hcd->self.controller); @@ -3178,6 +3219,9 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) return 0; +error4: + kmem_cache_destroy(hsotg->desc_gen_cache); + kmem_cache_destroy(hsotg->desc_hsisoc_cache); error3: dwc2_hcd_release(hsotg); error2: @@ -3218,6 +3262,10 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) usb_remove_hcd(hcd); hsotg->priv = NULL; + + kmem_cache_destroy(hsotg->desc_gen_cache); + kmem_cache_destroy(hsotg->desc_hsisoc_cache); + dwc2_hcd_release(hsotg); usb_put_hcd(hcd); diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c index 85d7816..36606fc 100644 --- a/drivers/usb/dwc2/hcd_ddma.c +++ b/drivers/usb/dwc2/hcd_ddma.c @@ -87,10 +87,18 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, gfp_t flags) { + struct kmem_cache *desc_cache; + + if (qh->ep_type == USB_ENDPOINT_XFER_ISOC + && qh->dev_speed == USB_SPEED_HIGH) + desc_cache = hsotg->desc_hsisoc_cache; + else + desc_cache = hsotg->desc_gen_cache; + qh->desc_list_sz = sizeof(struct dwc2_hcd_dma_desc) *
[PATCH RESEND v2 1/4] usb: dwc2: host: enable descriptor dma for fs devices
From: Mian Yousaf Kaukab As descriptor dma mode does not support split transfers, it can't be enabled for high speed devices. Add a core parameter to enable it for full speed devices. Ensure frame list and descriptor list are correctly freed during disconnect. Acked-by: John Youn Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.c | 24 drivers/usb/dwc2/core.h | 20 drivers/usb/dwc2/hcd.c | 22 ++ drivers/usb/dwc2/hcd_intr.c | 15 +-- drivers/usb/dwc2/hcd_queue.c | 2 +- drivers/usb/dwc2/platform.c | 4 6 files changed, 84 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index ef73e49..5568d9c 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -2485,6 +2485,29 @@ void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) hsotg->core_params->dma_desc_enable = val; } +void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val) +{ + int valid = 1; + + if (val > 0 && (hsotg->core_params->dma_enable <= 0 || + !hsotg->hw_params.dma_desc_enable)) + valid = 0; + if (val < 0) + valid = 0; + + if (!valid) { + if (val >= 0) + dev_err(hsotg->dev, + "%d invalid for dma_desc_fs_enable parameter. Check HW configuration.\n", + val); + val = (hsotg->core_params->dma_enable > 0 && + hsotg->hw_params.dma_desc_enable); + } + + hsotg->core_params->dma_desc_fs_enable = val; + dev_dbg(hsotg->dev, "Setting dma_desc_fs_enable to %d\n", val); +} + void dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg, int val) { @@ -3016,6 +3039,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_otg_cap(hsotg, params->otg_cap); dwc2_set_param_dma_enable(hsotg, params->dma_enable); dwc2_set_param_dma_desc_enable(hsotg, params->dma_desc_enable); + dwc2_set_param_dma_desc_fs_enable(hsotg, params->dma_desc_fs_enable); dwc2_set_param_host_support_fs_ls_low_power(hsotg, params->host_support_fs_ls_low_power); dwc2_set_param_enable_dynamic_fifo(hsotg, diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index a66d3cb..fd4c236 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -246,6 +246,13 @@ enum dwc2_ep0_state { * value for this if none is specified. * 0 - Address DMA * 1 - Descriptor DMA (default, if available) + * @dma_desc_fs_enable: When DMA mode is enabled, specifies whether to use + * address DMA mode or descriptor DMA mode for accessing + * the data FIFOs in Full Speed mode only. The driver + * will automatically detect the value for this if none is + * specified. + * 0 - Address DMA + * 1 - Descriptor DMA in FS (default, if available) * @speed: Specifies the maximum speed of operation in host and * device mode. The actual speed depends on the speed of * the attached device and the value of phy_type. @@ -375,6 +382,7 @@ struct dwc2_core_params { int otg_ver; int dma_enable; int dma_desc_enable; + int dma_desc_fs_enable; int speed; int enable_dynamic_fifo; int en_multiple_tx_fifo; @@ -456,6 +464,7 @@ struct dwc2_hw_params { unsigned op_mode:3; unsigned arch:2; unsigned dma_desc_enable:1; + unsigned dma_desc_fs_enable:1; unsigned enable_dynamic_fifo:1; unsigned en_multiple_tx_fifo:1; unsigned host_rx_fifo_size:16; @@ -770,6 +779,7 @@ struct dwc2_hsotg { u16 frame_number; u16 periodic_qh_count; bool bus_suspended; + bool new_connection; #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS #define FRAME_NUM_ARRAY_SIZE 1000 @@ -942,6 +952,16 @@ extern void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val); extern void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val); /* + * When DMA mode is enabled specifies whether to use + * address DMA or DMA Descritor mode with full speed devices + * for accessing the data FIFOs in host mode. + * 0 - address DMA + * 1 - FS DMA Descriptor(default, if available) + */ +extern void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, + int val); + +/* * Specifies the maximum speed of operation in host and device mode. * The actual speed depends on the speed of the attached device and * the v
Re: [PATCH RESEND 1/2] usb: dwc2: Make PHY optional
Hi Felipe, Am 19.11.2015 um 20:54 schrieb Felipe Balbi: Hi John, John Youn writes: Fixes commit 09a75e85 "usb: dwc2: refactor common low-level hw code to platform.c" these two lines should be placed ... The above commit consolidated the low-level phy access into a common location. This change introduced a check from the gadget requiring that a PHY is specified. This requirement never existed on the host side and broke some platforms when it was moved into platform.c. The gadget doesn't require the PHY either so remove the check. ... here with the following format: Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c") Just is just FYI, as I have already applied another version ;-) thanks but https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/fixes seems to miss ("usb: dwc2: fix kernel oops during driver probe") and https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/next seems to miss ("usb: dwc2: Return errors from PHY") Maybe i forgot to mention that the patch series needs to be applied complete to fix the regression. Regards Stefan -- 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 v6 4/4] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
> >> > > And it seems can't apply for felipe's testing/next which I just > > rebased on it. > > I really have no idea why it fails for You. The patchset applies correctly on > both > Felipe's 'next' and 'testing/next' branches from today. > I may know the reason, it may be because I changed include/linux/usb/gadget.h due to your 1st patch's warning, since I enable checkpatch.pl hook for applying, I need to fix it after applying more. Applying: usb: gadget: udc-core: independent registration of gadgets and gadget drivers fatal: sha1 information is lacking or useless (include/linux/usb/gadget.h). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 usb: gadget: udc-core: independent registration of gadgets and gadget drivers Peter > Best regards > -- > Marek Szyprowski, PhD > Samsung R&D Institute Poland
Re: [PATCH v6 4/4] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
Hello, On 2015-11-20 10:26, Peter Chen wrote: On Fri, Nov 20, 2015 at 09:54:12AM +0100, Marek Szyprowski wrote: From: Ruslan Bilovol Change behavior during registration of gadgets and gadget drivers in udc-core. Instead of previous approach when for successful probe of usb gadget driver at least one usb gadget should be already registered use another one where gadget drivers and gadgets can be registered in udc-core independently. Independent registration of gadgets and gadget drivers is useful for built-in into kernel gadget and gadget driver case - because it's possible that gadget is really probed only on late_init stage (due to deferred probe) whereas gadget driver's probe is silently failed on module_init stage due to no any UDC added. Also it is useful for modules case - now there is no difference what module to insert first: gadget module or gadget driver one. Tested-by: Maxime Ripard Signed-off-by: Ruslan Bilovol [simplified code as requested by Alan Stern and Felipe Balbi] Signed-off-by: Marek Szyprowski --- drivers/usb/gadget/udc/udc-core.c | 43 +++ include/linux/usb/gadget.h| 2 ++ 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index f76ebc8..461b311 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -51,8 +51,12 @@ struct usb_udc { static struct class *udc_class; static LIST_HEAD(udc_list); +static LIST_HEAD(gadget_driver_pending_list); static DEFINE_MUTEX(udc_lock); +static int udc_bind_to_driver(struct usb_udc *udc, + struct usb_gadget_driver *driver); + /* - */ #ifdef CONFIG_HAS_DMA @@ -356,6 +360,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, void (*release)(struct device *dev)) { struct usb_udc *udc; + struct usb_gadget_driver *driver; int ret = -ENOMEM; udc = kzalloc(sizeof(*udc), GFP_KERNEL); @@ -403,6 +408,18 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, usb_gadget_set_state(gadget, USB_STATE_NOTATTACHED); udc->vbus = true; + /* pick up one of pending gadget drivers */ + list_for_each_entry(driver, &gadget_driver_pending_list, pending) { + if (!driver->udc_name || strcmp(driver->udc_name, + dev_name(&udc->dev)) == 0) { + ret = udc_bind_to_driver(udc, driver); + if (ret) + goto err4; + list_del(&driver->pending); + break; + } + } + mutex_unlock(&udc_lock); return 0; @@ -475,9 +492,16 @@ void usb_del_gadget_udc(struct usb_gadget *gadget) list_del(&udc->list); mutex_unlock(&udc_lock); - if (udc->driver) + if (udc->driver) { + struct usb_gadget_driver *driver = udc->driver; + usb_gadget_remove_driver(udc); + mutex_lock(&udc_lock); + list_add(&driver->pending, &gadget_driver_pending_list); + mutex_unlock(&udc_lock); + } + kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE); flush_work(&gadget->work); device_unregister(&udc->dev); @@ -535,11 +559,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) if (!ret) break; } - if (ret) - ret = -ENODEV; - else if (udc->driver) - ret = -EBUSY; - else + if (!ret && !udc->driver) goto found; } else { list_for_each_entry(udc, &udc_list, list) { @@ -549,9 +569,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) } } - pr_debug("couldn't find an available UDC\n"); + list_add_tail(&driver->pending, &gadget_driver_pending_list); + pr_info("udc-core: couldn't find an available UDC " + "- added [%s] to list of pending drivers\n", + driver->function); mutex_unlock(&udc_lock); - return ret; + return 0; found: ret = udc_bind_to_driver(udc, driver); mutex_unlock(&udc_lock); @@ -577,6 +600,10 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) break; } + if (ret) { + list_del(&driver->pending); + ret = 0; + } mutex_unlock(&udc_lock); return ret; } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e11f5a2..a3436bf 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb
Re: [PATCH v6 4/4] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
On Fri, Nov 20, 2015 at 09:54:12AM +0100, Marek Szyprowski wrote: > From: Ruslan Bilovol > > Change behavior during registration of gadgets and > gadget drivers in udc-core. Instead of previous > approach when for successful probe of usb gadget driver > at least one usb gadget should be already registered > use another one where gadget drivers and gadgets > can be registered in udc-core independently. > > Independent registration of gadgets and gadget drivers > is useful for built-in into kernel gadget and gadget > driver case - because it's possible that gadget is > really probed only on late_init stage (due to deferred > probe) whereas gadget driver's probe is silently failed > on module_init stage due to no any UDC added. > > Also it is useful for modules case - now there is no > difference what module to insert first: gadget module > or gadget driver one. > > Tested-by: Maxime Ripard > Signed-off-by: Ruslan Bilovol > [simplified code as requested by Alan Stern and Felipe Balbi] > Signed-off-by: Marek Szyprowski > --- > drivers/usb/gadget/udc/udc-core.c | 43 > +++ > include/linux/usb/gadget.h| 2 ++ > 2 files changed, 37 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/gadget/udc/udc-core.c > b/drivers/usb/gadget/udc/udc-core.c > index f76ebc8..461b311 100644 > --- a/drivers/usb/gadget/udc/udc-core.c > +++ b/drivers/usb/gadget/udc/udc-core.c > @@ -51,8 +51,12 @@ struct usb_udc { > > static struct class *udc_class; > static LIST_HEAD(udc_list); > +static LIST_HEAD(gadget_driver_pending_list); > static DEFINE_MUTEX(udc_lock); > > +static int udc_bind_to_driver(struct usb_udc *udc, > + struct usb_gadget_driver *driver); > + > /* - > */ > > #ifdef CONFIG_HAS_DMA > @@ -356,6 +360,7 @@ int usb_add_gadget_udc_release(struct device *parent, > struct usb_gadget *gadget, > void (*release)(struct device *dev)) > { > struct usb_udc *udc; > + struct usb_gadget_driver *driver; > int ret = -ENOMEM; > > udc = kzalloc(sizeof(*udc), GFP_KERNEL); > @@ -403,6 +408,18 @@ int usb_add_gadget_udc_release(struct device *parent, > struct usb_gadget *gadget, > usb_gadget_set_state(gadget, USB_STATE_NOTATTACHED); > udc->vbus = true; > > + /* pick up one of pending gadget drivers */ > + list_for_each_entry(driver, &gadget_driver_pending_list, pending) { > + if (!driver->udc_name || strcmp(driver->udc_name, > + dev_name(&udc->dev)) == 0) { > + ret = udc_bind_to_driver(udc, driver); > + if (ret) > + goto err4; > + list_del(&driver->pending); > + break; > + } > + } > + > mutex_unlock(&udc_lock); > > return 0; > @@ -475,9 +492,16 @@ void usb_del_gadget_udc(struct usb_gadget *gadget) > list_del(&udc->list); > mutex_unlock(&udc_lock); > > - if (udc->driver) > + if (udc->driver) { > + struct usb_gadget_driver *driver = udc->driver; > + > usb_gadget_remove_driver(udc); > > + mutex_lock(&udc_lock); > + list_add(&driver->pending, &gadget_driver_pending_list); > + mutex_unlock(&udc_lock); > + } > + > kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE); > flush_work(&gadget->work); > device_unregister(&udc->dev); > @@ -535,11 +559,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver > *driver) > if (!ret) > break; > } > - if (ret) > - ret = -ENODEV; > - else if (udc->driver) > - ret = -EBUSY; > - else > + if (!ret && !udc->driver) > goto found; > } else { > list_for_each_entry(udc, &udc_list, list) { > @@ -549,9 +569,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver > *driver) > } > } > > - pr_debug("couldn't find an available UDC\n"); > + list_add_tail(&driver->pending, &gadget_driver_pending_list); > + pr_info("udc-core: couldn't find an available UDC " > + "- added [%s] to list of pending drivers\n", > + driver->function); > mutex_unlock(&udc_lock); > - return ret; > + return 0; > found: > ret = udc_bind_to_driver(udc, driver); > mutex_unlock(&udc_lock); > @@ -577,6 +600,10 @@ int usb_gadget_unregister_driver(struct > usb_gadget_driver *driver) > break; > } > > + if (ret) { > + list_del(&driver->pending); > + ret = 0; > + } > mutex_unlock(&udc_lock); > return ret; > } > diff --git a/include/linux/usb/gadge
Re: [PATCH v6 2/4] usb: gadget: configfs: pass UDC name via usb_gadget_driver struct
On Fri, Nov 20, 2015 at 09:54:10AM +0100, Marek Szyprowski wrote: > From: Ruslan Bilovol > > Now when udc-core supports binding to specific UDC by passing > its name via 'udc_name' member of usb_gadget_driver struct, > switch to this generic approach. > > Tested-by: Maxime Ripard > Signed-off-by: Ruslan Bilovol > Signed-off-by: Marek Szyprowski > --- > drivers/usb/gadget/configfs.c | 27 ++- > 1 file changed, 14 insertions(+), 13 deletions(-) > > diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c > index 163d305..0bc6865 100644 > --- a/drivers/usb/gadget/configfs.c > +++ b/drivers/usb/gadget/configfs.c > @@ -56,7 +56,6 @@ struct gadget_info { > struct list_head string_list; > struct list_head available_func; > > - const char *udc_name; > struct usb_composite_driver composite; > struct usb_composite_dev cdev; > bool use_os_desc; > @@ -233,21 +232,21 @@ static ssize_t gadget_dev_desc_bcdUSB_store(struct > config_item *item, > > static ssize_t gadget_dev_desc_UDC_show(struct config_item *item, char *page) > { > - return sprintf(page, "%s\n", to_gadget_info(item)->udc_name ?: ""); > + return sprintf(page, "%s\n", > to_gadget_info(item)->composite.gadget_driver.udc_name ?: ""); > } > > static int unregister_gadget(struct gadget_info *gi) > { > int ret; > > - if (!gi->udc_name) > + if (!gi->composite.gadget_driver.udc_name) > return -ENODEV; > > ret = usb_gadget_unregister_driver(&gi->composite.gadget_driver); > if (ret) > return ret; > - kfree(gi->udc_name); > - gi->udc_name = NULL; > + kfree(gi->composite.gadget_driver.udc_name); > + gi->composite.gadget_driver.udc_name = NULL; > return 0; > } > > @@ -271,14 +270,16 @@ static ssize_t gadget_dev_desc_UDC_store(struct > config_item *item, > if (ret) > goto err; > } else { > - if (gi->udc_name) { > + if (gi->composite.gadget_driver.udc_name) { > ret = -EBUSY; > goto err; > } > - ret = usb_udc_attach_driver(name, &gi->composite.gadget_driver); > - if (ret) > + gi->composite.gadget_driver.udc_name = name; > + ret = usb_gadget_probe_driver(&gi->composite.gadget_driver); > + if (ret) { > + gi->composite.gadget_driver.udc_name = NULL; > goto err; > - gi->udc_name = name; > + } > } > mutex_unlock(&gi->lock); > return len; > @@ -427,9 +428,9 @@ static int config_usb_cfg_unlink( >* remove the function. >*/ > mutex_lock(&gi->lock); > - if (gi->udc_name) > + if (gi->composite.gadget_driver.udc_name) > unregister_gadget(gi); > - WARN_ON(gi->udc_name); > + WARN_ON(gi->composite.gadget_driver.udc_name); > > list_for_each_entry(f, &cfg->func_list, list) { > if (f->fi == fi) { > @@ -873,10 +874,10 @@ static int os_desc_unlink(struct config_item > *os_desc_ci, > struct usb_composite_dev *cdev = &gi->cdev; > > mutex_lock(&gi->lock); > - if (gi->udc_name) > + if (gi->composite.gadget_driver.udc_name) > unregister_gadget(gi); > cdev->os_desc_config = NULL; > - WARN_ON(gi->udc_name); > + WARN_ON(gi->composite.gadget_driver.udc_name); > mutex_unlock(&gi->lock); > return 0; > } > -- Applying: usb: gadget: configfs: pass UDC name via usb_gadget_driver struct WARNING: line over 80 characters #18: FILE: drivers/usb/gadget/configfs.c:235: + return sprintf(page, "%s\n", to_gadget_info(item)->composite.gadget_driver.udc_name ?: ""); -- Best Regards, Peter Chen -- 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 v6 1/4] usb: gadget: bind UDC by name passed via usb_gadget_driver structure
On Fri, Nov 20, 2015 at 09:54:09AM +0100, Marek Szyprowski wrote: > From: Ruslan Bilovol > > Introduce new 'udc_name' member to usb_gadget_driver structure. > The 'udc_name' is a name of UDC that usb_gadget_driver should > be bound to. If udc_name is NULL, it will be bound to any > available UDC. > > Tested-by: Maxime Ripard > Signed-off-by: Ruslan Bilovol > Signed-off-by: Marek Szyprowski > --- > drivers/usb/gadget/udc/udc-core.c | 24 +++- > include/linux/usb/gadget.h| 4 > 2 files changed, 23 insertions(+), 5 deletions(-) > > diff --git a/drivers/usb/gadget/udc/udc-core.c > b/drivers/usb/gadget/udc/udc-core.c > index f660afb..429d64e 100644 > --- a/drivers/usb/gadget/udc/udc-core.c > +++ b/drivers/usb/gadget/udc/udc-core.c > @@ -549,21 +549,35 @@ EXPORT_SYMBOL_GPL(usb_udc_attach_driver); > int usb_gadget_probe_driver(struct usb_gadget_driver *driver) > { > struct usb_udc *udc = NULL; > - int ret; > + int ret = -ENODEV; > > if (!driver || !driver->bind || !driver->setup) > return -EINVAL; > > mutex_lock(&udc_lock); > - list_for_each_entry(udc, &udc_list, list) { > - /* For now we take the first one */ > - if (!udc->driver) > + if (driver->udc_name) { > + list_for_each_entry(udc, &udc_list, list) { > + ret = strcmp(driver->udc_name, dev_name(&udc->dev)); > + if (!ret) > + break; > + } > + if (ret) > + ret = -ENODEV; > + else if (udc->driver) > + ret = -EBUSY; > + else > goto found; > + } else { > + list_for_each_entry(udc, &udc_list, list) { > + /* For now we take the first one */ > + if (!udc->driver) > + goto found; > + } > } > > pr_debug("couldn't find an available UDC\n"); > mutex_unlock(&udc_lock); > - return -ENODEV; > + return ret; > found: > ret = udc_bind_to_driver(udc, driver); > mutex_unlock(&udc_lock); > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index 3d583a1..b32e44f 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -1012,6 +1012,8 @@ static inline int usb_gadget_activate(struct usb_gadget > *gadget) > * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers > * and should be called in_interrupt. > * @driver: Driver model state for this driver. > + * @udc_name: A name of UDC this driver should be bound to. If udc_name is > NULL, > + * this driver will be bound to any available UDC. > * > * Devices are disabled till a gadget driver successfully bind()s, which > * means the driver will handle setup() requests needed to enumerate (and > @@ -1072,6 +1074,8 @@ struct usb_gadget_driver { > > /* FIXME support safe rmmod */ > struct device_driverdriver; > + > + char*udc_name; > }; > When trying to apply for testing, I meet below warning: Applying: usb: gadget: bind UDC by name passed via usb_gadget_driver structure WARNING: please, no space before tabs #55: FILE: include/linux/usb/gadget.h:1016: + * ^Ithis driver will be bound to any available UDC.$ > > -- > 1.9.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen -- 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
Not enough host controller resources for new device state
Hi, I have read various forum posts and some of the archive from this list about the following error message: Not enough host controller resources for new device state Some people have had success with disabling XHCI at the BIOS level. That seems to be an unnecessary work around to me given we are progressing towards USB4 in the not too distant future. Is there a definitive explanation other than "no one had time/resources to work on this issue yet" why we cannot have more than 30 odd devices connected with XHCI enabled? In my case I would like to use the full 128 ports on the USB bus. The gives me a practical limit of 100 mobile devices and 20 something ports for chaining usb hubs together. I am available to assist with debugging this issue if there is a way to make it work. -- Patrick Shirkey Boost Hardware Ltd -- 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 v2 10/13] usb: dwc2: host: enable descriptor dma for fs devices
On Thu, Nov 19, 2015 at 08:26:22PM +0100, Felipe Balbi wrote: > > Hi, > > Gregory Herrero writes: > > From: Mian Yousaf Kaukab > > > > As descriptor dma mode does not support split transfers, it can't be > > enabled for high speed devices. Add a core parameter to enable it for > > full speed devices. > > > > Ensure frame list and descriptor list are correctly freed during > > disconnect. > > > > Signed-off-by: Mian Yousaf Kaukab > > Signed-off-by: Gregory Herrero > > this one doesn't apply: > > Applying: usb: dwc2: host: enable descriptor dma for fs devices > error: drivers/usb/dwc2/core.h: does not match index > error: drivers/usb/dwc2/hcd.c: does not match index > error: drivers/usb/dwc2/hcd_intr.c: does not match index > error: drivers/usb/dwc2/platform.c: does not match index > Patch failed at 0001 usb: dwc2: host: enable descriptor dma for fs devices > The copy of the patch that failed is found in: > workspace/linux/.git/rebase-apply/patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > Care to rebase on my testing/next ? Patches 1-9 are already applied. > Ok, I will resend patches 10-13 rebased on your testing/next. Regards, Gregory -- 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 v6 2/4] usb: gadget: configfs: pass UDC name via usb_gadget_driver struct
From: Ruslan Bilovol Now when udc-core supports binding to specific UDC by passing its name via 'udc_name' member of usb_gadget_driver struct, switch to this generic approach. Tested-by: Maxime Ripard Signed-off-by: Ruslan Bilovol Signed-off-by: Marek Szyprowski --- drivers/usb/gadget/configfs.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 163d305..0bc6865 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -56,7 +56,6 @@ struct gadget_info { struct list_head string_list; struct list_head available_func; - const char *udc_name; struct usb_composite_driver composite; struct usb_composite_dev cdev; bool use_os_desc; @@ -233,21 +232,21 @@ static ssize_t gadget_dev_desc_bcdUSB_store(struct config_item *item, static ssize_t gadget_dev_desc_UDC_show(struct config_item *item, char *page) { - return sprintf(page, "%s\n", to_gadget_info(item)->udc_name ?: ""); + return sprintf(page, "%s\n", to_gadget_info(item)->composite.gadget_driver.udc_name ?: ""); } static int unregister_gadget(struct gadget_info *gi) { int ret; - if (!gi->udc_name) + if (!gi->composite.gadget_driver.udc_name) return -ENODEV; ret = usb_gadget_unregister_driver(&gi->composite.gadget_driver); if (ret) return ret; - kfree(gi->udc_name); - gi->udc_name = NULL; + kfree(gi->composite.gadget_driver.udc_name); + gi->composite.gadget_driver.udc_name = NULL; return 0; } @@ -271,14 +270,16 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item, if (ret) goto err; } else { - if (gi->udc_name) { + if (gi->composite.gadget_driver.udc_name) { ret = -EBUSY; goto err; } - ret = usb_udc_attach_driver(name, &gi->composite.gadget_driver); - if (ret) + gi->composite.gadget_driver.udc_name = name; + ret = usb_gadget_probe_driver(&gi->composite.gadget_driver); + if (ret) { + gi->composite.gadget_driver.udc_name = NULL; goto err; - gi->udc_name = name; + } } mutex_unlock(&gi->lock); return len; @@ -427,9 +428,9 @@ static int config_usb_cfg_unlink( * remove the function. */ mutex_lock(&gi->lock); - if (gi->udc_name) + if (gi->composite.gadget_driver.udc_name) unregister_gadget(gi); - WARN_ON(gi->udc_name); + WARN_ON(gi->composite.gadget_driver.udc_name); list_for_each_entry(f, &cfg->func_list, list) { if (f->fi == fi) { @@ -873,10 +874,10 @@ static int os_desc_unlink(struct config_item *os_desc_ci, struct usb_composite_dev *cdev = &gi->cdev; mutex_lock(&gi->lock); - if (gi->udc_name) + if (gi->composite.gadget_driver.udc_name) unregister_gadget(gi); cdev->os_desc_config = NULL; - WARN_ON(gi->udc_name); + WARN_ON(gi->composite.gadget_driver.udc_name); mutex_unlock(&gi->lock); return 0; } -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 0/4] usb/gadget: independent registration of gadgets and gadget drivers
Hello, This is a resurrection of the patches initially submitted by Ruslan Bilovol in the following thread: https://lkml.org/lkml/2015/6/22/554 The changes since the original submission (v5) includes rebase onto latest linux-next branch, simplification of the code requested by Alan Stern and Felipe Balbi and removal of a patch, which deleted __init/__exit attributes (this change has been already merged). This feature is urgently needed, because it is not longer possible to use workaround to avoid deferred probe in UDC drivers due to not-yet-probed i2c regulator drivers (for more information see https://lkml.org/lkml/2015/10/30/374 ). This patchset has been successfully tested on Odroid XU3 boards with DWC3 UDC driver being deferred by missing regulator drivers. Best regards Marek Szyprowski Samsung R&D Institute Poland Patch summary: Ruslan Bilovol (4): usb: gadget: bind UDC by name passed via usb_gadget_driver structure usb: gadget: configfs: pass UDC name via usb_gadget_driver struct usb: gadget: udc-core: remove unused usb_udc_attach_driver() usb: gadget: udc-core: independent registration of gadgets and gadget drivers drivers/usb/gadget/configfs.c | 27 ++--- drivers/usb/gadget/udc/udc-core.c | 81 +++ include/linux/usb/gadget.h| 8 +++- 3 files changed, 68 insertions(+), 48 deletions(-) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 3/4] usb: gadget: udc-core: remove unused usb_udc_attach_driver()
From: Ruslan Bilovol Now when last user of usb_udc_attach_driver() is switched to passing UDC name via usb_gadget_driver struct, it's safe to remove this function Tested-by: Maxime Ripard Signed-off-by: Ruslan Bilovol Signed-off-by: Marek Szyprowski --- drivers/usb/gadget/udc/udc-core.c | 26 -- include/linux/usb/gadget.h| 2 -- 2 files changed, 28 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 429d64e..f76ebc8 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -520,32 +520,6 @@ err1: return ret; } -int usb_udc_attach_driver(const char *name, struct usb_gadget_driver *driver) -{ - struct usb_udc *udc = NULL; - int ret = -ENODEV; - - mutex_lock(&udc_lock); - list_for_each_entry(udc, &udc_list, list) { - ret = strcmp(name, dev_name(&udc->dev)); - if (!ret) - break; - } - if (ret) { - ret = -ENODEV; - goto out; - } - if (udc->driver) { - ret = -EBUSY; - goto out; - } - ret = udc_bind_to_driver(udc, driver); -out: - mutex_unlock(&udc_lock); - return ret; -} -EXPORT_SYMBOL_GPL(usb_udc_attach_driver); - int usb_gadget_probe_driver(struct usb_gadget_driver *driver) { struct usb_udc *udc = NULL; diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index b32e44f..e11f5a2 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -1121,8 +1121,6 @@ extern int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, void (*release)(struct device *dev)); extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); extern void usb_del_gadget_udc(struct usb_gadget *gadget); -extern int usb_udc_attach_driver(const char *name, - struct usb_gadget_driver *driver); /*-*/ -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 1/4] usb: gadget: bind UDC by name passed via usb_gadget_driver structure
From: Ruslan Bilovol Introduce new 'udc_name' member to usb_gadget_driver structure. The 'udc_name' is a name of UDC that usb_gadget_driver should be bound to. If udc_name is NULL, it will be bound to any available UDC. Tested-by: Maxime Ripard Signed-off-by: Ruslan Bilovol Signed-off-by: Marek Szyprowski --- drivers/usb/gadget/udc/udc-core.c | 24 +++- include/linux/usb/gadget.h| 4 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index f660afb..429d64e 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -549,21 +549,35 @@ EXPORT_SYMBOL_GPL(usb_udc_attach_driver); int usb_gadget_probe_driver(struct usb_gadget_driver *driver) { struct usb_udc *udc = NULL; - int ret; + int ret = -ENODEV; if (!driver || !driver->bind || !driver->setup) return -EINVAL; mutex_lock(&udc_lock); - list_for_each_entry(udc, &udc_list, list) { - /* For now we take the first one */ - if (!udc->driver) + if (driver->udc_name) { + list_for_each_entry(udc, &udc_list, list) { + ret = strcmp(driver->udc_name, dev_name(&udc->dev)); + if (!ret) + break; + } + if (ret) + ret = -ENODEV; + else if (udc->driver) + ret = -EBUSY; + else goto found; + } else { + list_for_each_entry(udc, &udc_list, list) { + /* For now we take the first one */ + if (!udc->driver) + goto found; + } } pr_debug("couldn't find an available UDC\n"); mutex_unlock(&udc_lock); - return -ENODEV; + return ret; found: ret = udc_bind_to_driver(udc, driver); mutex_unlock(&udc_lock); diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 3d583a1..b32e44f 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -1012,6 +1012,8 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget) * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers * and should be called in_interrupt. * @driver: Driver model state for this driver. + * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL, + * this driver will be bound to any available UDC. * * Devices are disabled till a gadget driver successfully bind()s, which * means the driver will handle setup() requests needed to enumerate (and @@ -1072,6 +1074,8 @@ struct usb_gadget_driver { /* FIXME support safe rmmod */ struct device_driverdriver; + + char*udc_name; }; -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 4/4] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
From: Ruslan Bilovol Change behavior during registration of gadgets and gadget drivers in udc-core. Instead of previous approach when for successful probe of usb gadget driver at least one usb gadget should be already registered use another one where gadget drivers and gadgets can be registered in udc-core independently. Independent registration of gadgets and gadget drivers is useful for built-in into kernel gadget and gadget driver case - because it's possible that gadget is really probed only on late_init stage (due to deferred probe) whereas gadget driver's probe is silently failed on module_init stage due to no any UDC added. Also it is useful for modules case - now there is no difference what module to insert first: gadget module or gadget driver one. Tested-by: Maxime Ripard Signed-off-by: Ruslan Bilovol [simplified code as requested by Alan Stern and Felipe Balbi] Signed-off-by: Marek Szyprowski --- drivers/usb/gadget/udc/udc-core.c | 43 +++ include/linux/usb/gadget.h| 2 ++ 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index f76ebc8..461b311 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -51,8 +51,12 @@ struct usb_udc { static struct class *udc_class; static LIST_HEAD(udc_list); +static LIST_HEAD(gadget_driver_pending_list); static DEFINE_MUTEX(udc_lock); +static int udc_bind_to_driver(struct usb_udc *udc, + struct usb_gadget_driver *driver); + /* - */ #ifdef CONFIG_HAS_DMA @@ -356,6 +360,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, void (*release)(struct device *dev)) { struct usb_udc *udc; + struct usb_gadget_driver *driver; int ret = -ENOMEM; udc = kzalloc(sizeof(*udc), GFP_KERNEL); @@ -403,6 +408,18 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, usb_gadget_set_state(gadget, USB_STATE_NOTATTACHED); udc->vbus = true; + /* pick up one of pending gadget drivers */ + list_for_each_entry(driver, &gadget_driver_pending_list, pending) { + if (!driver->udc_name || strcmp(driver->udc_name, + dev_name(&udc->dev)) == 0) { + ret = udc_bind_to_driver(udc, driver); + if (ret) + goto err4; + list_del(&driver->pending); + break; + } + } + mutex_unlock(&udc_lock); return 0; @@ -475,9 +492,16 @@ void usb_del_gadget_udc(struct usb_gadget *gadget) list_del(&udc->list); mutex_unlock(&udc_lock); - if (udc->driver) + if (udc->driver) { + struct usb_gadget_driver *driver = udc->driver; + usb_gadget_remove_driver(udc); + mutex_lock(&udc_lock); + list_add(&driver->pending, &gadget_driver_pending_list); + mutex_unlock(&udc_lock); + } + kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE); flush_work(&gadget->work); device_unregister(&udc->dev); @@ -535,11 +559,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) if (!ret) break; } - if (ret) - ret = -ENODEV; - else if (udc->driver) - ret = -EBUSY; - else + if (!ret && !udc->driver) goto found; } else { list_for_each_entry(udc, &udc_list, list) { @@ -549,9 +569,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) } } - pr_debug("couldn't find an available UDC\n"); + list_add_tail(&driver->pending, &gadget_driver_pending_list); + pr_info("udc-core: couldn't find an available UDC " + "- added [%s] to list of pending drivers\n", + driver->function); mutex_unlock(&udc_lock); - return ret; + return 0; found: ret = udc_bind_to_driver(udc, driver); mutex_unlock(&udc_lock); @@ -577,6 +600,10 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) break; } + if (ret) { + list_del(&driver->pending); + ret = 0; + } mutex_unlock(&udc_lock); return ret; } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e11f5a2..a3436bf 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -1014,6 +1014,7 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget) *
Re: Udoo support for chipidea
Am Freitag, den 20.11.2015, 16:05 +0800 schrieb Peter Chen: > On Thu, Nov 19, 2015 at 11:26:50AM -0500, Alan Stern wrote: > > On Thu, 19 Nov 2015, Philipp Zabel wrote: > > > > > On Wed, Oct 21, 2015 at 10:39:00AM +0800, Peter Chen wrote: > > > > On Tue, Oct 20, 2015 at 02:09:38PM -0200, Fabio Estevam wrote: > > > > > Hi Peter, > > > > > > > > > > On Mon, Oct 19, 2015 at 12:50 AM, Peter Chen > > > > > wrote: > > > > > > > > > > > Add linux-usb. > > > > > > > > > > > > Patryk, your problem is you may need to open 24M OSC for HUB 2514 > > > > > > manually, and you have used IMX6QDL_CLK_CKO for it in the design, > > > > > > but this clock is not controller's clock, controller's clock has > > > > > > already decided at SoC dts file (imx6qdl.dtsi), you don't need to > > > > > > override it at board's dts file. > > > > > > > > > > > > You can try delete clock property at imx6qdl-udoo.dtsi, if it still > > > > > > can't work, try to open IMX6QDL_CLK_CKO at one place to test. > > > > > > > > > > What is the appropriate place to acquire and enable the USB hub clock? > > > > > > > > > > This issue has appeared several times and it seems we don't have a > > > > > solution for this yet. > > > > > > > > > > Any suggestions? > > > > > > > > Add Alan. > > > > > > > > Hi Alan, we have several designs that the on-board HUB need to > > > > be reset by gpio pin and its clock is also from the board or > > > > the SoC. Any suggestions how to add these platform information > > > > for HUB device? > > > > > > How about putting it in the device tree? > > > http://www.firmware.org/1275/bindings/usb/usb-1_0.ps > > > clocks and reset-gpios properties could be added to the USB hub node. > > > > Something like this is necessary. Instead of making the hub driver > > take care of the reset gpio and the clock, I suggest you make the host > > controller's platform driver do these things. > > > > This is because USB hubs are generic devices, not specific to any > > platform and (usually) hot-pluggable. Associating platform-specific > > data with a hub is out of the ordinary, and it deserves to be handled > > by platform-specific code -- there is no such code in the hub driver. > > > If this on-board HUB is special, its reset pin needs to be toggled > after power on, no matter for Intel or ARM platforms, how we handle > it? It is not feasible we add this for all platform drivers. Further whether the GPIO reset line is initially in asserted state and just needs to change to deasserted, or whether the GPIO reset line is initially in deasserted state and needs to be pulsed for a certain time is probably hub IC specific. regards Philipp -- 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/4] usb: dwc3: qcom: Configure TCSR phy mux register
This patch adds automatic configuration of the TCSR phy mux register based on the syscon-tcsr devicetree entry. This configuration is optional, as some platforms may not require the mux selection. Signed-off-by: Andy Gross --- drivers/usb/dwc3/dwc3-qcom.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 0880260..fcf264c 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include struct dwc3_qcom { struct device *dev; @@ -30,6 +32,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; struct dwc3_qcom *qdwc; + struct regmap *regmap; + u32 mux_offset; + u32 mux_bit; int ret; qdwc = devm_kzalloc(&pdev->dev, sizeof(*qdwc), GFP_KERNEL); @@ -58,6 +63,26 @@ static int dwc3_qcom_probe(struct platform_device *pdev) qdwc->sleep_clk = NULL; } + /* look for tcsr and if present, provision it */ + regmap = syscon_regmap_lookup_by_phandle(node, "syscon-tcsr"); + if (!IS_ERR(regmap)) { + if (of_property_read_u32_index(node, "syscon-tcsr", 1, + &mux_offset)) { + dev_err(qdwc->dev, "missing USB TCSR mux offset\n"); + return -EINVAL; + } + if (of_property_read_u32_index(node, "syscon-tcsr", 2, + &mux_bit)) { + dev_err(qdwc->dev, "missing USB TCSR mux bit\n"); + return -EINVAL; + } + + regmap_update_bits(regmap, mux_offset, BIT(mux_bit), + BIT(mux_bit)); + } else { + dev_info(qdwc->dev, "missing syscon tcsr entry\n"); + } + ret = clk_prepare_enable(qdwc->core_clk); if (ret) { dev_err(qdwc->dev, "failed to enable core clock\n"); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- 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/4] ARM: dts: qcom: Add DWC3 USB support on IPQ8064
This patch adds Qualcomm DWC3 USB nodes to device tree to enable support for the DWC3 controller found on IPQ8064/AP148 platforms. Signed-off-by: Andy Gross --- arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 24 + arch/arm/boot/dts/qcom-ipq8064.dtsi | 89 2 files changed, 113 insertions(+) diff --git a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts index d501382..bf1638c 100644 --- a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts +++ b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts @@ -97,5 +97,29 @@ sata@2900 { status = "ok"; }; + + phy@100f8800 { + status = "ok"; + }; + + phy@100f8830 { + status = "ok"; + }; + + usb30@0 { + status = "ok"; + }; + + phy@110f8800 { + status = "ok"; + }; + + phy@110f8830 { + status = "ok"; + }; + + usb30@1 { + status = "ok"; + }; }; }; diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi index fa69863..b2dcd9d 100644 --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi @@ -329,5 +329,94 @@ #reset-cells = <1>; }; + hs_phy_0: phy@100f8800 { + compatible = "qcom,dwc3-hs-usb-phy"; + reg = <0x100f8800 0x30>; + clocks = <&gcc USB30_0_UTMI_CLK>; + clock-names = "ref"; + + #phy-cells = <0>; + status = "disabled"; + }; + + ss_phy_0: phy@100f8830 { + compatible = "qcom,dwc3-ss-usb-phy"; + reg = <0x100f8830 0x30>; + + clocks = <&gcc USB30_0_MASTER_CLK>; + clock-names = "ref"; + + #phy-cells = <0>; + status = "disabled"; + }; + + usb30@0 { + compatible = "qcom,dwc3"; + #address-cells = <1>; + #size-cells = <1>; + clocks = <&gcc USB30_0_MASTER_CLK>; + clock-names = "core"; + + syscon-tcsr = <&tcsr 0xb0 1>; + + ranges; + + status = "disabled"; + + dwc3@1000 { + compatible = "snps,dwc3"; + reg = <0x1000 0xcd00>; + interrupts = <0 205 0x4>; + phys = <&hs_phy_0>, <&ss_phy_0>; + phy-names = "usb2-phy", "usb3-phy"; + tx-fifo-resize; + dr_mode = "host"; + }; + }; + + hs_phy_1: phy@110f8800 { + compatible = "qcom,dwc3-hs-usb-phy"; + reg = <0x110f8800 0x30>; + clocks = <&gcc USB30_1_UTMI_CLK>; + clock-names = "ref"; + + #phy-cells = <0>; + status = "disabled"; + }; + + ss_phy_1: phy@110f8830 { + compatible = "qcom,dwc3-ss-usb-phy"; + reg = <0x110f8830 0x30>; + + clocks = <&gcc USB30_1_MASTER_CLK>; + clock-names = "ref"; + + #phy-cells = <0>; + status = "disabled"; + }; + + usb30@1 { + compatible = "qcom,dwc3"; + #address-cells = <1>; + #size-cells = <1>; + clocks = <&gcc USB30_1_MASTER_CLK>; + clock-names = "core"; + + syscon-tcsr = <&tcsr 0xb0 0>; + + ranges; + + status = "disabled"; + + dwc3@1100 { + compatible = "snps,dwc3"; + reg = <0x1100 0xcd00>; + interrupts = <0 110 0x4>; + phys = <&hs_phy_1>, <&ss_phy_1>; + phy-names = "usb2-phy", "usb3-phy"; + tx-fifo-resize; + dr_mode = "host"; + }; + }; }; }; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message
[PATCH 0/4] Add QCOM DWC3 Phy support
This set of patches adds support for the QCOM DWC3 phys found on various Qualcomm platforms. The PHY portion of this set was originally part of: https://lkml.org/lkml/2014/9/12/597 The applicable review comments were fixed and additional changes were made to accomodate the TCSR phy mux selection required to get working ports. Andy Gross (4): phy: Add Qualcomm DWC3 HS/SS PHY driver usb: dwc3: qcom: Configure TCSR phy mux register ARM: dts: qcom: Add DWC3 USB support on IPQ8064 Documentation: usb: dwc3: qcom: Add TCSR mux usage .../devicetree/bindings/usb/qcom,dwc3.txt | 11 + arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 24 + arch/arm/boot/dts/qcom-ipq8064.dtsi| 89 drivers/phy/Kconfig| 11 + drivers/phy/Makefile | 1 + drivers/phy/phy-qcom-dwc3.c| 483 + drivers/usb/dwc3/dwc3-qcom.c | 25 ++ 7 files changed, 644 insertions(+) create mode 100644 drivers/phy/phy-qcom-dwc3.c -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- 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/4] phy: Add Qualcomm DWC3 HS/SS PHY driver
This patch adds a new driver for the Qualcomm USB 3.0 PHY that exists on some Qualcomm platforms. This driver uses the generic PHY framework and will interact with the DWC3 controller. Signed-off-by: Andy Gross --- drivers/phy/Kconfig | 11 + drivers/phy/Makefile| 1 + drivers/phy/phy-qcom-dwc3.c | 483 3 files changed, 495 insertions(+) create mode 100644 drivers/phy/phy-qcom-dwc3.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 7eb5859d..f26bfc9 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -305,6 +305,17 @@ config PHY_QCOM_APQ8064_SATA depends on OF select GENERIC_PHY +config PHY_QCOM_DWC3 + tristate "Qualcomm DWC3 USB PHY support" + depends on ARCH_QCOM + depends on HAS_IOMEM + depends on OF + select GENERIC_PHY + help + This option enables support for the Synopsis PHYs present inside the + Qualcomm USB3.0 DWC3 controller. This driver supports both HS and SS + PHY controllers. + config PHY_QCOM_IPQ806X_SATA tristate "Qualcomm IPQ806x SATA SerDes/PHY driver" depends on ARCH_QCOM diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 075db1a..0610e0d 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -48,3 +48,4 @@ obj-$(CONFIG_PHY_TUSB1210)+= phy-tusb1210.o obj-$(CONFIG_PHY_BRCMSTB_SATA) += phy-brcmstb-sata.o obj-$(CONFIG_PHY_PISTACHIO_USB)+= phy-pistachio-usb.o obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o +obj-$(CONFIG_PHY_QCOM_DWC3)+= phy-qcom-dwc3.o diff --git a/drivers/phy/phy-qcom-dwc3.c b/drivers/phy/phy-qcom-dwc3.c new file mode 100644 index 000..9398f6b --- /dev/null +++ b/drivers/phy/phy-qcom-dwc3.c @@ -0,0 +1,483 @@ +/* Copyright (c) 2014-2015, Code Aurora Forum. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * USB QSCRATCH Hardware registers + */ +#define QSCRATCH_GENERAL_CFG (0x08) +#define HSUSB_PHY_CTRL_REG (0x10) + +/* PHY_CTRL_REG */ +#define HSUSB_CTRL_DMSEHV_CLAMPBIT(24) +#define HSUSB_CTRL_USB2_SUSPENDBIT(23) +#define HSUSB_CTRL_UTMI_CLK_EN BIT(21) +#define HSUSB_CTRL_UTMI_OTG_VBUS_VALID BIT(20) +#define HSUSB_CTRL_USE_CLKCORE BIT(18) +#define HSUSB_CTRL_DPSEHV_CLAMPBIT(17) +#define HSUSB_CTRL_COMMONONN BIT(11) +#define HSUSB_CTRL_ID_HV_CLAMP BIT(9) +#define HSUSB_CTRL_OTGSESSVLD_CLAMPBIT(8) +#define HSUSB_CTRL_CLAMP_ENBIT(7) +#define HSUSB_CTRL_RETENABLEN BIT(1) +#define HSUSB_CTRL_POR BIT(0) + +/* QSCRATCH_GENERAL_CFG */ +#define HSUSB_GCFG_XHCI_REVBIT(2) + +/** + * USB QSCRATCH Hardware registers + */ +#define SSUSB_PHY_CTRL_REG (0x00) +#define SSUSB_PHY_PARAM_CTRL_1 (0x04) +#define SSUSB_PHY_PARAM_CTRL_2 (0x08) +#define CR_PROTOCOL_DATA_IN_REG(0x0c) +#define CR_PROTOCOL_DATA_OUT_REG (0x10) +#define CR_PROTOCOL_CAP_ADDR_REG (0x14) +#define CR_PROTOCOL_CAP_DATA_REG (0x18) +#define CR_PROTOCOL_READ_REG (0x1c) +#define CR_PROTOCOL_WRITE_REG (0x20) + +/* PHY_CTRL_REG */ +#define SSUSB_CTRL_REF_USE_PAD BIT(28) +#define SSUSB_CTRL_TEST_POWERDOWN BIT(27) +#define SSUSB_CTRL_LANE0_PWR_PRESENT BIT(24) +#define SSUSB_CTRL_SS_PHY_EN BIT(8) +#define SSUSB_CTRL_SS_PHY_RESETBIT(7) + +/* SSPHY control registers */ +#define SSPHY_CTRL_RX_OVRD_IN_HI(lane) (0x1006 + 0x100 * lane) +#define SSPHY_CTRL_TX_OVRD_DRV_LO(lane)(0x1002 + 0x100 * lane) + +/* RX OVRD IN HI bits */ +#define RX_OVRD_IN_HI_RX_RESET_OVRDBIT(13) +#define RX_OVRD_IN_HI_RX_RX_RESET BIT(12) +#define RX_OVRD_IN_HI_RX_EQ_OVRD BIT(11) +#define RX_OVRD_IN_HI_RX_EQ_MASK 0x0700 +#define RX_OVRD_IN_HI_RX_EQ_SHIFT 8 +#define RX_OVRD_IN_HI_RX_EQ_EN_OVRDBIT(7) +#define RX_OVRD_IN_HI_RX_EQ_EN BIT(6) +#define RX_OVRD_IN_HI_RX_LOS_FILTER_OVRD BIT(5) +#define RX_OVRD_IN_HI_RX_LOS_FILTER_MASK 0x0018 +#define RX_OVRD_IN_HI_RX_RATE_OVRD BIT(2) +#define RX_OVRD_IN_HI_RX_RATE_MASK 0x0003 + +/* TX OVRD DRV LO register bits */ +#d
[PATCH 4/4] Documentation: usb: dwc3: qcom: Add TCSR mux usage
This patch adds documentation for the optional syscon-tcsr property in the Qualcomm DWC3 node. The syscon-tcsr specifies the register and bit used to configure the TCSR USB phy mux register. Signed-off-by: Andy Gross --- Documentation/devicetree/bindings/usb/qcom,dwc3.txt | 11 +++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt index ca164e7..dfa222d 100644 --- a/Documentation/devicetree/bindings/usb/qcom,dwc3.txt +++ b/Documentation/devicetree/bindings/usb/qcom,dwc3.txt @@ -8,6 +8,10 @@ Required properties: "core" Master/Core clock, have to be >= 125 MHz for SS operation and >= 60MHz for HS operation +Optional properties: +- syscon-tcsr Specifies TCSR handle, register offset, and bit position for + configuring the phy mux setting. + Optional clocks: "iface" System bus AXI clock. Not present on all platforms "sleep" Sleep clock, used when USB3 core goes into low @@ -22,6 +26,11 @@ Documentation/devicetree/bindings/phy/qcom,dwc3-usb-phy.txt Example device nodes: + tcsr: syscon@1a40 { + compatible = "qcom,tcsr-ipq8064", "syscon"; + reg = <0x1a40 0x100>; + }; + hs_phy: phy@100f8800 { compatible = "qcom,dwc3-hs-usb-phy"; reg = <0x100f8800 0x30>; @@ -51,6 +60,8 @@ Example device nodes: ranges; + syscon-tcsr = <&tcsr 0xb0 0x1>; + status = "ok"; dwc3@1000 { -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- 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