Re: [PATCH V2 3/3] usb/dwc3: Fix Pedning isoc
On 8/29/2012 11:01 PM, Sergei Shtylyov wrote: Hello. On 08/29/2012 08:30 PM, Pratyush Anand wrote: If xfernotready is received and there is no request in request_list then PENDING flag must be set, so that next request in ep queue is executed. In case of isoc transfer, if xfornotready is alreday elapsed and even first request has not been queued to request_list, then issue END TRANSFER, so that you can receive xfernotready again and can have notion of current microframe. Signed-off-by: Pratyush Anand pratyush.an...@st.com You didn't correct any typos as promised. :-( Ohhh.. I sent patches from wrong old branch...So sorry.. :( WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 3/3] usb/dwc3: Fix Pending isoc
If xfernotready is received and there is no request in request_list then PENDING flag must be set, so that next request in ep queue is executed. In case of isoc transfer, if xfernotready is already elapsed and even first request has not been queued to request_list, then issue END TRANSFER, so that you can receive xfernotready again and can have notion of current microframe. Signed-off-by: Pratyush Anand pratyush.an...@st.com --- drivers/usb/dwc3/gadget.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index d6d31cf..f13daa2 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1043,6 +1043,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc, if (list_empty(dep-request_list)) { dev_vdbg(dwc-dev, ISOC ep %s run out for requests.\n, dep-name); + dep-flags |= DWC3_EP_PENDING_REQUEST; return; } @@ -1106,6 +1107,16 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) if (dep-flags DWC3_EP_PENDING_REQUEST) { int ret; + /* +* If xfernotready is already elapsed and it is a case +* of isoc transfer, then issue END TRANSFER, so that +* you can receive xfernotready again and can have +* notion of current microframe. +*/ + if (usb_endpoint_xfer_isoc(dep-endpoint.desc)) { + dwc3_stop_active_transfer(dwc, dep-number); + return 0; + } ret = __dwc3_gadget_kick_transfer(dep, 0, true); if (ret ret != -EBUSY) { struct dwc3 *dwc = dep-dwc; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 18/21] usb/gadget: remove string override from struct usb_composite_driver
On 08/29/2012 10:58 PM, Michal Nazarewicz wrote: @@ -1625,8 +1612,6 @@ int usb_composite_probe(struct usb_composite_driver *driver) if (!driver-name) driver-name = composite; - if (!driver-iProduct) - driver-iProduct = driver-name; This leaves gadgets that do not provide name explicitly with no product name, doesn't it? At the moment, if gadget does not provide any product string, the name given in usb_composite_driver is used. If even that is not provided, composite is assumed. As far as I can tell, this change removes that functionality.USB_GADGET_PRODUCT_IDX $ git grep USB_GADGET_COMPOSITE_OPTIONS | sed 's/:.*//' | sort compo $ git grep USB_GADGET_PRODUCT_IDX].s | sed 's/:.*//' | sort have $ diff -u compo have --- compo 2012-08-30 09:05:05.084992590 +0200 +++ have2012-08-30 09:07:38.786684500 +0200 @@ -1,6 +1,7 @@ drivers/usb/gadget/acm_ms.c drivers/usb/gadget/audio.c drivers/usb/gadget/cdc2.c +drivers/usb/gadget/composite.c drivers/usb/gadget/ether.c drivers/usb/gadget/g_ffs.c drivers/usb/gadget/gmidi.c @@ -14,4 +15,3 @@ drivers/usb/gadget/tcm_usb_gadget.c drivers/usb/gadget/webcam.c drivers/usb/gadget/zero.c -include/linux/usb/composite.h That means _all_ gadgets provide a product strings. If you look at .s than you notice that none of them is set to . That makes driver-iProduct not required. Only g_ffs, g_multi and g_mass_storage used this field and here I forgot to initialize desc.id while I moved the entry to the string array. driver-gadget_driver = composite_driver_template; gadget_driver =driver-gadget_driver; Sebastian -- 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 19/21] usb/gadget: Provide a default implementation of default manufacturer string
On 08/29/2012 11:05 PM, Michal Nazarewicz wrote: Sebastian Andrzej Siewiorbige...@linutronix.de writes: Some gadgets provide custom entry here. Some may override it with an etntry that is also created by composite if there was no value sumbitted at all. This patch removes all custom manufacturer strings which are the same as these which are created by composite. Then it moves the creation of the default manufacturer string to usb_composite_overwrite_options() in case no command line argument has been used and the entry is still an empty string. By doing this we get rid of the global variable manufacturer in composite. It's actually called composite_manufacturer. :) Ach you right. Signed-off-by: Sebastian Andrzej Siewiorbige...@linutronix.de Acked-by: Michal Nazarewiczmin...@mina86.com diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index b477d9e..20a1ace 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1672,6 +1628,28 @@ void usb_composite_setup_continue(struct usb_composite_dev *cdev) spin_unlock_irqrestore(cdev-lock, flags); } +static char *composite_default_mfr(struct usb_gadget *gadget) +{ + char *mfr; + int len; + + len = snprintf(NULL, 0, %s %s with %s, init_utsname()-sysname, + init_utsname()-release, gadget-name); I'd probably explicitly sum strlen() of the strings, but either is fine. + if (len 0) + return NULL; Can that even happen? According to the man page, yes. Looking at the code no. So, let me remove this. + len = min(32, len + 1); Is min really needed here? Just do ++len and let allocator worry. ;) Okay. + mfr = kmalloc(len, GFP_KERNEL); + if (!mfr) + return NULL; + len = snprintf(mfr, len, %s %s with %s, init_utsname()-sysname, + init_utsname()-release, gadget-name); + if (len 0) { Again, can that even happen? Not according to current code. I get rid of it. Sebastian -- 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 19/21 v2] usb/gadget: Provide a default implementation of default manufacturer string
Some gadgets provide custom entry here. Some may override it with an etntry that is also created by composite if there was no value sumbitted at all. This patch removes all custom manufacturer strings which are the same as these which are created by composite. Then it moves the creation of the default manufacturer string to usb_composite_overwrite_options() in case no command line argument has been used and the entry is still an empty string. By doing this we get rid of the global variable composite_manufacturer in composite. Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/acm_ms.c | 12 +-- drivers/usb/gadget/audio.c |9 + drivers/usb/gadget/cdc2.c | 10 +- drivers/usb/gadget/composite.c | 67 --- drivers/usb/gadget/ether.c | 12 +-- drivers/usb/gadget/f_hid.c |1 - drivers/usb/gadget/f_mass_storage.c |1 - drivers/usb/gadget/f_midi.c |1 - drivers/usb/gadget/g_ffs.c |1 - drivers/usb/gadget/gmidi.c |1 - drivers/usb/gadget/hid.c| 10 +- drivers/usb/gadget/mass_storage.c |2 -- drivers/usb/gadget/multi.c |2 -- drivers/usb/gadget/ncm.c| 12 +-- drivers/usb/gadget/nokia.c |1 - drivers/usb/gadget/printer.c|8 + drivers/usb/gadget/serial.c |9 + drivers/usb/gadget/zero.c |9 + include/linux/usb/composite.h |2 +- 19 files changed, 32 insertions(+), 138 deletions(-) diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index 35db6aa..d280f16 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -15,7 +15,6 @@ */ #include linux/kernel.h -#include linux/utsname.h #include u_serial.h @@ -87,13 +86,9 @@ static const struct usb_descriptor_header *otg_desc[] = { NULL, }; - /* string IDs are assigned dynamically */ - -static char manufacturer[50]; - static struct usb_string strings_dev[] = { - [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_MANUFACTURER_IDX].s = , [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ @@ -186,11 +181,6 @@ static int __init acm_ms_bind(struct usb_composite_dev *cdev) * Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ - - /* device descriptor strings: manufacturer, product */ - snprintf(manufacturer, sizeof manufacturer, %s %s with %s, - init_utsname()-sysname, init_utsname()-release, - gadget-name); status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail1; diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 8857b6e..1f81e0f 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c @@ -12,7 +12,6 @@ /* #define VERBOSE_DEBUG */ #include linux/kernel.h -#include linux/utsname.h #include linux/usb/composite.h #include gadget_chips.h @@ -33,10 +32,8 @@ USB_GADGET_COMPOSITE_OPTIONS(); /* string IDs are assigned dynamically */ -static char manufacturer[50]; - static struct usb_string strings_dev[] = { - [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_MANUFACTURER_IDX].s = , [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ @@ -161,10 +158,6 @@ static int __init audio_bind(struct usb_composite_dev *cdev) __constant_cpu_to_le16(0x0300 | 0x0099); } - /* device descriptor strings: manufacturer, product */ - snprintf(manufacturer, sizeof manufacturer, %s %s with %s, - init_utsname()-sysname, init_utsname()-release, - cdev-gadget-name); status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail; diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 8966bde..4e2060b 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -11,7 +11,6 @@ */ #include linux/kernel.h -#include linux/utsname.h #include linux/module.h #include u_ether.h @@ -90,10 +89,8 @@ static const struct usb_descriptor_header *otg_desc[] = { /* string IDs are assigned dynamically */ -static char manufacturer[50]; - static struct usb_string strings_dev[] = { - [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_MANUFACTURER_IDX].s = , [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ @@ -182,15 +179,10 @@ static int __init cdc_bind(struct usb_composite_dev *cdev) cpu_to_le16(0x0300 | 0x0099); } - /* Allocate string descriptor numbers ...
Re: [PATCH 18/21 v2] usb/gadget: remove string override from struct usb_composite_driver
The struct usb_composite_driver members iProduct, iSerial and iManufacturer can be entered directly via the string array. There is no need for them to appear here. Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- v1..v2: initialize iProduct with proper id drivers/usb/gadget/composite.c| 29 +++-- drivers/usb/gadget/g_ffs.c|4 ++-- drivers/usb/gadget/mass_storage.c |4 ++-- drivers/usb/gadget/multi.c|4 ++-- include/linux/usb/composite.h | 12 5 files changed, 13 insertions(+), 40 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index f3e46a6..b477d9e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -904,11 +904,7 @@ static int get_string(struct usb_composite_dev *cdev, * check if the string has not been overridden. */ if (cdev-manufacturer_override == id) - str = cdriver-iManufacturer ?: composite_manufacturer; - else if (cdev-product_override == id) - str = cdriver-iProduct; - else if (cdev-serial_override == id) - str = cdriver-iSerialNumber; + str = composite_manufacturer; else str = NULL; if (str) { @@ -1483,26 +1479,17 @@ static int composite_bind(struct usb_gadget *gadget, /* string overrides */ if (!cdev-desc.iManufacturer) { - if (!cdriver-iManufacturer) - snprintf(composite_manufacturer, -sizeof composite_manufacturer, -%s %s with %s, -init_utsname()-sysname, -init_utsname()-release, -gadget-name); + snprintf(composite_manufacturer, + sizeof composite_manufacturer, + %s %s with %s, + init_utsname()-sysname, + init_utsname()-release, + gadget-name); cdev-manufacturer_override = override_id(cdev, cdev-desc.iManufacturer); } - if (!cdev-desc.iProduct cdriver-iProduct) - cdev-product_override = - override_id(cdev, cdev-desc.iProduct); - - if (cdriver-iSerialNumber) - cdev-serial_override = - override_id(cdev, cdev-desc.iSerialNumber); - /* has userspace failed to provide a serial number? */ if (cdriver-needs_serial !cdev-desc.iSerialNumber) WARNING(cdev, userspace failed to provide iSerialNumber\n); @@ -1625,8 +1612,6 @@ int usb_composite_probe(struct usb_composite_driver *driver) if (!driver-name) driver-name = composite; - if (!driver-iProduct) - driver-iProduct = driver-name; driver-gadget_driver = composite_driver_template; gadget_driver = driver-gadget_driver; diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 16d1887..eaaed19 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c @@ -117,7 +117,7 @@ static const struct usb_descriptor_header *gfs_otg_desc[] = { /* String IDs are assigned dynamically */ static struct usb_string gfs_strings[] = { [USB_GADGET_MANUFACTURER_IDX].s = , - [USB_GADGET_PRODUCT_IDX].s = , + [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, [USB_GADGET_SERIAL_IDX].s = , #ifdef CONFIG_USB_FUNCTIONFS_RNDIS { .s = FunctionFS + RNDIS }, @@ -172,7 +172,6 @@ static __refdata struct usb_composite_driver gfs_driver = { .max_speed = USB_SPEED_HIGH, .bind = gfs_bind, .unbind = gfs_unbind, - .iProduct = DRIVER_DESC, }; static DEFINE_MUTEX(gfs_lock); @@ -360,6 +359,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) ret = usb_string_ids_tab(cdev, gfs_strings); if (unlikely(ret 0)) goto error; + gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; for (i = func_num; --i; ) { ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c index 6f5a3b2..50da3c8 100644 --- a/drivers/usb/gadget/mass_storage.c +++ b/drivers/usb/gadget/mass_storage.c @@ -85,7 +85,7 @@ static const struct usb_descriptor_header *otg_desc[] = { static struct usb_string strings_dev[] = { [USB_GADGET_MANUFACTURER_IDX].s = , - [USB_GADGET_PRODUCT_IDX].s = , + [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ }; @@ -160,6 +160,7 @@ static int __init msg_bind(struct usb_composite_dev *cdev) status = usb_string_ids_tab(cdev, strings_dev);
Re: JMicron 20337 (152d:2338) and 3TB
Hello, Is there anything new in this regard? I have the same issue with 3T drive. Thanks! -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] usb/dummy_hcd: use -ESHUTDOWN if an URB can not be assigned to an UDC EP
* Alan Stern | 2012-08-29 13:31:54 [-0400]: On Wed, 29 Aug 2012, Sebastian Andrzej Siewior wrote: --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -194,6 +194,7 @@ static void intr_complete (struct urb *urb) /* software-driven interface shutdown */ case -ENOENT: /* urb killed */ case -ESHUTDOWN:/* hardware gone */ +case -EPIPE: netif_dbg(dev, ifdown, dev-net, intr shutdown, code %d\n, status); return; No, that's not right. For one thing, the error is -EPROTO, not -EPIPE. Ehm yes. But aside from that, usbnet has a comment a little farther down: /* NOTE: not throttling like RX/TX, since this endpoint * already polls infrequently */ Corresponding to this, there's a comment in dummy-hcd: case PIPE_INTERRUPT: /* FIXME is it urb-interval since the last xfer? * this almost certainly polls too fast. */ So the problem appears to be that dummy-hcd doesn't implement the right interval for periodic transfers. I'd accept a patch to fix that. That is also missing. However, we are pulled down, that means find_endpoint() in dummy returns always NULL due to !active(). So we never get here to delay the interrupt packet. If we remove that active check in find address then we have the same problem once dummy_disable() disables the endpoint on UDC side. *Now* we can't find a match between URB and endpoint. As a result we _loop_ in timer interrupt and won't leave. Once we deliver a packet we start the URB list from the beginning. If the bandwith runs = 0 and we have BULK URBs only left then we might end. That means we have either to account bandwith for the failures and consider the bandwith also for INT URBs or something like this: --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -1668,6 +1668,7 @@ static void dummy_timer(unsigned long _dum_hcd) unsigned long flags; int limit, total; int i; + int errors_allowed = 4; /* simplistic model for one frame's bandwidth */ switch (dum-gadget.speed) { @@ -1708,6 +1709,8 @@ static void dummy_timer(unsigned long _dum_hcd) } restart: + if (!errors_allowed) + goto leave_now; list_for_each_entry_safe(urbp, tmp, dum_hcd-urbp_list, urbp_list) { struct urb *urb; struct dummy_request*req; @@ -1740,6 +1743,7 @@ restart: dev_dbg(dummy_dev(dum_hcd), no ep configured for urb %p\n, urb); + errors_allowed--; status = -EPROTO; goto return_urb; } @@ -1755,6 +1759,7 @@ restart: /* NOTE: must not be iso! */ dev_dbg(dummy_dev(dum_hcd), ep %s halted, urb %p\n, ep-ep.name, urb); + errors_allowed--; status = -EPIPE; goto return_urb; } @@ -1864,6 +1869,7 @@ return_urb: goto restart; } +leave_now: if (list_empty(dum_hcd-urbp_list)) { usb_put_dev(dum_hcd-udev); Or we loop and loop and loop⊠Alan Stern Sebastian -- 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 v8 13/13] usb: otg: nop: add dt support
Added device tree support for nop transceiver driver and updated the Documentation with device tree binding information for am33xx platform. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- .../devicetree/bindings/usb/am33xx-usb.txt |3 +++ drivers/usb/otg/nop-usb-xceiv.c| 10 ++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt index b0caac3..e2702df 100644 --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt @@ -14,3 +14,6 @@ AM33XX MUSB GLUE 500mA when operating in host mode. - usb0-phy : phandle for usb0 NOP PHY - usb1-phy : phandle for usb1 NOP PHY + +NOP USB PHY + - compatible : Should be nop-xceiv-usb diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index 7e0dba3..fdbc285 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c @@ -27,6 +27,7 @@ */ #include linux/module.h +#include linux/of.h #include linux/platform_device.h #include linux/dma-mapping.h #include linux/usb/otg.h @@ -194,12 +195,21 @@ static int __devexit nop_usb_xceiv_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id nop_xceiv_id_table[] = { + { .compatible = nop-xceiv-usb }, + {} +}; +MODULE_DEVICE_TABLE(of, nop_xceiv_id_table); +#endif + static struct platform_driver nop_usb_xceiv_driver = { .probe = nop_usb_xceiv_probe, .remove = __devexit_p(nop_usb_xceiv_remove), .driver = { .name = nop_usb_xceiv, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(nop_xceiv_id_table), }, }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 07/13] usb: musb: dsps: add dt support
From: Ajay Kumar Gupta ajay.gu...@ti.com Added device tree support for dsps musb glue driver and updated the Documentation with device tree binding information. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- .../devicetree/bindings/usb/am33xx-usb.txt | 14 + drivers/usb/musb/musb_dsps.c | 60 +--- 2 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt new file mode 100644 index 000..ca8fa56 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt @@ -0,0 +1,14 @@ +AM33XX MUSB GLUE + - compatible : Should be ti,musb-am33xx + - ti,hwmods : must be usb_otg_hs + - multipoint : Should be 1 indicating the musb controller supports + multipoint. This is a MUSB configuration-specific setting. + - num_eps : Specifies the number of endpoints. This is also a + MUSB configuration-specific setting. Should be set to 16 + - ram_bits : Specifies the ram address size. Should be set to 12 + - port0_mode : Should be 3 to represent OTG. 1 signifies HOST and 2 + represents PERIPHERAL. + - port1_mode : Should be 1 to represent HOST. 3 signifies OTG and 2 + represents PERIPHERAL. + - power : Should be 250. This signifies the controller can supply upto + 500mA when operating in host mode. diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 25e395b..2c104bf 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -31,6 +31,7 @@ #include linux/init.h #include linux/io.h +#include linux/of.h #include linux/err.h #include linux/platform_device.h #include linux/dma-mapping.h @@ -46,6 +47,10 @@ #include musb_core.h +#ifdef CONFIG_OF +static const struct of_device_id musb_dsps_of_match[]; +#endif + /** * avoid using musb_readx()/musb_writex() as glue layer should not be * dependent on musb core layer symbols. @@ -486,6 +491,8 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) struct device *dev = glue-dev; struct platform_device *pdev = to_platform_device(dev); struct musb_hdrc_platform_data *pdata = dev-platform_data; + struct device_node *np = pdev-dev.of_node; + struct musb_hdrc_config *config; struct platform_device *musb; struct resource *res; struct resource resources[2]; @@ -552,14 +559,40 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) glue-musb[id] = musb; - pdata-platform_ops = dsps_ops; - ret = platform_device_add_resources(musb, resources, 2); if (ret) { dev_err(dev, failed to add resources\n); goto err2; } + if (np) { + pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + dev_err(pdev-dev, + failed to allocate musb platfrom data\n); + ret = -ENOMEM; + goto err2; + } + + config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL); + if (!config) { + dev_err(pdev-dev, + failed to allocate musb hdrc config\n); + goto err2; + } + + of_property_read_u32(np, num_eps, (u32 *)config-num_eps); + of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits); + sprintf(res_name, port%d_mode, id); + of_property_read_u32(np, res_name, (u32 *)pdata-mode); + of_property_read_u32(np, power, (u32 *)pdata-power); + config-multipoint = of_property_read_bool(np, multipoint); + + pdata-config = config; + } + + pdata-platform_ops = dsps_ops; + ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); if (ret) { dev_err(dev, failed to add platform_data\n); @@ -591,14 +624,22 @@ static void __devexit dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id) static int __devinit dsps_probe(struct platform_device *pdev) { - const struct platform_device_id *id = platform_get_device_id(pdev); - const struct dsps_musb_wrapper *wrp = - (struct dsps_musb_wrapper *)id-driver_data; + struct device_node *np = pdev-dev.of_node; + const struct of_device_id *match; + const struct dsps_musb_wrapper *wrp; struct dsps_glue *glue; struct resource *iomem; u32 __iomem *usbss; int ret, i; + match =
[PATCH v8 05/13] usb: musb: am335x: add support for dual instance
AM335x and TI81xx platform has dual musb controller so updating the musb_dspc.c to support the same. Changes: - Moved otg_workaround timer to glue structure - Moved static local variable last_timer to glue structure - PHY on/off related cleanups Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- drivers/usb/musb/musb_dsps.c | 112 +- 1 files changed, 66 insertions(+), 46 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 36130ba..f883c25 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -106,6 +106,8 @@ struct dsps_musb_wrapper { /* miscellaneous stuff */ u32 musb_core_offset; u8 poll_seconds; + /* number of musb instances */ + u8 instances; }; /** @@ -113,16 +115,18 @@ struct dsps_musb_wrapper { */ struct dsps_glue { struct device *dev; - struct platform_device *musb; /* child musb pdev */ + struct platform_device *musb[2];/* child musb pdev */ const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */ - struct timer_list timer;/* otg_workaround timer */ - u32 __iomem *usb_ctrl; + struct timer_list timer[2]; /* otg_workaround timer */ + unsigned long last_timer[2];/* last timer data for each instance */ + u32 __iomem *usb_ctrl[2]; u8 usbss_rev; }; /** * musb_dsps_phy_control - phy on/off * @glue: struct dsps_glue * + * @id: musb instance * @on: flag for phy to be switched on or off * * This is to enable the PHY using usb_ctrl register in system control @@ -131,11 +135,11 @@ struct dsps_glue { * XXX: This function will be removed once we have a seperate driver for * control module */ -static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on) +static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on) { u32 usbphycfg; - usbphycfg = __raw_readl(glue-usb_ctrl); + usbphycfg = __raw_readl(glue-usb_ctrl[id]); if (on) { if (glue-usbss_rev == MUSB_USBSS_REV_816X) { @@ -158,7 +162,7 @@ static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on) glue-usbss_rev == MUSB_USBSS_REV_33XX) usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; } - __raw_writel(usbphycfg, glue-usb_ctrl); + __raw_writel(usbphycfg, glue-usb_ctrl[id]); } /** * dsps_musb_enable - enable interrupts @@ -207,8 +211,8 @@ static void otg_timer(unsigned long _musb) struct musb *musb = (void *)_musb; void __iomem *mregs = musb-mregs; struct device *dev = musb-controller; - struct platform_device *pdev = to_platform_device(dev-parent); - struct dsps_glue *glue = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct dsps_glue *glue = dev_get_drvdata(dev-parent); const struct dsps_musb_wrapper *wrp = glue-wrp; u8 devctl; unsigned long flags; @@ -244,7 +248,7 @@ static void otg_timer(unsigned long _musb) case OTG_STATE_B_IDLE: devctl = dsps_readb(mregs, MUSB_DEVCTL); if (devctl MUSB_DEVCTL_BDEVICE) - mod_timer(glue-timer, + mod_timer(glue-timer[pdev-id], jiffies + wrp-poll_seconds * HZ); else musb-xceiv-state = OTG_STATE_A_IDLE; @@ -258,9 +262,8 @@ static void otg_timer(unsigned long _musb) static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout) { struct device *dev = musb-controller; - struct platform_device *pdev = to_platform_device(dev-parent); - struct dsps_glue *glue = platform_get_drvdata(pdev); - static unsigned long last_timer; + struct platform_device *pdev = to_platform_device(dev); + struct dsps_glue *glue = dev_get_drvdata(dev-parent); if (timeout == 0) timeout = jiffies + msecs_to_jiffies(3); @@ -270,22 +273,23 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout) musb-xceiv-state == OTG_STATE_A_WAIT_BCON)) { dev_dbg(musb-controller, %s active, deleting timer\n, otg_state_string(musb-xceiv-state)); - del_timer(glue-timer); - last_timer = jiffies; + del_timer(glue-timer[pdev-id]); + glue-last_timer[pdev-id] = jiffies; return; } - if (time_after(last_timer, timeout) timer_pending(glue-timer)) { + if (time_after(glue-last_timer[pdev-id], timeout) +
[PATCH v8 04/13] usb: musb: kill global and static for multi instance
From: Ajay Kumar Gupta ajay.gu...@ti.com Moved global variable musb_debugfs_root and static variable old_state to 'struct musb' to help support multi instance of musb controller as present on AM335x platform. Also removed the global variable orig_dma_mask and filled the dev-dma_mask with parent device's dma_mask. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- drivers/usb/musb/musb_core.c| 22 +++--- drivers/usb/musb/musb_core.h|4 drivers/usb/musb/musb_debugfs.c |8 +++- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 7499fbb..44c8caa 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -100,6 +100,7 @@ #include linux/platform_device.h #include linux/io.h #include linux/idr.h +#include linux/dma-mapping.h #include musb_core.h @@ -1797,10 +1798,9 @@ static const struct attribute_group musb_attr_group = { static void musb_irq_work(struct work_struct *data) { struct musb *musb = container_of(data, struct musb, irq_work); - static int old_state; - if (musb-xceiv-state != old_state) { - old_state = musb-xceiv-state; + if (musb-xceiv-state != musb-xceiv_old_state) { + musb-xceiv_old_state = musb-xceiv-state; sysfs_notify(musb-controller-kobj, NULL, mode); } } @@ -2060,11 +2060,6 @@ fail0: /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just * bridge to a platform device; this driver then suffices. */ - -#ifndef CONFIG_MUSB_PIO_ONLY -static u64 *orig_dma_mask; -#endif - static int __devinit musb_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; @@ -2083,10 +2078,6 @@ static int __devinit musb_probe(struct platform_device *pdev) return -ENOMEM; } -#ifndef CONFIG_MUSB_PIO_ONLY - /* clobbered by use_dma=n */ - orig_dma_mask = dev-dma_mask; -#endif status = musb_init_controller(dev, irq, base); if (status 0) iounmap(base); @@ -2096,7 +2087,8 @@ static int __devinit musb_probe(struct platform_device *pdev) static int __devexit musb_remove(struct platform_device *pdev) { - struct musb *musb = dev_to_musb(pdev-dev); + struct device *dev = pdev-dev; + struct musb *musb = dev_to_musb(dev); void __iomem*ctrl_base = musb-ctrl_base; /* this gets called on rmmod. @@ -2109,9 +2101,9 @@ static int __devexit musb_remove(struct platform_device *pdev) musb_free(musb); iounmap(ctrl_base); - device_init_wakeup(pdev-dev, 0); + device_init_wakeup(dev, 0); #ifndef CONFIG_MUSB_PIO_ONLY - pdev-dev.dma_mask = orig_dma_mask; + dma_set_mask(dev, *dev-parent-dma_mask); #endif return 0; } diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index a69ffd6..c158aac 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -437,6 +437,10 @@ struct musb { #ifdef MUSB_CONFIG_PROC_FS struct proc_dir_entry *proc_entry; #endif + int xceiv_old_state; +#ifdef CONFIG_DEBUG_FS + struct dentry *debugfs_root; +#endif }; static inline struct musb *gadget_to_musb(struct usb_gadget *g) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 40a37c9..1d6e8af 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -103,8 +103,6 @@ static const struct musb_register_map musb_regmap[] = { { }/* Terminating Entry */ }; -static struct dentry *musb_debugfs_root; - static int musb_regdump_show(struct seq_file *s, void *unused) { struct musb *musb = s-private; @@ -241,7 +239,7 @@ int __devinit musb_init_debugfs(struct musb *musb) struct dentry *file; int ret; - root = debugfs_create_dir(musb, NULL); + root = debugfs_create_dir(dev_name(musb-controller), NULL); if (!root) { ret = -ENOMEM; goto err0; @@ -261,7 +259,7 @@ int __devinit musb_init_debugfs(struct musb *musb) goto err1; } - musb_debugfs_root = root; + musb-debugfs_root = root; return 0; @@ -274,5 +272,5 @@ err0: void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb) { - debugfs_remove_recursive(musb_debugfs_root); + debugfs_remove_recursive(musb-debugfs_root); } -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 01/13] usb: musb: dsps: add phy control logic to glue
From: Santhapuri, Damodar damodar.santhap...@ti.com AM335x uses NOP transceiver driver and need to enable builtin PHY by writing into usb_ctrl register available in system control module register space. This is being added at musb glue driver layer untill a separate system control module driver is available. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- arch/arm/mach-omap2/board-ti8168evm.c |1 - arch/arm/mach-omap2/omap_phy_internal.c | 35 arch/arm/plat-omap/include/plat/usb.h |5 +- drivers/usb/musb/musb_dsps.c| 87 +-- 4 files changed, 73 insertions(+), 55 deletions(-) diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c index d4c8392..0c7c098 100644 --- a/arch/arm/mach-omap2/board-ti8168evm.c +++ b/arch/arm/mach-omap2/board-ti8168evm.c @@ -26,7 +26,6 @@ #include plat/usb.h static struct omap_musb_board_data musb_board_data = { - .set_phy_power = ti81xx_musb_phy_power, .interface_type = MUSB_INTERFACE_ULPI, .mode = MUSB_OTG, .power = 500, diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c index d52651a..d80bb16 100644 --- a/arch/arm/mach-omap2/omap_phy_internal.c +++ b/arch/arm/mach-omap2/omap_phy_internal.c @@ -254,38 +254,3 @@ void am35x_set_mode(u8 musb_mode) omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2); } - -void ti81xx_musb_phy_power(u8 on) -{ - void __iomem *scm_base = NULL; - u32 usbphycfg; - - scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K); - if (!scm_base) { - pr_err(system control module ioremap failed\n); - return; - } - - usbphycfg = __raw_readl(scm_base + USBCTRL0); - - if (on) { - if (cpu_is_ti816x()) { - usbphycfg |= TI816X_USBPHY0_NORMAL_MODE; - usbphycfg = ~TI816X_USBPHY_REFCLK_OSC; - } else if (cpu_is_ti814x()) { - usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN - | USBPHY_DPINPUT | USBPHY_DMINPUT); - usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN - | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL); - } - } else { - if (cpu_is_ti816x()) - usbphycfg = ~TI816X_USBPHY0_NORMAL_MODE; - else if (cpu_is_ti814x()) - usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; - - } - __raw_writel(usbphycfg, scm_base + USBCTRL0); - - iounmap(scm_base); -} diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index 548a4c8..c2aa4ae 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h @@ -95,7 +95,6 @@ extern void am35x_musb_reset(void); extern void am35x_musb_phy_power(u8 on); extern void am35x_musb_clear_irq(void); extern void am35x_set_mode(u8 musb_mode); -extern void ti81xx_musb_phy_power(u8 on); /* AM35x */ /* USB 2.0 PHY Control */ @@ -120,8 +119,8 @@ extern void ti81xx_musb_phy_power(u8 on); #define CONF2_DATPOL (1 1) /* TI81XX specific definitions */ -#define USBCTRL0 0x620 -#define USBSTAT0 0x624 +#define MUSB_USBSS_REV_816X0x9 +#define MUSB_USBSS_REV_814X0xb /* TI816X PHY controls bits */ #define TI816X_USBPHY0_NORMAL_MODE (1 0) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 84d8181..960258d 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -116,9 +116,46 @@ struct dsps_glue { struct platform_device *musb; /* child musb pdev */ const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */ struct timer_list timer;/* otg_workaround timer */ + u32 __iomem *usb_ctrl; + u8 usbss_rev; }; /** + * musb_dsps_phy_control - phy on/off + * @glue: struct dsps_glue * + * @on: flag for phy to be switched on or off + * + * This is to enable the PHY using usb_ctrl register in system control + * module space. + * + * XXX: This function will be removed once we have a seperate driver for + * control module + */ +static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on) +{ + u32 usbphycfg; + + usbphycfg = __raw_readl(glue-usb_ctrl); + + if (on) { + if (glue-usbss_rev == MUSB_USBSS_REV_816X) { + usbphycfg |= TI816X_USBPHY0_NORMAL_MODE; + usbphycfg = ~TI816X_USBPHY_REFCLK_OSC; + } else if (glue-usbss_rev == MUSB_USBSS_REV_814X) { + usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN + | USBPHY_DPINPUT | USBPHY_DMINPUT); +
[PATCH v8 00/13] usb: musb: adding multi instance support
This series of patches adds, a) Multi instances support in musb driver b) DT support for musb_dsps glue layer c) DT support for NOP transceiver AM33xx and TI81xx has dual musb controller and has two usb PHY of same type. This patch series uses 'phandle' based API devm_usb_get_phy_by_phandle() to get the PHY of same type. This API support is being added by Kishon's patch discussed at [1] The series applies to felipe/master [1] branch + Vaibhav baseport patches on his tree at [4] + Kishon's multi phy patches on Felipe's branch 'xceiv' + Kishon's patch on phandle at [2] + Damodar's recent patch at [3] + Ajay's Damodar's patches at [5] and [6] included in this series 1. http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=summary 2. http://marc.info/?l=linux-usbm=134070369306112w=2 3. http://marc.info/?l=linux-usbm=134200284230689w=2 4. https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-staging 5. http://marc.info/?l=linux-usbm=134200285530701w=2 6. http://marc.info/?l=linux-usbm=134208820028625w=2 Changes from v7: - patches rebased on felipe/master branch verified - included additional two patches 0001 0002 as part of this series which are already submitted [5] [6] Changes from v6: - Removed parent_pdev to get glue and used dev_get_getdrv() as per Felipe's comment - use pr_debug() instead of pr_info() as per Felipe's comment Changes from v5: - Removed musb-id as per Felipe's comment - used nop_ida as per Felipe's comment Changes from v4: - Fixed Felipe's comment for adding EXPORT_SYMBOL_GPL() - Fixed Felipe's comment on using dev_set_mask() Changes from v3: - Fixed Kishon's comment on removing id from phy struct and removing unneeded #else part. Changes from v2: - Fixed Sergei's comment on not using address prefix in musb_dsps glue and nop transceiver dt dats. - Also removed the ti string in compatible property for nop data. Changes from v1: - Defined musb_ida to manage core ids based on Felipe's comment in [PATCH 01/11] Ajay Kumar Gupta (7): usb: musb: dsps: enable phy control for am335x usb: musb: kill global and static for multi instance usb: musb: dsps: add dt support arm/dts: am33xx: Add dt data for usbss arm/dts: am33xx: add dt data for usb nop phy usb: musb: dsps: remove explicit NOP device creation arm/dts: am33xx: add phy phandle to usbss Ravi Babu (3): usb: musb: add musb_ida for multi instance support usb: musb: am335x: add support for dual instance usb: otg: nop: add dt support Santhapuri, Damodar (3): usb: musb: dsps: add phy control logic to glue usb: otg: nop: add support for multiple tranceiver usb: musb: dsps: get the PHY using phandle api .../devicetree/bindings/usb/am33xx-usb.txt | 19 ++ arch/arm/boot/dts/am33xx.dtsi | 21 ++ arch/arm/mach-omap2/board-ti8168evm.c |1 - arch/arm/mach-omap2/omap_phy_internal.c| 35 --- arch/arm/plat-omap/include/plat/usb.h |6 +- drivers/usb/musb/am35x.c | 44 ++- drivers/usb/musb/blackfin.c| 28 ++- drivers/usb/musb/da8xx.c | 36 ++- drivers/usb/musb/davinci.c | 38 ++- drivers/usb/musb/musb_core.c | 53 +++- drivers/usb/musb/musb_core.h |6 + drivers/usb/musb/musb_debugfs.c|8 +- drivers/usb/musb/musb_dsps.c | 281 +++- drivers/usb/musb/omap2430.c| 26 ++- drivers/usb/musb/tusb6010.c| 30 ++- drivers/usb/musb/ux500.c | 33 ++- drivers/usb/otg/nop-usb-xceiv.c| 64 - include/linux/usb/nop-usb-xceiv.h |4 +- 18 files changed, 523 insertions(+), 210 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt -- 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 v8 02/13] usb: musb: dsps: enable phy control for am335x
From: Ajay Kumar Gupta ajay.gu...@ti.com Enabled the phy control logic for am335x also based on usbss revision register. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- arch/arm/plat-omap/include/plat/usb.h |1 + drivers/usb/musb/musb_dsps.c | 17 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index c2aa4ae..6459b10 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h @@ -121,6 +121,7 @@ extern void am35x_set_mode(u8 musb_mode); /* TI81XX specific definitions */ #define MUSB_USBSS_REV_816X0x9 #define MUSB_USBSS_REV_814X0xb +#define MUSB_USBSS_REV_33XX0xd /* TI816X PHY controls bits */ #define TI816X_USBPHY0_NORMAL_MODE (1 0) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 960258d..e62fa05 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -141,16 +141,21 @@ static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on) if (glue-usbss_rev == MUSB_USBSS_REV_816X) { usbphycfg |= TI816X_USBPHY0_NORMAL_MODE; usbphycfg = ~TI816X_USBPHY_REFCLK_OSC; - } else if (glue-usbss_rev == MUSB_USBSS_REV_814X) { - usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN - | USBPHY_DPINPUT | USBPHY_DMINPUT); - usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN - | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL); + } else if (glue-usbss_rev == MUSB_USBSS_REV_814X || + glue-usbss_rev == MUSB_USBSS_REV_33XX) { + usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN); + usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN; + if (glue-usbss_rev == MUSB_USBSS_REV_814X) { + usbphycfg = ~(USBPHY_DPINPUT | USBPHY_DMINPUT); + usbphycfg |= USBPHY_DPOPBUFCTL + | USBPHY_DMOPBUFCTL; + } } } else { if (glue-usbss_rev == MUSB_USBSS_REV_816X) usbphycfg = ~TI816X_USBPHY0_NORMAL_MODE; - else if (glue-usbss_rev == MUSB_USBSS_REV_814X) + else if (glue-usbss_rev == MUSB_USBSS_REV_814X || + glue-usbss_rev == MUSB_USBSS_REV_33XX) usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; } __raw_writel(usbphycfg, glue-usb_ctrl); -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 08/13] arm/dts: am33xx: Add dt data for usbss
From: Ajay Kumar Gupta ajay.gu...@ti.com Added device tree data for usbss on am33xx. There are two musb controllers on am33xx platform so have port0_mode and port1_mode additional data. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 59509c4..778b95e 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -154,5 +154,16 @@ #size-cells = 0; ti,hwmods = i2c3; }; + + usb_otg_hs: usb_otg_hs { + compatible = ti,musb-am33xx; + ti,hwmods = usb_otg_hs; + multipoint = 1; + num_eps = 16; + ram_bits = 12; + port0_mode = 3; + port1_mode = 3; + power = 250; + }; }; }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 10/13] usb: musb: dsps: remove explicit NOP device creation
From: Ajay Kumar Gupta ajay.gu...@ti.com As NOP device node is now added in am33xx tree so remove the call which creates the NOP platform_device. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- drivers/usb/musb/musb_dsps.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 2c104bf..2775496 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -418,8 +418,7 @@ static int dsps_musb_init(struct musb *musb) /* mentor core register starts at offset of 0x400 from musb base */ musb-mregs += wrp-musb_core_offset; - /* Register NOP driver */ - usb_nop_xceiv_register(); + /* Get the NOP PHY */ musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb-xceiv)) return -ENODEV; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 03/13] usb: musb: add musb_ida for multi instance support
Added musb_ida in musb_core.c to manage the multi core ids. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- drivers/usb/musb/am35x.c | 42 -- drivers/usb/musb/blackfin.c | 26 -- drivers/usb/musb/da8xx.c | 34 -- drivers/usb/musb/davinci.c | 34 -- drivers/usb/musb/musb_core.c | 31 +++ drivers/usb/musb/musb_core.h |2 ++ drivers/usb/musb/musb_dsps.c | 25 ++--- drivers/usb/musb/omap2430.c | 26 -- drivers/usb/musb/tusb6010.c | 26 -- drivers/usb/musb/ux500.c | 33 +++-- 10 files changed, 210 insertions(+), 69 deletions(-) diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 29b1d60..457f25e 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c @@ -459,6 +459,7 @@ static int __devinit am35x_probe(struct platform_device *pdev) struct clk *clk; int ret = -ENOMEM; + int musbid; glue = kzalloc(sizeof(*glue), GFP_KERNEL); if (!glue) { @@ -466,38 +467,47 @@ static int __devinit am35x_probe(struct platform_device *pdev) goto err0; } - musb = platform_device_alloc(musb-hdrc, -1); + /* get the musb id */ + musbid = musb_get_id(pdev-dev, GFP_KERNEL); + if (musbid 0) { + dev_err(pdev-dev, failed to allocate musb id\n); + ret = -ENOMEM; + goto err1; + } + + musb = platform_device_alloc(musb-hdrc, musbid); if (!musb) { dev_err(pdev-dev, failed to allocate musb device\n); - goto err1; + goto err2; } phy_clk = clk_get(pdev-dev, fck); if (IS_ERR(phy_clk)) { dev_err(pdev-dev, failed to get PHY clock\n); ret = PTR_ERR(phy_clk); - goto err2; + goto err3; } clk = clk_get(pdev-dev, ick); if (IS_ERR(clk)) { dev_err(pdev-dev, failed to get clock\n); ret = PTR_ERR(clk); - goto err3; + goto err4; } ret = clk_enable(phy_clk); if (ret) { dev_err(pdev-dev, failed to enable PHY clock\n); - goto err4; + goto err5; } ret = clk_enable(clk); if (ret) { dev_err(pdev-dev, failed to enable clock\n); - goto err5; + goto err6; } + musb-id= musbid; musb-dev.parent= pdev-dev; musb-dev.dma_mask = am35x_dmamask; musb-dev.coherent_dma_mask = am35x_dmamask; @@ -515,38 +525,41 @@ static int __devinit am35x_probe(struct platform_device *pdev) pdev-num_resources); if (ret) { dev_err(pdev-dev, failed to add resources\n); - goto err6; + goto err7; } ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); if (ret) { dev_err(pdev-dev, failed to add platform_data\n); - goto err6; + goto err7; } ret = platform_device_add(musb); if (ret) { dev_err(pdev-dev, failed to register musb device\n); - goto err6; + goto err7; } return 0; -err6: +err7: clk_disable(clk); -err5: +err6: clk_disable(phy_clk); -err4: +err5: clk_put(clk); -err3: +err4: clk_put(phy_clk); -err2: +err3: platform_device_put(musb); +err2: + musb_put_id(pdev-dev, musbid); + err1: kfree(glue); @@ -558,6 +571,7 @@ static int __devexit am35x_remove(struct platform_device *pdev) { struct am35x_glue *glue = platform_get_drvdata(pdev); + musb_put_id(pdev-dev, glue-musb-id); platform_device_del(glue-musb); platform_device_put(glue-musb); clk_disable(glue-clk); diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 2a80dec..e8cff9b 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -455,6 +455,7 @@ static int __devinit bfin_probe(struct platform_device *pdev) struct bfin_glue*glue; int ret = -ENOMEM; + int musbid; glue = kzalloc(sizeof(*glue), GFP_KERNEL); if (!glue) { @@ -462,12 +463,21 @@ static int __devinit bfin_probe(struct platform_device *pdev)
[PATCH v8 11/13] usb: musb: dsps: get the PHY using phandle api
From: Santhapuri, Damodar damodar.santhap...@ti.com AM33xx has two PHY of same type used by each musb controller so use phandle of phy nodes to get the phy pointer. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- .../devicetree/bindings/usb/am33xx-usb.txt |2 ++ drivers/usb/musb/musb_dsps.c |5 - 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt index ca8fa56..b0caac3 100644 --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt @@ -12,3 +12,5 @@ AM33XX MUSB GLUE represents PERIPHERAL. - power : Should be 250. This signifies the controller can supply upto 500mA when operating in host mode. + - usb0-phy : phandle for usb0 NOP PHY + - usb1-phy : phandle for usb1 NOP PHY diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 2775496..46a2344 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -409,9 +409,11 @@ static int dsps_musb_init(struct musb *musb) { struct device *dev = musb-controller; struct platform_device *pdev = to_platform_device(dev); + struct platform_device *parent_pdev = to_platform_device(dev-parent); struct dsps_glue *glue = dev_get_drvdata(dev-parent); const struct dsps_musb_wrapper *wrp = glue-wrp; void __iomem *reg_base = musb-ctrl_base; + char name[10]; u32 rev, val; int status; @@ -419,7 +421,8 @@ static int dsps_musb_init(struct musb *musb) musb-mregs += wrp-musb_core_offset; /* Get the NOP PHY */ - musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2); + sprintf(name, usb%d-phy, pdev-id); + musb-xceiv = devm_usb_get_phy_by_phandle(parent_pdev-dev, name); if (IS_ERR_OR_NULL(musb-xceiv)) return -ENODEV; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 09/13] arm/dts: am33xx: add dt data for usb nop phy
From: Ajay Kumar Gupta ajay.gu...@ti.com AM33xx has two musb controller and they have one NOP PHY each. Added the device tree data for NOP PHY. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- arch/arm/boot/dts/am33xx.dtsi |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 778b95e..789c384 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -155,6 +155,14 @@ ti,hwmods = i2c3; }; + usb0_phy: phy0 { + compatible = nop-xceiv-usb; + }; + + usb1_phy: phy1 { + compatible = nop-xceiv-usb; + }; + usb_otg_hs: usb_otg_hs { compatible = ti,musb-am33xx; ti,hwmods = usb_otg_hs; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 06/13] usb: otg: nop: add support for multiple tranceiver
From: Santhapuri, Damodar damodar.santhap...@ti.com Currently we have one single nop transceiver support as same is defined as a global variable in drivers/usb/otg/nop-usb-xceiv.c. This need to be changed to support multiple otg controller each using nop transceiver on a platform such as am335x. Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com Signed-off-by: Ravi Babu ravib...@ti.com --- drivers/usb/musb/am35x.c |2 +- drivers/usb/musb/blackfin.c |2 +- drivers/usb/musb/da8xx.c |2 +- drivers/usb/musb/davinci.c|4 +- drivers/usb/musb/musb_dsps.c |8 +++--- drivers/usb/musb/tusb6010.c |4 +- drivers/usb/otg/nop-usb-xceiv.c | 54 - include/linux/usb/nop-usb-xceiv.h |4 +- 8 files changed, 60 insertions(+), 20 deletions(-) diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 457f25e..e3099fc 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c @@ -399,7 +399,7 @@ static int am35x_musb_exit(struct musb *musb) data-set_phy_power(0); usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return 0; } diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index e8cff9b..32b4fe4 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -427,7 +427,7 @@ static int bfin_musb_exit(struct musb *musb) gpio_free(musb-config-gpio_vrsel); usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return 0; } diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index ce11d20..f86a1c7 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -451,7 +451,7 @@ static int da8xx_musb_exit(struct musb *musb) phy_off(); usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return 0; } diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 606bfd0..e12d20a 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -437,7 +437,7 @@ static int davinci_musb_init(struct musb *musb) fail: usb_put_phy(musb-xceiv); unregister: - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return -ENODEV; } @@ -485,7 +485,7 @@ static int davinci_musb_exit(struct musb *musb) phy_off(); usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return 0; } diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index f883c25..25e395b 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -413,7 +413,7 @@ static int dsps_musb_init(struct musb *musb) /* mentor core register starts at offset of 0x400 from musb base */ musb-mregs += wrp-musb_core_offset; - /* NOP driver needs change if supporting dual instance */ + /* Register NOP driver */ usb_nop_xceiv_register(); musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb-xceiv)) @@ -447,7 +447,7 @@ static int dsps_musb_init(struct musb *musb) return 0; err0: usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return status; } @@ -462,9 +462,9 @@ static int dsps_musb_exit(struct musb *musb) /* Shutdown the on-chip PHY and its PLL. */ musb_dsps_phy_control(glue, pdev-id, 0); - /* NOP driver needs change if supporting dual instance */ + /* Unregister NOP driver */ usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return 0; } diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index dc4d75e..71c4778 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1117,7 +1117,7 @@ done: iounmap(sync); usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); } return ret; } @@ -1133,7 +1133,7 @@ static int tusb_musb_exit(struct musb *musb) iounmap(musb-sync_va); usb_put_phy(musb-xceiv); - usb_nop_xceiv_unregister(); + usb_nop_xceiv_unregister(musb-xceiv); return 0; } diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index e52e35e..7e0dba3 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c @@ -32,30 +32,69 @@ #include linux/usb/otg.h #include linux/usb/nop-usb-xceiv.h #include linux/slab.h +#include linux/idr.h struct nop_usb_xceiv {
Re: [PATCH 19/21 v2] usb/gadget: Provide a default implementation of default manufacturer string
Sebastian Andrzej Siewior bige...@linutronix.de writes: Some gadgets provide custom entry here. Some may override it with an etntry that is also created by composite if there was no value sumbitted at all. This patch removes all custom manufacturer strings which are the same as these which are created by composite. Then it moves the creation of the default manufacturer string to usb_composite_overwrite_options() in case no command line argument has been used and the entry is still an empty string. By doing this we get rid of the global variable composite_manufacturer in composite. Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de Acked-by: Michal Nazarewicz min...@mina86.com diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index b477d9e..1f0e59c 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1695,6 +1667,11 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev, if (covr-manufacturer) { desc-iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id; dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr-manufacturer; + + } else if (!strlen(dev_str[USB_GADGET_MANUFACTURER_IDX].s)) { I'd still go with: + } else if (!*dev_str[USB_GADGET_MANUFACTURER_IDX].s) { but no pressure. + desc-iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id; + cdev-def_manufacturer = composite_default_mfr(cdev-gadget); + dev_str[USB_GADGET_MANUFACTURER_IDX].s = cdev-def_manufacturer; } if (covr-product) { -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz(o o) ooo +email/xmpp: m...@google.com--ooO--(_)--Ooo-- pgpJUm5TPsLm9.pgp Description: PGP signature
[PATCH] usb: otg: mxs-phy: Fix mx23 operation
From: Mike Thompson mpthomp...@gmail.com Currently mx23 fails to enumerate a USB device: [ 1.30] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.52] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.74] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.96] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 2.18] hub 1-0:1.0: unable to enumerate USB device on port 1 Use a kernel workqueue to asynchronously delay the setting of ENHOSTDISCONDETECT bit until after higher level hub connect/reset processing is complete. Prematurely setting the bit prevents the connection processing from completing and not setting it prevents disconnect from being detected. No delay is needed for clearing of ENHOSTDISCONDETECT. Successfully tested on mx23-olinuxino (micro, mini and maxi variants) and mx28evk. Signed-off-by: Mike Thompson mpthomp...@gmail.com Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/otg/mxs-phy.c | 34 +++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c index c1a67cb..8188380 100644 --- a/drivers/usb/otg/mxs-phy.c +++ b/drivers/usb/otg/mxs-phy.c @@ -20,6 +20,7 @@ #include linux/delay.h #include linux/err.h #include linux/io.h +#include linux/workqueue.h #define DRIVER_NAME mxs_phy @@ -34,9 +35,12 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250 + struct mxs_phy { struct usb_phy phy; struct clk *clk; + struct delayed_work enhostdiscondetect_work; }; #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) @@ -62,6 +66,7 @@ static int mxs_phy_init(struct usb_phy *phy) clk_prepare_enable(mxs_phy-clk); mxs_phy_hw_init(mxs_phy); + INIT_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, NULL); return 0; } @@ -76,13 +81,34 @@ static void mxs_phy_shutdown(struct usb_phy *phy) clk_disable_unprepare(mxs_phy-clk); } +static void mxs_phy_enhostdiscondetect_delay(struct work_struct *ws) +{ + struct mxs_phy *mxs_phy = container_of(ws, struct mxs_phy, + enhostdiscondetect_work.work); + + /* Enable HOSTDISCONDETECT after delay. */ + dev_dbg(mxs_phy-phy.dev, Setting ENHOSTDISCONDETECT\n); + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, + mxs_phy-phy.io_priv + HW_USBPHY_CTRL_SET); +} + static int mxs_phy_on_connect(struct usb_phy *phy, int port) { + struct mxs_phy *mxs_phy = to_mxs_phy(phy); + dev_dbg(phy-dev, Connect on port %d\n, port); - mxs_phy_hw_init(to_mxs_phy(phy)); - writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, - phy-io_priv + HW_USBPHY_CTRL_SET); + mxs_phy_hw_init(mxs_phy); + + /* +* Delay enabling ENHOSTDISCONDETECT so that connection and +* reset processing can be completed for the root hub. +*/ + dev_dbg(phy-dev, Delaying setting ENHOSTDISCONDETECT\n); + PREPARE_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, + mxs_phy_enhostdiscondetect_delay); + schedule_delayed_work(mxs_phy-enhostdiscondetect_work, + msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY)); return 0; } @@ -91,6 +117,8 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port) { dev_dbg(phy-dev, Disconnect on port %d\n, port); + /* No need to delay before clearing ENHOSTDISCONDETECT. */ + dev_dbg(phy-dev, Clearing ENHOSTDISCONDETECT\n); writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, phy-io_priv + HW_USBPHY_CTRL_CLR); -- 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] usb: otg: mxs-phy: Improve mxs phy initialization
From: Mike Thompson mpthomp...@gmail.com Improve error reporting for USB device reset and initialization. Add device definitions for proper use of the clear register with the specific bits required to power up the USB device upon initialization and to power down upon shutdown. Signed-off-by: Mike Thompson mpthomp...@gmail.com Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/otg/mxs-phy.c | 57 - 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c index 8188380..93a48ce 100644 --- a/drivers/usb/otg/mxs-phy.c +++ b/drivers/usb/otg/mxs-phy.c @@ -25,10 +25,19 @@ #define DRIVER_NAME mxs_phy #define HW_USBPHY_PWD 0x00 +#define HW_USBPHY_PWD_SET 0x04 +#define HW_USBPHY_PWD_CLR 0x08 #define HW_USBPHY_CTRL 0x30 #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define BM_USBPHY_PWD_RXPWDRX BIT(20) +#define BM_USBPHY_PWD_RXPWDIFF BIT(19) +#define BM_USBPHY_PWD_RXPWD1PT1BIT(18) +#define BM_USBPHY_PWD_RXPWDENV BIT(17) +#define BM_USBPHY_PWD_TXPWDV2I BIT(12) +#define BM_USBPHY_PWD_TXPWDIBIAS BIT(11) +#define BM_USBPHY_PWD_TXPWDFS BIT(10) #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENUTMILEVEL3BIT(15) @@ -45,36 +54,72 @@ struct mxs_phy { #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) -static void mxs_phy_hw_init(struct mxs_phy *mxs_phy) +static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { + int ret; void __iomem *base = mxs_phy-phy.io_priv; - stmp_reset_block(base + HW_USBPHY_CTRL); + /* +* Use global device reset function. Side effect of this +* is to soft reset USBPHY_PWD, USBPHY_TX, USBPHY_RX, +* and USBPHY_CTRL registers. +*/ + ret = stmp_reset_block(base + HW_USBPHY_CTRL); + if (ret) { + dev_err(mxs_phy-phy.dev, USB PHY reset failed: %d\n, ret); + return ret; + } - /* Power up the PHY */ - writel_relaxed(0, base + HW_USBPHY_PWD); + /* Enable the USB PHY clock after reset. */ + writel_relaxed(BM_USBPHY_CTRL_SFTRST | + BM_USBPHY_CTRL_CLKGATE, + base + HW_USBPHY_CTRL_CLR); + + /* Power up the PHY after reset. */ + writel_relaxed(BM_USBPHY_PWD_RXPWDRX | + BM_USBPHY_PWD_RXPWDIFF | + BM_USBPHY_PWD_RXPWD1PT1 | + BM_USBPHY_PWD_RXPWDENV | + BM_USBPHY_PWD_TXPWDV2I | + BM_USBPHY_PWD_TXPWDIBIAS | + BM_USBPHY_PWD_TXPWDFS, + base + HW_USBPHY_PWD_CLR); /* enable FS/LS device */ writel_relaxed(BM_USBPHY_CTRL_ENUTMILEVEL2 | BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + + return 0; } static int mxs_phy_init(struct usb_phy *phy) { + int ret; struct mxs_phy *mxs_phy = to_mxs_phy(phy); clk_prepare_enable(mxs_phy-clk); - mxs_phy_hw_init(mxs_phy); + ret = mxs_phy_hw_init(mxs_phy); INIT_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, NULL); - return 0; + return ret; } static void mxs_phy_shutdown(struct usb_phy *phy) { struct mxs_phy *mxs_phy = to_mxs_phy(phy); + /* Power down USB receivers and transmitters. */ + writel_relaxed(BM_USBPHY_PWD_RXPWDRX | + BM_USBPHY_PWD_RXPWDIFF | + BM_USBPHY_PWD_RXPWD1PT1 | + BM_USBPHY_PWD_RXPWDENV | + BM_USBPHY_PWD_TXPWDV2I | + BM_USBPHY_PWD_TXPWDIBIAS | + BM_USBPHY_PWD_TXPWDFS, + phy-io_priv + HW_USBPHY_PWD_SET); + + /* Disable USB PHY clock. */ writel_relaxed(BM_USBPHY_CTRL_CLKGATE, phy-io_priv + HW_USBPHY_CTRL_SET); -- 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: detected XactErr
On Wed, 29 Aug 2012, Gary E. Miller wrote: Yo Alan! On Wed, 29 Aug 2012 17:08:43 -0400 (EDT) Alan Stern st...@rowland.harvard.edu wrote: Uh, not easy. This is a production machine. Acceptable downtime is very small. There should be a way to turn it off at runtime. No, there shouldn't. It's a debugging feature; while debugging we want to see all occurrences of these messages. Production machines should not run debugging kernels. We'll have to agree to disagree. My experience is the fun bugs only happen in production. A big NASA study years ago proved that after spending $1M per line of code that only half the bugs could be caught before live missions. Well, put it this way: Production machines should not run debugging kernels unless you're actually trying to debug something. For normal operation, a debugging kernel should not be used. Remember, the purpose of a debugging kernel is not to provoke bugs or notify you that the bugs exist. Normal kernels do these things just fine. The purpose is to help find the cause of bugs. 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/2] usb: otg: mxs-phy: Fix mx23 operation
From: Mike Thompson mpthomp...@gmail.com Currently mx23 fails to enumerate a USB device: [ 1.30] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.52] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.74] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.96] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 2.18] hub 1-0:1.0: unable to enumerate USB device on port 1 Use a kernel workqueue to asynchronously delay the setting of ENHOSTDISCONDETECT bit until after higher level hub connect/reset processing is complete. Prematurely setting the bit prevents the connection processing from completing and not setting it prevents disconnect from being detected. No delay is needed for clearing of ENHOSTDISCONDETECT. Successfully tested on mx23-olinuxino (micro, mini and maxi variants) and mx28evk. Signed-off-by: Mike Thompson mpthomp...@gmail.com Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/otg/mxs-phy.c | 34 +++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c index c1a67cb..8188380 100644 --- a/drivers/usb/otg/mxs-phy.c +++ b/drivers/usb/otg/mxs-phy.c @@ -20,6 +20,7 @@ #include linux/delay.h #include linux/err.h #include linux/io.h +#include linux/workqueue.h #define DRIVER_NAME mxs_phy @@ -34,9 +35,12 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250 + struct mxs_phy { struct usb_phy phy; struct clk *clk; + struct delayed_work enhostdiscondetect_work; }; #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) @@ -62,6 +66,7 @@ static int mxs_phy_init(struct usb_phy *phy) clk_prepare_enable(mxs_phy-clk); mxs_phy_hw_init(mxs_phy); + INIT_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, NULL); return 0; } @@ -76,13 +81,34 @@ static void mxs_phy_shutdown(struct usb_phy *phy) clk_disable_unprepare(mxs_phy-clk); } +static void mxs_phy_enhostdiscondetect_delay(struct work_struct *ws) +{ + struct mxs_phy *mxs_phy = container_of(ws, struct mxs_phy, + enhostdiscondetect_work.work); + + /* Enable HOSTDISCONDETECT after delay. */ + dev_dbg(mxs_phy-phy.dev, Setting ENHOSTDISCONDETECT\n); + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, + mxs_phy-phy.io_priv + HW_USBPHY_CTRL_SET); +} + static int mxs_phy_on_connect(struct usb_phy *phy, int port) { + struct mxs_phy *mxs_phy = to_mxs_phy(phy); + dev_dbg(phy-dev, Connect on port %d\n, port); - mxs_phy_hw_init(to_mxs_phy(phy)); - writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, - phy-io_priv + HW_USBPHY_CTRL_SET); + mxs_phy_hw_init(mxs_phy); + + /* +* Delay enabling ENHOSTDISCONDETECT so that connection and +* reset processing can be completed for the root hub. +*/ + dev_dbg(phy-dev, Delaying setting ENHOSTDISCONDETECT\n); + PREPARE_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, + mxs_phy_enhostdiscondetect_delay); + schedule_delayed_work(mxs_phy-enhostdiscondetect_work, + msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY)); return 0; } @@ -91,6 +117,8 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port) { dev_dbg(phy-dev, Disconnect on port %d\n, port); + /* No need to delay before clearing ENHOSTDISCONDETECT. */ + dev_dbg(phy-dev, Clearing ENHOSTDISCONDETECT\n); writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, phy-io_priv + HW_USBPHY_CTRL_CLR); -- 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: How to associate lsusb bus/device with /dev entry?
Just out of curiosity... Why did you post two nearly identical versions of this message? On Wed, 29 Aug 2012, Mathew Binkley wrote: Hi all. How can you associate a USB Bus:Device info with a /dev/entry? There is no general way to do this because most USB devices don't have entries under /dev. However I gather that you're talking about USB mass storage devices in particular; for these it is possible. Below I have copy/pasted lsusb and /sys/block entries for two drives plugged into the same USB bus. When there was only one USB key, I could simply take the Bus number (with leading 0's trimmed off) and ls -alh /sys/block | grep /usbB/ # B is the bus number That heuristic fails when there is more than one drive on the same bus. The lsusb Device number has no discernible match in the corresponding /sys/block path Can anyone give me any advice? There is no direct way. You have to do a search. --- lsusb: Bus 003 Device 013: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick Bus 003 Device 015: ID 0781:5406 SanDisk Corp. Cruzer Micro U3 /sys/block: sdc - /sys/devices/pci:00/:00:16.2/usb3/3-3/3-3:1.0/host16/target16:0:0/16:0:0:0/block/sdc sdd - /sys/devices/pci:00/:00:16.2/usb3/3-4/3-4:1.0/host18/target18:0:0/18:0:0:0/block/sdd From the /sys/block/sdX directory, go up 6 levels and read the contents of the busnum and devnum files there. You'll have to look through the various sdX entries to find the proper match. Here an example from my system (this is a DVD drive rather than a flash drive, so I'm using srX instead of sdX, but the idea is the same): lsusb: Bus 001 Device 002: ID 059f:0202 LaCie, Ltd StudioDrive USB2 /sys/block/sr0 - ../devices/pci:00/:00:1f.1/ata2/host1/target1:0:0/1:0:0:0/block/sr0/ /sys/block/sr1 - ../devices/pci:00/:00:1d.7/usb1/1-4/1-4:2.0/host2/target2:0:0/2:0:0:0/block/sr1/ $ cat /sys/block/sr0/../../../../../../busnum cat: /sys/block/sr0/../../../../../../busnum: No such file or directory $ cat /sys/block/sr1/../../../../../../busnum 1 $ cat /sys/block/sr1/../../../../../../devnum 2 The busnum and devnum values for sr1 match the Bus and Device values from lsusb, so the LaCie StudioDrive is /dev/sr1. Of course, you could tell just by looking at the full path that the sr0 device wasn't USB. But if it was, the busnum/devnum values would be different from those of the LaCie drive. 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: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI
On Thu, 30 Aug 2012, Lan Tianyu wrote: OK. This can resolve the root hub problems. And this let me think of the same problem for non-root hub on the motherboard(e.g ehci has integrated hub under root hub). Their ports also have acpi information. I think we also need to find some place to set DeviceRemovable for them and power resource should be at the integrated hub ports because the usb devices are acctually attached to them. right? Yes. Here you probably want the ACPI information to override the information provided by the integrated hub's hub descriptor. You can do this from within hub_configure(), at the point where you were going to add the second call to get_hub_descriptor(). 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: [RFC] usb/dummy_hcd: use -ESHUTDOWN if an URB can not be assigned to an UDC EP
On Thu, 30 Aug 2012, Sebastian Andrzej Siewior wrote: So the problem appears to be that dummy-hcd doesn't implement the right interval for periodic transfers. I'd accept a patch to fix that. That is also missing. However, we are pulled down, that means find_endpoint() in dummy returns always NULL due to !active(). So we never get here to delay the interrupt packet. You're missing the point. The test of the interrupt URB's interval should be done _before_ find_endpoint() is called. That's how real host controllers work; they don't try to contact interrupt endpoints during frames that aren't in the endpoint's schedule. (The same goes for isochronous endpoints... but dummy-hcd currently doesn't support isochronous at all.) 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: JMicron 20337 (152d:2338) and 3TB
On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Hello, Is there anything new in this regard? I have the same issue with 3T drive. What are you referring to? What issue? 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: [RFC PATCH 2/2] USB: Set usb port's DevicerRemovable according acpi information in EHCI
On 2012年8月30日 22:21:15, Alan Stern wrote: Yes. Here you probably want the ACPI information to override the information provided by the integrated hub's hub descriptor. You can do this from within hub_configure(), at the point where you were going to add the second call to get_hub_descriptor(). Yeah. This also can cover root hub. So we don't need to add additional routine for root hub, right? 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: Virtualbox/Vmware usb device is working but on installed linux not.
Please use Reply-To-All so that your messages get sent to the mailing list as well as to me. On Thu, 30 Aug 2012, adam ? wrote: Ok my friend have the same error. Will be this patch added to new kernel? I will submit it. By the way, what is a Joss Optical device? What does it do? 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: [RFC] usb/dummy_hcd: use -ESHUTDOWN if an URB can not be assigned to an UDC EP
On 08/30/2012 04:28 PM, Alan Stern wrote: On Thu, 30 Aug 2012, Sebastian Andrzej Siewior wrote: So the problem appears to be that dummy-hcd doesn't implement the right interval for periodic transfers. I'd accept a patch to fix that. That is also missing. However, we are pulled down, that means find_endpoint() in dummy returns always NULL due to !active(). So we never get here to delay the interrupt packet. You're missing the point. The test of the interrupt URB's interval should be done _before_ find_endpoint() is called. The endpoint has a last_io field which could be used for that (which isn't used right now at all) so I though it would be handy to consider that. However, for that we need the endpoint… In that case I would have to extend urbp for by an last_io member. That's how real host controllers work; they don't try to contact interrupt endpoints during frames that aren't in the endpoint's schedule. Yes but they know to which endpoint the particular URB belongs. dummy just wakes up and says I have no memory of you and completes it. (The same goes for isochronous endpoints... but dummy-hcd currently doesn't support isochronous at all.) Alan Stern Sebastian -- 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 associate lsusb bus/device with /dev entry?
On 08/30/2012 09:18 AM, Alan Stern wrote: Just out of curiosity... Why did you post two nearly identical versions of this message? I subscribed to the email list yesterday, sent my message 5 minutes later, and after I'd sent it Majordomo sent me an email requiring me to send a confirmation email in order to subscribe. I sent the confirmation email to Majordomo, waited 5 minutes, saw someone else's patch email come through but didn't see my original email come through, so I figured Majordomo had sent it to /dev/null because I wasn't a confirmed subsubscriber when I sent it. So I sent it again. Wasn't trying to spam the list. Mat -- 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 associate lsusb bus/device with /dev entry?
On Thu, 30 Aug 2012, Mathew Binkley wrote: On 08/30/2012 09:18 AM, Alan Stern wrote: Just out of curiosity... Why did you post two nearly identical versions of this message? I subscribed to the email list yesterday, sent my message 5 minutes later, and after I'd sent it Majordomo sent me an email requiring me to send a confirmation email in order to subscribe. I sent the confirmation email to Majordomo, waited 5 minutes, saw someone else's patch email come through but didn't see my original email come through, so I figured Majordomo had sent it to /dev/null because I wasn't a confirmed subsubscriber when I sent it. So I sent it again. Wasn't trying to spam the list. Ah, okay. It wasn't necessary to subscribe. linux-usb is an open list; anybody can post to it. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] usb/dummy_hcd: use -ESHUTDOWN if an URB can not be assigned to an UDC EP
On Thu, 30 Aug 2012, Sebastian Andrzej Siewior wrote: You're missing the point. The test of the interrupt URB's interval should be done _before_ find_endpoint() is called. The endpoint has a last_io field which could be used for that (which isn't used right now at all) so I though it would be handy to consider that. However, for that we need the endpoint� Yeah; that's not the right approach. You have to think in terms of emulating a real host controller/device controller combination. The scheduling information is maintained by the host controller driver, whereas the endpoint array in dummy-hcd holds device-side information. In that case I would have to extend urbp for by an last_io member. No, that's not good enough. The scheduling information has to survive beyond the lifetime of an individual URB. Real host controllers use various data structures to store this; it looks like dummy-hcd will have to add something equivalent to ehci-hcd's ehci_qh structure. Only a few fields will be needed, probably just period and start. And a pointer to the endpoint structure. In theory dummy-hcd should also do scheduling of periodic transfers. In practice I think we can ignore it; interrupt URBs are not likely to take up a very large fraction of the available bandwidth. That's how real host controllers work; they don't try to contact interrupt endpoints during frames that aren't in the endpoint's schedule. Yes but they know to which endpoint the particular URB belongs. dummy just wakes up and says I have no memory of you and completes it. Like I said, dummy-hcd will need a new data structure. On the bright side, this will reduce the amount of work that find_endpoint() has to do, because the endpoint pointer can be stored in the new structure. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: dwc3: correct default value of maxburst
On Thu, Aug 30, 2012 at 11:19:15AM +0900, Chanho Park wrote: -Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Thursday, August 30, 2012 1:15 AM To: Chanho Park Cc: ba...@ti.com; linux-usb@vger.kernel.org; gre...@linuxfoundation.org; Kyungmin Park Subject: Re: [PATCH] usb: dwc3: correct default value of maxburst Hi, On Wed, Aug 29, 2012 at 10:49:58AM +0900, Chanho Park wrote: This patch changes default value of maxburst to 1. When a connection is established to highspeed, the maxburst is set to 0. So, we need to check and change default value of the maxburst before setting up burst size of ep. Signed-off-by: Chanho Park chanho61.p...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/usb/dwc3/gadget.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 58fdfad..025a1bc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -437,6 +437,9 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, memset(params, 0x00, sizeof(params)); + if (!dep-endpoint.maxburst) + dep-endpoint.maxburst = 1; a better patch would be to only check maxburst if endpoint is ss-capable. You can just check if comp_desc is a valid pointer (aka not NULL). Thank you for your suggestion. I'll change the check routine like below: + if (!comp_desc) + dep-endpoint.maxburst = 1; not what I meant. What I mean is that maxburst doesn't exist in non-usb3 mode, so we shouldn't even write that bitfield to the HW, meaning we shouldn't forcefully initialize dep-endpoint.maxburst either. Although that won't cause any issues today, we cannot initialize fields we shouldn't use in the endpoint structure. Try to initialize that bitfield on params.param0 conditionally, instead of hardcoding maxburst to some wrong value. -- balbi signature.asc Description: Digital signature
Re: [PATCHv2] usb: dwc3: correct default value of maxburst
On Thu, Aug 30, 2012 at 11:58:59AM +0900, Chanho Park wrote: This patch changes default value of maxburst to 1. When a connection is established to highspeed not superspeed, the maxburst is set to 0. So, we need to check and change default value of the maxburst before setting up burst size of ep. Signed-off-by: Chanho Park chanho61.p...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/usb/dwc3/gadget.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 58fdfad..01f2d0e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -437,6 +437,9 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, memset(params, 0x00, sizeof(params)); + if (!comp_desc) + dep-endpoint.maxburst = 1; still wrong. see my other reply. NAK -- balbi signature.asc Description: Digital signature
Re: create libcomposite, v3
On Wed, Aug 29, 2012 at 10:53:33AM -0700, Greg KH wrote: On Wed, Aug 29, 2012 at 07:13:45PM +0200, Sebastian Andrzej Siewior wrote: This series creates the libcomposite and is based on Towords libcomposite, v2 It addresses the review comments of create libcomposite. The numbers were gather from size on each gadget before and after series. textdatabss dec diff filename old new old new old newold new 0 13049 0 376 0 8 0 13433 ∞ 13433 libcomposite.ko 45974 33149 1516 1496 900 808 48390 35453 ~73 -12937 g_acm_ms.ko 12451 12451 660 66056 56 13167 13167 100 0 gadgetfs.ko 20070 7218 1380 1304 184 56 21634 8578 ~39 -13056 g_audio.ko 34625 21838 1524 1536 564 424 36713 23798 ~64 -12915 g_cdc.ko 9869 8525 476 476 384 384 10729 9385 ~87 -1344 g_dbgp.ko 39697 26877 2210 2134 276 132 42183 29143 ~69 -13040 g_ether.ko 49719 37731 2364 2344 356 244 52439 40319 ~76 -12120 g_ffs.ko 25849 22972 1012 1012 136 136 26997 24120 ~89 -2877 g_file_storage.ko 18163 5368 944 900 212 72 19319 6340 ~32 -12979 g_hid.ko 35665 22896 1092 1080 492 416 37249 24392 ~65 -12857 g_mass_storage.ko 19275 6562 914 88696 24 20285 7472 ~36 -12813 g_midi.ko 69522 56557 2840 2828 1000 936 73362 60321 ~82 -13041 g_multi.ko 27398 14735 1187 1167 212 80 28797 15982 ~55 -12815 g_ncm.ko 40515 27821 2244 2264 532 464 43291 30549 ~70 -12742 g_nokia.ko 21735 8993 2064 1996 700 588 24499 11577 ~47 -12922 g_printer.ko 27330 14512 1520 1452 532 364 29382 16328 ~55 -13054 g_serial.ko 24837 13016 993 1013 136 68 25966 14097 ~54 -11869 g_webcam.ko 20219 7426 1444 1400 244 108 21907 8934 ~40 -12973 g_zero.ko 26143 14508 1216 1192 148 80 27507 15780 ~57 -11727 tcm_usb_gadget.ko Impressive numbers, nice job. I'm guessing this will come to my trees eventually through Felipe's tree? that's correct, I'm just letting things soak for a while before starting to queue ;-) I have high hopes of getting this series ready for v3.7. -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/2] usb: otg: mxs-phy: Fix mx23 operation
Hi Marek, On Thu, Aug 30, 2012 at 12:20 PM, Marek Vasut ma...@denx.de wrote: +#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250 + Why 250 what unit? ? :) It is 250 ms. We found this one to be a safe value to enable ENHOSTDISCONDETECT in our tests. + /* + * Delay enabling ENHOSTDISCONDETECT so that connection and + * reset processing can be completed for the root hub. + */ + dev_dbg(phy-dev, Delaying setting ENHOSTDISCONDETECT\n); + PREPARE_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, + mxs_phy_enhostdiscondetect_delay); + schedule_delayed_work(mxs_phy-enhostdiscondetect_work, + msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY)); Isn't this mx23 specific? Checked with Peter Chen and also the design team confirmed that the mxs phy block is the same on mx23/mx28/mx6q. Regards, Fabio Estevam -- 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: JMicron 20337 (152d:2338) and 3TB
On Thu, Aug 30, 2012 at 5:29 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Hello, Is there anything new in this regard? I have the same issue with 3T drive. What are you referring to? What issue? Alan Stern Thanks for replying! This[1] thread. I am experiencing the same issue, and could not understand if this is software or hardware issue. Regards, Alon Bar-Lev. [1] http://comments.gmane.org/gmane.linux.usb.general/62798 -- 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: otg: mxs-phy: Fix mx23 operation
Dear Fabio Estevam, Hi Marek, On Thu, Aug 30, 2012 at 12:20 PM, Marek Vasut ma...@denx.de wrote: +#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250 + Why 250 what unit? ? :) It is 250 ms. We found this one to be a safe value to enable ENHOSTDISCONDETECT in our tests. Documentation / comment would be handy ... but why 250mS and not 500mS for example? Cant it get racy here? + /* + * Delay enabling ENHOSTDISCONDETECT so that connection and + * reset processing can be completed for the root hub. + */ + dev_dbg(phy-dev, Delaying setting ENHOSTDISCONDETECT\n); + PREPARE_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, + mxs_phy_enhostdiscondetect_delay); + schedule_delayed_work(mxs_phy-enhostdiscondetect_work, + msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY)); Isn't this mx23 specific? Checked with Peter Chen and also the design team confirmed that the mxs phy block is the same on mx23/mx28/mx6q. Regards, Fabio Estevam Best regards, Marek Vasut -- 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: JMicron 20337 (152d:2338) and 3TB
On Thu, 30 Aug 2012, Alon Bar-Lev wrote: On Thu, Aug 30, 2012 at 5:29 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Hello, Is there anything new in this regard? I have the same issue with 3T drive. What are you referring to? What issue? Alan Stern Thanks for replying! This[1] thread. I am experiencing the same issue, and could not understand if this is software or hardware issue. Regards, Alon Bar-Lev. [1] http://comments.gmane.org/gmane.linux.usb.general/62798 In the end it turns out to be caused by problems in both software and hardware. The software problem is fixed in the 3.5 kernel. 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: JMicron 20337 (152d:2338) and 3TB
On Thu, Aug 30, 2012 at 9:49 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: On Thu, Aug 30, 2012 at 5:29 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Hello, Is there anything new in this regard? I have the same issue with 3T drive. What are you referring to? What issue? Alan Stern Thanks for replying! This[1] thread. I am experiencing the same issue, and could not understand if this is software or hardware issue. Regards, Alon Bar-Lev. [1] http://comments.gmane.org/gmane.linux.usb.general/62798 In the end it turns out to be caused by problems in both software and hardware. The software problem is fixed in the 3.5 kernel. Alan Stern Thank you ! I am using 3.5.2, is there any workaround for the hardware issue? Alon. -- 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: JMicron 20337 (152d:2338) and 3TB
On Thu, 30 Aug 2012, Alon Bar-Lev wrote: On Thu, Aug 30, 2012 at 9:49 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: On Thu, Aug 30, 2012 at 5:29 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Hello, Is there anything new in this regard? I have the same issue with 3T drive. What are you referring to? What issue? Alan Stern Thanks for replying! This[1] thread. I am experiencing the same issue, and could not understand if this is software or hardware issue. Regards, Alon Bar-Lev. [1] http://comments.gmane.org/gmane.linux.usb.general/62798 In the end it turns out to be caused by problems in both software and hardware. The software problem is fixed in the 3.5 kernel. Alan Stern Thank you ! I am using 3.5.2, is there any workaround for the hardware issue? There is no workaround in the current kernel. The patch below should allow you to access all 3 TB, but the patch isn't suitable for general use. Alan Stern Index: usb-3.6/drivers/scsi/sd.c === --- usb-3.6.orig/drivers/scsi/sd.c +++ usb-3.6/drivers/scsi/sd.c @@ -1900,13 +1900,11 @@ static int sd_try_rc16_first(struct scsi { if (sdp-host-max_cmd_len 16) return 0; - if (sdp-try_rc_10_first) - return 0; if (sdp-scsi_level SCSI_SPC_2) return 1; if (scsi_device_protection(sdp)) return 1; - return 0; + return 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: JMicron 20337 (152d:2338) and 3TB
On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Thank you! I will test this and report back. As this is in scsi layer, I guess it does not get the USB vendor:product to automatically apply this workaround... :( I don't entirely understand this comment. But it is true that the patch will affect every USB storage device, not just the JMicron 20337. 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: JMicron 20337 (152d:2338) and 3TB
On Thu, Aug 30, 2012 at 11:47 PM, Alan Stern st...@rowland.harvard.edu wrote: On Thu, 30 Aug 2012, Alon Bar-Lev wrote: Thank you! I will test this and report back. As this is in scsi layer, I guess it does not get the USB vendor:product to automatically apply this workaround... :( I don't entirely understand this comment. But it is true that the patch will affect every USB storage device, not just the JMicron 20337. Alan Stern I was trying to figure out if there can be automatic workaround based on USB vendor:product... If these exposed at this point then a patch can be written to effect only this device. I never traced the scsi module, but scsi_device does contain vendor, model and rev, maybe these can be mapped to the JMicron 20337 device and apply the workaround. Just a though... Thank you very much, Alon -- 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: JMicron 20337 (152d:2338) and 3TB
On Thu, 30 Aug 2012, Alon Bar-Lev wrote: I was trying to figure out if there can be automatic workaround based on USB vendor:product... If these exposed at this point then a patch can be written to effect only this device. I never traced the scsi module, but scsi_device does contain vendor, model and rev, maybe these can be mapped to the JMicron 20337 device and apply the workaround. Such a patch can be written. It would be more complicated than the one I sent you, though, and I wanted to try the easier patch first. 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 v2 1/2] usb: otg: mxs-phy: Fix mx23 operation
From: Mike Thompson mpthomp...@gmail.com Currently mx23 fails to enumerate a USB device: [ 1.30] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.52] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.74] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 1.96] hub 1-0:1.0: unable to enumerate USB device on port 1 [ 2.18] hub 1-0:1.0: unable to enumerate USB device on port 1 Use a kernel workqueue to asynchronously delay the setting of ENHOSTDISCONDETECT bit until after higher level hub connect/reset processing is complete. Prematurely setting the bit prevents the connection processing from completing and not setting it prevents disconnect from being detected. No delay is needed for clearing of ENHOSTDISCONDETECT. Successfully tested on mx23-olinuxino (micro, mini and maxi variants) and mx28evk. Signed-off-by: Mike Thompson mpthomp...@gmail.com Signed-off-by: Fabio Estevam fabio.este...@freescale.com Changes since v1: - Add comment about the delay and its unit. drivers/usb/otg/mxs-phy.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c index c1a67cb..88db976 100644 --- a/drivers/usb/otg/mxs-phy.c +++ b/drivers/usb/otg/mxs-phy.c @@ -20,6 +20,7 @@ #include linux/delay.h #include linux/err.h #include linux/io.h +#include linux/workqueue.h #define DRIVER_NAME mxs_phy @@ -34,9 +35,16 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +/* + * Amount of delay in miliseconds to safely enable ENHOSTDISCONDETECT bit + * so that connection and reset processing can be completed for the root hub. + */ +#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250 + struct mxs_phy { struct usb_phy phy; struct clk *clk; + struct delayed_work enhostdiscondetect_work; }; #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) @@ -62,6 +70,7 @@ static int mxs_phy_init(struct usb_phy *phy) clk_prepare_enable(mxs_phy-clk); mxs_phy_hw_init(mxs_phy); + INIT_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, NULL); return 0; } @@ -76,13 +85,34 @@ static void mxs_phy_shutdown(struct usb_phy *phy) clk_disable_unprepare(mxs_phy-clk); } +static void mxs_phy_enhostdiscondetect_delay(struct work_struct *ws) +{ + struct mxs_phy *mxs_phy = container_of(ws, struct mxs_phy, + enhostdiscondetect_work.work); + + /* Enable HOSTDISCONDETECT after delay. */ + dev_dbg(mxs_phy-phy.dev, Setting ENHOSTDISCONDETECT\n); + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, + mxs_phy-phy.io_priv + HW_USBPHY_CTRL_SET); +} + static int mxs_phy_on_connect(struct usb_phy *phy, int port) { + struct mxs_phy *mxs_phy = to_mxs_phy(phy); + dev_dbg(phy-dev, Connect on port %d\n, port); - mxs_phy_hw_init(to_mxs_phy(phy)); - writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, - phy-io_priv + HW_USBPHY_CTRL_SET); + mxs_phy_hw_init(mxs_phy); + + /* +* Delay enabling ENHOSTDISCONDETECT so that connection and +* reset processing can be completed for the root hub. +*/ + dev_dbg(phy-dev, Delaying setting ENHOSTDISCONDETECT\n); + PREPARE_DELAYED_WORK(mxs_phy-enhostdiscondetect_work, + mxs_phy_enhostdiscondetect_delay); + schedule_delayed_work(mxs_phy-enhostdiscondetect_work, + msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY)); return 0; } @@ -91,6 +121,8 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port) { dev_dbg(phy-dev, Disconnect on port %d\n, port); + /* No need to delay before clearing ENHOSTDISCONDETECT. */ + dev_dbg(phy-dev, Clearing ENHOSTDISCONDETECT\n); writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, phy-io_priv + HW_USBPHY_CTRL_CLR); -- 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] ftdi_sio: PID for NZR SEM 16+ USB
This adds the USB PID for the NZR SEM 16+ USB energy monitor device http://www.nzr.de. It works perfectly with the GPL software on http://schou.dk/linux/sparometer/. Signed-off-by: Horst Schirmeier ho...@schirmeier.com --- drivers/usb/serial/ftdi_sio.c |1 + drivers/usb/serial/ftdi_sio_ids.h |3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 5620db6..5cae2a1 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -704,6 +704,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_NZR_SEM_USB_PID) }, { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 5dd96ca..117f42b 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -75,6 +75,9 @@ #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB #define FTDI_OPENDCC_GBM_PID 0xBFDC +/* NZR SEM 16+ USB (http://www.nzr.de) */ +#define FTDI_NZR_SEM_USB_PID 0xC1E0 /* NZR SEM-LOG16+ */ + /* * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) */ -- PGP-Key 0xD40E0E7A signature.asc Description: Digital signature
Re: create libcomposite, v3
On Wed, Aug 29, 2012 at 12:35 PM, Sebastian Andrzej Siewior bige...@linutronix.de wrote: On 08/29/2012 08:36 PM, Greg KH wrote: I'd be glad to remove that code, if the Android people say they no longer need it. Last I heard, their userspace code needed to be changed over, and the Samsung developers were trying to accomplish that. It would be great to find out how that effort is going. Okay. Dear ccg gadget submitter: Do you still need that code in staging tree or is it okay if it gets removed? It's ok if it gets removed. Actually we're still using the original android driver for now, not ccg. I'll change the userland interface to support configfs when we upgrade the kernel. Thanks! Benoit The current composite rework resulted in a copy of composite.c and headers since it is hard to fix. I'm not yet sure what happens when I start to remove the remaining #include dot.c statements. You need to convert to configfs which will change your userland interface. Is there a reason to keep this in tree? thanks, greg k-h Sebastian -- 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: dwc3: correct default value of maxburst
-Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Friday, August 31, 2012 12:51 AM To: Chanho Park Cc: ba...@ti.com; linux-usb@vger.kernel.org; gre...@linuxfoundation.org; 'Kyungmin Park' Subject: Re: [PATCH] usb: dwc3: correct default value of maxburst On Thu, Aug 30, 2012 at 11:19:15AM +0900, Chanho Park wrote: -Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Thursday, August 30, 2012 1:15 AM To: Chanho Park Cc: ba...@ti.com; linux-usb@vger.kernel.org; gre...@linuxfoundation.org; Kyungmin Park Subject: Re: [PATCH] usb: dwc3: correct default value of maxburst Hi, On Wed, Aug 29, 2012 at 10:49:58AM +0900, Chanho Park wrote: This patch changes default value of maxburst to 1. When a connection is established to highspeed, the maxburst is set to 0. So, we need to check and change default value of the maxburst before setting up burst size of ep. Signed-off-by: Chanho Park chanho61.p...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/usb/dwc3/gadget.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 58fdfad..025a1bc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -437,6 +437,9 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, memset(params, 0x00, sizeof(params)); + if (!dep-endpoint.maxburst) + dep-endpoint.maxburst = 1; a better patch would be to only check maxburst if endpoint is ss-capable. You can just check if comp_desc is a valid pointer (aka not NULL). Thank you for your suggestion. I'll change the check routine like below: + if (!comp_desc) + dep-endpoint.maxburst = 1; not what I meant. What I mean is that maxburst doesn't exist in non-usb3 mode, so we shouldn't even write that bitfield to the HW, meaning we shouldn't forcefully initialize dep-endpoint.maxburst either. Although that won't cause any issues today, we cannot initialize fields we shouldn't use in the endpoint structure. Try to initialize that bitfield on params.param0 conditionally, instead of hardcoding maxburst to some wrong value. I understand what you meant. I agree with your comment. I'll repost it after applying which you pointed out Thanks. Best regards, Chanho Park -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3] usb: dwc3: use a burst size only ss-mode
When connection is established non-ss mode, a maxburst is set to 0. Therefore, the value of burst size has wrong value. We must use the burst size only in ss-mode. Signed-off-by: Chanho Park chanho61.p...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- drivers/usb/dwc3/gadget.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 58fdfad..440a86b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -434,12 +434,16 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, const struct usb_ss_ep_comp_descriptor *comp_desc) { struct dwc3_gadget_ep_cmd_params params; + u32 burst_size; memset(params, 0x00, sizeof(params)); + /* We only use a burst size in ss-mode */ + burst_size = (com_desc) ? (dep-endpoint.maxburst - 1) : 0; + params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc)) | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc)) - | DWC3_DEPCFG_BURST_SIZE(dep-endpoint.maxburst - 1); + | DWC3_DEPCFG_BURST_SIZE(burst_size); params.param1 = DWC3_DEPCFG_XFER_COMPLETE_EN | DWC3_DEPCFG_XFER_NOT_READY_EN; -- 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: JMicron 20337 (152d:2338) and 3TB
On 05/08/2012 06:12 PM, Norman Diamond wrote: On Wed, 2012/5/9, Alan Stern wrote: On Tue, 8 May 2012, Norman Diamond wrote: Alan Stern wrote: On Tue, 8 May 2012, Norman Diamond wrote: In my case there is no other way that a host (PC or other, any OS or driver) could obtain a reported capacity past the 2.2TB mark. Sometimes I guess a USB-to-[S]ATA bridge might obey ATA passthru of an ATA Identify command though I haven't seen one. There definitely are some bridges which handle ATA passthru correctly. Oh, please can you suggest some. I search occasionally but have never found one that was described as obeying ATA passthru. Of course I can't command my users to use such bridges, but I would like to use one or two. The only ones I'm aware of are the entries marked with the SANE_SENSE quirk in unusual_devs.h: the HP Personal Media Drive (03f0:070c), the Genesys Logic bridge (05e3:0723), the Seagate FreeAgent Pro (0bc2:3010), the Maxtor bridge (0d49:7310), the Western Digital bridge (1058:0704), and a different JMicron bridge (152d:2329). Of course, the fact that the flag is set doesn't necessarily mean the device really does have SAT support. Among those, the Genesys and JMicron ones look like they have a chance of being used in adapters sold separately from Seagate and Western Digital external drives. By any chance do you know of cables or docking stations that use them? I have a Vantex NexStar TX 2.5 SATA enclosure that uses: Bus 001 Device 006: ID 152d:2329 JMicron Technology Corp. / JMicron USA Technology Corp. JM20329 SATA Bridge and ATA pass-through seems to work (at least as far as commands like hdparm -I and smartctl). Except that READ CAPACITY(16) might cause some buggy devices to crash. Instead of rejecting the command as not handled? Exactly. For example, it wouldn't be surprising if quite a few flash drives crashed upon receiving that command. Considering that READ CAPACITY(16) has additional reasons for existing besides increased capacity, I hoped every manufacturer would be prepared to expect it, even if they reject it. Sigh. CAPACITY_10_AND_16: Issue both READ CAPACITY and READ CAPACITY(16), and if READ CAPACITY(16) gives a result 2 TB and READ CAPACITY doesn't give 0x, truncate the size to 2 TB; CAPACITY_HEURISTICS_63: Don't decrement the capacity if the reported capacity is a multiple of 63, but otherwise behave like CAPACITY_HEURISTICS; TEST_CAPACITY: Try to do a single-block read of the last reported block. What I'm wondering is whether it's appropriate to have three separate flags for these things, or whether some subset of them should be controlled by the same flag -- maybe a flag that would be set only for devices that are known to be bridges. They are three separate operations, and you've pointed out there's a chance that some devices might crash on some of them and not others, so it would be a good idea to make three separate flags. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majordomo-u79uwxl29ty76z2rm5m...@public.gmane.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