[PATCH 0/3] ARM: at91: at91sam9n12ek: enable usb gadget support
This patch series enable the usb gadget support on at91sam9n12ek board. On at91sam9n12 SoC which integrate the full speed udc device. Bo Shen (3): USB: gadget: at91_udc: add at91sam9n12 support ARM: at91: dt: at91sam9n12: add udp device node ARM: at91: dt: at91sam9n12ek: enable udp arch/arm/boot/dts/at91sam9n12.dtsi | 9 + arch/arm/boot/dts/at91sam9n12ek.dts | 5 + drivers/usb/gadget/udc/at91_udc.c | 9 ++--- 3 files changed, 20 insertions(+), 3 deletions(-) -- 2.3.0.rc0 -- 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/3] ARM: at91: dt: at91sam9n12ek: enable udp
Enable usb device port on at91sam9n12ek board. Signed-off-by: Bo Shen voice.s...@atmel.com --- arch/arm/boot/dts/at91sam9n12ek.dts | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts index 13bb24e..3e572e5 100644 --- a/arch/arm/boot/dts/at91sam9n12ek.dts +++ b/arch/arm/boot/dts/at91sam9n12ek.dts @@ -120,6 +120,11 @@ }; }; + usb1: gadget@f803c000 { + atmel,vbus-gpio = pioB 16 GPIO_ACTIVE_HIGH; + status = okay; + }; + watchdog@fe40 { status = okay; }; -- 2.3.0.rc0 -- 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/3] ARM: at91: dt: at91sam9n12: add udp device node
Add usb device node for at91sam9n12. Signed-off-by: Bo Shen voice.s...@atmel.com --- arch/arm/boot/dts/at91sam9n12.dtsi | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 68eb9ad..6120e03 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi @@ -901,6 +901,15 @@ clocks = pwm_clk; status = disabled; }; + + usb1: gadget@f803c000 { + compatible = atmel,at91rm9200-udc; + reg = 0xf803c000 0x4000; + interrupts = 23 IRQ_TYPE_LEVEL_HIGH 2; + clocks = usb, udphs_clk, udpck; + clock-names = usb_clk, udc_clk, udpck; + status = disabled; + }; }; nand0: nand@4000 { -- 2.3.0.rc0 -- 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/3] USB: gadget: at91_udc: add at91sam9n12 support
Add at91sam9n12 SoC support. Signed-off-by: Bo Shen voice.s...@atmel.com --- drivers/usb/gadget/udc/at91_udc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index c862656..f4c785f 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -931,7 +931,8 @@ static void pullup(struct at91_udc *udc, int is_on) at91_udp_write(udc, AT91_UDP_TXVC, 0); if (cpu_is_at91rm9200()) gpio_set_value(udc-board.pullup_pin, active); - else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { + else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || +cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) { u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); txvc |= AT91_UDP_TXVC_PUON; @@ -949,7 +950,8 @@ static void pullup(struct at91_udc *udc, int is_on) at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); if (cpu_is_at91rm9200()) gpio_set_value(udc-board.pullup_pin, !active); - else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { + else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || +cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) { u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); txvc = ~AT91_UDP_TXVC_PUON; @@ -1758,7 +1760,8 @@ static int at91udc_probe(struct platform_device *pdev) } /* newer chips have more FIFO memory than rm9200 */ - if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) { + if (cpu_is_at91sam9260() || cpu_is_at91sam9g20() || + cpu_is_at91sam9n12()) { udc-ep[0].maxpacket = 64; udc-ep[3].maxpacket = 64; udc-ep[4].maxpacket = 512; -- 2.3.0.rc0 -- 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: isp1760: use msecs_to_jiffies for time conversion
Hi Nicholas, Thank you for the patch. On Friday 06 February 2015 05:08:53 Nicholas Mc Guire wrote: This is only an API consolidation and should make things more readable it replaces var * HZ / 1000 by msecs_to_jiffies(var). Signed-off-by: Nicholas Mc Guire hof...@osadl.org Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- Patch was only compile tested with x86_64_defconfig + CONFIG_USB_ISP1760=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/usb/isp1760/isp1760-hcd.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index eba9b82..3cb98b1 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1274,7 +1274,7 @@ static void errata2_function(unsigned long data) for (slot = 0; slot 32; slot++) if (priv-atl_slots[slot].qh time_after(jiffies, priv-atl_slots[slot].timestamp + - SLOT_TIMEOUT * HZ / 1000)) { + msecs_to_jiffies(SLOT_TIMEOUT))) { ptd_read(hcd-regs, ATL_PTD_OFFSET, slot, ptd); if (!FROM_DW0_VALID(ptd.dw0) !FROM_DW3_ACTIVE(ptd.dw3)) @@ -1286,7 +1286,7 @@ static void errata2_function(unsigned long data) spin_unlock_irqrestore(priv-lock, spinflags); - errata2_timer.expires = jiffies + SLOT_CHECK_PERIOD * HZ / 1000; + errata2_timer.expires = jiffies + msecs_to_jiffies(SLOT_CHECK_PERIOD); add_timer(errata2_timer); } @@ -1336,7 +1336,7 @@ static int isp1760_run(struct usb_hcd *hcd) return retval; setup_timer(errata2_timer, errata2_function, (unsigned long)hcd); - errata2_timer.expires = jiffies + SLOT_CHECK_PERIOD * HZ / 1000; + errata2_timer.expires = jiffies + msecs_to_jiffies(SLOT_CHECK_PERIOD); add_timer(errata2_timer); chipid = reg_read32(hcd-regs, HC_CHIP_ID_REG); -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
On Sun, Feb 08, 2015 at 09:04:32PM +0200, Ruslan Bilovol wrote: Hi Alan, On Thu, Jan 29, 2015 at 5:56 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 29 Jan 2015, Ruslan Bilovol wrote: 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. It's possible to do all this much more simply. In fact, I posted a patch some time ago to do exactly this (but I can't find a copy of it anywhere). Unfortunately I didn't find your patch. Signed-off-by: Ruslan Bilovol ruslan.bilo...@gmail.com --- drivers/usb/gadget/udc/udc-core.c | 113 +++--- 1 file changed, 105 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index e31d574..4c9412b 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -43,13 +43,23 @@ struct usb_udc { struct usb_gadget_driver*driver; struct usb_gadget *gadget; struct device dev; + boolbind_by_name; + struct list_headlist; +}; + +struct pending_gadget_driver { + struct usb_gadget_driver*driver; + char*udc_name; struct list_headlist; }; You don't need all this stuff. What's the point of keeping track of names? If there are any unbound gadget drivers pending, a newly registered UDC should bind to the first one available. It's because gadget driver may be bound to usb_gadget in two ways: - standard way - in this case any available udc will be picked up - by name of udc, in this case only matching udc will be picked up Main feature of my path is not only deferred binding of gadget driver, but also possibility to register/unregister udc at any time. This is useful for user who can load, for example, udc module if needed and unload it safely, not touching gadget driver. Another example is USB device controllers that consist of pair of HS+SS controllers, each one having its own udc driver. In this case it's possible to switch SS/HS by registering/unregistering corresponding udc and not touching gadget driver. I did all of this inside of udc-core because it looks like to be best place for udc - gadget driver housekeeping. Also it is verified on lot of combinations of udc and gadget drivers that can be built-in or build as modules In fact, both I and Robert Baldyga posted patches to try fix this problem. http://marc.info/?l=linux-usbm=139287784610046w=2 http://lwn.net/Articles/601839/ I tried to use Robert's solution (fix some bugs) in internal tree, but the mass storage gadget still has problems to work if unload udc first. The possible reason should be: it has two places to call usb_composite_unregister. -- 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 3/3] ARM: at91: dt: at91sam9n12ek: enable udp
Hello Bo, On Mon, Feb 09, 2015 at 05:02:52PM +0800, Bo Shen wrote: Enable usb device port on at91sam9n12ek board. Signed-off-by: Bo Shen voice.s...@atmel.com --- arch/arm/boot/dts/at91sam9n12ek.dts | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts index 13bb24e..3e572e5 100644 --- a/arch/arm/boot/dts/at91sam9n12ek.dts +++ b/arch/arm/boot/dts/at91sam9n12ek.dts @@ -120,6 +120,11 @@ }; }; + usb1: gadget@f803c000 { + atmel,vbus-gpio = pioB 16 GPIO_ACTIVE_HIGH; + status = okay; + }; + There is an external resistor divider on PB16, acting like a pull-down (R22+R23). PB16 reset state is input, pull-up, schmitt trigger, you need to disable the pull-up in pinctrl this way: usb1: gadget@f803c000 { pinctrl-names = default; pinctrl-0 = pinctrl_board_usb1; … } pinctrl … { usb1 { pinctrl_board_usb1: usb1-board { atmel,pins = AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH;/* PB16, no pull up and deglitch */ }; }; }; Sylvain -- 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: support for more than 8 LUNs
On Mon, 9 Feb 2015, Oliver Neukum wrote: This is necessary to make some storage arrays work. Some storage devices have more than 8 LUNs. In addition you can hook up a WideSCSI bus to USB. In these cases even level 2 devices can have more than 8 devices. For them it is necessary to simply believe the class specific command and report its result back to the SCSI layer. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/storage/usb.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index d468d02..cf2fafb 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct *work) !(us-fflags US_FL_SCM_MULT_TARG)) { mutex_lock(us-dev_mutex); us-max_lun = usb_stor_Bulk_max_lun(us); + /* + * Allow proper scanning of devices that present more than 8 LUNs + * While not affecting other devices that may need the previous behavior + */ + if (us-max_lun 8) = 8, not 8. Or, if you prefer, 7. + us_to_host(us)-max_lun = us-max_lun+1; What about the fact that you may be overriding max_scsi_luns? Also, since the protocol allows only 4 bits for the LUN value, would it be safer to use min(us-max_lun+1, 16)? 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: intensive IO on usb-storage device causing system lock
Hello guys. Now that 3.19 is out there - I would like to know if I can domething more to help improve the situation regarding this bug - send some more info. I might eventually try to debug the problem differently but I will need some more spare time to do so. Thank you for all the help and attention, Enrico -- 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: support for more than 8 LUNs
On Mon, 2015-02-09 at 11:10 -0500, Alan Stern wrote: On Mon, 9 Feb 2015, Oliver Neukum wrote: This is necessary to make some storage arrays work. Some storage devices have more than 8 LUNs. In addition you can hook up a WideSCSI bus to USB. In these cases even level 2 devices can have more than 8 devices. For them it is necessary to simply believe the class specific command and report its result back to the SCSI layer. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/storage/usb.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index d468d02..cf2fafb 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct *work) !(us-fflags US_FL_SCM_MULT_TARG)) { mutex_lock(us-dev_mutex); us-max_lun = usb_stor_Bulk_max_lun(us); + /* +* Allow proper scanning of devices that present more than 8 LUNs +* While not affecting other devices that may need the previous behavior +*/ + if (us-max_lun 8) = 8, not 8. Or, if you prefer, 7. + us_to_host(us)-max_lun = us-max_lun+1; What about the fact that you may be overriding max_scsi_luns? As far as I can tell scsi_sequential_lun_scan() will prevent that by max_dev_lun = min(max_scsi_luns, shost-max_lun); Also, since the protocol allows only 4 bits for the LUN value, would it be safer to use min(us-max_lun+1, 16)? usb_stor_Bulk_max_lun() will always return a number between 0 and 15 Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/4] usb: phy: add phy-hi6220-usb
On 9 February 2015 at 22:26, zhangfei zhangfei@linaro.org wrote: On 02/09/2015 10:11 AM, Peter Chen wrote: +static void hi6220_detect_work(struct work_struct *work) +{ + struct hi6220_priv *priv = + container_of(work, struct hi6220_priv, work.work); + int gpio_id, gpio_vubs; %s/gpio_vubs/gpio_vbus Yes, typo +static void hi6220_phy_setup(struct hi6220_priv *priv, bool on) +{ + struct regmap *reg = priv-reg; + u32 val, mask; + int ret; + + if (priv-reg == NULL) + return; + + if (on) { + val = RST0_USBOTG_BUS | RST0_POR_PICOPHY | + RST0_USBOTG | RST0_USBOTG_32K; + mask = val; + ret = regmap_update_bits(reg, SC_PERIPH_RSTDIS0, mask, val); + if (ret) + return; + + ret = regmap_read(reg, SC_PERIPH_CTRL5, val); + val = CTRL5_USBOTG_RES_SEL | CTRL5_PICOPHY_ACAENB; + mask = val | CTRL5_PICOPHY_BC_MODE; + ret = regmap_update_bits(reg, SC_PERIPH_CTRL5, mask, val); + if (ret) + return; + + val = CTRL4_PICO_VBUSVLDEXT | CTRL4_PICO_VBUSVLDEXTSEL | + CTRL4_OTG_PHY_SEL; + mask = val | CTRL4_PICO_SIDDQ | CTRL4_PICO_OGDISABLE; + ret = regmap_update_bits(reg, SC_PERIPH_CTRL4, mask, val); + if (ret) + return; + + ret = regmap_write(reg, SC_PERIPH_CTRL8, EYE_PATTERN_PARA); + if (ret) + return; + } else { + val = CTRL4_PICO_SIDDQ; + mask = val; + ret = regmap_update_bits(reg, SC_PERIPH_CTRL4, mask, val); + if (ret) + return; + + ret = regmap_read(reg, SC_PERIPH_CTRL4, val); + + val = RST0_USBOTG_BUS | RST0_POR_PICOPHY | + RST0_USBOTG | RST0_USBOTG_32K; + mask = val; + ret = regmap_update_bits(reg, SC_PERIPH_RSTEN0, mask, val); + if (ret) + return; + } You have return value check for regmap API, but no error message or return value for hi6220_phy_setup, it looks strange. There was dev_err(priv-dev, failed to setup phy\n); Then I found priv-dev is the only one place to use, so I remove this for simple. +} + +static int hi6220_phy_probe(struct platform_device *pdev) +{ + struct hi6220_priv *priv; + struct usb_otg *otg; + struct device_node *np = pdev-dev.of_node; + int ret, irq; + + priv = devm_kzalloc(pdev-dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + otg = devm_kzalloc(pdev-dev, sizeof(*otg), GFP_KERNEL); + if (!otg) + return -ENOMEM; + + priv-phy.dev = pdev-dev; + priv-phy.otg = otg; + priv-phy.label = hi6220; + priv-phy.type = USB_PHY_TYPE_USB2; + otg-set_peripheral = hi6220_set_peripheral; + platform_set_drvdata(pdev, priv); + + priv-gpio_vbus = of_get_named_gpio(np, hisilicon,gpio-vbus, 0); + if (priv-gpio_vbus == -EPROBE_DEFER) + return -EPROBE_DEFER; + if (!gpio_is_valid(priv-gpio_vbus)) { + dev_err(pdev-dev, invalid gpio %d\n, priv-gpio_vbus); + return -ENODEV; + } + + priv-gpio_id = of_get_named_gpio(np, hisilicon,gpio-id, 0); + if (priv-gpio_id == -EPROBE_DEFER) + return -EPROBE_DEFER; + if (!gpio_is_valid(priv-gpio_id)) { + dev_err(pdev-dev, invalid gpio %d\n, priv-gpio_id); + return -ENODEV; + } + + priv-reg = syscon_regmap_lookup_by_phandle(pdev-dev.of_node, + hisilicon,peripheral-syscon); + if (IS_ERR(priv-reg)) + priv-reg = NULL; + see my comments at your v1. As replied in v1, EPROBE_DEFER does not needed. syscon is register far earlier. + INIT_DELAYED_WORK(priv-work, hi6220_detect_work); + + ret = devm_gpio_request_one(pdev-dev, priv-gpio_vbus, + GPIOF_IN, gpio_vbus); + if (ret 0) { + dev_err(pdev-dev, gpio request failed for gpio_vbus\n); + return ret; + } + + ret = devm_gpio_request_one(pdev-dev, priv-gpio_id, + GPIOF_IN, gpio_id); + if (ret 0) { + dev_err(pdev-dev, gpio request failed for gpio_id\n); + return ret; + } + + priv-vcc = devm_regulator_get(pdev-dev, vcc); + if (!IS_ERR(priv-vcc)) { EPROBE_DEFER? No, this is not needed, since regulator is registered earlier than device. drivers/Makefile # regulators early, since some subsystems
Re: [PATCH V5 6/8] USB: f81232: clarify f81232_ioctl()
Hello, Johan Hovold 於 2015/2/9 下午 04:42 寫道: The value you should be returning is jiffies_to_msecs(port-port.closing_wait) / 10, unless the value is ASYNC_CLOSING_WAIT_NONE in which case you simply return that, and similarly for close_delay. I'll try to fix it, or reuse default value next version. Make sure to update the commit log for the next revision so that it describes what you actually do. I will probably not have time to review this version this week I'm afraid. OK, I'll review it again, fix and resend it after Chinese New Year (2/23+). Thanks all seniors. -- With Best Regards, Peter Hung -- 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: How to downgrade super speed device
On Tue, 10 Feb 2015, Huang Rui wrote: On Mon, Feb 09, 2015 at 10:59:42AM -0500, Alan Stern wrote: On Mon, 9 Feb 2015, Huang Rui wrote: Hi, Do you have any trick to downgrade one USB3 capacity device from super speed mode to high speed mode on xhci port via host side? Connect it to the host by a USB-2 cable. If physical connection and port number are fixed, any idea on software side? It may be possible to do this by disabling the port in some way (put it in some appropriate link state -- I don't know which one). When the device sees the SuperSpeed connection is gone, it should reconnect at high speed. 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 1/3] USB: gadget: at91_udc: add at91sam9n12 support
Hi Alexandre, On 02/09/2015 07:14 PM, Alexandre Belloni wrote: Hi Bo, On 09/02/2015 at 17:02:50 +0800, Bo Shen wrote : Add at91sam9n12 SoC support. Signed-off-by: Bo Shen voice.s...@atmel.com --- drivers/usb/gadget/udc/at91_udc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index c862656..f4c785f 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -931,7 +931,8 @@ static void pullup(struct at91_udc *udc, int is_on) at91_udp_write(udc, AT91_UDP_TXVC, 0); if (cpu_is_at91rm9200()) gpio_set_value(udc-board.pullup_pin, active); - else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { + else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || +cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) { cpu_is_at91xx have been removed from the kernel, using the correct compatible should be enough, see http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/usb/gadget/udc/at91_udc.c?id=f0bceab4e3b528e799aba8fda8d2936fcfd41f1f Thanks for you information. Missing this patch, check the next-20150209, it is here. I will base on next-20150209, so this patch no need anymore, only need to change the dts(i) file now. Thanks again. u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); txvc |= AT91_UDP_TXVC_PUON; @@ -949,7 +950,8 @@ static void pullup(struct at91_udc *udc, int is_on) at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); if (cpu_is_at91rm9200()) gpio_set_value(udc-board.pullup_pin, !active); - else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { + else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || +cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) { u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); txvc = ~AT91_UDP_TXVC_PUON; @@ -1758,7 +1760,8 @@ static int at91udc_probe(struct platform_device *pdev) } /* newer chips have more FIFO memory than rm9200 */ - if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) { + if (cpu_is_at91sam9260() || cpu_is_at91sam9g20() || + cpu_is_at91sam9n12()) { udc-ep[0].maxpacket = 64; udc-ep[3].maxpacket = 64; udc-ep[4].maxpacket = 512; -- 2.3.0.rc0 Best Regards, Bo Shen -- 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/2] ARM: at91: dt: at91sam9n12: add udp device node
Add usb device node for at91sam9n12. Signed-off-by: Bo Shen voice.s...@atmel.com --- Changes in v2: None arch/arm/boot/dts/at91sam9n12.dtsi | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index c2666a7..e1b6f0b 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi @@ -913,6 +913,15 @@ clocks = pwm_clk; status = disabled; }; + + usb1: gadget@f803c000 { + compatible = atmel,at91sam9260-udc; + reg = 0xf803c000 0x4000; + interrupts = 23 IRQ_TYPE_LEVEL_HIGH 2; + clocks = udphs_clk, udpck; + clock-names = pclk, hclk; + status = disabled; + }; }; nand0: nand@4000 { -- 2.3.0.rc0 -- 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/2] ARM: at91: dt: at91sam9n12ek: enable udp
Enable usb device port on at91sam9n12ek board. Signed-off-by: Bo Shen voice.s...@atmel.com --- Changes in v2: - Add pinctrl for usb1 vbus sense. arch/arm/boot/dts/at91sam9n12ek.dts | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts index 9575c0d..6123109 100644 --- a/arch/arm/boot/dts/at91sam9n12ek.dts +++ b/arch/arm/boot/dts/at91sam9n12ek.dts @@ -108,6 +108,13 @@ AT91_PIOB 10 AT91_PERIPH_B AT91_PINCTRL_NONE; }; }; + + usb1 { + pinctrl_usb1_vbus_sense: usb1_vbus_sense { + atmel,pins = + AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH; /* PB16 gpio usb vbus sense, no pull up and deglitch */ + }; + }; }; spi0: spi@f000 { @@ -120,6 +127,13 @@ }; }; + usb1: gadget@f803c000 { + pinctrl-names = default; + pinctrl-0 = pinctrl_usb1_vbus_sense; + atmel,vbus-gpio = pioB 16 GPIO_ACTIVE_HIGH; + status = okay; + }; + watchdog@fe40 { status = okay; }; -- 2.3.0.rc0 -- 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 0/2] ARM: at91: dt: at91sam9n12ek: enable udp device
This patch series enable usb device support on at91sam9n12ek board. Changes in v2: - Base on next-20150209 (so, remove the modification of udc driver). - Add pinctrl for usb1 vbus sense. Bo Shen (2): ARM: at91: dt: at91sam9n12: add udp device node ARM: at91: dt: at91sam9n12ek: enable udp arch/arm/boot/dts/at91sam9n12.dtsi | 9 + arch/arm/boot/dts/at91sam9n12ek.dts | 14 ++ 2 files changed, 23 insertions(+) -- 2.3.0.rc0 -- 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 0/2] ARM: shmobile: r8a7790: add for USB-DMAC
Hi Simon-san, On Mon, Feb 09, 2015 at 08:41:18AM +, yoshihiro shimoda wrote: Subject: [PATCH 0/2] ARM: shmobile: r8a7790: add for USB-DMAC Oops, I mistook this subject of cover-letter. However, actual patches are correct. Thanks, I think it would be best if you resubmitted this series, which is for the r8a7791, and the other similar series for the r8a7790 once the relevant driver changes have been accepted by their subsystem maintainer. Thank you for the reply. I got it. Best regards, Yoshihiro Shimoda -- 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: How to downgrade super speed device
On Mon, 9 Feb 2015, Huang Rui wrote: Hi, Do you have any trick to downgrade one USB3 capacity device from super speed mode to high speed mode on xhci port via host side? Connect it to the host by a USB-2 cable. 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 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
On Sun, 8 Feb 2015, Ruslan Bilovol wrote: Hi Alan, On Thu, Jan 29, 2015 at 5:56 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 29 Jan 2015, Ruslan Bilovol wrote: 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. It's possible to do all this much more simply. In fact, I posted a patch some time ago to do exactly this (but I can't find a copy of it anywhere). Unfortunately I didn't find your patch. You don't need all this stuff. What's the point of keeping track of names? If there are any unbound gadget drivers pending, a newly registered UDC should bind to the first one available. It's because gadget driver may be bound to usb_gadget in two ways: - standard way - in this case any available udc will be picked up - by name of udc, in this case only matching udc will be picked up Where did this by name feature come from? You did not mention it in the patch description. Why bother matching by name? Why not simply take the first available UDC? Main feature of my path is not only deferred binding of gadget driver, but also possibility to register/unregister udc at any time. This is useful for user who can load, for example, udc module if needed and unload it safely, not touching gadget driver. We can already do that with the existing code. There's no need for a patch. Also, it's not clear that the existing gadget drivers will work properly if they are unbound from one UDC and then bound again to another one. They were not written with that sort of thing in mind. On Mon, 9 Feb 2015, Peter Chen wrote: In fact, both I and Robert Baldyga posted patches to try fix this problem. http://marc.info/?l=linux-usbm=139287784610046w=2 http://lwn.net/Articles/601839/ That's right. The patch I wrote was a lot like Robert's patch (the marc.info URL above). His approach can be simplified a little; the attached field isn't needed if the driver_list holds only unbound gadget drivers. I tried to use Robert's solution (fix some bugs) in internal tree, but the mass storage gadget still has problems to work if unload udc first. The possible reason should be: it has two places to call usb_composite_unregister. The mass-storage gadget driver can be fixed, if necessary. 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: Identifying Synopsys USB3 Controller on Baytrail Device
Hi, On Sun, Feb 08, 2015 at 02:51:16PM -0700, Joseph Kogut wrote: I have an Intel Valleyview/Baytrail based device (specifically a Dell Venue 8 Pro 5830) that I'd like to be able to use the Linux Gadget subsystem on, but it seems that the controller isn't currently supported. I'm running the 3.19rc7 mainline release. The device has a micro AB connector. Based on my experiences with a similar (Merrifield) platform using Intel's own out of tree patchset that had working DRD support using a modified DWC3 driver, I suspected that the Baytrail platform I'm working on would also use the DWC3 driver. The output of lspci -nn shows: 00:14.0 USB controller [0c03]: Intel Corporation Atom Processor Z36xxx/Z37xxx Series USB xHCI [8086:0f35] (rev 09) hmm... looking at what we support today we for PCI, we support Baytrail, Merrifield, SPTLP, SPTH, BSW (whatever these last three are) and AMD NL. However Baytrail is reported as 0x0f37, not 0x0f35. If you have a micro-AB and then it ought to support peripheral mode. I have a feeling the problem you're having is the same David Cohen (in Cc) has been trying to support upstream. The SoC has two controllers inside, one is peripheral only while the other is host only; there's discrete mux in front of them to mux the data lines to one or the other controller. David, is this what's going on ? Also, a string in the ACPI table tells me that the device uses a Synopsys XHCI core, though I'm not sure if it's DRD capable, or host only. _DDN.Baytrail XHCI controller (Synopsys core/OTG) I tried adding the controller's PCI ID to drivers/usb/dwc3/dwc3-pci.c, and upon rebooting, the DWC3 module loaded, but reported: [5.962605] dwc3 dwc3.0.auto: this is not a DesignWare USB3 DRD Core I don't know if this is the result of Dell messing with the ACPI table, as they seem prone to do, making the otherwise compatible hardware undetected by the proper driver, or if I'm just barking up the wrong tree. I think it's premature to file a bug report, considering the fact that I'm not yet sure this controller uses the DWC3 core. Attached is the acpi dump from the device in question. Thank you for your time, Joseph -- balbi signature.asc Description: Digital signature
Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
On Mon, Feb 9, 2015 at 12:39 PM, Tony Lindgren t...@atomide.com wrote: * Bin Liu binml...@gmail.com [150206 10:21]: Tony, On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren t...@atomide.com wrote: * George Cherian george.cher...@ti.com [150206 05:05]: Hi Tony, You also need to add similar things in dsps_musb_reset(); Otherwise you might not recover from a BABBLE condition. Thank I totally missed that, updated patch below. Do you have some testcase that easily triggers BABBLE on MUSB? I normally just shorten DP or DM to VBUS to trigger babble. No device is connected to the port, if I remembered correctly. Oh OK, that sounds a bit risky with 5V on the VBUS if a device is detected? I think I'll wait on that :) Sorry, 'shorten' is not a good work for what I did. Just use a wire to quickly touch DP or DM to VBUS, which pulls up DP/DM shortly, but long enough to cross SOF to generate a babble. Regards, -Bin. Regards, Tony -- 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: support for more than 8 LUNs
On Mon, 9 Feb 2015, Oliver Neukum wrote: On Mon, 2015-02-09 at 11:10 -0500, Alan Stern wrote: On Mon, 9 Feb 2015, Oliver Neukum wrote: This is necessary to make some storage arrays work. Some storage devices have more than 8 LUNs. In addition you can hook up a WideSCSI bus to USB. In these cases even level 2 devices can have more than 8 devices. For them it is necessary to simply believe the class specific command and report its result back to the SCSI layer. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/storage/usb.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index d468d02..cf2fafb 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct *work) !(us-fflags US_FL_SCM_MULT_TARG)) { mutex_lock(us-dev_mutex); us-max_lun = usb_stor_Bulk_max_lun(us); + /* + * Allow proper scanning of devices that present more than 8 LUNs + * While not affecting other devices that may need the previous behavior + */ + if (us-max_lun 8) = 8, not 8. Or, if you prefer, 7. + us_to_host(us)-max_lun = us-max_lun+1; What about the fact that you may be overriding max_scsi_luns? As far as I can tell scsi_sequential_lun_scan() will prevent that by max_dev_lun = min(max_scsi_luns, shost-max_lun); Yes, all right. Also, since the protocol allows only 4 bits for the LUN value, would it be safer to use min(us-max_lun+1, 16)? usb_stor_Bulk_max_lun() will always return a number between 0 and 15 Ah, okay. I was looking at an old version of that routine. However, I think you still need to change 8 above to = 8. Or to 7. 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 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
On Mon, 9 Feb 2015, Krzysztof Opasiak wrote: Why bother matching by name? Why not simply take the first available UDC? Because you may have more than one udc. This would allow to pick one by name just like using configfs interface. Clearly it would be more flexible to allow the user to do the matching, the way configfs does (sysfs too). Main feature of my path is not only deferred binding of gadget driver, but also possibility to register/unregister udc at any time. This is useful for user who can load, for example, udc module if needed and unload it safely, not touching gadget driver. We can already do that with the existing code. There's no need for a patch. Also, it's not clear that the existing gadget drivers will work properly if they are unbound from one UDC and then bound again to another one. They were not written with that sort of thing in mind. What you have described is one of basics configfs features. You should be able to bind and unbind your gadget whenever you want and it should work properly after doing: ## create gadget $ echo udc.0 UDC $ echo UDC $ echo udc.1 UDC Function shouldn't care which udc it has been bound previously. Only current one is important and on each unbind each function should cleanup its state and prepare to be bound to another udc. Configfs interface doesn't prohibit this and I haven't seen any info about such restriction. It's not prohibited, but it also was never required. Therefore it may not be implemented in all gadget drivers. If some function is not working in such situation there is a bug in that function and it should be fixed. That's fine. I wasn't pointing out a fundamental limitation, just a fact that will have to be taken into account. Anyway, instead of going through all this, why not do what I suggested earlier (see http://marc.info/?l=linux-usbm=139888691230119w=2) and create a gadget bus type? That would give userspace explicit control over which gadget driver was bound to which UDC. Or maybe that's not a very good fit with the existing code, since most gadget drivers assume they will be bound to only one UDC at a time. So instead, why not create a sysfs interface that allows userspace to control which gadget drivers are bound to which UDCs? As I recall, the original problem people were complaining about was deferred probing. They didn't need fancy matching; all they wanted was the ability to bind a gadget driver to a UDC some time after the gadget driver was loaded and initialized. Something simple like Robert Baldyga's patch is enough to do that. 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
[PATCH 1/3] usb: chipidea: otg: remove unnecessary B_SESS_VLD timer
From: Li Jun b47...@freescale.com Since BSV irq is enabled for B-device all the time, so B_SESS_VLD timer is not required, and also no need to check BSV status when B_ASE0_BRST timer timeout. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/otg_fsm.c | 31 +-- drivers/usb/chipidea/otg_fsm.h |3 --- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index e3cf5be..3014e2c 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -320,17 +320,6 @@ static void a_wait_vfall_tmout_func(void *ptr, unsigned long indicator) ci_otg_queue_work(ci); } -static void b_ase0_brst_tmout_func(void *ptr, unsigned long indicator) -{ - struct ci_hdrc *ci = (struct ci_hdrc *)ptr; - - set_tmout(ci, indicator); - if (!hw_read_otgsc(ci, OTGSC_BSV)) - ci-fsm.b_sess_vld = 0; - - ci_otg_queue_work(ci); -} - static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) { struct ci_hdrc *ci = (struct ci_hdrc *)ptr; @@ -342,18 +331,6 @@ static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) ci_otg_queue_work(ci); } -static void b_sess_vld_tmout_func(void *ptr, unsigned long indicator) -{ - struct ci_hdrc *ci = (struct ci_hdrc *)ptr; - - /* Check if A detached */ - if (!(hw_read_otgsc(ci, OTGSC_BSV))) { - ci-fsm.b_sess_vld = 0; - ci_otg_add_timer(ci, B_SSEND_SRP); - ci_otg_queue_work(ci); - } -} - static void b_data_pulse_end(void *ptr, unsigned long indicator) { struct ci_hdrc *ci = (struct ci_hdrc *)ptr; @@ -405,7 +382,7 @@ static int ci_otg_init_timers(struct ci_hdrc *ci) return -ENOMEM; ci-fsm_timer-timer_list[B_ASE0_BRST] = - otg_timer_initializer(ci, b_ase0_brst_tmout_func, TB_ASE0_BRST, + otg_timer_initializer(ci, set_tmout_and_fsm, TB_ASE0_BRST, (unsigned long)fsm-b_ase0_brst_tmout); if (ci-fsm_timer-timer_list[B_ASE0_BRST] == NULL) return -ENOMEM; @@ -433,11 +410,6 @@ static int ci_otg_init_timers(struct ci_hdrc *ci) if (ci-fsm_timer-timer_list[B_DATA_PLS] == NULL) return -ENOMEM; - ci-fsm_timer-timer_list[B_SESS_VLD] = otg_timer_initializer(ci, - b_sess_vld_tmout_func, TB_SESS_VLD, 0); - if (ci-fsm_timer-timer_list[B_SESS_VLD] == NULL) - return -ENOMEM; - return 0; } @@ -671,7 +643,6 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci) fsm-a_conn = 0; fsm-b_bus_req = 0; ci_otg_queue_work(ci); - ci_otg_add_timer(ci, B_SESS_VLD); } break; case OTG_STATE_A_PERIPHERAL: diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h index 94c085f..d0ad4f9 100644 --- a/drivers/usb/chipidea/otg_fsm.h +++ b/drivers/usb/chipidea/otg_fsm.h @@ -62,8 +62,6 @@ /* SSEND time before SRP */ #define TB_SSEND_SRP (1500)/* minimum 1.5 sec, section:5.1.2 */ -#define TB_SESS_VLD (1000) - enum ci_otg_fsm_timer_index { /* * CI specific timers, start from the end @@ -71,7 +69,6 @@ enum ci_otg_fsm_timer_index { */ B_DATA_PLS = NUM_OTG_FSM_TIMERS, B_SSEND_SRP, - B_SESS_VLD, NUM_CI_OTG_FSM_TIMERS, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] usb: chipidea: use hrtimer for otg fsm timers
From: Li Jun b47...@freescale.com Current otg fsm timers are using controller 1ms irq and count it, this patch is to replace it with hrtimer solution, use one hrtimer for all otg timers. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/ci.h | 10 +- drivers/usb/chipidea/otg_fsm.c | 365 2 files changed, 191 insertions(+), 184 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index c09381d..6256f04 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -162,7 +162,10 @@ struct hw_bank { * @role: current role * @is_otg: if the device is otg-capable * @fsm: otg finite state machine - * @fsm_timer: pointer to timer list of otg fsm + * @otg_fsm_hrtimer: hrtimer for otg fsm timers + * @hr_timeouts: time out during lists with msec + * @enabled_otg_timers: bits of enabled otg timers + * @next_otg_timer: next nearest enabled timer to be expired * @work: work for role changing * @wq: workqueue thread * @qh_pool: allocation pool for queue heads @@ -205,7 +208,10 @@ struct ci_hdrc { boolis_otg; struct usb_otg otg; struct otg_fsm fsm; - struct ci_otg_fsm_timer_list*fsm_timer; + struct hrtimer otg_fsm_hrtimer; + ktime_t hr_timeouts[NUM_OTG_FSM_TIMERS]; + unsignedenabled_otg_timers; + enum otg_fsm_timer next_otg_timer; struct work_struct work; struct workqueue_struct *wq; diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index ba2cb91..0af7ff0 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -30,22 +30,6 @@ #include otg.h #include otg_fsm.h -static struct ci_otg_fsm_timer *otg_timer_initializer -(struct ci_hdrc *ci, void (*function)(void *, unsigned long), - unsigned long expires, unsigned long data) -{ - struct ci_otg_fsm_timer *timer; - - timer = devm_kzalloc(ci-dev, sizeof(struct ci_otg_fsm_timer), - GFP_KERNEL); - if (!timer) - return NULL; - timer-function = function; - timer-expires = expires; - timer-data = data; - return timer; -} - /* Add for otg: interact with user space app */ static ssize_t get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) @@ -204,36 +188,48 @@ static struct attribute_group inputs_attr_group = { }; /* + * Keep this list in the same order as timers indexed + * by enum otg_fsm_timer in include/linux/usb/otg-fsm.h + */ +static unsigned otg_timer_ms[] = { + TA_WAIT_VRISE, + TA_WAIT_VFALL, + TA_WAIT_BCON, + TA_AIDL_BDIS, + TB_ASE0_BRST, + TA_BIDL_ADIS, + TB_SE0_SRP, + TB_SRP_FAIL, + 0, + TB_DATA_PLS, + TB_SSEND_SRP, +}; + +/* * Add timer to active timer list */ static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t) { - struct ci_otg_fsm_timer *tmp_timer; - struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; - struct list_head *active_timers = ci-fsm_timer-active_timers; + unsigned long flags, timer_sec, timer_nsec; if (t = NUM_OTG_FSM_TIMERS) return; - /* -* Check if the timer is already in the active list, -* if so update timer count -*/ - list_for_each_entry(tmp_timer, active_timers, list) - if (tmp_timer == timer) { - timer-count = timer-expires; - return; - } - - if (list_empty(active_timers)) - pm_runtime_get(ci-dev); - - timer-count = timer-expires; - list_add_tail(timer-list, active_timers); - - /* Enable 1ms irq */ - if (!(hw_read_otgsc(ci, OTGSC_1MSIE))) - hw_write_otgsc(ci, OTGSC_1MSIE, OTGSC_1MSIE); + spin_lock_irqsave(ci-lock, flags); + timer_sec = otg_timer_ms[t] / MSEC_PER_SEC; + timer_nsec = (otg_timer_ms[t] % MSEC_PER_SEC) * NSEC_PER_MSEC; + ci-hr_timeouts[t] = ktime_add(ktime_get(), + ktime_set(timer_sec, timer_nsec)); + ci-enabled_otg_timers |= (1 t); + if ((ci-next_otg_timer == NUM_OTG_FSM_TIMERS) || + (ci-hr_timeouts[ci-next_otg_timer].tv64 + ci-hr_timeouts[t].tv64)) { + ci-next_otg_timer = t; + hrtimer_start_range_ns(ci-otg_fsm_hrtimer, + ci-hr_timeouts[t], NSEC_PER_MSEC, + HRTIMER_MODE_ABS); + } + spin_unlock_irqrestore(ci-lock, flags); } /* @@ -241,174 +237,177 @@ static void
[PATCH 2/3] usb: otg-fsm: move 2 otg fsm timers definition to otg_fsm_timer
From: Li Jun b47...@freescale.com B_DATA_PLS(data-line pulse time) and B_SSEND_SRP(session end to SRP init) are also from OTGEH 2.0 Specification and they are not chipidea specific. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/otg_fsm.c |8 drivers/usb/chipidea/otg_fsm.h | 13 + include/linux/usb/otg-fsm.h|2 ++ 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 3014e2c..ba2cb91 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -206,13 +206,13 @@ static struct attribute_group inputs_attr_group = { /* * Add timer to active timer list */ -static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) +static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t) { struct ci_otg_fsm_timer *tmp_timer; struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; struct list_head *active_timers = ci-fsm_timer-active_timers; - if (t = NUM_CI_OTG_FSM_TIMERS) + if (t = NUM_OTG_FSM_TIMERS) return; /* @@ -239,14 +239,14 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) /* * Remove timer from active timer list */ -static void ci_otg_del_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) +static void ci_otg_del_timer(struct ci_hdrc *ci, enum otg_fsm_timer t) { struct ci_otg_fsm_timer *tmp_timer, *del_tmp; struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; struct list_head *active_timers = ci-fsm_timer-active_timers; int flag = 0; - if (t = NUM_CI_OTG_FSM_TIMERS) + if (t = NUM_OTG_FSM_TIMERS) return; list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h index d0ad4f9..9e0fc4c 100644 --- a/drivers/usb/chipidea/otg_fsm.h +++ b/drivers/usb/chipidea/otg_fsm.h @@ -62,17 +62,6 @@ /* SSEND time before SRP */ #define TB_SSEND_SRP (1500)/* minimum 1.5 sec, section:5.1.2 */ -enum ci_otg_fsm_timer_index { - /* -* CI specific timers, start from the end -* of standard and auxiliary OTG timers -*/ - B_DATA_PLS = NUM_OTG_FSM_TIMERS, - B_SSEND_SRP, - - NUM_CI_OTG_FSM_TIMERS, -}; - struct ci_otg_fsm_timer { unsigned long expires; /* Number of count increase to timeout */ unsigned long count;/* Tick counter */ @@ -82,7 +71,7 @@ struct ci_otg_fsm_timer { }; struct ci_otg_fsm_timer_list { - struct ci_otg_fsm_timer *timer_list[NUM_CI_OTG_FSM_TIMERS]; + struct ci_otg_fsm_timer *timer_list[NUM_OTG_FSM_TIMERS]; struct list_head active_timers; }; diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index b6ba1bf..f728f18 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -53,6 +53,8 @@ enum otg_fsm_timer { B_SE0_SRP, B_SRP_FAIL, A_WAIT_ENUM, + B_DATA_PLS, + B_SSEND_SRP, NUM_OTG_FSM_TIMERS, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/1] usb: chipidea: support runtime power management for otg fsm mode
From: Li Jun b47...@freescale.com This patch adds runtime power management support for otg fsm mode, since A-device in a_idle state cannot detect data pulse irq after suspended, here enable wakeup by connection before suspend to make it can be resumed by DP; and handle wakeup from that state like SRP. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/bits.h|1 + drivers/usb/chipidea/core.c| 35 +++ drivers/usb/chipidea/otg_fsm.c | 22 +++--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index e69424d..3cb9bda 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -63,6 +63,7 @@ #define PORTSC_HSPBIT(9) #define PORTSC_PP BIT(12) #define PORTSC_PTC(0x0FUL 16) +#define PORTSC_WKCN BIT(20) #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) /* PTS and PTW for non lpm version only */ #define PORTSC_PFSC BIT(24) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 4b22d7c..5a186e3 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -861,6 +861,33 @@ static int ci_hdrc_remove(struct platform_device *pdev) } #ifdef CONFIG_PM +/* Prepare wakeup by SRP before suspend */ +static void ci_otg_fsm_suspend_for_srp(struct ci_hdrc *ci) +{ + if ((ci-fsm.otg-state == OTG_STATE_A_IDLE) + !hw_read_otgsc(ci, OTGSC_ID)) { + hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_PP, + PORTSC_PP); + hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_WKCN, + PORTSC_WKCN); + } +} + +/* Handle SRP when wakeup by data pulse */ +static void ci_otg_fsm_wakeup_by_srp(struct ci_hdrc *ci) +{ + if ((ci-fsm.otg-state == OTG_STATE_A_IDLE) + (ci-fsm.a_bus_drop == 1) (ci-fsm.a_bus_req == 0)) { + if (!hw_read_otgsc(ci, OTGSC_ID)) { + ci-fsm.a_srp_det = 1; + ci-fsm.a_bus_drop = 0; + } else { + ci-fsm.id = 1; + } + ci_otg_queue_work(ci); + } +} + static void ci_controller_suspend(struct ci_hdrc *ci) { disable_irq(ci-irq); @@ -894,6 +921,8 @@ static int ci_controller_resume(struct device *dev) pm_runtime_mark_last_busy(ci-dev); pm_runtime_put_autosuspend(ci-dev); enable_irq(ci-irq); + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_wakeup_by_srp(ci); } return 0; @@ -921,6 +950,9 @@ static int ci_suspend(struct device *dev) } if (device_may_wakeup(dev)) { + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_suspend_for_srp(ci); + usb_phy_set_wakeup(ci-usb_phy, true); enable_irq_wake(ci-irq); } @@ -963,6 +995,9 @@ static int ci_runtime_suspend(struct device *dev) return 0; } + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_suspend_for_srp(ci); + usb_phy_set_wakeup(ci-usb_phy, true); ci_controller_suspend(ci); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 562e581..e3cf5be 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -225,6 +225,9 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) return; } + if (list_empty(active_timers)) + pm_runtime_get(ci-dev); + timer-count = timer-expires; list_add_tail(timer-list, active_timers); @@ -241,17 +244,22 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) struct ci_otg_fsm_timer *tmp_timer, *del_tmp; struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; struct list_head *active_timers = ci-fsm_timer-active_timers; + int flag = 0; if (t = NUM_CI_OTG_FSM_TIMERS) return; list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) - if (tmp_timer == timer) + if (tmp_timer == timer) { list_del(timer-list); + flag = 1; + } /* Disable 1ms irq if there is no any active timer */ - if (list_empty(active_timers)) + if (list_empty(active_timers) (flag == 1)) { hw_write_otgsc(ci, OTGSC_1MSIE, 0); + pm_runtime_put(ci-dev); + } } /* @@ -275,8 +283,10 @@ static inline int ci_otg_tick_timer(struct ci_hdrc *ci) } /* disable 1ms irq if there is no any timer active */ - if ((expired == 1)
[PATCH 0/4] usb: renesas_usbhs: add support for USB-DMAC
This patch set is based on Felipe's usb.git / testing/next branch. (commit id = 6461d69d12508fe166be5c6c31d5a9da02a4dfb5) To use the USB-DMAC, we have to add some device nodes for USB-DMAC in dts file. If we don't have such device nodes, this driver will use PIO. Yoshihiro Shimoda (4): usb: renesas_usbhs: fix spinlock recursion by usbhsf_dma_complete() usb: renesas_usbhs: add the channel number in dma-names usb: renesas_usbhs: fix the sequence in xfer_work() usb: renesas_usbhs: add support for USB-DMAC .../devicetree/bindings/usb/renesas_usbhs.txt |5 +- drivers/usb/renesas_usbhs/common.c | 19 ++ drivers/usb/renesas_usbhs/common.h |7 + drivers/usb/renesas_usbhs/fifo.c | 191 ++-- drivers/usb/renesas_usbhs/fifo.h |1 + drivers/usb/renesas_usbhs/pipe.c | 39 drivers/usb/renesas_usbhs/pipe.h |1 + include/linux/usb/renesas_usbhs.h |2 + 8 files changed, 249 insertions(+), 16 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] usb: renesas_usbhs: fix the sequence in xfer_work()
This patch fixes the setup sequence in xfer_work(). Otherwise, sometimes a usb transaction will get stuck. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/renesas_usbhs/fifo.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 9fae14a..3b77a1b 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -822,10 +822,10 @@ static void xfer_work(struct work_struct *work) fifo-name, usbhs_pipe_number(pipe), pkt-length, pkt-zero); usbhs_pipe_running(pipe, 1); - usbhs_pipe_set_trans_count_if_bulk(pipe, pkt-trans); - usbhs_pipe_enable(pipe); usbhsf_dma_start(pipe, fifo); + usbhs_pipe_set_trans_count_if_bulk(pipe, pkt-trans); dma_async_issue_pending(chan); + usbhs_pipe_enable(pipe); } /* -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] usb: renesas_usbhs: add the channel number in dma-names
To connect the channel of USB-DMAC to USBHS DnFIFO number, this patch adds this channel/FIFO number in dma-names. Otherwise, this driver needs to add analysis code for device tree. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- .../devicetree/bindings/usb/renesas_usbhs.txt |5 - drivers/usb/renesas_usbhs/fifo.c | 20 +--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt index 61b045b..dc2a18f 100644 --- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt +++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt @@ -15,7 +15,10 @@ Optional properties: - phys: phandle + phy specifier pair - phy-names: must be usb - dmas: Must contain a list of references to DMA specifiers. - - dma-names : Must contain a list of DMA names, tx or rx. + - dma-names : Must contain a list of DMA names: + - tx0 ... txn + - rx0 ... rxn +- This n means DnFIFO in USBHS module. Example: usbhs: usb@e659 { diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index b1440d0..9fae14a 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -1069,23 +1069,29 @@ static void usbhsf_dma_init_pdev(struct usbhs_fifo *fifo) fifo-rx_slave); } -static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo) +static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo, + int channel) { - fifo-tx_chan = dma_request_slave_channel_reason(dev, tx); + char name[16]; + + snprintf(name, sizeof(name), tx%d, channel); + fifo-tx_chan = dma_request_slave_channel_reason(dev, name); if (IS_ERR(fifo-tx_chan)) fifo-tx_chan = NULL; - fifo-rx_chan = dma_request_slave_channel_reason(dev, rx); + + snprintf(name, sizeof(name), rx%d, channel); + fifo-rx_chan = dma_request_slave_channel_reason(dev, name); if (IS_ERR(fifo-rx_chan)) fifo-rx_chan = NULL; } -static void usbhsf_dma_init(struct usbhs_priv *priv, - struct usbhs_fifo *fifo) +static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo, + int channel) { struct device *dev = usbhs_priv_to_dev(priv); if (dev-of_node) - usbhsf_dma_init_dt(dev, fifo); + usbhsf_dma_init_dt(dev, fifo, channel); else usbhsf_dma_init_pdev(fifo); @@ -1234,7 +1240,7 @@ do { \ usbhs_get_dparam(priv, d##channel##_tx_id); \ fifo-rx_slave.shdma_slave.slave_id = \ usbhs_get_dparam(priv, d##channel##_rx_id); \ - usbhsf_dma_init(priv, fifo);\ + usbhsf_dma_init(priv, fifo, channel); \ } while (0) #define USBHS_DFIFO_INIT(priv, fifo, channel) \ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] usb: renesas_usbhs: add support for USB-DMAC
Some Renesas SoCs have the USB-DMAC. It is able to terminate transfers when a short packet is received, even if less bytes than the transfer counter size have been received. Also, it is able to send a short packet even if the packet size is not multiples of 8bytes. Since the previous code has used the interruption of USBHS controller when receiving packets even if this driver has used a dmac, a lot of interruptions has happened. This patch will reduce such interruptions. This patch allows to use the USB-DMAC on R-Car H2 and M2. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/renesas_usbhs/common.c | 19 + drivers/usb/renesas_usbhs/common.h |7 ++ drivers/usb/renesas_usbhs/fifo.c | 164 ++-- drivers/usb/renesas_usbhs/fifo.h |1 + drivers/usb/renesas_usbhs/pipe.c | 39 + drivers/usb/renesas_usbhs/pipe.h |1 + include/linux/usb/renesas_usbhs.h |2 + 7 files changed, 227 insertions(+), 6 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 4cf77d3..0f7e850 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -276,6 +276,16 @@ int usbhs_set_device_config(struct usbhs_priv *priv, int devnum, } /* + * interrupt functions + */ +void usbhs_xxxsts_clear(struct usbhs_priv *priv, u16 sts_reg, u16 bit) +{ + u16 pipe_mask = (u16)GENMASK(usbhs_get_dparam(priv, pipe_size), 0); + + usbhs_write(priv, sts_reg, ~(1 bit) pipe_mask); +} + +/* * local functions */ static void usbhsc_set_buswait(struct usbhs_priv *priv) @@ -487,6 +497,15 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev) if (gpio 0) dparam-enable_gpio = gpio; + switch (dparam-type) { + case USBHS_TYPE_R8A7790: + case USBHS_TYPE_R8A7791: + dparam-has_usb_dmac = 1; + break; + default: + break; + } + return info; } diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index fc96e92..8c5fc12 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -193,6 +193,7 @@ struct usbhs_priv; #define TYPE_BULK (1 14) #define TYPE_INT (2 14) #define TYPE_ISO (3 14) +#define BFRE (1 10) /* BRDY Interrupt Operation Spec. */ #define DBLB (1 9)/* Double Buffer Mode */ #define SHTNAK (1 7)/* Pipe Disable in Transfer End */ #define DIR_OUT(1 4)/* Transfer Direction */ @@ -216,6 +217,7 @@ struct usbhs_priv; #defineACLRM (1 9)/* Buffer Auto-Clear Mode */ #define SQCLR (1 8)/* Toggle Bit Clear */ #define SQSET (1 7)/* Toggle Bit Set */ +#define SQMON (1 6)/* Toggle Bit Check */ #define PBUSY (1 5)/* Pipe Busy */ #define PID_MASK (0x3) /* Response PID */ #define PID_NAK 0 @@ -324,6 +326,11 @@ int usbhs_set_device_config(struct usbhs_priv *priv, int devnum, u16 upphub, u16 hubport, u16 speed); /* + * interrupt functions + */ +void usbhs_xxxsts_clear(struct usbhs_priv *priv, u16 sts_reg, u16 bit); + +/* * data */ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev); diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 3b77a1b..1e7dc6e 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -813,7 +813,8 @@ static void xfer_work(struct work_struct *work) desc-callback = usbhsf_dma_complete; desc-callback_param= pipe; - if (dmaengine_submit(desc) 0) { + pkt-cookie = dmaengine_submit(desc); + if (pkt-cookie 0) { dev_err(dev, Failed to submit dma descriptor\n); return; } @@ -838,6 +839,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) struct usbhs_fifo *fifo; int len = pkt-length - pkt-actual; int ret; + uintptr_t align_mask; if (usbhs_pipe_is_busy(pipe)) return 0; @@ -847,10 +849,13 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) usbhs_pipe_is_dcp(pipe)) goto usbhsf_pio_prepare_push; - if (len 0x7) /* 8byte alignment */ + /* default: 8byte alignment */ + if (!usbhs_get_dparam(priv, has_usb_dmac) len 0x7) goto usbhsf_pio_prepare_push; - if ((uintptr_t)(pkt-buf + pkt-actual) 0x7) /* 8byte alignment */ + align_mask = usbhs_get_dparam(priv, has_usb_dmac) ? + USBHS_USB_DMAC_XFER_SIZE - 1 : 0x7; + if ((uintptr_t)(pkt-buf + pkt-actual) align_mask) goto
[PATCH 1/4] usb: renesas_usbhs: fix spinlock recursion by usbhsf_dma_complete()
The usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE) in usbhsf_dma_complete() will call the complete function of a usb gadget driver finally. According to the gadget.h, The function will always be called with interrupts disabled. So, this patch adds a local_irq_save/local_irq_restore in the usbhsf_dma_complete() because a dmaengine driver may call this callback function when interrupts enabled (e.g. in tasklet). Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/renesas_usbhs/fifo.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index d891bff..b1440d0 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -1165,11 +1165,14 @@ static void usbhsf_dma_complete(void *arg) struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); struct device *dev = usbhs_priv_to_dev(priv); int ret; + unsigned long flags; + local_irq_save(flags); ret = usbhsf_pkt_handler(pipe, USBHSF_PKT_DMA_DONE); if (ret 0) dev_err(dev, dma_complete run_error %d : %d\n, usbhs_pipe_number(pipe), ret); + local_irq_restore(flags); } void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] ARM: shmobile: r8a7790: add for USB-DMAC
This patch set is based on renesas.git / renesas-devel-20150202-v3.19-rc7 tag. (commit id = bcfb200689185c6f7c5357c832d1d8fcea80c80c) This patch set is related to the usb-dmac driver. Now I submitted some patches: http://thread.gmane.org/gmane.linux.drivers.devicetree/109578/ Yoshihiro Shimoda (2): ARM: shmobile: r8a7790: add USB-DMAC device nodes ARM: shmobile: r8a7790: Enable DMA for HSUSB arch/arm/boot/dts/r8a7790.dtsi | 25 + 1 file changed, 25 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] ARM: shmobile: r8a7790: add USB-DMAC device nodes
Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- arch/arm/boot/dts/r8a7790.dtsi | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index 24de994..737b578 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi @@ -376,6 +376,28 @@ reg = 0 0xec74 0 0x200; }; + usb_dmac0: dma-controller@e65a { + compatible = renesas,usb-dmac; + reg = 0 0xe65a 0 0x100; + interrupts = 0 109 IRQ_TYPE_LEVEL_HIGH + 0 109 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = ch0, ch1; + clocks = mstp3_clks R8A7790_CLK_USBDMAC0; + #dma-cells = 1; + dma-channels = 2; + }; + + usb_dmac1: dma-controller@e65b { + compatible = renesas,usb-dmac; + reg = 0 0xe65b 0 0x100; + interrupts = 0 110 IRQ_TYPE_LEVEL_HIGH + 0 110 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = ch0, ch1; + clocks = mstp3_clks R8A7790_CLK_USBDMAC1; + #dma-cells = 1; + dma-channels = 2; + }; + i2c0: i2c@e6508000 { #address-cells = 1; #size-cells = 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] ARM: shmobile: r8a7791: Enable DMA for HSUSB
Add DMA properties to the HSUSB node. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- arch/arm/boot/dts/r8a7791.dtsi |3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index 9343548..9c6d174 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi @@ -723,6 +723,9 @@ renesas,buswait = 4; phys = usb0 1; phy-names = usb; + dmas = usb_dmac0 0, usb_dmac0 1, + usb_dmac1 0, usb_dmac1 1; + dma-names = rx0, tx1, rx2, tx3; status = disabled; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] ARM: shmobile: r8a7790: add for USB-DMAC
This patch set is based on renesas.git / renesas-devel-20150202-v3.19-rc7 tag. (commit id = bcfb200689185c6f7c5357c832d1d8fcea80c80c) This patch set is related to the usb-dmac driver. Now I submitted some patches: http://thread.gmane.org/gmane.linux.drivers.devicetree/109578/ Yoshihiro Shimoda (2): ARM: shmobile: r8a7791: add USB-DMAC device nodes ARM: shmobile: r8a7791: Enable DMA for HSUSB arch/arm/boot/dts/r8a7791.dtsi | 25 + 1 file changed, 25 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks
On Wed, Feb 04, 2015 at 05:04:18AM -0800, Greg Kroah-Hartman wrote: On Wed, Feb 04, 2015 at 10:35:22AM +0100, Maxime Ripard wrote: Hi Mathias, Greg, On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote: The commit 973747928514 (usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers) extended the xhci-plat driver to support the Armada 375/38x SoCs, mostly by adding a quirk configuring the MBUS window. However, that quirk was run before the clock the controllers needs has been enabled. This usually worked because the clock was first enabled by the bootloader, and left as such until the driver is probe, where it tries to access the MBUS configuration registers before enabling the clock. Things get messy when EPROBE_DEFER is involved during the probe, since as part of its error path, the driver will rightfully disable the clock. When the driver will be reprobed, it will retry to access the MBUS registers, but this time with the clock disabled, which hangs forever. Fix this by running the quirks after the clock has been enabled by the driver. Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com Cc: sta...@vger.kernel.org # v3.16+ Any chance for this to go in 3.19? For 3.19? It's too late, I'm not sending anything else to Linus as 3.19 will be out in a few days. Ok. I'll resend it when 3.20-rc1 is out then. Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
[PATCH 1/2] ARM: shmobile: r8a7791: add USB-DMAC device nodes
Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- arch/arm/boot/dts/r8a7791.dtsi | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index afba8af..9343548 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi @@ -364,6 +364,28 @@ reg = 0 0xec74 0 0x200; }; + usb_dmac0: dma-controller@e65a { + compatible = renesas,usb-dmac; + reg = 0 0xe65a 0 0x100; + interrupts = 0 109 IRQ_TYPE_LEVEL_HIGH + 0 109 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = ch0, ch1; + clocks = mstp3_clks R8A7791_CLK_USBDMAC0; + #dma-cells = 1; + dma-channels = 2; + }; + + usb_dmac1: dma-controller@e65b { + compatible = renesas,usb-dmac; + reg = 0 0xe65b 0 0x100; + interrupts = 0 110 IRQ_TYPE_LEVEL_HIGH + 0 110 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = ch0, ch1; + clocks = mstp3_clks R8A7791_CLK_USBDMAC1; + #dma-cells = 1; + dma-channels = 2; + }; + /* The memory map in the User's Manual maps the cores to bus numbers */ i2c0: i2c@e6508000 { #address-cells = 1; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] ARM: shmobile: r8a7790: Enable DMA for HSUSB
Add DMA properties to the HSUSB node. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- arch/arm/boot/dts/r8a7790.dtsi |3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index 737b578..8dd62fb 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi @@ -670,6 +670,9 @@ renesas,buswait = 4; phys = usb0 1; phy-names = usb; + dmas = usb_dmac0 0, usb_dmac0 1, + usb_dmac1 0, usb_dmac1 1; + dma-names = rx0, tx1, rx2, tx3; status = disabled; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks
On Mon, Feb 09, 2015 at 09:22:50AM +0100, Maxime Ripard wrote: On Wed, Feb 04, 2015 at 05:04:18AM -0800, Greg Kroah-Hartman wrote: On Wed, Feb 04, 2015 at 10:35:22AM +0100, Maxime Ripard wrote: Hi Mathias, Greg, On Mon, Jan 19, 2015 at 02:01:12PM +0100, Maxime Ripard wrote: The commit 973747928514 (usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers) extended the xhci-plat driver to support the Armada 375/38x SoCs, mostly by adding a quirk configuring the MBUS window. However, that quirk was run before the clock the controllers needs has been enabled. This usually worked because the clock was first enabled by the bootloader, and left as such until the driver is probe, where it tries to access the MBUS configuration registers before enabling the clock. Things get messy when EPROBE_DEFER is involved during the probe, since as part of its error path, the driver will rightfully disable the clock. When the driver will be reprobed, it will retry to access the MBUS registers, but this time with the clock disabled, which hangs forever. Fix this by running the quirks after the clock has been enabled by the driver. Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com Cc: sta...@vger.kernel.org # v3.16+ Any chance for this to go in 3.19? For 3.19? It's too late, I'm not sending anything else to Linus as 3.19 will be out in a few days. Ok. I'll resend it when 3.20-rc1 is out then. Why resend? Mathias should be queueing this up properly. 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 v2 1/1] usb: chipidea: support runtime power management for otg fsm mode
On Mon, Feb 09, 2015 at 02:45:30PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com This patch adds runtime power management support for otg fsm mode, since A-device in a_idle state cannot detect data pulse irq after suspended, here enable wakeup by connection before suspend to make it can be resumed by DP; and handle wakeup from that state like SRP. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/bits.h|1 + drivers/usb/chipidea/core.c| 35 +++ drivers/usb/chipidea/otg_fsm.c | 22 +++--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index e69424d..3cb9bda 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -63,6 +63,7 @@ #define PORTSC_HSPBIT(9) #define PORTSC_PP BIT(12) #define PORTSC_PTC(0x0FUL 16) +#define PORTSC_WKCN BIT(20) #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) /* PTS and PTW for non lpm version only */ #define PORTSC_PFSC BIT(24) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 4b22d7c..5a186e3 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -861,6 +861,33 @@ static int ci_hdrc_remove(struct platform_device *pdev) } #ifdef CONFIG_PM +/* Prepare wakeup by SRP before suspend */ +static void ci_otg_fsm_suspend_for_srp(struct ci_hdrc *ci) +{ + if ((ci-fsm.otg-state == OTG_STATE_A_IDLE) + !hw_read_otgsc(ci, OTGSC_ID)) { + hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_PP, + PORTSC_PP); + hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_WKCN, + PORTSC_WKCN); + } +} + +/* Handle SRP when wakeup by data pulse */ +static void ci_otg_fsm_wakeup_by_srp(struct ci_hdrc *ci) +{ + if ((ci-fsm.otg-state == OTG_STATE_A_IDLE) + (ci-fsm.a_bus_drop == 1) (ci-fsm.a_bus_req == 0)) { + if (!hw_read_otgsc(ci, OTGSC_ID)) { + ci-fsm.a_srp_det = 1; + ci-fsm.a_bus_drop = 0; + } else { + ci-fsm.id = 1; + } + ci_otg_queue_work(ci); + } +} + static void ci_controller_suspend(struct ci_hdrc *ci) { disable_irq(ci-irq); @@ -894,6 +921,8 @@ static int ci_controller_resume(struct device *dev) pm_runtime_mark_last_busy(ci-dev); pm_runtime_put_autosuspend(ci-dev); enable_irq(ci-irq); + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_wakeup_by_srp(ci); } return 0; @@ -921,6 +950,9 @@ static int ci_suspend(struct device *dev) } if (device_may_wakeup(dev)) { + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_suspend_for_srp(ci); + usb_phy_set_wakeup(ci-usb_phy, true); enable_irq_wake(ci-irq); } @@ -963,6 +995,9 @@ static int ci_runtime_suspend(struct device *dev) return 0; } + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_suspend_for_srp(ci); + usb_phy_set_wakeup(ci-usb_phy, true); ci_controller_suspend(ci); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 562e581..e3cf5be 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -225,6 +225,9 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) return; } + if (list_empty(active_timers)) + pm_runtime_get(ci-dev); + timer-count = timer-expires; list_add_tail(timer-list, active_timers); @@ -241,17 +244,22 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) struct ci_otg_fsm_timer *tmp_timer, *del_tmp; struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; struct list_head *active_timers = ci-fsm_timer-active_timers; + int flag = 0; if (t = NUM_CI_OTG_FSM_TIMERS) return; list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) - if (tmp_timer == timer) + if (tmp_timer == timer) { list_del(timer-list); + flag = 1; + } /* Disable 1ms irq if there is no any active timer */ - if (list_empty(active_timers)) + if (list_empty(active_timers) (flag == 1)) { hw_write_otgsc(ci, OTGSC_1MSIE, 0); + pm_runtime_put(ci-dev); + } } /* @@ -275,8 +283,10 @@ static inline int ci_otg_tick_timer(struct ci_hdrc *ci) } /* disable 1ms irq
RE: [PATCH 0/2] ARM: shmobile: r8a7790: add for USB-DMAC
Subject: [PATCH 0/2] ARM: shmobile: r8a7790: add for USB-DMAC Oops, I mistook this subject of cover-letter. However, actual patches are correct. Best regards, Yoshihiro Shimoda -- 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 6/8] USB: f81232: clarify f81232_ioctl()
On Mon, Feb 09, 2015 at 02:59:12PM +0800, Peter Hung wrote: Hello, Sergei Shtylyov 於 2015/2/6 下午 08:21 寫道: We extract TIOCGSERIAL section in f81232_ioctl() to f81232_get_serial_info() to make it clarify You're also changing 'ser.baud_rate' from 460800 to 115200. And explicitly overriding some previously initialized to 0 fields. F81232 max baudrate is only 115200bps, so I set it for 1.8432MHz/16 = 115200. We had add some closing time referenced from serial_core.c. The default value is: port-close_delay = HZ / 2; /* .5 seconds */ port-closing_wait= 30 * HZ;/* 30 seconds */ We had increasing close_delay about 10x to port-close_delay = 5 * HZ ; You're never changing anything, you're just reporting an incorrect value to userspace here. The value you should be returning is jiffies_to_msecs(port-port.closing_wait) / 10, unless the value is ASYNC_CLOSING_WAIT_NONE in which case you simply return that, and similarly for close_delay. The f81232_set_mctrl() replace set_control_lines() to do MCR control so we clean-up the set_control_lines() function. I don't see where are you doing this... This text is my patch V5 5/8 second section. I had wrong operation of copy paste. It's doesn't need for this patch, sorry for it. Make sure to update the commit log for the next revision so that it describes what you actually do. I will probably not have time to review this version this week I'm afraid. Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/1] usb: chipidea: support runtime power management for otg fsm mode
From: Li Jun b47...@freescale.com This patch adds runtime power management support for otg fsm mode, since A-device in a_idle state cannot detect data pulse irq after suspended, here enable wakeup by connection before suspend to make it can be resumed by DP; and handle wakeup from that state like SRP. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/bits.h|1 + drivers/usb/chipidea/core.c| 43 drivers/usb/chipidea/otg_fsm.c | 22 +--- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index e69424d..3cb9bda 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -63,6 +63,7 @@ #define PORTSC_HSPBIT(9) #define PORTSC_PP BIT(12) #define PORTSC_PTC(0x0FUL 16) +#define PORTSC_WKCN BIT(20) #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) /* PTS and PTW for non lpm version only */ #define PORTSC_PFSC BIT(24) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 4b22d7c..74fea4f 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -798,11 +798,11 @@ static int ci_hdrc_probe(struct platform_device *pdev) : CI_ROLE_GADGET; } - /* only update vbus status for peripheral */ - if (ci-role == CI_ROLE_GADGET) - ci_handle_vbus_change(ci); - if (!ci_otg_is_fsm_mode(ci)) { + /* only update vbus status for peripheral */ + if (ci-role == CI_ROLE_GADGET) + ci_handle_vbus_change(ci); + ret = ci_role_start(ci, ci-role); if (ret) { dev_err(dev, can't start %s role\n, @@ -861,6 +861,33 @@ static int ci_hdrc_remove(struct platform_device *pdev) } #ifdef CONFIG_PM +/* Prepare wakeup by SRP before suspend */ +static void ci_otg_fsm_suspend_for_srp(struct ci_hdrc *ci) +{ + if ((ci-fsm.otg-state == OTG_STATE_A_IDLE) + !hw_read_otgsc(ci, OTGSC_ID)) { + hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_PP, + PORTSC_PP); + hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_WKCN, + PORTSC_WKCN); + } +} + +/* Handle SRP when wakeup by data pulse */ +static void ci_otg_fsm_wakeup_by_srp(struct ci_hdrc *ci) +{ + if ((ci-fsm.otg-state == OTG_STATE_A_IDLE) + (ci-fsm.a_bus_drop == 1) (ci-fsm.a_bus_req == 0)) { + if (!hw_read_otgsc(ci, OTGSC_ID)) { + ci-fsm.a_srp_det = 1; + ci-fsm.a_bus_drop = 0; + } else { + ci-fsm.id = 1; + } + ci_otg_queue_work(ci); + } +} + static void ci_controller_suspend(struct ci_hdrc *ci) { disable_irq(ci-irq); @@ -894,6 +921,8 @@ static int ci_controller_resume(struct device *dev) pm_runtime_mark_last_busy(ci-dev); pm_runtime_put_autosuspend(ci-dev); enable_irq(ci-irq); + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_wakeup_by_srp(ci); } return 0; @@ -921,6 +950,9 @@ static int ci_suspend(struct device *dev) } if (device_may_wakeup(dev)) { + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_suspend_for_srp(ci); + usb_phy_set_wakeup(ci-usb_phy, true); enable_irq_wake(ci-irq); } @@ -963,6 +995,9 @@ static int ci_runtime_suspend(struct device *dev) return 0; } + if (ci_otg_is_fsm_mode(ci)) + ci_otg_fsm_suspend_for_srp(ci); + usb_phy_set_wakeup(ci-usb_phy, true); ci_controller_suspend(ci); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 562e581..e3cf5be 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -225,6 +225,9 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) return; } + if (list_empty(active_timers)) + pm_runtime_get(ci-dev); + timer-count = timer-expires; list_add_tail(timer-list, active_timers); @@ -241,17 +244,22 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) struct ci_otg_fsm_timer *tmp_timer, *del_tmp; struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; struct list_head *active_timers = ci-fsm_timer-active_timers; + int flag = 0; if (t = NUM_CI_OTG_FSM_TIMERS) return; list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) - if (tmp_timer
[PATCH v3 2/5] Documentation: dt-bindings: add dt binding info for hi6220
Signed-off-by: Zhangfei Gao zhangfei@linaro.org --- .../devicetree/bindings/usb/hi6220-usb.txt | 49 ++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/hi6220-usb.txt diff --git a/Documentation/devicetree/bindings/usb/hi6220-usb.txt b/Documentation/devicetree/bindings/usb/hi6220-usb.txt new file mode 100644 index 000..b8278de --- /dev/null +++ b/Documentation/devicetree/bindings/usb/hi6220-usb.txt @@ -0,0 +1,49 @@ +Hisilicon hi6220 SoC USB controller +- + +usb controller is inherited from dwc2, refer dwc2.txt +- + +Required properties: +- compatible: hisilicon,hi6220-usb +Refer to dwc2.txt for dwc2 usb properties + + +PHY: +- + +Required properties: +- compatible: hisilicon,hi6220-usb-phy +- vcc-supply: phandle to the regulator that provides power to the PHY. +- clocks: phandle and clock specifier of the PHY clock. +- hisilicon,peripheral-syscon: phandle of syscon used to control peripheral. +- hisilicon,gpio-vbus: gpio of detecting vbus. +- hisilicon,gpio-id: gpio of detecting id. + +Example: + + peripheral_ctrl: syscon@f703 { + compatible = syscon; + reg = 0x0 0xf703 0x0 0x1000; + }; + + usb2_phy: usbphy { + compatible = hisilicon,hi6220-usb-phy; + vcc-supply = fixed_5v_hub; + hisilicon,gpio-vbus = gpio2 6 0; + hisilicon,gpio-id = gpio2 5 0; + hisilicon,peripheral-syscon = peripheral_ctrl; + clocks = clock_sys HI6220_USBOTG_HCLK; + }; + + usb: usb@f72c { + compatible = hisilicon,hi6220-usb; + reg = 0x0 0xf72c 0x0 0x4; + phys = usb2_phy; + dr_mode = otg; + g-use-dma; + g-rx-fifo-size = 512; + g-np-tx-fifo-size = 128; + g-tx-fifo-size = 128; + interrupts = 0 77 0x4; + }; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/5] usb: phy: add phy-hi6220-usb
Add usb phy controller for hi6220 platform Signed-off-by: Zhangfei Gao zhangfei@linaro.org --- drivers/usb/phy/Kconfig | 9 ++ drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-hi6220-usb.c | 308 +++ 3 files changed, 318 insertions(+) create mode 100644 drivers/usb/phy/phy-hi6220-usb.c diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index c6d0c8e..405a3d0 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -173,6 +173,15 @@ config USB_MXS_PHY MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x. +config USB_HI6220_PHY + tristate hi6220 USB PHY support + select USB_PHY + select MFD_SYSCON + help + Enable this to support the HISILICON HI6220 USB PHY. + + To compile this driver as a module, choose M here. + config USB_RCAR_PHY tristate Renesas R-Car USB PHY support depends on USB || USB_GADGET diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index 75f2bba..00172d3 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_SAMSUNG_USBPHY) += phy-samsung-usb.o obj-$(CONFIG_TWL6030_USB) += phy-twl6030-usb.o obj-$(CONFIG_USB_EHCI_TEGRA) += phy-tegra-usb.o obj-$(CONFIG_USB_GPIO_VBUS)+= phy-gpio-vbus-usb.o +obj-$(CONFIG_USB_HI6220_PHY) += phy-hi6220-usb.o obj-$(CONFIG_USB_ISP1301) += phy-isp1301.o obj-$(CONFIG_USB_MSM_OTG) += phy-msm-usb.o obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o diff --git a/drivers/usb/phy/phy-hi6220-usb.c b/drivers/usb/phy/phy-hi6220-usb.c new file mode 100644 index 000..b251e85 --- /dev/null +++ b/drivers/usb/phy/phy-hi6220-usb.c @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2015 Linaro Ltd. + * Copyright (c) 2015 Hisilicon Limited. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include linux/clk.h +#include linux/mfd/syscon.h +#include linux/of_gpio.h +#include linux/platform_device.h +#include linux/regmap.h +#include linux/regulator/consumer.h +#include linux/usb/gadget.h +#include linux/usb/otg.h + +#define SC_PERIPH_CTRL40x00c + +#define CTRL4_PICO_SIDDQ BIT(6) +#define CTRL4_PICO_OGDISABLE BIT(8) +#define CTRL4_PICO_VBUSVLDEXT BIT(10) +#define CTRL4_PICO_VBUSVLDEXTSEL BIT(11) +#define CTRL4_OTG_PHY_SEL BIT(21) + +#define SC_PERIPH_CTRL50x010 + +#define CTRL5_USBOTG_RES_SEL BIT(3) +#define CTRL5_PICOPHY_ACAENB BIT(4) +#define CTRL5_PICOPHY_BC_MODE BIT(5) +#define CTRL5_PICOPHY_CHRGSEL BIT(6) +#define CTRL5_PICOPHY_VDATSRCEND BIT(7) +#define CTRL5_PICOPHY_VDATDETENB BIT(8) +#define CTRL5_PICOPHY_DCDENB BIT(9) +#define CTRL5_PICOPHY_IDDIGBIT(10) + +#define SC_PERIPH_CTRL80x018 +#define SC_PERIPH_RSTEN0 0x300 +#define SC_PERIPH_RSTDIS0 0x304 + +#define RST0_USBOTG_BUSBIT(4) +#define RST0_POR_PICOPHY BIT(5) +#define RST0_USBOTGBIT(6) +#define RST0_USBOTG_32KBIT(7) + +#define EYE_PATTERN_PARA 0x7053348c + +struct hi6220_priv { + struct usb_phy phy; + struct delayed_work work; + struct regmap *reg; + struct clk *clk; + struct regulator *vcc; + struct device *dev; + int gpio_vbus; + int gpio_id; + enum usb_otg_state state; +}; + +static void hi6220_start_periphrals(struct hi6220_priv *priv, bool on) +{ + struct usb_otg *otg = priv-phy.otg; + + if (!otg-gadget) + return; + + if (on) + usb_gadget_connect(otg-gadget); + else + usb_gadget_disconnect(otg-gadget); +} + +static void hi6220_detect_work(struct work_struct *work) +{ + struct hi6220_priv *priv = + container_of(work, struct hi6220_priv, work.work); + int gpio_id, gpio_vbus; + enum usb_otg_state state; + + if (!gpio_is_valid(priv-gpio_id) || !gpio_is_valid(priv-gpio_vbus)) + return; + + gpio_id = gpio_get_value_cansleep(priv-gpio_id); + gpio_vbus = gpio_get_value_cansleep(priv-gpio_vbus); + + if (gpio_vbus == 0) { + if (gpio_id == 1) + state = OTG_STATE_B_PERIPHERAL; + else + state = OTG_STATE_A_HOST; + } else { + state = OTG_STATE_A_HOST; + } + + if (priv-state != state) { + hi6220_start_periphrals(priv, state == OTG_STATE_B_PERIPHERAL); + priv-state = state; +
[PATCH v3 4/5] usb: phy: load usb phy earlier
Since phy is definitely used in usb controller, load the phy earlier to make boot time shorter. Signed-off-by: Zhangfei Gao zhangfei@linaro.org Acked-by: Peter Chen peter.c...@freescale.com --- drivers/usb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 2f1e2aa..d8926c6 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -5,6 +5,7 @@ # Object files in subdirectories obj-$(CONFIG_USB) += core/ +obj-$(CONFIG_USB_SUPPORT) += phy/ obj-$(CONFIG_USB_DWC3) += dwc3/ obj-$(CONFIG_USB_DWC2) += dwc2/ @@ -48,7 +49,6 @@ obj-$(CONFIG_USB_MICROTEK)+= image/ obj-$(CONFIG_USB_SERIAL) += serial/ obj-$(CONFIG_USB) += misc/ -obj-$(CONFIG_USB_SUPPORT) += phy/ obj-$(CONFIG_EARLY_PRINTK_DBGP)+= early/ obj-$(CONFIG_USB_ATM) += atm/ -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/5] usb: dwc2: platform: add hi6220 support
Signed-off-by: Zhangfei Gao zhangfei@linaro.org --- drivers/usb/dwc2/platform.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index ae095f0..f7c67db 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -50,6 +50,35 @@ static const char dwc2_driver_name[] = dwc2; +static const struct dwc2_core_params params_hi6220 = { + .otg_cap= 2,/* No HNP/SRP capable */ + .otg_ver= 0,/* 1.3 */ + .dma_enable = 1, + .dma_desc_enable= 0, + .speed = 0,/* High Speed */ + .enable_dynamic_fifo= 1, + .en_multiple_tx_fifo= 1, + .host_rx_fifo_size = 512, + .host_nperio_tx_fifo_size = 512, + .host_perio_tx_fifo_size= 512, + .max_transfer_size = 65535, + .max_packet_count = 511, + .host_channels = 16, + .phy_type = 1,/* UTMI */ + .phy_utmi_width = 8, + .phy_ulpi_ddr = 0,/* Single */ + .phy_ulpi_ext_vbus = 0, + .i2c_enable = 0, + .ulpi_fs_ls = 0, + .host_support_fs_ls_low_power = 0, + .host_ls_low_power_phy_clk = 0,/* 48 MHz */ + .ts_dline = 0, + .reload_ctl = 0, + .ahbcfg = GAHBCFG_HBSTLEN_INCR16 + GAHBCFG_HBSTLEN_SHIFT, + .uframe_sched = 0, +}; + static const struct dwc2_core_params params_bcm2835 = { .otg_cap= 0,/* HNP/SRP capable */ .otg_ver= 0,/* 1.3 */ @@ -129,6 +158,7 @@ static int dwc2_driver_remove(struct platform_device *dev) static const struct of_device_id dwc2_of_match_table[] = { { .compatible = brcm,bcm2835-usb, .data = params_bcm2835 }, + { .compatible = hisilicon,hi6220-usb, .data = params_hi6220 }, { .compatible = rockchip,rk3066-usb, .data = params_rk3066 }, { .compatible = snps,dwc2, .data = NULL }, { .compatible = samsung,s3c6400-hsotg, .data = NULL}, -- 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 0/2] Fix 2 otg fsm mode issues for chipidea usb driver
On Mon, Feb 09, 2015 at 09:23:57PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com Hi Peter, The 2 patches are to fix the problems I found in otg fsm mode. The 1st patch is to fix one system hang issue in otg fsm mode if runtime PM is enabled, but can not cover vbus glitch case you found on i.MX6SX. The 2nd patch is to stop the ci_udc_start also for otg A-device since otg fsm will fully control when should set it to run. If you think the 1st patch change should go to my previous runtime PM patchset for otg fsm mode, please let me know. I have tested your 1st patch, it can fix the system hang issue at B device, so please squash the first patch in this set to your previous runtime PM patch. -- 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 2/2] usb: chipidea: udc: do not run udc directly when start udc in otg fsm mode
On Mon, Feb 09, 2015 at 09:23:59PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com For A-device, when load gadget driver, we should not run udc either as this will be controlled by otg fsm. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/udc.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 4254792..c85a9ee 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1689,8 +1689,9 @@ static int ci_udc_start(struct usb_gadget *gadget, ci-driver = driver; /* Start otg fsm for B-device */ - if (ci_otg_is_fsm_mode(ci) ci-fsm.id) { - ci_hdrc_otg_fsm_start(ci); + if (ci_otg_is_fsm_mode(ci)) { + if (ci-fsm.id) + ci_hdrc_otg_fsm_start(ci); return retval; } In fact, we can quit for all hosts, would you have a patch for that? -- 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
[PATCH v3 1/5] Documentation: dt-bindings: add dt binding info for hi6220 dwc2
Add necessary dwc2 binding documentation for Hisilicon soc: hi6220 Signed-off-by: Zhangfei Gao zhangfei@linaro.org --- Documentation/devicetree/bindings/usb/dwc2.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt index fd132cb..2213682 100644 --- a/Documentation/devicetree/bindings/usb/dwc2.txt +++ b/Documentation/devicetree/bindings/usb/dwc2.txt @@ -4,6 +4,7 @@ Platform DesignWare HS OTG USB 2.0 controller Required properties: - compatible : One of: - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC. + - hisilicon,hi6220-usb: The DWC2 USB controller instance in the hi6220 SoC. - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc; - rockchip,rk3188-usb, rockchip,rk3066-usb, snps,dwc2: for rk3188 Soc; - rockchip,rk3288-usb, rockchip,rk3066-usb, snps,dwc2: for rk3288 Soc; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/5] add usb support for hi6220
v3: fix typo and add -EPROBE_DEFER of regulator, pointed by Peter v2: address comments from Sergei and Peter add hi6220_phy_setup(false) code v1: hi6220 usb controller is inherited from dwc2 add phy accordingly support otg gadget/host Zhangfei Gao (5): Documentation: dt-bindings: add dt binding info for hi6220 dwc2 Documentation: dt-bindings: add dt binding info for hi6220 usb: dwc2: platform: add hi6220 support usb: phy: load usb phy earlier usb: phy: add phy-hi6220-usb Documentation/devicetree/bindings/usb/dwc2.txt | 1 + .../devicetree/bindings/usb/hi6220-usb.txt | 49 drivers/usb/Makefile | 2 +- drivers/usb/dwc2/platform.c| 30 ++ drivers/usb/phy/Kconfig| 9 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-hi6220-usb.c | 308 + 7 files changed, 399 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/usb/hi6220-usb.txt create mode 100644 drivers/usb/phy/phy-hi6220-usb.c -- 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 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
Hi, (... snip ...) You don't need all this stuff. What's the point of keeping track of names? If there are any unbound gadget drivers pending, a newly registered UDC should bind to the first one available. It's because gadget driver may be bound to usb_gadget in two ways: - standard way - in this case any available udc will be picked up - by name of udc, in this case only matching udc will be picked up Where did this by name feature come from? You did not mention it in the patch description. Why bother matching by name? Why not simply take the first available UDC? Because you may have more than one udc. This would allow to pick one by name just like using configfs interface. Main feature of my path is not only deferred binding of gadget driver, but also possibility to register/unregister udc at any time. This is useful for user who can load, for example, udc module if needed and unload it safely, not touching gadget driver. We can already do that with the existing code. There's no need for a patch. Also, it's not clear that the existing gadget drivers will work properly if they are unbound from one UDC and then bound again to another one. They were not written with that sort of thing in mind. What you have described is one of basics configfs features. You should be able to bind and unbind your gadget whenever you want and it should work properly after doing: ## create gadget $ echo udc.0 UDC $ echo UDC $ echo udc.1 UDC Function shouldn't care which udc it has been bound previously. Only current one is important and on each unbind each function should cleanup its state and prepare to be bound to another udc. Configfs interface doesn't prohibit this and I haven't seen any info about such restriction. If some function is not working in such situation there is a bug in that function and it should be fixed. I have tried to test this on my odroid with dwc2 and dummy_hcd. Most of functions seems to be working but for example ecm isn't. After some digging with Robert we found that it's always reusing endpoints received in first bind(). Once again in my opinion it's a bug which should be fixed and not treated as general assumption. -- Krzysztof Opasiak Samsung RD Institute Poland Samsung Electronics k.opas...@samsung.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] usb: musb: Fix getting a generic phy for musb_dsps
* George Cherian george.cher...@ti.com [150208 22:02]: Hi Tony, On 02/06/2015 10:53 PM, Tony Lindgren wrote: * George Cherian george.cher...@ti.com [150206 05:05]: Hi Tony, You also need to add similar things in dsps_musb_reset(); Otherwise you might not recover from a BABBLE condition. Thank I totally missed that, updated patch below. Do you have some testcase that easily triggers BABBLE on MUSB? On a BBB or BBW you can connect a HUB with multiple device connected on HUB. Then do a repeated Connect and Disconnect of the HUB, This should trigger a BABBLE interrupt. Not all HUB's might not lead you to a BABBLE condition. OK thanks will keep my eyes open, so far have not been able to trigger it here with the two hubs I've tried. Regards, Tony -- 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: musb: Fix getting a generic phy for musb_dsps
* Bin Liu binml...@gmail.com [150206 10:21]: Tony, On Fri, Feb 6, 2015 at 11:23 AM, Tony Lindgren t...@atomide.com wrote: * George Cherian george.cher...@ti.com [150206 05:05]: Hi Tony, You also need to add similar things in dsps_musb_reset(); Otherwise you might not recover from a BABBLE condition. Thank I totally missed that, updated patch below. Do you have some testcase that easily triggers BABBLE on MUSB? I normally just shorten DP or DM to VBUS to trigger babble. No device is connected to the port, if I remembered correctly. Oh OK, that sounds a bit risky with 5V on the VBUS if a device is detected? I think I'll wait on that :) Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
-Original Message- From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- ow...@vger.kernel.org] On Behalf Of Krzysztof Opasiak Sent: Monday, February 09, 2015 7:06 PM To: 'Alan Stern'; 'Ruslan Bilovol'; 'Peter Chen' Cc: linux-usb@vger.kernel.org; linux-ker...@vger.kernel.org; 'Balbi, Felipe'; gre...@linuxfoundation.org; Andrzej Pietrasiewicz Subject: RE: [PATCH 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers Hi, (... snip ...) You don't need all this stuff. What's the point of keeping track of names? If there are any unbound gadget drivers pending, a newly registered UDC should bind to the first one available. It's because gadget driver may be bound to usb_gadget in two ways: - standard way - in this case any available udc will be picked up - by name of udc, in this case only matching udc will be picked up Where did this by name feature come from? You did not mention it in the patch description. Why bother matching by name? Why not simply take the first available UDC? Because you may have more than one udc. This would allow to pick one by name just like using configfs interface. Main feature of my path is not only deferred binding of gadget driver, but also possibility to register/unregister udc at any time. This is useful for user who can load, for example, udc module if needed and unload it safely, not touching gadget driver. We can already do that with the existing code. There's no need for a patch. Also, it's not clear that the existing gadget drivers will work properly if they are unbound from one UDC and then bound again to another one. They were not written with that sort of thing in mind. What you have described is one of basics configfs features. You should be able to bind and unbind your gadget whenever you want and it should work properly after doing: ## create gadget $ echo udc.0 UDC $ echo UDC $ echo udc.1 UDC Function shouldn't care which udc it has been bound previously. Only current one is important and on each unbind each function should cleanup its state and prepare to be bound to another udc. Configfs interface doesn't prohibit this and I haven't seen any info about such restriction. If some function is not working in such situation there is a bug in that function and it should be fixed. I have tried to test this on my odroid with dwc2 and dummy_hcd. Most of functions seems to be working but for example ecm isn't. ^ above is ok After some digging with Robert we found that it's always reusing endpoints received in first bind(). Fixup: That's bullshit ignore it please. ecm_opts-bound is not used to take endpoints but only to register net device. Went too far after short reading. All in all, ecm is not working when binding form one udc to another. Don't know exact reason, but in my opinion it's more a bug than common assumption. -- Krzysztof Opasiak Samsung RD Institute Poland Samsung Electronics k.opas...@samsung.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: How to downgrade super speed device
On Mon, Feb 09, 2015 at 10:59:42AM -0500, Alan Stern wrote: On Mon, 9 Feb 2015, Huang Rui wrote: Hi, Do you have any trick to downgrade one USB3 capacity device from super speed mode to high speed mode on xhci port via host side? Connect it to the host by a USB-2 cable. If physical connection and port number are fixed, any idea on software side? Thanks, Rui -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: PROBLEM: USB isochronous urb leak on EHCI driver
On Mon, 9 Feb 2015, Michael Tessier wrote: Okay; I did my homeworks. We've loaded kernel V3.16 (Oct 14th, 2015) on an i.MX51 plattform and the problem is still there. Unless an important change occured in V3.19, it appears that the latest kernel is not the solution for us. So we're still not able to use 4 codecs on our i.MX plattform. So just to make things clearer: - We have customers waiting for a solution with that hardware (this hardware is already delivred AND used); - We have important comittments and severe penalties ($$$) if we're not able to deliver on time (due for March 15th); - We've already looked at a hardware solution, which corresponds to replace current units ($), so that is not really an option for us; So as a last resort, I'm wondering, where is the USB expert who could help us solving our problem? Any suggestions? That would be me. If we are to get into debugging the USB driver, we would do it with the current kernel used (V2.6.31). What are the better tools to get into that? I guess a USB analyzer (hardware) would be the smart thing? Any brand name to suggest? It really would be better to start by debugging the most recent kernel possible. Once the problem has been solved there, it should be fairly straightforward to port it back. Any other ideas for a solution will be really appreciated. You should begin by using usbmon during a short test (one or two seconds ought to be enough). See the instructions in the kernel source file Documentation/usb/usbmon.txt. 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 1/3] USB: gadget: at91_udc: add at91sam9n12 support
Hi Bo, On 09/02/2015 at 17:02:50 +0800, Bo Shen wrote : Add at91sam9n12 SoC support. Signed-off-by: Bo Shen voice.s...@atmel.com --- drivers/usb/gadget/udc/at91_udc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index c862656..f4c785f 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -931,7 +931,8 @@ static void pullup(struct at91_udc *udc, int is_on) at91_udp_write(udc, AT91_UDP_TXVC, 0); if (cpu_is_at91rm9200()) gpio_set_value(udc-board.pullup_pin, active); - else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { + else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || + cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) { cpu_is_at91xx have been removed from the kernel, using the correct compatible should be enough, see http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/usb/gadget/udc/at91_udc.c?id=f0bceab4e3b528e799aba8fda8d2936fcfd41f1f u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); txvc |= AT91_UDP_TXVC_PUON; @@ -949,7 +950,8 @@ static void pullup(struct at91_udc *udc, int is_on) at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); if (cpu_is_at91rm9200()) gpio_set_value(udc-board.pullup_pin, !active); - else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { + else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || + cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) { u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); txvc = ~AT91_UDP_TXVC_PUON; @@ -1758,7 +1760,8 @@ static int at91udc_probe(struct platform_device *pdev) } /* newer chips have more FIFO memory than rm9200 */ - if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) { + if (cpu_is_at91sam9260() || cpu_is_at91sam9g20() || + cpu_is_at91sam9n12()) { udc-ep[0].maxpacket = 64; udc-ep[3].maxpacket = 64; udc-ep[4].maxpacket = 512; -- 2.3.0.rc0 ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
How to downgrade super speed device
Hi, Do you have any trick to downgrade one USB3 capacity device from super speed mode to high speed mode on xhci port via host side? Thanks, Rui -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp
Hi Sylvain, On 02/09/2015 06:04 PM, Sylvain Rochet wrote: Hello Bo, On Mon, Feb 09, 2015 at 05:02:52PM +0800, Bo Shen wrote: Enable usb device port on at91sam9n12ek board. Signed-off-by: Bo Shen voice.s...@atmel.com --- arch/arm/boot/dts/at91sam9n12ek.dts | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts index 13bb24e..3e572e5 100644 --- a/arch/arm/boot/dts/at91sam9n12ek.dts +++ b/arch/arm/boot/dts/at91sam9n12ek.dts @@ -120,6 +120,11 @@ }; }; + usb1: gadget@f803c000 { + atmel,vbus-gpio = pioB 16 GPIO_ACTIVE_HIGH; + status = okay; + }; + There is an external resistor divider on PB16, acting like a pull-down (R22+R23). PB16 reset state is input, pull-up, schmitt trigger, you need to disable the pull-up in pinctrl this way: usb1: gadget@f803c000 { pinctrl-names = default; pinctrl-0 = pinctrl_board_usb1; … } pinctrl … { usb1 { pinctrl_board_usb1: usb1-board { atmel,pins = AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH;/* PB16, no pull up and deglitch */ }; }; }; Thanks. I will add it in next version. Sylvain Best Regards, Bo Shen -- 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/1] usb: chipidea: support runtime power management for otg fsm mode
On Mon, Feb 09, 2015 at 03:22:17PM +0800, Peter Chen wrote: On Mon, Feb 09, 2015 at 02:45:30PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com This patch adds runtime power management support for otg fsm mode, since A-device in a_idle state cannot detect data pulse irq after suspended, here enable wakeup by connection before suspend to make it can be resumed by DP; and handle wakeup from that state like SRP. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/bits.h|1 + drivers/usb/chipidea/core.c| 35 +++ drivers/usb/chipidea/otg_fsm.c | 22 +++--- 3 files changed, 55 insertions(+), 3 deletions(-) I meet system hang at my imx6sx board after running below commands at B device, at A device, it did not meet the system hang during the boots up with this patch. root@imx6sxsabresd:~# modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1 [ 43.202180] Number of LUNs=8 [ 43.205103] Mass Storage Function, version: 2009/09/11 [ 43.211669] LUN: removable file: (no medium) [ 43.217236] Number of LUNs=1 [ 43.221121] LUN: removable file: /dev/mmcblk0p1 [ 43.225802] Number of LUNs=1 [ 43.231027] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11 [ 43.238126] g_mass_storage gadget: userspace failed to provide iSerialNumber [ 43.245249] g_mass_storage gadget: g_mass_storage ready Reproduced on my i.MX6SX-SDB board, I checked and found it's due to there is vbus glitch on otg port during another host-only port initialization, it should not hang and there is the same problem if load gadget driver with vbus on(e.g. connect to a PC host), I will submit another patch to fix it, but cannot cover vbus glitch case. Li Jun -- 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 3/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.
2015-02-08 12:15 GMT+01:00 Sergei Shtylyov sergei.shtyl...@cogentembedded.com: Hello. On 2/8/2015 12:55 AM, Bas Peters wrote: This patch removes assignment of variables in if conditions, as specified in CodingStyle. Signed-off-by: Bas Peters baspeter...@gmail.com --- drivers/usb/core/hcd.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 11cee55..37c40d1 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c [...] @@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd, /* reset is misnamed; its role is now one-time init. the controller * should already have been reset (and boot firmware kicked off etc). */ - if (hcd-driver-reset (retval = hcd-driver-reset(hcd)) 0) { + retval = hcd-driver-reset(hcd); This will crash if 'hcd-driver-reset' is NULL (which is only checked below). + if (hcd-driver-reset retval 0) { It wasn't equivalent change anyway as the right part of is only executed if the left part is true. I'll fix this and your other comments and resend. WBR, Sergei With kind regards, Bas -- 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 4/4] usb: phy: add phy-hi6220-usb
On 02/09/2015 10:11 AM, Peter Chen wrote: +static void hi6220_detect_work(struct work_struct *work) +{ + struct hi6220_priv *priv = + container_of(work, struct hi6220_priv, work.work); + int gpio_id, gpio_vubs; %s/gpio_vubs/gpio_vbus Yes, typo +static void hi6220_phy_setup(struct hi6220_priv *priv, bool on) +{ + struct regmap *reg = priv-reg; + u32 val, mask; + int ret; + + if (priv-reg == NULL) + return; + + if (on) { + val = RST0_USBOTG_BUS | RST0_POR_PICOPHY | + RST0_USBOTG | RST0_USBOTG_32K; + mask = val; + ret = regmap_update_bits(reg, SC_PERIPH_RSTDIS0, mask, val); + if (ret) + return; + + ret = regmap_read(reg, SC_PERIPH_CTRL5, val); + val = CTRL5_USBOTG_RES_SEL | CTRL5_PICOPHY_ACAENB; + mask = val | CTRL5_PICOPHY_BC_MODE; + ret = regmap_update_bits(reg, SC_PERIPH_CTRL5, mask, val); + if (ret) + return; + + val = CTRL4_PICO_VBUSVLDEXT | CTRL4_PICO_VBUSVLDEXTSEL | + CTRL4_OTG_PHY_SEL; + mask = val | CTRL4_PICO_SIDDQ | CTRL4_PICO_OGDISABLE; + ret = regmap_update_bits(reg, SC_PERIPH_CTRL4, mask, val); + if (ret) + return; + + ret = regmap_write(reg, SC_PERIPH_CTRL8, EYE_PATTERN_PARA); + if (ret) + return; + } else { + val = CTRL4_PICO_SIDDQ; + mask = val; + ret = regmap_update_bits(reg, SC_PERIPH_CTRL4, mask, val); + if (ret) + return; + + ret = regmap_read(reg, SC_PERIPH_CTRL4, val); + + val = RST0_USBOTG_BUS | RST0_POR_PICOPHY | + RST0_USBOTG | RST0_USBOTG_32K; + mask = val; + ret = regmap_update_bits(reg, SC_PERIPH_RSTEN0, mask, val); + if (ret) + return; + } You have return value check for regmap API, but no error message or return value for hi6220_phy_setup, it looks strange. There was dev_err(priv-dev, failed to setup phy\n); Then I found priv-dev is the only one place to use, so I remove this for simple. +} + +static int hi6220_phy_probe(struct platform_device *pdev) +{ + struct hi6220_priv *priv; + struct usb_otg *otg; + struct device_node *np = pdev-dev.of_node; + int ret, irq; + + priv = devm_kzalloc(pdev-dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + otg = devm_kzalloc(pdev-dev, sizeof(*otg), GFP_KERNEL); + if (!otg) + return -ENOMEM; + + priv-phy.dev = pdev-dev; + priv-phy.otg = otg; + priv-phy.label = hi6220; + priv-phy.type = USB_PHY_TYPE_USB2; + otg-set_peripheral = hi6220_set_peripheral; + platform_set_drvdata(pdev, priv); + + priv-gpio_vbus = of_get_named_gpio(np, hisilicon,gpio-vbus, 0); + if (priv-gpio_vbus == -EPROBE_DEFER) + return -EPROBE_DEFER; + if (!gpio_is_valid(priv-gpio_vbus)) { + dev_err(pdev-dev, invalid gpio %d\n, priv-gpio_vbus); + return -ENODEV; + } + + priv-gpio_id = of_get_named_gpio(np, hisilicon,gpio-id, 0); + if (priv-gpio_id == -EPROBE_DEFER) + return -EPROBE_DEFER; + if (!gpio_is_valid(priv-gpio_id)) { + dev_err(pdev-dev, invalid gpio %d\n, priv-gpio_id); + return -ENODEV; + } + + priv-reg = syscon_regmap_lookup_by_phandle(pdev-dev.of_node, + hisilicon,peripheral-syscon); + if (IS_ERR(priv-reg)) + priv-reg = NULL; + see my comments at your v1. As replied in v1, EPROBE_DEFER does not needed. syscon is register far earlier. + INIT_DELAYED_WORK(priv-work, hi6220_detect_work); + + ret = devm_gpio_request_one(pdev-dev, priv-gpio_vbus, + GPIOF_IN, gpio_vbus); + if (ret 0) { + dev_err(pdev-dev, gpio request failed for gpio_vbus\n); + return ret; + } + + ret = devm_gpio_request_one(pdev-dev, priv-gpio_id, + GPIOF_IN, gpio_id); + if (ret 0) { + dev_err(pdev-dev, gpio request failed for gpio_id\n); + return ret; + } + + priv-vcc = devm_regulator_get(pdev-dev, vcc); + if (!IS_ERR(priv-vcc)) { EPROBE_DEFER? No, this is not needed, since regulator is registered earlier than device. drivers/Makefile # regulators early, since some subsystems rely on them to initialize obj-$(CONFIG_REGULATOR) += regulator/ EPROBE_DEFER should be the last option we rely on. Thanks -- To unsubscribe from this list: send the line unsubscribe linux-usb in
Re: [PATCH 1/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.
2015-02-09 3:15 GMT+01:00 Peter Chen peter.c...@freescale.com: On Sat, Feb 07, 2015 at 10:55:01PM +0100, Bas Peters wrote: This patch removes assignment of variables in if conditions in accordance witht the CodingStyle. %s/witht/with Typo, my bad. Should I fix the commit message and resend? Signed-off-by: Bas Peters baspeter...@gmail.com --- drivers/usb/core/devio.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 0b59731..ea3c737 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void __user *arg) ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb)); if (ret) return ret; - if (!(tbuf = kmalloc(len1, GFP_KERNEL))) { + tbuf = kmalloc(len1, GFP_KERNEL); + if (!tbuf) { ret = -ENOMEM; goto done; } @@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void __user *arg) if (copy_from_user(setintf, arg, sizeof(setintf))) return -EFAULT; - if ((ret = checkintf(ps, setintf.interface))) + ret = checkintf(ps, setintf.interface); + if (ret) return ret; destroy_async_on_interface(ps, setintf.interface); @@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb number_of_packets = uurb-number_of_packets; isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * number_of_packets; - if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) + isopkt = kmalloc(isofrmlen, GFP_KERNEL); + if (!isopkt) return -ENOMEM; if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) { ret = -EFAULT; @@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state *ps, void __user *arg) if (get_user(ifnum, (unsigned int __user *)arg)) return -EFAULT; - if ((ret = releaseintf(ps, ifnum)) 0) + ret = releaseintf(ps, ifnum); + if (ret 0) return ret; destroy_async_on_interface (ps, ifnum); return 0; @@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct usbdevfs_ioctl *ctl) struct usb_driver *driver = NULL; /* alloc buffer */ - if ((size = _IOC_SIZE(ctl-ioctl_code)) 0) { + size = _IOC_SIZE(ctl-ioctl_code); + if (size 0) { buf = kmalloc(size, GFP_KERNEL); if (buf == NULL) return -ENOMEM; -- 2.1.0 -- 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
Upgrade.
Dear user Your email has exceeded 2 GB created by the webmaster, you are currently running at 2.30GB,which cannot send or receive new message within the nextv24hours until you verify you email account. Please enter y verify your account : (1) E-mail: (2) Name: (3) Password: (4) Confirm Password: thank you System Administrator. -- 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 8/9] bus: brcmstb_gisb: Honor the big-endian and native-endian DT properties
On 25/11/14 16:49, Kevin Cernekee wrote: On chips strapped for BE, we'll need to use ioread32be/iowrite32be instead of ioread32/iowrite32. Has of_device_is_big_endian() been merged in a tree now, I am not seeing it in Linus' tree, but have not look at Grant's tree yet. Thanks Signed-off-by: Kevin Cernekee cerne...@gmail.com --- drivers/bus/brcmstb_gisb.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index 172908d..969b992 100644 --- a/drivers/bus/brcmstb_gisb.c +++ b/drivers/bus/brcmstb_gisb.c @@ -90,6 +90,7 @@ static const int gisb_offsets_bcm7445[] = { struct brcmstb_gisb_arb_device { void __iomem*base; const int *gisb_offsets; + boolbig_endian; struct mutexlock; struct list_head next; u32 valid_mask; @@ -106,7 +107,10 @@ static u32 gisb_read(struct brcmstb_gisb_arb_device *gdev, int reg) if (offset == -1) return 1; - return ioread32(gdev-base + offset); + if (gdev-big_endian) + return ioread32be(gdev-base + offset); + else + return ioread32(gdev-base + offset); } static void gisb_write(struct brcmstb_gisb_arb_device *gdev, u32 val, int reg) @@ -115,7 +119,11 @@ static void gisb_write(struct brcmstb_gisb_arb_device *gdev, u32 val, int reg) if (offset == -1) return; - iowrite32(val, gdev-base + reg); + + if (gdev-big_endian) + iowrite32be(val, gdev-base + reg); + else + iowrite32(val, gdev-base + reg); } static ssize_t gisb_arb_get_timeout(struct device *dev, @@ -300,6 +308,7 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev) return -EINVAL; } gdev-gisb_offsets = of_id-data; + gdev-big_endian = of_device_is_big_endian(dn); err = devm_request_irq(pdev-dev, timeout_irq, brcmstb_gisb_timeout_handler, 0, pdev-name, -- Florian -- 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-storage: support for more than 8 LUNs
This is necessary to make some storage arrays work. Some storage devices have more than 8 LUNs. In addition you can hook up a WideSCSI bus to USB. In these cases even level 2 devices can have more than 8 devices. For them it is necessary to simply believe the class specific command and report its result back to the SCSI layer. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/storage/usb.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index d468d02..cf2fafb 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct *work) !(us-fflags US_FL_SCM_MULT_TARG)) { mutex_lock(us-dev_mutex); us-max_lun = usb_stor_Bulk_max_lun(us); + /* +* Allow proper scanning of devices that present more than 8 LUNs +* While not affecting other devices that may need the previous behavior +*/ + if (us-max_lun 8) + us_to_host(us)-max_lun = us-max_lun+1; mutex_unlock(us-dev_mutex); } scsi_scan_host(us_to_host(us)); -- 1.8.4.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] usb: gadget: udc-core: independent registration of gadgets and gadget drivers
Hi guys, On Mon, Feb 9, 2015 at 10:00 PM, Alan Stern st...@rowland.harvard.edu wrote: On Mon, 9 Feb 2015, Krzysztof Opasiak wrote: Why bother matching by name? Why not simply take the first available UDC? Because you may have more than one udc. This would allow to pick one by name just like using configfs interface. Clearly it would be more flexible to allow the user to do the matching, the way configfs does (sysfs too). Main feature of my path is not only deferred binding of gadget driver, but also possibility to register/unregister udc at any time. This is useful for user who can load, for example, udc module if needed and unload it safely, not touching gadget driver. We can already do that with the existing code. There's no need for a patch. Also, it's not clear that the existing gadget drivers will work properly if they are unbound from one UDC and then bound again to another one. They were not written with that sort of thing in mind. What you have described is one of basics configfs features. You should be able to bind and unbind your gadget whenever you want and it should work properly after doing: ## create gadget $ echo udc.0 UDC $ echo UDC $ echo udc.1 UDC Function shouldn't care which udc it has been bound previously. Only current one is important and on each unbind each function should cleanup its state and prepare to be bound to another udc. Configfs interface doesn't prohibit this and I haven't seen any info about such restriction. Thank you Krzysztof for this explanation that makes things more clear for reviewers. It's not prohibited, but it also was never required. Therefore it may not be implemented in all gadget drivers. If some function is not working in such situation there is a bug in that function and it should be fixed. That's fine. I wasn't pointing out a fundamental limitation, just a fact that will have to be taken into account. I also don't see any restrictions to bind/unbind gadget driver few times and in case of such bug we just can fix it. I didn't see any issue with gadget drivers that I used for verification, however, to be honest, I didn't test it with all possible ones. Anyway, it should work in legacy way (one gadget driver is bound to one uds) so current behavior at least is not broken. Anyway, instead of going through all this, why not do what I suggested earlier (see http://marc.info/?l=linux-usbm=139888691230119w=2) and create a gadget bus type? That would give userspace explicit control over which gadget driver was bound to which UDC. Exactly, my patch transforms udc-core to something like tiny bus with very basic functionality. But in mentioned mailthread I see good ideas that is possible to implement with small overhead. Or maybe that's not a very good fit with the existing code, since most gadget drivers assume they will be bound to only one UDC at a time. So instead, why not create a sysfs interface that allows userspace to control which gadget drivers are bound to which UDCs? As I recall, the original problem people were complaining about was deferred probing. They didn't need fancy matching; all they wanted was the ability to bind a gadget driver to a UDC some time after the gadget driver was loaded and initialized. Something simple like Robert Baldyga's patch is enough to do that. This simplicity is also a limitation. As I mentioned before, sometimes it is needed to be able to bind/unbind gadget driver multiple times to different UDCs. A real case I faced recently is SoC with HighSpeed-only and SuperSpeed-only UDCs. SuperSpeed-only UDC can't work on USB 2.0 speeds and vice versa. The system has USB3.0 USB connector with soldered HS lines from mentioned HS-only and SS lines from SS-only UDCs. Each UDC has it's own device driver, so if we want to use both of them with one gadget driver, we must be able to bind/unbind it multiple times to different UDCs. Another one usecase is users who can unload udc drivers without carrying about gadget drivers. Third usecase is, for example, developers who can switch between dummy_hcd and real UDC hardware without unloading gadget driver. I'll work on improved version and will send new patch soon... Best regards, Ruslan 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 0/2] ARM: shmobile: r8a7790: add for USB-DMAC
On Mon, Feb 09, 2015 at 08:41:18AM +, yoshihiro shimoda wrote: Subject: [PATCH 0/2] ARM: shmobile: r8a7790: add for USB-DMAC Oops, I mistook this subject of cover-letter. However, actual patches are correct. Thanks, I think it would be best if you resubmitted this series, which is for the r8a7791, and the other similar series for the r8a7790 once the relevant driver changes have been accepted by their subsystem maintainer. -- 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: PROBLEM: USB isochronous urb leak on EHCI driver
That is interresting, however, I have an older kernel running an OHCI driver which is able to handle 4 codecs. Same usb hardware (codecs and hub), but older kernel on a different CPU, with much less power. This makes me believe that there's a solution to make it work... Of course there is: Install an OHCI host controller and use it to drive your codecs. It should work fine. What do you mean by that? The host controller is embedded in the i.MX CPU... Changing the CPU is not really an option to me. Unless I am missing something? I didn't realize you were talking about an i.MX-based system. On a computer with a free PCI slot, it's easy to add an OHCI controller. iMX isn't as accomodating. If there's no way to add an extra USB controller to your system then the only choice is to upgrade the driver software. Alan Stern Okay; I did my homeworks. We've loaded kernel V3.16 (Oct 14th, 2015) on an i.MX51 plattform and the problem is still there. Unless an important change occured in V3.19, it appears that the latest kernel is not the solution for us. So we're still not able to use 4 codecs on our i.MX plattform. So just to make things clearer: - We have customers waiting for a solution with that hardware (this hardware is already delivred AND used); - We have important comittments and severe penalties ($$$) if we're not able to deliver on time (due for March 15th); - We've already looked at a hardware solution, which corresponds to replace current units ($), so that is not really an option for us; So as a last resort, I'm wondering, where is the USB expert who could help us solving our problem? Any suggestions? If we are to get into debugging the USB driver, we would do it with the current kernel used (V2.6.31). What are the better tools to get into that? I guess a USB analyzer (hardware) would be the smart thing? Any brand name to suggest? Any other ideas for a solution will be really appreciated. Regards, Michael Tessier. -- 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/2] usb: chipidea: udc: do not run udc directly when start udc in otg fsm mode
From: Li Jun b47...@freescale.com For A-device, when load gadget driver, we should not run udc either as this will be controlled by otg fsm. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/udc.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 4254792..c85a9ee 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1689,8 +1689,9 @@ static int ci_udc_start(struct usb_gadget *gadget, ci-driver = driver; /* Start otg fsm for B-device */ - if (ci_otg_is_fsm_mode(ci) ci-fsm.id) { - ci_hdrc_otg_fsm_start(ci); + if (ci_otg_is_fsm_mode(ci)) { + if (ci-fsm.id) + ci_hdrc_otg_fsm_start(ci); return retval; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] Fix 2 otg fsm mode issues for chipidea usb driver
From: Li Jun b47...@freescale.com Hi Peter, The 2 patches are to fix the problems I found in otg fsm mode. The 1st patch is to fix one system hang issue in otg fsm mode if runtime PM is enabled, but can not cover vbus glitch case you found on i.MX6SX. The 2nd patch is to stop the ci_udc_start also for otg A-device since otg fsm will fully control when should set it to run. If you think the 1st patch change should go to my previous runtime PM patchset for otg fsm mode, please let me know. Li Jun (2): usb: chipidea: do not update vbus_active when probe in otg fsm mode usb: chipidea: udc: do not run udc directly when start udc in otg fsm mode drivers/usb/chipidea/core.c |8 drivers/usb/chipidea/udc.c |5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usb: chipidea: do not update vbus_active when probe in otg fsm mode
From: Li Jun b47...@freescale.com In otg fsm mode, vbus_active will be updated by otg fsm, this is to fix the system hang issue if load gadget driver with vbus turned on, because when binding gadget driver, if vbus_active is set, udc core will pull up DP by enable R/S bit but controller is already runtime suspended. Signed-off-by: Li Jun jun...@freescale.com --- drivers/usb/chipidea/core.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5a186e3..74fea4f 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -798,11 +798,11 @@ static int ci_hdrc_probe(struct platform_device *pdev) : CI_ROLE_GADGET; } - /* only update vbus status for peripheral */ - if (ci-role == CI_ROLE_GADGET) - ci_handle_vbus_change(ci); - if (!ci_otg_is_fsm_mode(ci)) { + /* only update vbus status for peripheral */ + if (ci-role == CI_ROLE_GADGET) + ci_handle_vbus_change(ci); + ret = ci_role_start(ci, ci-role); if (ret) { dev_err(dev, can't start %s role\n, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html