Re: [PATCH v3 4/5] usb: chipidea: cleanup dma_pool if udc_start() fails
On Wed, Sep 05, 2012 at 10:11:52AM +0200, Marc Kleine-Budde wrote: If udc_start() fails the qh_pool dma-pool cannot be closed because it's still in use. This patch factors out the dma_pool_free() loop into destroy_eps() and calls it in the error path of udc_start(), too. Cc: Richard Zhao richard.z...@freescale.com Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Reviewed-by: Richard Zhao richard.z...@freescale.com --- drivers/usb/chipidea/udc.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 3a755e5..2d8b609 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1503,6 +1503,17 @@ static int init_eps(struct ci13xxx *ci) return retval; } +static void destroy_eps(struct ci13xxx *ci) +{ + int i; + + for (i = 0; i ci-hw_ep_max; i++) { + struct ci13xxx_ep *mEp = ci-ci13xxx_ep[i]; + + dma_pool_free(ci-qh_pool, mEp-qh.ptr, mEp-qh.dma); + } +} + /** * ci13xxx_start: register a gadget driver * @gadget: our gadget @@ -1710,7 +1721,7 @@ static int udc_start(struct ci13xxx *ci) if (ci-platdata-flags CI13XXX_REQUIRE_TRANSCEIVER) { if (ci-transceiver == NULL) { retval = -ENODEV; - goto free_pools; + goto destroy_eps; } } @@ -1761,6 +1772,8 @@ unreg_device: put_transceiver: if (!IS_ERR_OR_NULL(ci-transceiver) ci-global_phy) usb_put_phy(ci-transceiver); +destroy_eps: + destroy_eps(ci); free_pools: dma_pool_destroy(ci-td_pool); free_qh_pool: @@ -1775,18 +1788,12 @@ free_qh_pool: */ static void udc_stop(struct ci13xxx *ci) { - int i; - if (ci == NULL) return; usb_del_gadget_udc(ci-gadget); - for (i = 0; i ci-hw_ep_max; i++) { - struct ci13xxx_ep *mEp = ci-ci13xxx_ep[i]; - - dma_pool_free(ci-qh_pool, mEp-qh.ptr, mEp-qh.dma); - } + destroy_eps(ci); dma_pool_destroy(ci-td_pool); dma_pool_destroy(ci-qh_pool); -- 1.7.10.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: changing usbnet's API to better deal with cdc-ncm
-Original Message- From: Oliver Neukum [mailto:oneu...@suse.de] looking at cdc-ncm it seeems to me that cdc-ncm is forced to play very dirty games because usbnet doesn't have a notion about aggregating packets for a single transfer. Several issues need to be improved: Tx path: 1. IP packets must be accumulated in one NTB. Currently it's done via data copy. Preferred way would be a possibility to have a list of skb-s in resulting frame sent down. 2. Timer is needed to accumulate enough packets to get acceptable throughput and reducing amount of HW INTs on device side. If we get access to Tx queue size and can read skb from it, time can be removed. But Tx queue is above usbnet, so doesn't look possible in current framework. 3. While trying to get best throughput we also need to keep latency in mind, because in some setups it is quite important. As a simple solution configuration parameters could be used to address this issue. Rx path: 4. IP packets are cloned to separate skb and length of actual data set to eth packet size, while skb size is still the same as skb containing full NTB frame. This causes problems with TCP stack when throughput is high because of flow control in the stack, if too much data allocated. Someone suggested a patch for it, which was rejected. Anyway, I don't think copy data to a new skb would be a nice solution, but keeping several clones with size equal to incoming skb in not good either. /alexey -- To unsubscribe from this list: send the line unsubscribe 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: changing usbnet's API to better deal with cdc-ncm
Oliver Neukum oneu...@suse.de writes: looking at cdc-ncm it seeems to me that cdc-ncm is forced to play very dirty games because usbnet doesn't have a notion about aggregating packets for a single transfer. It seems to me that this can be fixed introducing a method for bundling, which tells usbnet how packets have been aggregated. To have performance usbnet strives to always keep at least two transfers in flight. The code isn't complete and I need to get a device for testing, but to get your opinion, I ask you to comment on what I have now. I haven't tested this on any device either, but it looks like the right direction to me. Note that there are several other existing minidrivers which could take advantage of this code. A quick look found that both sierra_net and rndis_host have some unbundling support in their rx_fixups, but both ignore tx bundling. rndis_host has the following explanation in tx_fixup: /* fill out the RNDIS header. we won't bother trying to batch * packets; Linux minimizes wasted bandwidth through tx queues. */ Although that may be true for the host, I am not sure it will be true for every device? @@ -874,71 +840,37 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb) /* return skb */ ctx-tx_curr_skb = NULL; ctx-netdev-stats.tx_packets += ctx-tx_curr_frame_num; Maybe all the statistics could be moved back to usbnet now that it will see all packets again? index f87cf62..bb2f622 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -33,6 +33,7 @@ struct usbnet { wait_queue_head_t *wait; struct mutexphy_mutex; unsigned char suspend_count; + atomic_ttx_in_flight; /* i/o info: pipes etc */ unsignedin, out; So you don't keep any timer here? The idea is that you always will transmit immediately unless there are two transmit's in flight? I believe that is a change which has to be tested against real devices. They may be optimized for receiving bundles. Not really related, but I am still worrying how MBIM is going to fit into the usbnet model where you have a strict relation between one netdev and one USB interface. Do you see any way usbnet could be extended to manage a list of netdevs? All the netdev related functions doing struct usbnet *dev = netdev_priv(net); would still work. But all the USB related functions using dev-net to get _the_ netdev would fail. Maybe this will be too difficult to implement within the usbnet framework at all? Bjørn -- To unsubscribe from this list: send the line unsubscribe 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: changing usbnet's API to better deal with cdc-ncm
Ming Lei tom.leim...@gmail.com writes: On Thu, Sep 6, 2012 at 4:12 AM, Oliver Neukum oneu...@suse.de wrote: Hi, looking at cdc-ncm it seeems to me that cdc-ncm is forced to play very dirty games because usbnet doesn't have a notion about aggregating packets for a single transfer. The Ethernet API we are using does not support transmitting multiple Ethernet frames in a single call, so the aggregation things should be done inside low level driver, in fact it is just what some wlan(802.11n) drivers have been doing. IMO, the current .tx_fixup is intelligent enough to handle aggregation: - return a skb_out for sending if low level drivers think it is ready to send the aggregated frames - return NULL if the low level drivers think they need to wait for more frames Of course, the low level drivers need to start a timer to trigger sending remainder frames in case of timeout and no further frames come from upper protocol stack. Looks the introduced .tx_bundle is not necessary since .tx_fixup is OK. The minidriver does not have any information about tx in progress. The strategy above, which is what cdc_ncm uses today, is fine as long as you always want to wait as long as you always want to fill as many frames as possible in each packet. But what if the queue is empty and the device is just sitting there doing nothing while you are waiting for more frames? Then you are just adding unnecessary latency. There are also several usbnet minidrivers for protocols with frame aggregation support. Most of them do not currently implement tx aggregation, possibly due to the complexity. This makes a common aggregation framework interesting in any case. Reimplementing similar loginc in multiple minidrivers is meaningless. I believe Oliver is adding very useful functionality to usbnet here. Functionality which at least cdc_ncm and possibly other existing minidrivers can take advantage of immediately. There also seems to be a trend towards more complex aggregating protocols as the devices get smarter and speeds go up. BJørn -- To unsubscribe from this list: send the line unsubscribe 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: changing usbnet's API to better deal with cdc-ncm
On Thursday 06 September 2012 10:13:01 Alexey ORISHKO wrote: -Original Message- From: Oliver Neukum [mailto:oneu...@suse.de] looking at cdc-ncm it seeems to me that cdc-ncm is forced to play very dirty games because usbnet doesn't have a notion about aggregating packets for a single transfer. Several issues need to be improved: Tx path: 1. IP packets must be accumulated in one NTB. Currently it's done via data copy. Preferred way would be a possibility to have a list of skb-s in resulting frame sent down. I am afraid much HCD hardware is just not capable of doing DMA on a list of skbs. I guess one copy will be necessary. We might consider not freeing the buffer used to transfer over the bus. 2. Timer is needed to accumulate enough packets to get acceptable throughput and reducing amount of HW INTs on device side. If we get access to Tx queue size and can read skb from it, time can be removed. But Tx queue is above usbnet, so doesn't look possible in current framework. I think we can use the number of transfers in flight to make that decision. So if the choice is to not transfer data at all or to send transfers filled to the max, we should send, otherwise we ought to accumulate. That way we get rid of the timer. 3. While trying to get best throughput we also need to keep latency in mind, because in some setups it is quite important. As a simple solution configuration parameters could be used to address this issue. I think we should just send the first (two) packages and use the time to aggregate later packets. Rx path: 4. IP packets are cloned to separate skb and length of actual data set to eth packet size, while skb size is still the same as skb containing full NTB frame. This causes problems with TCP stack when throughput is high because of flow control in the stack, if too much data allocated. Someone suggested a patch for it, which was rejected. Anyway, I don't think copy data to a new skb would be a nice solution, but keeping several clones with size equal to incoming skb in not good either. Perhaps the problem is using an skb for aggregate reception at all. Possibly enough buffers of fixed size should be allocated on open and reused, not freed. Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: changing usbnet's API to better deal with cdc-ncm
On Thu, 2012-09-06 at 10:50 +0200, Oliver Neukum wrote: On Thursday 06 September 2012 10:13:01 Alexey ORISHKO wrote: Rx path: 4. IP packets are cloned to separate skb and length of actual data set to eth packet size, while skb size is still the same as skb containing full NTB frame. This causes problems with TCP stack when throughput is high because of flow control in the stack, if too much data allocated. Someone suggested a patch for it, which was rejected. Anyway, I don't think copy data to a new skb would be a nice solution, but keeping several clones with size equal to incoming skb in not good either. Perhaps the problem is using an skb for aggregate reception at all. Possibly enough buffers of fixed size should be allocated on open and reused, not freed. Really skb_clone() use should be removed from cdc_ncm_rx_fixup() Unless you expect 10Gbit speed from this driver, skb_clone() is the worst possible strategy. Allocating fresh skbs of the right size permits better memory use and allows TCP coalescing as well. The use of skb_clone() forces some parts of the stack to perform a full copy anyway. It's still unclear to me with we use up to 32KB blocks in USB drivers... -- To unsubscribe from this list: send the line unsubscribe 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: changing usbnet's API to better deal with cdc-ncm
On Thu, 2012-09-06 at 11:11 +0200, Eric Dumazet wrote: Really skb_clone() use should be removed from cdc_ncm_rx_fixup() Unless you expect 10Gbit speed from this driver, skb_clone() is the worst possible strategy. Allocating fresh skbs of the right size permits better memory use and allows TCP coalescing as well. The use of skb_clone() forces some parts of the stack to perform a full copy anyway. It's still unclear to me with we use up to 32KB blocks in USB drivers... So I advise testing this patch : diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 4cd582a..c0821f7 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1052,12 +1052,11 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) break; } else { - skb = skb_clone(skb_in, GFP_ATOMIC); + skb = netdev_alloc_skb_ip_align(dev-net, len); if (!skb) goto error; - skb-len = len; - skb-data = ((u8 *)skb_in-data) + offset; - skb_set_tail_pointer(skb, len); + skb_put(skb, len); + memcpy(skb-data, skb_in-data + offset, len); usbnet_skb_return(dev, skb); } } -- To unsubscribe from this list: send the line unsubscribe 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 Tue, Sep 4, 2012 at 5:32 PM, Alon Bar-Lev alon.bar...@gmail.com wrote: Going to try out this one[1][2], but now I go to the store and test it on site before buying. Alon [1] http://a.slickdeals.net/attachment.php?attachmentid=84784d=... [2] http://www.zhuzhuchina.com/store/esata_to_usb_2_0_external_adapter_spif225a_serial_ata.html Got it, and it is working[1]! 152d:2329 JMicron Technology Corp. / JMicron USA Technology Corp. transcend storejet 25P [1] http://en.gentoo-wiki.com/wiki/USB_SATA_SPIF225A -- To unsubscribe from this list: send the line unsubscribe 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] usbip: avoid deadlock in vhci_device_unlink_cleanup()
Almost all of usbip assumes that the_controller-lock is acquired before vdev-priv_lock. The exception is in vhci_device_unlink_cleanup(), where locks are acquired in the reverse order. This leads to occasional deadlocks. Fixing this is a bit fiddly, as the_controller-lock can't be held when calling usb_hcd_unlink_urb_from_ep() in the middle of the list traversal. As I can't rule out concurrent callers to this function (perhaps it is safe?), the code here becomes slightly uglier - when locks are dropped in the middle so the list may have emptied itself (not even list_for_each_entry_safe is safe here). Signed-off-by: Bernard Blackham b-linux...@largestprime.net diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 12a9a5f..dfeb492 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -749,6 +749,7 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) { struct vhci_unlink *unlink, *tmp; + spin_lock(the_controller-lock); spin_lock(vdev-priv_lock); list_for_each_entry_safe(unlink, tmp, vdev-unlink_tx, list) { @@ -757,9 +758,12 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) kfree(unlink); } - list_for_each_entry_safe(unlink, tmp, vdev-unlink_rx, list) { + while (!list_empty(vdev-unlink_rx)) { struct urb *urb; + unlink = list_first_entry(vdev-unlink_rx, struct vhci_unlink, + list); + /* give back URB of unanswered unlink request */ pr_info(unlink cleanup rx %lu\n, unlink-unlink_seqnum); @@ -774,18 +778,24 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) urb-status = -ENODEV; - spin_lock(the_controller-lock); usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); + + list_del(unlink-list); + + spin_unlock(vdev-priv_lock); spin_unlock(the_controller-lock); usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb-status); - list_del(unlink-list); + spin_lock(the_controller-lock); + spin_lock(vdev-priv_lock); + kfree(unlink); } spin_unlock(vdev-priv_lock); + spin_unlock(the_controller-lock); } /* -- To unsubscribe from this list: send the line unsubscribe 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] staging: usbip: vhci_hcd: fixed suspend-resume loop
USB autosuspend suspends vhci_hcd. In this process hcd_bus_suspend gets executed which puts vhci_hcd in suspend state and calls vhci_hub_status. vhci_hub_status function checks hub state and if it is in suspend state, usb_hcd_resume_root_hub gets executed which resumes hub and if hub is idle, again autosuspend puts it in suspend state and this goes on. vhci_hub_status should resume hub only when hub port is in suspend state and hub port status has changed. Signed-off-by: navin patidar nav...@cdac.in --- drivers/staging/usbip/vhci_hcd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 12a9a5f..6076f42 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -220,7 +220,7 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf) pr_info(changed %d\n, changed); - if (hcd-state == HC_STATE_SUSPENDED) + if ((hcd-state == HC_STATE_SUSPENDED) (changed == 1)) usb_hcd_resume_root_hub(hcd); done: -- 1.7.9.5 --- This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken. --- -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 1/7] drivers: usb: phy: add a new driver for omap usb2 phy
Hi, On Mon, Aug 6, 2012 at 6:37 PM, Kishon Vijay Abraham I kis...@ti.com wrote: All phy related programming like enabling/disabling the clocks, powering on/off the phy is taken care of by this driver. It is also used for OTG related functionality like srp. This also includes device tree support for usb2 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. Cc: Felipe Balbi ba...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- .../devicetree/bindings/bus/omap-ocp2scp.txt |3 + Documentation/devicetree/bindings/usb/omap-usb.txt | 17 ++ drivers/usb/phy/Kconfig| 10 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/omap-usb2.c| 271 include/linux/usb/omap_usb.h | 46 include/linux/usb/phy_companion.h | 34 +++ 7 files changed, 382 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt create mode 100644 drivers/usb/phy/omap-usb2.c create mode 100644 include/linux/usb/omap_usb.h create mode 100644 include/linux/usb/phy_companion.h diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt index d2fe064..bb0c7f4 100644 --- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt @@ -8,3 +8,6 @@ properties: Sub-nodes: All the devices connected to ocp2scp are described using sub-node to ocp2scp +- usb2phy : + The binding details of usb2phy can be found in: + Documentation/devicetree/bindings/usb/omap-usb.txt The above two lines should be added in omap-ocp2scp.txt (this file was added as part of omap: add ocp2scp as a bus driver and is in linux-next). However this file is still not in Felipe's xceiv branch. So I'm not sure how I can get this patch merged in Felipe's tree without conflict. Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/5] usb: chipidea: udc: fix setup of endpoint maxpacket size
Marc Kleine-Budde m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de This patch changes the setup of the endpoint maxpacket size. All non control endpoints are initialized with an undefined ((unsigned short)~0) maxpacket size. The maxpacket size of Endpoint 0 will be kept at CTRL_PAYLOAD_MAX. Some gadget drivers check for the maxpacket size before they enable the endpoint, which leads to a wrong state in these drivers. Cc: sta...@vger.kernel.org Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Acked-by: Felipe Balbi ba...@ti.com Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com --- changes since v1: - reworded patch description - Added Felipe's Ack drivers/usb/chipidea/udc.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index c7a032a..7801a3f 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1455,7 +1455,12 @@ static int init_eps(struct ci13xxx *ci) mEp-ep.name = mEp-name; mEp-ep.ops = usb_ep_ops; - mEp-ep.maxpacket = CTRL_PAYLOAD_MAX; + /* + * for ep0: maxP defined in desc, for other + * eps, maxP is set by epautoconfig() called + * by gadget layer + */ + mEp-ep.maxpacket = (unsigned short)~0; INIT_LIST_HEAD(mEp-qh.queue); mEp-qh.ptr = dma_pool_alloc(ci-qh_pool, GFP_KERNEL, @@ -1475,6 +1480,7 @@ static int init_eps(struct ci13xxx *ci) else ci-ep0in = mEp; + mEp-ep.maxpacket = CTRL_PAYLOAD_MAX; continue; } -- 1.7.10.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 v3 2/5] usb: chipidea: udc: add pullup fuction, needed by the uvc gadget
Marc Kleine-Budde m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de Add function to physicaly enable or disable of pullup connection on the USB-D+ line. The uvc gaget will fail, if this function is not implemented. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Acked-by: Felipe Balbi ba...@ti.com Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com --- drivers/usb/chipidea/udc.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 7801a3f..32ee870 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -78,8 +78,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n) } /** - * hw_device_state: enables/disables interrupts starts/stops device (execute - * without interruption) + * hw_device_state: enables/disables interrupts (execute without interruption) * @dma: 0 = disable, !0 = enable and set dma engine * * This function returns an error code @@ -91,9 +90,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma) /* interrupt, error, port change, reset, sleep/suspend */ hw_write(ci, OP_USBINTR, ~0, USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); - hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); } else { - hw_write(ci, OP_USBCMD, USBCMD_RS, 0); hw_write(ci, OP_USBINTR, ~0, 0); } return 0; @@ -1420,6 +1417,21 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) return -ENOTSUPP; } +/* Change Data+ pullup status + * this func is used by usb_gadget_connect/disconnet + */ +static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) +{ + struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); + + if (is_on) + hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); + else + hw_write(ci, OP_USBCMD, USBCMD_RS, 0); + + return 0; +} + static int ci13xxx_start(struct usb_gadget *gadget, struct usb_gadget_driver *driver); static int ci13xxx_stop(struct usb_gadget *gadget, @@ -1432,6 +1444,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, static const struct usb_gadget_ops usb_gadget_ops = { .vbus_session = ci13xxx_vbus_session, .wakeup = ci13xxx_wakeup, + .pullup = ci13xxx_pullup, .vbus_draw = ci13xxx_vbus_draw, .udc_start = ci13xxx_start, .udc_stop = ci13xxx_stop, -- 1.7.10.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 v3 3/5] usb: chipidea: udc: fix error path in udc_start()
Marc Kleine-Budde m...@pengutronix.de writes: This patch fixes the error path of udc_start(). Now NULL is used to unset the peripheral with otg_set_peripheral(). Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Reviewed-by: Richard Zhao richard.z...@freescale.com Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com --- drivers/usb/chipidea/udc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 32ee870..3a755e5 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1748,7 +1748,7 @@ static int udc_start(struct ci13xxx *ci) remove_trans: if (!IS_ERR_OR_NULL(ci-transceiver)) { - otg_set_peripheral(ci-transceiver-otg, ci-gadget); + otg_set_peripheral(ci-transceiver-otg, NULL); if (ci-global_phy) usb_put_phy(ci-transceiver); } -- 1.7.10.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 v3 2/5] usb: chipidea: udc: add pullup fuction, needed by the uvc gadget
On 09/06/2012 02:26 PM, Alexander Shishkin wrote: Marc Kleine-Budde m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de Add function to physicaly enable or disable of pullup connection on the USB-D+ line. The uvc gaget will fail, if this function is not implemented. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Acked-by: Felipe Balbi ba...@ti.com Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com Thanks. Should we put stable@v.k.o on Cc? Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: [PATCH v3 4/5] usb: chipidea: cleanup dma_pool if udc_start() fails
Marc Kleine-Budde m...@pengutronix.de writes: If udc_start() fails the qh_pool dma-pool cannot be closed because it's still in use. This patch factors out the dma_pool_free() loop into destroy_eps() and calls it in the error path of udc_start(), too. Cc: Richard Zhao richard.z...@freescale.com Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com --- drivers/usb/chipidea/udc.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 3a755e5..2d8b609 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1503,6 +1503,17 @@ static int init_eps(struct ci13xxx *ci) return retval; } +static void destroy_eps(struct ci13xxx *ci) +{ + int i; + + for (i = 0; i ci-hw_ep_max; i++) { + struct ci13xxx_ep *mEp = ci-ci13xxx_ep[i]; + + dma_pool_free(ci-qh_pool, mEp-qh.ptr, mEp-qh.dma); + } +} + /** * ci13xxx_start: register a gadget driver * @gadget: our gadget @@ -1710,7 +1721,7 @@ static int udc_start(struct ci13xxx *ci) if (ci-platdata-flags CI13XXX_REQUIRE_TRANSCEIVER) { if (ci-transceiver == NULL) { retval = -ENODEV; - goto free_pools; + goto destroy_eps; } } @@ -1761,6 +1772,8 @@ unreg_device: put_transceiver: if (!IS_ERR_OR_NULL(ci-transceiver) ci-global_phy) usb_put_phy(ci-transceiver); +destroy_eps: + destroy_eps(ci); free_pools: dma_pool_destroy(ci-td_pool); free_qh_pool: @@ -1775,18 +1788,12 @@ free_qh_pool: */ static void udc_stop(struct ci13xxx *ci) { - int i; - if (ci == NULL) return; usb_del_gadget_udc(ci-gadget); - for (i = 0; i ci-hw_ep_max; i++) { - struct ci13xxx_ep *mEp = ci-ci13xxx_ep[i]; - - dma_pool_free(ci-qh_pool, mEp-qh.ptr, mEp-qh.dma); - } + destroy_eps(ci); dma_pool_destroy(ci-td_pool); dma_pool_destroy(ci-qh_pool); -- 1.7.10.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 0/2] usb: chipidea: usbmisc: cleanups and prepare for multi soc support
Hello, these patches apply to Richard's usb-driver branch [1] and prepare the usbmisc driver for multi-soc support. Feel free to squash into your patches, or add to your tree. regards, Marc [1] https://github.com/riczhao/kernel-imx/tree/topics/usb-driver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usb: chipidea: usbmisc: unset global varibale usbmisc on driver remove
While there fix a potential race condition, first set usbmisc, then call usbmisc_set_ops(). Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- drivers/usb/chipidea/usbmisc_imx6q.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c index 416e3fc..edc0edd7 100644 --- a/drivers/usb/chipidea/usbmisc_imx6q.c +++ b/drivers/usb/chipidea/usbmisc_imx6q.c @@ -116,14 +116,14 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) return ret; } + usbmisc = data; ret = usbmisc_set_ops(imx6q_usbmisc_ops); if (ret) { + usbmisc = NULL; clk_disable_unprepare(data-clk); return ret; } - usbmisc = data; - return 0; } @@ -131,6 +131,7 @@ static int __devexit usbmisc_imx6q_remove(struct platform_device *pdev) { usbmisc_unset_ops(imx6q_usbmisc_ops); clk_disable_unprepare(usbmisc-clk); + usbmisc = NULL; return 0; } -- 1.7.10.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 2/2] usb: chipidea: usbmisc: prepare driver to handle more than one soc
Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- drivers/usb/chipidea/usbmisc_imx6q.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c index edc0edd7..5989a80 100644 --- a/drivers/usb/chipidea/usbmisc_imx6q.c +++ b/drivers/usb/chipidea/usbmisc_imx6q.c @@ -26,6 +26,7 @@ struct imx6q_usbmisc { spinlock_t lock; struct clk *clk; struct usbmisc_usb_device usbdev[USB_DEV_MAX]; + const struct usbmisc_ops *ops; }; static struct imx6q_usbmisc *usbmisc; @@ -78,7 +79,7 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = { }; static const struct of_device_id usbmisc_imx6q_dt_ids[] = { - { .compatible = fsl,imx6q-usbmisc}, + { .compatible = fsl,imx6q-usbmisc, .data = (void *)imx6q_usbmisc_ops }, { /* sentinel */ } }; @@ -116,8 +117,10 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) return ret; } + data-ops = (const struct usbmisc_ops *) + of_match_device(usbmisc_imx6q_dt_ids, pdev-dev); usbmisc = data; - ret = usbmisc_set_ops(imx6q_usbmisc_ops); + ret = usbmisc_set_ops(data-ops); if (ret) { usbmisc = NULL; clk_disable_unprepare(data-clk); @@ -129,7 +132,7 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) static int __devexit usbmisc_imx6q_remove(struct platform_device *pdev) { - usbmisc_unset_ops(imx6q_usbmisc_ops); + usbmisc_unset_ops(usbmisc-ops); clk_disable_unprepare(usbmisc-clk); usbmisc = NULL; return 0; -- 1.7.10.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 2/2] usb: chipidea: usbmisc: prepare driver to handle more than one soc
On 09/06/2012 02:37 PM, Marc Kleine-Budde wrote: Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- drivers/usb/chipidea/usbmisc_imx6q.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c index edc0edd7..5989a80 100644 --- a/drivers/usb/chipidea/usbmisc_imx6q.c +++ b/drivers/usb/chipidea/usbmisc_imx6q.c @@ -26,6 +26,7 @@ struct imx6q_usbmisc { spinlock_t lock; struct clk *clk; struct usbmisc_usb_device usbdev[USB_DEV_MAX]; + const struct usbmisc_ops *ops; }; static struct imx6q_usbmisc *usbmisc; @@ -78,7 +79,7 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = { }; static const struct of_device_id usbmisc_imx6q_dt_ids[] = { - { .compatible = fsl,imx6q-usbmisc}, + { .compatible = fsl,imx6q-usbmisc, .data = (void *)imx6q_usbmisc_ops }, { /* sentinel */ } }; @@ -116,8 +117,10 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) return ret; } + data-ops = (const struct usbmisc_ops *) + of_match_device(usbmisc_imx6q_dt_ids, pdev-dev); usbmisc = data; - ret = usbmisc_set_ops(imx6q_usbmisc_ops); + ret = usbmisc_set_ops(data-ops); if (ret) { usbmisc = NULL; clk_disable_unprepare(data-clk); @@ -129,7 +132,7 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) static int __devexit usbmisc_imx6q_remove(struct platform_device *pdev) { - usbmisc_unset_ops(imx6q_usbmisc_ops); + usbmisc_unset_ops(usbmisc-ops); Or maybe remove the parameter alltogether. Marc clk_disable_unprepare(usbmisc-clk); usbmisc = NULL; return 0; -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: [PATCH v3 5/5] usb: chipidea: udc: don't stall endpoint if request list is empty in isr_tr_complete_low
Marc Kleine-Budde m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de When attaching an imx28 or imx53 in USB gadget mode to a Windows host and starting a rndis connection we see this message every 4-10 seconds: g_ether gadget: high speed config #2: RNDIS Analysis shows that each time this message is printed, the rndis connection is re-establish due to a reset because of a stalled endpoint (ep 0, dir 1). The endpoint is stalled because the reqeust complete bit on that endpoint is set, but in isr_tr_complete_low() the endpoint request list (mEp-qh.queue) is empty. This patch removed this check, because the code doesn't take the following situation into account: The loop over all endpoints in isr_tr_complete_handler() will call ep_nuke() on both ep0/dir0 and ep/dir1 in the first loop. Pending reqeusts will be flushed and completed here. There seems to be a race condition, the request is nuked, but the request complete bit will be set, too. The subsequent check (in ep0/dir1's loop cycle) for endpoint request list (mEp-qh.queue) empty will fail. Both other mainline chipidea drivers (mv_udc_core.c and fsl_udc_core.c) don't have this check. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Makes sense to me, Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com --- drivers/usb/chipidea/udc.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 2d8b609..d214448 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -771,10 +771,7 @@ __acquires(mEp-lock) { struct ci13xxx_req *mReq, *mReqTemp; struct ci13xxx_ep *mEpTemp = mEp; - int uninitialized_var(retval); - - if (list_empty(mEp-qh.queue)) - return -EINVAL; + int retval = 0; list_for_each_entry_safe(mReq, mReqTemp, mEp-qh.queue, queue) { -- 1.7.10.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 v3 5/5] usb: chipidea: udc: don't stall endpoint if request list is empty in isr_tr_complete_low
On 09/06/2012 02:46 PM, Alexander Shishkin wrote: Marc Kleine-Budde m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de When attaching an imx28 or imx53 in USB gadget mode to a Windows host and starting a rndis connection we see this message every 4-10 seconds: g_ether gadget: high speed config #2: RNDIS Analysis shows that each time this message is printed, the rndis connection is re-establish due to a reset because of a stalled endpoint (ep 0, dir 1). The endpoint is stalled because the reqeust complete bit on that endpoint is set, but in isr_tr_complete_low() the endpoint request list (mEp-qh.queue) is empty. This patch removed this check, because the code doesn't take the following situation into account: The loop over all endpoints in isr_tr_complete_handler() will call ep_nuke() on both ep0/dir0 and ep/dir1 in the first loop. Pending reqeusts will be flushed and completed here. There seems to be a race condition, the request is nuked, but the request complete bit will be set, too. The subsequent check (in ep0/dir1's loop cycle) for endpoint request list (mEp-qh.queue) empty will fail. Both other mainline chipidea drivers (mv_udc_core.c and fsl_udc_core.c) don't have this check. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Makes sense to me, Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com Thanks a lot. IMHO this is a candidate for stable. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: usbnet: fix oops in usbnet_start_xmit
I sent this email a year ago when the patch was committed but I never received a response. regards, dan carpenter On Wed, Nov 09, 2011 at 10:34:59AM +0300, Dan Carpenter wrote: Hello Konstantin Khlebnikov, This is a semi-automatic email about new static checker warnings. The patch 23ba07991dad: usbnet: fix oops in usbnet_start_xmit from Nov 7, 2011, leads to the following Smatch complaint: drivers/net/usb/usbnet.c +1077 usbnet_start_xmit() error: we previously assumed 'skb' could be null (see line 1060) drivers/net/usb/usbnet.c 1059 1060if (skb) ^^^ check introduced here. 1061skb_tx_timestamp(skb); 1062 1063// some devices want funky USB-level framing, for 1064// win32 driver (usually) and/or hardware quirks 1065if (info-tx_fixup) { 1066skb = info-tx_fixup (dev, skb, GFP_ATOMIC); 1067if (!skb) { 1068if (netif_msg_tx_err(dev)) { 1069netif_dbg(dev, tx_err, dev-net, can't tx_fixup skb\n); 1070goto drop; 1071} else { 1072/* cdc_ncm collected packet; waits for more */ 1073goto not_drop; 1074} 1075} 1076} 1077length = skb-len; dereference without checking. 1078 1079if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) { regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: cdc-ncm: struct usb_cdc_ncm_ndp_input_size not initialized
Hello, we developing CDC/NCM firmware and found that the Linux CDC/NCM is not compliant to the USB CDC/NCM specification. The cause is a Bug in the cdc_ncm.c file. The structure usb_cdc_ncm_ndp_input_size is only allocated but not initialized. The CDC/NCM specification section 6.2.7 SetNtbInputSize says that the dwNtbInMaxSize field must be at least 2048. But the current implementation leave it 0, because it is not initialized. I'm not sure if it is also required to initialize the wNtbInMaxDatagrams field because 0 (no limit) is a valid value. --- linux-3.6-rc4.orig/drivers/net/usb/cdc_ncm.c 2012-09-06 14:05:26.981402153 +0200 +++ linux-3.6-rc4/drivers/net/usb/cdc_ncm.c 2012-09-06 14:11:57.137398615 +0200 @@ -224,6 +224,7 @@ err = -ENOMEM; goto size_err; } + ndp_in_sz-dwNtbInMaxSize = cpu_to_le32(ctx-rx_max); err = usb_control_msg(ctx-udev, usb_sndctrlpipe(ctx-udev, 0), -- Kind regards, Frank Hoffmann Thesycon GmbH -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 2/5] usb: chipidea: udc: add pullup fuction, needed by the uvc gadget
Marc Kleine-Budde m...@pengutronix.de writes: On 09/06/2012 02:26 PM, Alexander Shishkin wrote: Marc Kleine-Budde m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de Add function to physicaly enable or disable of pullup connection on the USB-D+ line. The uvc gaget will fail, if this function is not implemented. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Acked-by: Felipe Balbi ba...@ti.com Acked-by: Alexander Shishkin alexander.shish...@linux.intel.com Thanks. Should we put stable@v.k.o on Cc? I certainly don't see why not. Btw, are you ok with sending these patches to Greg or should I take care of them? My recent awol seems to have caused a pile of patches on Richard's side too, but I don't think they conflict with yours. Regards, -- Alex -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 1/7] drivers: usb: phy: add a new driver for omap usb2 phy
On Thursday 06 September 2012, ABRAHAM, KISHON VIJAY wrote: diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt index d2fe064..bb0c7f4 100644 --- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt @@ -8,3 +8,6 @@ properties: Sub-nodes: All the devices connected to ocp2scp are described using sub-node to ocp2scp +- usb2phy : + The binding details of usb2phy can be found in: + Documentation/devicetree/bindings/usb/omap-usb.txt The above two lines should be added in omap-ocp2scp.txt (this file was added as part of omap: add ocp2scp as a bus driver and is in linux-next). However this file is still not in Felipe's xceiv branch. So I'm not sure how I can get this patch merged in Felipe's tree without conflict. There are three possible ways to do that: * Not add that text. Is is actually required? The ocp2scp bus driver doesn't actually care what is connected to it, does it? * Ask Felipe to merge the drivers/ocp2scp branch from arm-soc into his branch, then apply your patch on top. The branch is scheduled for merging in 3.7 and is stable, so there is no harm merging it into his tree, as long as Olof and I are aware of this. * Split out this change and apply the patch to add this documentation change on top of the drivers/ocp2scp branch in the arm-soc tree. There is no strict dependency between this change and the others you want to merge, so it does not matter which tree it is merged through. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL] USB fixes for v3.6-rc4
On Wed, Sep 05, 2012 at 04:49:37PM -0700, Greg KH wrote: On Thu, Aug 23, 2012 at 12:03:58PM +0300, Felipe Balbi wrote: Hi Greg, Here's my (hopefully) last set of fixes for v3.6-rc cycle. Let me know if you want me to change anything and I'll do so ASAP. cheers The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee: Linux 3.6-rc1 (2012-08-02 16:38:10 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/fixes-for-v3.6-rc4 for you to fetch changes up to 07dc6cb73678e5a2bdaed74774b9064d27b8da0d: usb: renesas_usbhs: fixup DMA transport data alignment (2012-08-23 11:05:40 +0300) (from the branch description for fixes local branch) usb: fixes for v3.6-rc4 Here's a rather big set of fixes for v3.6-rc4. There are some fixes for bugs which have been pending for a long time and only now were uncovered, like the musb and dwc3 patches. We have some remaining fixes for the ep-desc patch series from Ido, and a very important fix to u_ether which would cause 100% cpu utilization in eth_stop. All patches have been pending on linux-usb for a long time and shouldn't cause any further regressions. Ajay Kumar Gupta (3): usb: musb: Fix wrong config for am33xx and ti81xx usb: musb: am335x: fix pdev resource bug usb: musb: reorder runtime pm call Andrzej Pietrasiewicz (1): usb: gadget: add multiple definition guards Julia Lawall (1): usb: gadget: s3c-hsotg.c: fix error return code Kishon Vijay Abraham I (1): usb: dwc3: core: fix incorrect usage of resource pointer Kuninori Morimoto (3): usb: renesas_usbhs: mod_host: add missing .bus_suspend/resume usb: renesas_usbhs: fixup resume method for autonomy mode usb: renesas_usbhs: fixup DMA transport data alignment Michael Grzeschik (1): usb: gadget: u_ether: fix kworker 100% CPU issue with still used interfaces in eth_stop Pratyush Anand (1): usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced Sebastian Andrzej Siewior (4): usb: gadget: dummy_hcd: fixup error probe path usb: gadget: dummy_hcd: add support for USB_DT_BOS on rh usb: gadget: at91udc: don't overwrite driver data usb: gadget: at91udc: Don't check for ep-ep.desc Sergei Shtylyov (2): usb: musb: tusb6010: fix error path in tusb_probe() usb: musb: musbhsdma: fix IRQ check yuzheng ma (1): usb: musb: host: fix for musb_start_urb Oops drivers/usb/dwc3/core.c | 9 ++-- drivers/usb/dwc3/ep0.c | 1 - drivers/usb/dwc3/gadget.c| 7 -- drivers/usb/gadget/at91_udc.c| 6 +- drivers/usb/gadget/dummy_hcd.c | 41 drivers/usb/gadget/f_fs.c| 4 drivers/usb/gadget/s3c-hsotg.c | 3 +++ drivers/usb/gadget/u_ether.c | 6 ++ drivers/usb/gadget/u_serial.c| 4 drivers/usb/musb/Kconfig | 4 ++-- drivers/usb/musb/musb_dsps.c | 19 + drivers/usb/musb/musb_host.c | 2 +- drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/musb/tusb6010.c | 2 +- drivers/usb/renesas_usbhs/common.c | 6 +++--- drivers/usb/renesas_usbhs/fifo.c | 4 ++-- drivers/usb/renesas_usbhs/mod_host.c | 8 +++ 17 files changed, 95 insertions(+), 33 deletions(-) Odd, my pull ended up with: Merge made by the 'recursive' strategy. drivers/usb/dwc3/core.c | 9 +++-- drivers/usb/dwc3/ep0.c | 1 - drivers/usb/dwc3/gadget.c| 7 +-- drivers/usb/gadget/at91_udc.c| 6 +- drivers/usb/gadget/dummy_hcd.c | 41 + drivers/usb/gadget/f_fs.c| 4 drivers/usb/gadget/s3c-hsotg.c | 3 +++ drivers/usb/gadget/u_serial.c| 4 drivers/usb/musb/musb_host.c | 2 +- drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/musb/tusb6010.c | 2 +- drivers/usb/renesas_usbhs/fifo.c | 4 ++-- 12 files changed, 66 insertions(+), 19 deletions(-) So something is missing here, right? Because of this, I've not pulled this now, what went wrong? Did you merge the branch or the tag ? Here's what I get as git request-pull's output: $ git request-pull v3.6-rc1 usb fixes-for-v3.6-rc4 The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee: Linux 3.6-rc1 (2012-08-02 16:38:10 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/fixes-for-v3.6-rc4 for you to fetch changes up to
Re: chipidea driver
Greg KH gre...@linuxfoundation.org writes: On Fri, Aug 24, 2012 at 10:09:11AM +0800, Richard Zhao wrote: On Thu, Aug 23, 2012 at 06:57:03PM +0200, Marc Kleine-Budde wrote: Hello, Michael and I have a bunch of updates and improvement for the chipidea driver. They apply to Richard's tree: https://github.com/riczhao/kernel-imx/commits/topics/usb-driver What's the status of these patches? It would be fine if someone queues them for upstream. My patches is pending on Alex to review. The otg patch series was sent on Jul 12. I don't know whether Alex has been back from vacation, or what else I can do. otg patch: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/109020.html usbmisc: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/111945.html Alex, what is going on with the pending chipidea patches? There seem to be a lot of them, and I haven't seen any response from you in quite some time. Indeed there's a pile of patches, I'm going through them right now, Marc already has my acks. We should probably agree if I should collect them all before sending to you or if guys can send them to you directly (as soon as we agree on acks). Regards, -- Alex -- To unsubscribe from this list: send the line unsubscribe 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] musb: Kill __init from function that are called at other times as well.
On Thu, Sep 06, 2012 at 05:01:46PM +0300, Pantelis Antoniou wrote: Marking functions as __init or __devinit and calling them at other times leads to predictable crashes (if you're lucky). Remove them for now. Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com --- drivers/usb/musb/musb_core.c| 16 drivers/usb/musb/musb_debugfs.c | 2 +- drivers/usb/musb/musb_dma.h | 2 +- drivers/usb/musb/musb_gadget.c | 6 +++--- drivers/usb/musb/musbhsdma.c| 2 +- drivers/usb/musb/omap2430.c | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 26f1bef..215d2d5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1160,7 +1160,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { * * returns negative errno or offset for next fifo. */ -static int __devinit +static int fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, const struct musb_fifo_cfg *cfg, u16 offset) Are you sure all these functions are called from outside .init.text ? At least fifo_setup(), ep_config_from_table() and musb_core_init() are only during probe(), which sits in .init.text too. -- balbi signature.asc Description: Digital signature
Re: Re: Re: 3.0 device attached to USB 3.0 hub port doesn't respond address device command after resume
On Wed, Sep 05, 2012 at 02:23:30PM -0700, Sarah Sharp wrote: On Tue, Aug 21, 2012 at 08:16:10PM +0800, Andiry Xu wrote: Just have one question - how do you add suspend/resume support for DWC USB 3 controller? Where can I find the source code? Is it reusing the suspend/resume code of xhci.c? If you look in drivers/usb/host/xhci-plat.c, you'll see that the xHCI platform driver reuses the standard xHCI bus suspend/resume hooks. So the DWC3 host should have USB device and USB bus suspend. If you're asking about host controller suspend, that would be specific to whatever bus the DWC3 host is attached to. If the DWC3 host is connected via PCI, then it will just use the standard xHCI PCI suspend hooks. I'm not sure if there's suspend support for other host buses. Felipe should be able to answer that question. Yeah, we didn't go as far as PM yet. We want to make sure everything is stable before breaking it with PM :-) There's still a whole bunch of other details which need to be stabilized before even thinking about PM, just take a look at the errata list for this IP (if you have access to it) and you'll see what I'm talking about. I don't think it'd be wise to push any PM support to mainline now! We need to be very, very careful regarding xhci-plat.c and drivers/usb/dwc3/ because it's re-used by many different platforms, all with different PM requirements, so we better make sure the driver is really stable before we start fiddling with something as complex as adding proper suspend/resume hooks which will work on all implementations. cheers -- balbi signature.asc Description: Digital signature
Re: usbnet: fix oops in usbnet_start_xmit
On Thursday 06 September 2012 05:52:30 Dan Carpenter wrote: I sent this email a year ago when the patch was committed but I never received a response. I probably should have checked then. regards, dan carpenter On Wed, Nov 09, 2011 at 10:34:59AM +0300, Dan Carpenter wrote: Hello Konstantin Khlebnikov, This is a semi-automatic email about new static checker warnings. The patch 23ba07991dad: usbnet: fix oops in usbnet_start_xmit from Nov 7, 2011, leads to the following Smatch complaint: drivers/net/usb/usbnet.c +1077 usbnet_start_xmit() error: we previously assumed 'skb' could be null (see line 1060) drivers/net/usb/usbnet.c 1059 1060if (skb) ^^^ check introduced here. 1061skb_tx_timestamp(skb); 1062 1063// some devices want funky USB-level framing, for 1064// win32 driver (usually) and/or hardware quirks 1065if (info-tx_fixup) { 1066skb = info-tx_fixup (dev, skb, GFP_ATOMIC); It turns out that skb == NULL implies info-tx_fixup != NULL and skb will be reassigned. This is very dirty. Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: chipidea driver
On 09/06/2012 03:05 PM, Alexander Shishkin wrote: Greg KH gre...@linuxfoundation.org writes: On Fri, Aug 24, 2012 at 10:09:11AM +0800, Richard Zhao wrote: On Thu, Aug 23, 2012 at 06:57:03PM +0200, Marc Kleine-Budde wrote: Hello, Michael and I have a bunch of updates and improvement for the chipidea driver. They apply to Richard's tree: https://github.com/riczhao/kernel-imx/commits/topics/usb-driver What's the status of these patches? It would be fine if someone queues them for upstream. My patches is pending on Alex to review. The otg patch series was sent on Jul 12. I don't know whether Alex has been back from vacation, or what else I can do. otg patch: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/109020.html usbmisc: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/111945.html Alex, what is going on with the pending chipidea patches? There seem to be a lot of them, and I haven't seen any response from you in quite some time. Indeed there's a pile of patches, I'm going through them right now, Marc already has my acks. We should probably agree if I should collect them all before sending to you or if guys can send them to you directly (as soon as we agree on acks). The fixes patches you just Acked apply to latest v3.6-rc and I think even to Richard's branch. I can rebase them to some other tree. From my point of view the easiest method is that you setup a git tree, add the patches you just Acked, then review, Ack and add other outstanding patches like Richard's series. Then you can send them upstream. It makes development easier, at least for me, if we have a tree that holds all Acked patches. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: [PATCH] usb: host: xhci: fix compilation error for non-PCI based stacks
Hi, On Wed, Sep 05, 2012 at 12:31:50PM -0700, Sarah Sharp wrote: On Wed, Sep 05, 2012 at 08:34:26AM +0300, Felipe Balbi wrote: From: Moiz Sonasath m-sonas...@ti.com For non PCI-based stacks, this function call usb_disable_xhci_ports(to_pci_dev(hcd-self.controller)); made from xhci_shutdown is not applicable. Ideally, we wouldn't have any PCI-specific code on a generic driver such as the xHCI stack, but it looks like we should just stub usb_disable_xhci_ports() out for non-PCI devices. Oops, sorry about breaking non-PCI builds! I've already gotten a different bug fix for the same commit that broke it, so I probably shouldn't have rushed to push it before I left for vacation. :( no problem. This is the kind of issue which having xhci.c split to its own platform_device/platform_driver with PCI/OMAP/Exynos/etc glues as a parent device would solve. The core driver would only care about struct device * and all the bus glue specific details could be either implemented through the PM framework (which guarantees parent's suspend will only be called after all children are suspended) and, for non-PM stuff, with something such as: static int usb_pci_disable_ports(struct device *child) { struct pci_glue *glue = dev_get_drvdata(child-parent); if (!glue) bail(); pci_write_config_dword(glue-pci, USB_INTEL_USB3_PSSEN, 0x0); pci_write_config_dword(glue-pci, USB_INTEL_XUSB2PR, 0x0); return 0; } static struct xhci_bus_glue_ops xhci_pci_ops = { .disable_ports = usb_pci_disable_ports, [ ... ] }; then pass that as platform_data to xhci.c's device, and something like below on a header: static inline int usb_disable_xhci_ports(struct xhci_hcd *xhci) { if (!xhci || !xhci-ops || !xhci-ops-disable_ports) return 0; return xhci-ops-disable_ports(xhci-dev); } I know Alan will hate me for saying this, though, but that's life, I guess :-D -- balbi signature.asc Description: Digital signature
Re: [PATCH v7 1/7] drivers: usb: phy: add a new driver for omap usb2 phy
On Thu, Sep 06, 2012 at 01:03:02PM +, Arnd Bergmann wrote: On Thursday 06 September 2012, ABRAHAM, KISHON VIJAY wrote: diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt index d2fe064..bb0c7f4 100644 --- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt @@ -8,3 +8,6 @@ properties: Sub-nodes: All the devices connected to ocp2scp are described using sub-node to ocp2scp +- usb2phy : + The binding details of usb2phy can be found in: + Documentation/devicetree/bindings/usb/omap-usb.txt The above two lines should be added in omap-ocp2scp.txt (this file was added as part of omap: add ocp2scp as a bus driver and is in linux-next). However this file is still not in Felipe's xceiv branch. So I'm not sure how I can get this patch merged in Felipe's tree without conflict. There are three possible ways to do that: * Not add that text. Is is actually required? The ocp2scp bus driver doesn't actually care what is connected to it, does it? * Ask Felipe to merge the drivers/ocp2scp branch from arm-soc into his branch, then apply your patch on top. The branch is scheduled for merging in 3.7 and is stable, so there is no harm merging it into his tree, as long as Olof and I are aware of this. * Split out this change and apply the patch to add this documentation change on top of the drivers/ocp2scp branch in the arm-soc tree. There is no strict dependency between this change and the others you want to merge, so it does not matter which tree it is merged through. I'd be more comfortable with option 3 or 1, whatever you guys decide is fine ;-) -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: fsl_udc_core: do not immediatly prime STATUS for IN xfer
On Wed, Sep 05, 2012 at 02:10:39AM +, Chen Peter-B29397 wrote: Because the fsl_udc_core driver shares one 'status_req' object for the complete ep0 control transfer, it is not possible to prime the final STATUS phase immediately after the IN transaction. E.g. ch9getstatus() executed: | req = udc-status_req; | ... | list_add_tail(req-queue, ep-queue); | if (ep0_prime_status(udc, EP_DIR_OUT)) | | struct fsl_req *req = udc-status_req; | list_add_tail(req-queue, ep-queue); which corrupts the ep-queue list by inserting 'status_req' twice. This causes a kernel oops e.g. when 'lsusb -v' is executed on the host. Patch delays the final 'ep0_prime_status(udc, EP_DIR_OUT))' by moving it into the ep0 completion handler. Enrico, thanks for pointing this problem. As prime STATUS phase immediately after the IN transaction is followed USB 2.0 spec, to fix this problem, it is better to add data_req for ep0. In fact, it is already at FSL i.mx internal code, just still not mainlined. so, do I get an Acked-by to this patch ? Does it need to go on v3.6-rc or can it wait until v3.7 merge window ? -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: cdc-ncm: struct usb_cdc_ncm_ndp_input_size not initialized
On Thu, Sep 6, 2012 at 2:35 PM, Frank Hoffmann frank.hoffm...@thesycon.de wrote: I'm not sure if it is also required to initialize the wNtbInMaxDatagrams field because 0 (no limit) is a valid value. It is not required. The limit was removed in one of the patches earlier. /alexey -- To unsubscribe from this list: send the line unsubscribe 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: chipidea driver
On Thu, Sep 06, 2012 at 03:15:10PM +0200, Marc Kleine-Budde wrote: On 09/06/2012 03:05 PM, Alexander Shishkin wrote: Greg KH gre...@linuxfoundation.org writes: On Fri, Aug 24, 2012 at 10:09:11AM +0800, Richard Zhao wrote: On Thu, Aug 23, 2012 at 06:57:03PM +0200, Marc Kleine-Budde wrote: Hello, Michael and I have a bunch of updates and improvement for the chipidea driver. They apply to Richard's tree: https://github.com/riczhao/kernel-imx/commits/topics/usb-driver What's the status of these patches? It would be fine if someone queues them for upstream. My patches is pending on Alex to review. The otg patch series was sent on Jul 12. I don't know whether Alex has been back from vacation, or what else I can do. otg patch: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/109020.html usbmisc: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/111945.html Alex, what is going on with the pending chipidea patches? There seem to be a lot of them, and I haven't seen any response from you in quite some time. Indeed there's a pile of patches, I'm going through them right now, Marc already has my acks. We should probably agree if I should collect them all before sending to you or if guys can send them to you directly (as soon as we agree on acks). The fixes patches you just Acked apply to latest v3.6-rc and I think even to Richard's branch. I can rebase them to some other tree. From my point of view the easiest method is that you setup a git tree, add the patches you just Acked, then review, Ack and add other outstanding patches like Richard's series. Then you can send them upstream. It makes development easier, at least for me, if we have a tree that holds all Acked patches. Me too, as that way I _know_ they are the correct patches, and that you have properly tested them before sending them on to me. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] - USB3 bluetooth device not working properly?
On 09/06/2012 12:02 AM, Sarah Sharp wrote: I'm actually wondering if you're hitting a bug that is fixed by a patch in my queue to send to Greg. Apparently, some BIOSes expect specific USB ports on the mobile Panther Point chipset to remain under the EHCI controller, even though they can be switched over to the xHCI host controller. Hi Sarah! Thanks for your reply! Can you run this git command, compile a kernel, and see if it fixes your issue? git clone git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git -b for-usb-linus I did that but doesn't change anything. Same errors are still present. This is from logs with this rebuilt kernel: [ 293.314742] xhci_hcd :00:14.0: Timeout while waiting for address device command [ 313.518513] xhci_hcd :00:14.0: Timeout while waiting for address device command [ 313.722498] usb 3-3: device not accepting address 4, error -62 [ 314.258506] usb 3-3: device not accepting address 5, error -22 [ 314.778480] usb 3-3: device not accepting address 6, error -22 [ 315.298479] usb 3-3: device not accepting address 7, error -22 Please help. :) -- Best regards, Miroslav -- To unsubscribe from this list: send the line unsubscribe 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: chipidea driver
On 09/06/2012 04:02 PM, Greg KH wrote: Indeed there's a pile of patches, I'm going through them right now, Marc already has my acks. We should probably agree if I should collect them all before sending to you or if guys can send them to you directly (as soon as we agree on acks). The fixes patches you just Acked apply to latest v3.6-rc and I think even to Richard's branch. I can rebase them to some other tree. From my point of view the easiest method is that you setup a git tree, add the patches you just Acked, then review, Ack and add other outstanding patches like Richard's series. Then you can send them upstream. It makes development easier, at least for me, if we have a tree that holds all Acked patches. Me too, as that way I _know_ they are the correct patches, and that you have properly tested them before sending them on to me. \o/, I've put our patches (with Alexander's Acks and stable@v.k.o on Cc) into my repo: http://git.pengutronix.de/?p=mkl/linux.git;a=shortlog;h=refs/heads/chipidea-next Freshly rebased onto Greg's usb-next. Marc PS: I'm out-of-office soon and return on 12th of September. Feel free to ask Michael Grzeschik (Cc'ed) in the mean time. --- The following changes since commit a7bdf7fa33127bf08eb0810698bca607a9462df4: Merge v3.6-rc3 into usb-next (2012-08-27 07:15:30 -0700) are available in the git repository at: git://git.pengutronix.de/git/mkl/linux.git chipidea-next for you to fetch changes up to b5b9c55d667986b4a6d66d5721c92acbd42baf6e: usb: chipidea: udc: don't stall endpoint if request list is empty in isr_tr_complete_low (2012-09-06 16:01:36 +0200) Marc Kleine-Budde (2): usb: chipidea: udc: fix error path in udc_start() usb: chipidea: cleanup dma_pool if udc_start() fails Michael Grzeschik (3): usb: chipidea: udc: fix setup of endpoint maxpacket size usb: chipidea: udc: add pullup fuction, needed by the uvc gadget usb: chipidea: udc: don't stall endpoint if request list is empty in isr_tr_complete_low drivers/usb/chipidea/udc.c | 59 ++-- 1 file changed, 41 insertions(+), 18 deletions(-) -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: [PATCH] usb: gadget: fsl_udc_core: do not immediatly prime STATUS for IN xfer
Felipe Balbi ba...@ti.com writes: Because the fsl_udc_core driver shares one 'status_req' object for the complete ep0 control transfer, it is not possible to prime the final STATUS phase immediately after the IN transaction. E.g. ch9getstatus() executed: | req = udc-status_req; | ... | list_add_tail(req-queue, ep-queue); | if (ep0_prime_status(udc, EP_DIR_OUT)) | | struct fsl_req *req = udc-status_req; | list_add_tail(req-queue, ep-queue); which corrupts the ep-queue list by inserting 'status_req' twice. This causes a kernel oops e.g. when 'lsusb -v' is executed on the host. Patch delays the final 'ep0_prime_status(udc, EP_DIR_OUT))' by moving it into the ep0 completion handler. Enrico, thanks for pointing this problem. As prime STATUS phase immediately after the IN transaction is followed USB 2.0 spec, to fix this problem, it is better to add data_req for ep0. In fact, it is already at FSL i.mx internal code, just still not mainlined. so, do I get an Acked-by to this patch ? Does it need to go on v3.6-rc or can it wait until v3.7 merge window ? Without this (or the mentioned data_req patch), I can crash a g_multi gadget by executing 'lsusb -v' as root on the host. Should not be exploitable (only a BUG_ON() is triggered) but issue should be fixed asap. Enrico -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: fsl_udc_core: do not immediatly prime STATUS for IN xfer
Hi, On Thu, Sep 06, 2012 at 04:27:12PM +0200, Enrico Scholz wrote: Felipe Balbi ba...@ti.com writes: Because the fsl_udc_core driver shares one 'status_req' object for the complete ep0 control transfer, it is not possible to prime the final STATUS phase immediately after the IN transaction. E.g. ch9getstatus() executed: | req = udc-status_req; | ... | list_add_tail(req-queue, ep-queue); | if (ep0_prime_status(udc, EP_DIR_OUT)) | | struct fsl_req *req = udc-status_req; | list_add_tail(req-queue, ep-queue); which corrupts the ep-queue list by inserting 'status_req' twice. This causes a kernel oops e.g. when 'lsusb -v' is executed on the host. Patch delays the final 'ep0_prime_status(udc, EP_DIR_OUT))' by moving it into the ep0 completion handler. Enrico, thanks for pointing this problem. As prime STATUS phase immediately after the IN transaction is followed USB 2.0 spec, to fix this problem, it is better to add data_req for ep0. In fact, it is already at FSL i.mx internal code, just still not mainlined. so, do I get an Acked-by to this patch ? Does it need to go on v3.6-rc or can it wait until v3.7 merge window ? Without this (or the mentioned data_req patch), I can crash a g_multi gadget by executing 'lsusb -v' as root on the host. Should not be exploitable (only a BUG_ON() is triggered) but issue should be fixed asap. cool, so I'll apply to my fixes branch as soon as I get Acked-by or Tested-by from someone. cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: fsl_udc_core: remove mapped flag
Chen Peter-B29397 b29...@freescale.com writes: If the class driver has already mapped this address, the req-req.dma is not DMA_ADDR_INVALID either, in this case, the dma_sync_single_for_cpu is enough. ok; forget the patch then. Thanks Enrico -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] usb: otg: add device tree support to otg library
On Tue, Sep 04, 2012 at 09:32:06PM +0200, Marc Kleine-Budde wrote: On 09/04/2012 07:51 PM, ABRAHAM, KISHON VIJAY wrote: Since it's already a common function, we may give phandler property a common name too. So we will not need phandle argument. Please also don't forget to document the devm_xxx and dt binding. I don't think this is a good idea. If we hardcode the phandle name, we introduce a limit of one phy per usb device. The usb3 controllers alreadyt use two phys (one for usb2, the othere for usb3) for one controller. So I think we should not make the same mistake again. That only means current binding is not good enough. Rather not, means it should not be in common code. Maybe something like: usbport0-phys = phy0; usbport1-phys = phy1 phy2; /* usb2 usb3 */ Granted. Do we need strings that describe the phys, like in pinctrl or is a index enough? What about this? struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, int index) Comments? The phandle_name string will be usbphy. I don't think phandle_name should be usbphy. Eventually we want to turn this into a kernel-wide phy subsystem and if we use usbphy, we will just have to patch a bunch of dts files once we make the move. Coud you please give a link of kernel-wide phy subsystem discussion? Is just phy better? If the property name don't include port number, how do we know what port the phy is attached to? We can use something like -phy as the phandle name. And the users can get the phy by using devm_usb_get_phy_by_phandle(dev, ). (So the frwrk appends *-phy* to the name and searches). Or we don't have any restriction on the phandle naming conventions and search for the phandle by the name the user passes in devm_usb_get_phy_by_phandle directly. Maintainer, I need a Maintainer. Can someone please decide what we want to have here. I can code all that, but please someone has to make a decision. Now, please. Like I said on another reply: phyN (phy1, phy2, ... phyN) is better since eventually we want to turn this into a kernel-wide PHY layer. -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/2] usb: otg: mxs-phy: Fix mx23 operation
On Thu, Aug 30, 2012 at 08:04:04PM +0200, Marek Vasut wrote: 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? I need a final version for this series or it won't make it into v3.7 -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: fsl_udc_core: remove mapped flag
On Thu, Sep 06, 2012 at 04:32:28PM +0200, Enrico Scholz wrote: Chen Peter-B29397 b29...@freescale.com writes: If the class driver has already mapped this address, the req-req.dma is not DMA_ADDR_INVALID either, in this case, the dma_sync_single_for_cpu is enough. ok; forget the patch then. fair enough, when can I get generic map/unmap conversion patch ? -- balbi signature.asc Description: Digital signature
Re: [PATCH 2/3] usb: otg: add device tree support to otg library
On Thu, Sep 06, 2012 at 05:30:02PM +0300, Felipe Balbi wrote: On Tue, Sep 04, 2012 at 09:32:06PM +0200, Marc Kleine-Budde wrote: On 09/04/2012 07:51 PM, ABRAHAM, KISHON VIJAY wrote: Since it's already a common function, we may give phandler property a common name too. So we will not need phandle argument. Please also don't forget to document the devm_xxx and dt binding. I don't think this is a good idea. If we hardcode the phandle name, we introduce a limit of one phy per usb device. The usb3 controllers alreadyt use two phys (one for usb2, the othere for usb3) for one controller. So I think we should not make the same mistake again. That only means current binding is not good enough. Rather not, means it should not be in common code. Maybe something like: usbport0-phys = phy0; usbport1-phys = phy1 phy2; /* usb2 usb3 */ Granted. Do we need strings that describe the phys, like in pinctrl or is a index enough? What about this? struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, int index) Comments? The phandle_name string will be usbphy. I don't think phandle_name should be usbphy. Eventually we want to turn this into a kernel-wide phy subsystem and if we use usbphy, we will just have to patch a bunch of dts files once we make the move. Coud you please give a link of kernel-wide phy subsystem discussion? Is just phy better? If the property name don't include port number, how do we know what port the phy is attached to? We can use something like -phy as the phandle name. And the users can get the phy by using devm_usb_get_phy_by_phandle(dev, ). (So the frwrk appends *-phy* to the name and searches). Or we don't have any restriction on the phandle naming conventions and search for the phandle by the name the user passes in devm_usb_get_phy_by_phandle directly. Maintainer, I need a Maintainer. Can someone please decide what we want to have here. I can code all that, but please someone has to make a decision. Now, please. Like I said on another reply: phyN (phy1, phy2, ... phyN) is better since eventually we want to turn this into a kernel-wide PHY layer. I think Marc is wondering how to handle the below two case in such way. - how to get the port number the phy is attached to - how to describe it if a port has two phys. Thanks Richard -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] usb: otg: add device tree support to otg library
Hi, We should at least add Grant to the loop, I guess. On Thu, Sep 06, 2012 at 10:46:13PM +0800, Richard Zhao wrote: On Thu, Sep 06, 2012 at 05:30:02PM +0300, Felipe Balbi wrote: On Tue, Sep 04, 2012 at 09:32:06PM +0200, Marc Kleine-Budde wrote: On 09/04/2012 07:51 PM, ABRAHAM, KISHON VIJAY wrote: Since it's already a common function, we may give phandler property a common name too. So we will not need phandle argument. Please also don't forget to document the devm_xxx and dt binding. I don't think this is a good idea. If we hardcode the phandle name, we introduce a limit of one phy per usb device. The usb3 controllers alreadyt use two phys (one for usb2, the othere for usb3) for one controller. So I think we should not make the same mistake again. That only means current binding is not good enough. Rather not, means it should not be in common code. Maybe something like: usbport0-phys = phy0; usbport1-phys = phy1 phy2; /* usb2 usb3 */ Granted. Do we need strings that describe the phys, like in pinctrl or is a index enough? What about this? struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, int index) Comments? The phandle_name string will be usbphy. I don't think phandle_name should be usbphy. Eventually we want to turn this into a kernel-wide phy subsystem and if we use usbphy, we will just have to patch a bunch of dts files once we make the move. Coud you please give a link of kernel-wide phy subsystem discussion? Is just phy better? If the property name don't include port number, how do we know what port the phy is attached to? We can use something like -phy as the phandle name. And the users can get the phy by using devm_usb_get_phy_by_phandle(dev, ). (So the frwrk appends *-phy* to the name and searches). Or we don't have any restriction on the phandle naming conventions and search for the phandle by the name the user passes in devm_usb_get_phy_by_phandle directly. Maintainer, I need a Maintainer. Can someone please decide what we want to have here. I can code all that, but please someone has to make a decision. Now, please. Like I said on another reply: phyN (phy1, phy2, ... phyN) is better since eventually we want to turn this into a kernel-wide PHY layer. I think Marc is wondering how to handle the below two case in such way. - how to get the port number the phy is attached to - how to describe it if a port has two phys. Would something like below work ? phy = phy1 0 phy2 1; where the first attribute is a phandle to the phy and the second is a port number ? -- balbi signature.asc Description: Digital signature
[PATCH 0/3] omap: musb: Add device tree support
This patch series adds device tree support for MUSB. The glue layer is now made to write to mailbox register (present in control module) instead of calling phy layer to write to mailbox register. Writing to mailbox register notifies the core of events like device connect/disconnect. Previously these patches were part of [PATCH v7 0/7] omap: musb: Add device tree support This patch series was created to contain only the *musb* part and it also has one hwmod patch. This patch series was created on git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git musb Kishon Vijay Abraham I (3): arm: omap: hwmod: add a new addr space in otg for writing to control module usb: musb: omap: write directly to mailbox instead of using phy usb: musb: omap: Add device tree support for omap musb glue Documentation/devicetree/bindings/usb/omap-usb.txt | 33 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 + drivers/usb/musb/omap2430.c| 106 ++-- drivers/usb/musb/omap2430.h|9 ++ 4 files changed, 146 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt -- 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/3] usb: musb: omap: write directly to mailbox instead of using phy
The glue layer should directly write to mailbox register (present in control module) instead of calling phy layer to write to mailbox register. Writing to mailbox register notifies the core of events like device connect/disconnect. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/usb/musb/omap2430.c | 52 +-- drivers/usb/musb/omap2430.h |9 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 02c39a7..f4d9503 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -45,6 +45,7 @@ struct omap2430_glue { struct platform_device *musb; enum omap_musb_vbus_id_status status; struct work_struct omap_musb_mailbox_work; + u32 __iomem *control_otghs; }; #define glue_to_musb(g)platform_get_drvdata(g-musb) @@ -52,6 +53,26 @@ struct omap2430_glue *_glue; static struct timer_list musb_idle_timer; +/** + * omap4_usb_phy_mailbox - write to usb otg mailbox + * @glue: struct omap2430_glue * + * @val: the value to be written to the mailbox + * + * On detection of a device (ID pin is grounded), this API should be called + * to set AVALID, VBUSVALID and ID pin is grounded. + * + * When OMAP is connected to a host (OMAP in device mode), this API + * is called to set AVALID, VBUSVALID and ID pin in high impedance. + * + * XXX: This function will be removed once we have a seperate driver for + * control module + */ +static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val) +{ + if (glue-control_otghs) + writel(val, glue-control_otghs); +} + static void musb_do_idle(unsigned long _musb) { struct musb *musb = (void *)_musb; @@ -247,6 +268,7 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox); static void omap_musb_set_mailbox(struct omap2430_glue *glue) { + u32 val; struct musb *musb = glue_to_musb(glue); struct device *dev = musb-controller; struct musb_hdrc_platform_data *pdata = dev-platform_data; @@ -262,7 +284,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) musb-xceiv-last_event = USB_EVENT_ID; if (musb-gadget_driver) { pm_runtime_get_sync(dev); - usb_phy_init(musb-xceiv); + val = AVALID | VBUSVALID; + omap4_usb_phy_mailbox(glue, val); omap2430_musb_set_vbus(musb, 1); } break; @@ -275,7 +298,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) musb-xceiv-last_event = USB_EVENT_VBUS; if (musb-gadget_driver) pm_runtime_get_sync(dev); - usb_phy_init(musb-xceiv); + val = IDDIG | AVALID | VBUSVALID; + omap4_usb_phy_mailbox(glue, val); break; case OMAP_MUSB_ID_FLOAT: @@ -292,7 +316,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) if (musb-xceiv-otg-set_vbus) otg_set_vbus(musb-xceiv-otg, 0); } - usb_phy_shutdown(musb-xceiv); + val = SESSEND | IDDIG; + omap4_usb_phy_mailbox(glue, val); break; default: dev_dbg(dev, ID float\n); @@ -367,6 +392,7 @@ err1: static void omap2430_musb_enable(struct musb *musb) { u8 devctl; + u32 val; unsigned long timeout = jiffies + msecs_to_jiffies(1000); struct device *dev = musb-controller; struct omap2430_glue *glue = dev_get_drvdata(dev-parent); @@ -376,7 +402,8 @@ static void omap2430_musb_enable(struct musb *musb) switch (glue-status) { case OMAP_MUSB_ID_GROUND: - usb_phy_init(musb-xceiv); + val = AVALID | VBUSVALID; + omap4_usb_phy_mailbox(glue, val); if (data-interface_type != MUSB_INTERFACE_UTMI) break; devctl = musb_readb(musb-mregs, MUSB_DEVCTL); @@ -395,7 +422,8 @@ static void omap2430_musb_enable(struct musb *musb) break; case OMAP_MUSB_VBUS_VALID: - usb_phy_init(musb-xceiv); + val = IDDIG | AVALID | VBUSVALID; + omap4_usb_phy_mailbox(glue, val); break; default: @@ -405,11 +433,14 @@ static void omap2430_musb_enable(struct musb *musb) static void omap2430_musb_disable(struct musb *musb) { + u32 val; struct device *dev = musb-controller; struct omap2430_glue *glue = dev_get_drvdata(dev-parent); - if (glue-status != OMAP_MUSB_UNKNOWN) -
[PATCH 2/5] drivers: usb: otg: make twl6030_usb as a comparator driver to omap_usb2
All the PHY configuration other than VBUS, ID GND and OTG SRP are removed from twl6030. The phy configurations are taken care by the dedicated usb2 phy driver. So twl6030 is made as comparator driver for VBUS and ID detection. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/usb/otg/Kconfig |2 +- drivers/usb/otg/twl6030-usb.c | 118 +++-- 2 files changed, 19 insertions(+), 101 deletions(-) diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index 13fd1ddf..d8c8a42 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig @@ -68,7 +68,7 @@ config TWL4030_USB config TWL6030_USB tristate TWL6030 USB Transceiver Driver - depends on TWL4030_CORE + depends on TWL4030_CORE OMAP_USB2 select USB_OTG_UTILS help Enable this to support the USB OTG transceiver on TWL6030 diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c index 6907d8d..32525bb 100644 --- a/drivers/usb/otg/twl6030-usb.c +++ b/drivers/usb/otg/twl6030-usb.c @@ -25,8 +25,9 @@ #include linux/interrupt.h #include linux/platform_device.h #include linux/io.h -#include linux/usb/otg.h #include linux/usb/musb-omap.h +#include linux/usb/phy_companion.h +#include linux/usb/omap_usb.h #include linux/i2c/twl.h #include linux/regulator/consumer.h #include linux/err.h @@ -87,7 +88,7 @@ #defineVBUS_DETBIT(2) struct twl6030_usb { - struct usb_phy phy; + struct phy_companioncomparator; struct device *dev; /* for vbus reporting with irqs disabled */ @@ -107,7 +108,7 @@ struct twl6030_usb { unsigned long features; }; -#define phy_to_twl(x) container_of((x), struct twl6030_usb, phy) +#definecomparator_to_twl(x) container_of((x), struct twl6030_usb, comparator) /*-*/ @@ -137,50 +138,9 @@ static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address) return ret; } -static int twl6030_phy_init(struct usb_phy *x) +static int twl6030_start_srp(struct phy_companion *comparator) { - struct twl6030_usb *twl; - struct device *dev; - struct twl4030_usb_data *pdata; - - twl = phy_to_twl(x); - dev = twl-dev; - pdata = dev-platform_data; - - if (twl-linkstat == OMAP_MUSB_ID_GROUND) - pdata-phy_power(twl-dev, 1, 1); - else - pdata-phy_power(twl-dev, 0, 1); - - return 0; -} - -static void twl6030_phy_shutdown(struct usb_phy *x) -{ - struct twl6030_usb *twl; - struct device *dev; - struct twl4030_usb_data *pdata; - - twl = phy_to_twl(x); - dev = twl-dev; - pdata = dev-platform_data; - pdata-phy_power(twl-dev, 0, 0); -} - -static int twl6030_phy_suspend(struct usb_phy *x, int suspend) -{ - struct twl6030_usb *twl = phy_to_twl(x); - struct device *dev = twl-dev; - struct twl4030_usb_data *pdata = dev-platform_data; - - pdata-phy_suspend(dev, suspend); - - return 0; -} - -static int twl6030_start_srp(struct usb_otg *otg) -{ - struct twl6030_usb *twl = phy_to_twl(otg-phy); + struct twl6030_usb *twl = comparator_to_twl(comparator); twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET); twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET); @@ -313,23 +273,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) return IRQ_HANDLED; } -static int twl6030_set_peripheral(struct usb_otg *otg, - struct usb_gadget *gadget) +static int twl6030_enable_irq(struct twl6030_usb *twl) { - if (!otg) - return -ENODEV; - - otg-gadget = gadget; - if (!gadget) - otg-phy-state = OTG_STATE_UNDEFINED; - - return 0; -} - -static int twl6030_enable_irq(struct usb_phy *x) -{ - struct twl6030_usb *twl = phy_to_twl(x); - twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); @@ -362,9 +307,9 @@ static void otg_set_vbus_work(struct work_struct *data) CHARGERUSB_CTRL1); } -static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) +static int twl6030_set_vbus(struct phy_companion *comparator, bool enabled) { - struct twl6030_usb *twl = phy_to_twl(otg-phy); + struct twl6030_usb *twl = comparator_to_twl(comparator); twl-vbus_enable = enabled; schedule_work(twl-set_vbus_work); @@ -372,23 +317,12 @@ static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) return 0; } -static int twl6030_set_host(struct usb_otg *otg, struct usb_bus *host) -{ - if (!otg) - return -ENODEV; - -
Re: [PATCH] musb: Kill __init from function that are called at other times as well.
Hi Felipe, A proper answer required some instrumentation printks(). So what I did is that I peppered each function marked with a removed __init or __devinit with a printk(KERN_INFO %s:%d (%s) %s\n, __FILE__, __LINE__, KBUILD_MODNAME, __func__); Both omap2430 musb_hdrc are compiled as module, and I issued the following commands on a beagleboard xm. # modprobe omap2430 # modprobe g_mass_storage file=backing_file # rmmod g_mass_storage # rmmod omap2430 # modprobe omap2430 The problem is obvious when you see that functions marked as init or devinit are called when re-loading the omap2430 module again. Those functions if marked as much can (and will as I have witnessed) be removed from memory, leading to a crash. What do you think? Regards -- Pantelis On Sep 6, 2012, at 4:04 PM, Felipe Balbi wrote: On Thu, Sep 06, 2012 at 05:01:46PM +0300, Pantelis Antoniou wrote: Marking functions as __init or __devinit and calling them at other times leads to predictable crashes (if you're lucky). Remove them for now. Signed-off-by: Pantelis Antoniou pa...@antoniou-consulting.com --- drivers/usb/musb/musb_core.c| 16 drivers/usb/musb/musb_debugfs.c | 2 +- drivers/usb/musb/musb_dma.h | 2 +- drivers/usb/musb/musb_gadget.c | 6 +++--- drivers/usb/musb/musbhsdma.c| 2 +- drivers/usb/musb/omap2430.c | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 26f1bef..215d2d5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1160,7 +1160,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { * * returns negative errno or offset for next fifo. */ -static int __devinit +static int fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, const struct musb_fifo_cfg *cfg, u16 offset) Are you sure all these functions are called from outside .init.text ? At least fifo_setup(), ep_config_from_table() and musb_core_init() are only during probe(), which sits in .init.text too. -- balbi Log... root@beagleboard:~# modprobe omap2430 [ 114.643920] drivers/usb/musb/omap2430.c:584 (omap2430) omap2430_init [ 114.650939] drivers/usb/musb/omap2430.c:445 (omap2430) omap2430_probe [ 114.792205] drivers/usb/musb/musb_core.c:2409 (musb_hdrc) musb_init [ 114.798889] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host) [ 114.805358] drivers/usb/musb/musb_core.c:2118 (musb_hdrc) musb_probe [ 114.812225] drivers/usb/musb/musb_core.c:1888 (musb_hdrc) musb_init_controller [ 114.819824] drivers/usb/musb/musb_core.c:1813 (musb_hdrc) allocate_instance [ 114.835723] twl4030_usb twl4030_usb: twl4030_phy_resume [ 114.841339] drivers/usb/musb/musbhsdma.c:391 (musb_hdrc) dma_controller_create [ 114.848999] drivers/usb/musb/musb_core.c:1388 (musb_hdrc) musb_core_init [ 114.856079] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn) [ 114.867095] musb-hdrc: MHDRC RTL version 1.800 [ 114.871887] drivers/usb/musb/musb_core.c:1246 (musb_hdrc) ep_config_from_table [ 114.879486] musb-hdrc: setup fifo_mode 4 [ 114.883666] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.890319] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.897033] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.903686] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.910369] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.917083] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.923767] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.930480] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.937133] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.943817] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.950500] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.957183] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.963867] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.970550] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.977264] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.983947] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.990631] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 114.997314] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.003997] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.010711] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.017395] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.024078] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.030761] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.037475] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup [ 115.044158]
[PATCH 1/5] drivers: usb: phy: add a new driver for omap usb2 phy
All phy related programming like enabling/disabling the clocks, powering on/off the phy is taken care of by this driver. It is also used for OTG related functionality like srp. This also includes device tree support for usb2 phy driver and the documentation with device tree binding information is updated. Currently writing to control module register is taken care in this driver which will be removed once the control module driver is in place. Cc: Felipe Balbi ba...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 17 ++ drivers/usb/phy/Kconfig |9 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/omap-usb2.c | 271 + include/linux/usb/omap_usb.h | 46 include/linux/usb/phy_companion.h | 34 +++ 6 files changed, 378 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/usb-phy.txt create mode 100644 drivers/usb/phy/omap-usb2.c create mode 100644 include/linux/usb/omap_usb.h create mode 100644 include/linux/usb/phy_companion.h diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt new file mode 100644 index 000..80d4148 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -0,0 +1,17 @@ +USB PHY + +OMAP USB2 PHY + +Required properties: + - compatible: Should be ti,omap-usb2 + - reg : Address and length of the register set for the device. Also +add the address of control module dev conf register until a driver for +control module is added + +This is usually a subnode of ocp2scp to which it is connected. + +usb2phy@4a0ad080 { + compatible = ti,omap-usb2; + reg = 0x4a0ad080 0x58, + 0x4a002300 0x4; +}; diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 2838adb..63c339b 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -4,6 +4,15 @@ comment USB Physical Layer drivers depends on USB || USB_GADGET +config OMAP_USB2 + tristate OMAP USB2 PHY Driver + select USB_OTG_UTILS + help + Enable this to support the transceiver that is part of SOC. This + driver takes care of all the PHY functionality apart from comparator. + The USB OTG controller communicates with the comparator using this + driver. + config USB_ISP1301 tristate NXP ISP1301 USB transceiver support depends on USB || USB_GADGET diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index bb948fb..b069f29 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -4,6 +4,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG +obj-$(CONFIG_OMAP_USB2)+= omap-usb2.o obj-$(CONFIG_USB_ISP1301) += isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c new file mode 100644 index 000..15ab3d6 --- /dev/null +++ b/drivers/usb/phy/omap-usb2.c @@ -0,0 +1,271 @@ +/* + * omap-usb2.c - USB PHY, talking to musb controller in OMAP. + * + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Kishon Vijay Abraham I kis...@ti.com + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include linux/module.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/of.h +#include linux/io.h +#include linux/usb/omap_usb.h +#include linux/usb/phy_companion.h +#include linux/clk.h +#include linux/err.h +#include linux/pm_runtime.h +#include linux/delay.h + +/** + * omap_usb2_set_comparator - links the comparator present in the sytem with + * this phy + * @comparator - the companion phy(comparator) for this phy + * + * The phy companion driver should call this API passing the phy_companion + * filled with set_vbus and start_srp to be used by usb phy. + * + * For use by phy companion driver + */ +int omap_usb2_set_comparator(struct phy_companion *comparator) +{ + struct omap_usb *phy; + struct usb_phy *x = usb_get_phy(USB_PHY_TYPE_USB2); + + if (IS_ERR(x)) + return -ENODEV; + + phy = phy_to_omapusb(x); + phy-comparator = comparator; + return 0; +} +EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); + +/** + * omap_usb_phy_power - power on/off the phy using control module reg + * @phy:
[PATCH 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module
The mailbox register for usb otg in omap is present in control module. On detection of any events VBUS or ID, this register should be written to send the notification to musb core. Till we have a separate control module driver to write to control module, omap2430 will handle the register writes to control module by itself. So a new address space to represent this control module register is added to usb_otg_hs. Cc: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 242aee4..02341bc 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5890,6 +5890,11 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { .pa_end = 0x4a0ab003, .flags = ADDR_TYPE_RT }, + { + .pa_start = 0x4a00233c, + .pa_end = 0x4a00233f, + .flags = ADDR_TYPE_RT + }, { } }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] usb: phy/otg: add dt support
This patch series adds device tree support for phy's (twl4030 and twl6030). A new omap-usb2 phy driver has been added (with only dt suppport) to perform phy configurations. Previously this configuration was performed by twl6030, using pdata function pointers. With the addition of omap-usb2 to perform phy configurations, twl6030 is made as a comparator driver to detect VBUS and ID events and notify it to the glue layer. Previously these patches were part of [PATCH v7 0/7] omap: musb: Add device tree support This patch series was developed on git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv Kishon Vijay Abraham I (5): drivers: usb: phy: add a new driver for omap usb2 phy drivers: usb: otg: make twl6030_usb as a comparator driver to omap_usb2 drivers: usb: twl6030: Add dt support for twl6030 usb drivers: usb: twl4030: Add device tree support for twl4030 usb arm: omap: phy: remove unused functions from omap-phy-internal.c .../devicetree/bindings/usb/twl-usb.txt| 40 +++ Documentation/devicetree/bindings/usb/usb-phy.txt | 17 ++ arch/arm/mach-omap2/omap_phy_internal.c| 138 -- arch/arm/mach-omap2/twl-common.c |5 - arch/arm/mach-omap2/usb-musb.c |3 - drivers/usb/otg/Kconfig|2 +- drivers/usb/otg/twl4030-usb.c | 26 +- drivers/usb/otg/twl6030-usb.c | 157 drivers/usb/phy/Kconfig|9 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/omap-usb2.c| 271 include/linux/usb/omap_usb.h | 46 include/linux/usb/phy_companion.h | 34 +++ 13 files changed, 483 insertions(+), 266 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/twl-usb.txt create mode 100644 Documentation/devicetree/bindings/usb/usb-phy.txt create mode 100644 drivers/usb/phy/omap-usb2.c create mode 100644 include/linux/usb/omap_usb.h create mode 100644 include/linux/usb/phy_companion.h -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] usb: musb: omap: Add device tree support for omap musb glue
Added device tree support for omap musb driver and updated the Documentation with device tree binding information. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/usb/omap-usb.txt | 33 drivers/usb/musb/omap2430.c| 54 2 files changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt new file mode 100644 index 000..544fa97 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt @@ -0,0 +1,33 @@ +OMAP GLUE + +OMAP MUSB GLUE + - compatible : Should be ti,musb-omap2430 + - 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 + - interface_type : This is a board specific setting to describe the type of + interface between the controller and the phy. It should be 0 or 1 + specifying ULPI and UTMI respectively. + - mode : Should be 3 to represent OTG. 1 signifies HOST and 2 + represents PERIPHERAL. + - power : Should be 50. This signifies the controller can supply upto + 100mA when operating in host mode. + +SOC specific device node entry +usb_otg_hs: usb_otg_hs@4a0ab000 { + compatible = ti,musb-omap2430; + ti,hwmods = usb_otg_hs; + multipoint = 1; + num_eps = 16; + ram_bits = 12; +}; + +Board specific device node entry +usb_otg_hs { + interface_type = 1; + mode = 3; + power = 50; +}; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index f4d9503..d96873b 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -30,6 +30,7 @@ #include linux/init.h #include linux/list.h #include linux/io.h +#include linux/of.h #include linux/platform_device.h #include linux/dma-mapping.h #include linux/pm_runtime.h @@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32); static int __devinit omap2430_probe(struct platform_device *pdev) { struct musb_hdrc_platform_data *pdata = pdev-dev.platform_data; + struct omap_musb_board_data *data; struct platform_device *musb; struct omap2430_glue*glue; + struct device_node *np = pdev-dev.of_node; + struct musb_hdrc_config *config; struct resource *res; int ret = -ENOMEM; @@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct platform_device *pdev) if (glue-control_otghs == NULL) dev_dbg(pdev-dev, Failed to obtain control memory\n); + 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 err1; + } + + data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL); + if (!data) { + dev_err(pdev-dev, + failed to allocate musb board data\n); + ret = -ENOMEM; + goto err1; + } + + config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL); + if (!data) { + dev_err(pdev-dev, + failed to allocate musb hdrc config\n); + goto err1; + } + + of_property_read_u32(np, mode, (u32 *)pdata-mode); + of_property_read_u32(np, interface_type, + (u32 *)data-interface_type); + of_property_read_u32(np, num_eps, (u32 *)config-num_eps); + of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits); + of_property_read_u32(np, power, (u32 *)pdata-power); + config-multipoint = of_property_read_bool(np, multipoint); + + pdata-board_data = data; + pdata-config = config; + } + pdata-platform_ops = omap2430_ops; platform_set_drvdata(pdev, glue); @@ -597,12 +637,26 @@ static struct dev_pm_ops omap2430_pm_ops = { #define DEV_PM_OPS NULL #endif +#ifdef CONFIG_OF +static const struct of_device_id omap2430_id_table[] = { + { + .compatible = ti,omap4-musb + }, + { + .compatible = ti,omap3-musb + }, + {}, +}; +MODULE_DEVICE_TABLE(of, omap2430_id_table); +#endif + static
Re: [PATCH 1/2] usb: otg: mxs-phy: Fix mx23 operation
Hi Felipe, On Thu, Sep 6, 2012 at 11:30 AM, Felipe Balbi ba...@ti.com wrote: I need a final version for this series or it won't make it into v3.7 I sent a v2 for this last week: http://www.spinics.net/lists/linux-usb/msg69955.html Thanks, 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: [PATCH 1/2] usb: chipidea: usbmisc: unset global varibale usbmisc on driver remove
Hi Marc, Thanks for your patch. It's good. Richard On Thu, Sep 06, 2012 at 02:37:58PM +0200, Marc Kleine-Budde wrote: While there fix a potential race condition, first set usbmisc, then call usbmisc_set_ops(). Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- drivers/usb/chipidea/usbmisc_imx6q.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c index 416e3fc..edc0edd7 100644 --- a/drivers/usb/chipidea/usbmisc_imx6q.c +++ b/drivers/usb/chipidea/usbmisc_imx6q.c @@ -116,14 +116,14 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) return ret; } + usbmisc = data; ret = usbmisc_set_ops(imx6q_usbmisc_ops); if (ret) { + usbmisc = NULL; clk_disable_unprepare(data-clk); return ret; } - usbmisc = data; - return 0; } @@ -131,6 +131,7 @@ static int __devexit usbmisc_imx6q_remove(struct platform_device *pdev) { usbmisc_unset_ops(imx6q_usbmisc_ops); + usbmisc = NULL; clk_disable_unprepare(usbmisc-clk); + usbmisc = NULL; return 0; } -- 1.7.10.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 -- To unsubscribe from this list: send the line unsubscribe 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: chipidea: usbmisc: unset global varibale usbmisc on driver remove
On 09/06/2012 05:11 PM, Richard Zhao wrote: Hi Marc, Thanks for your patch. It's good. Please include or squash in your tree. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: [PATCH 2/2] usb: chipidea: usbmisc: prepare driver to handle more than one soc
Hi Marc, usbmisc_imx6q.c is only for imx6x. And for a certain running kernel, there will be always one driver instance. Thanks Richard On Thu, Sep 06, 2012 at 02:37:59PM +0200, Marc Kleine-Budde wrote: Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- drivers/usb/chipidea/usbmisc_imx6q.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c index edc0edd7..5989a80 100644 --- a/drivers/usb/chipidea/usbmisc_imx6q.c +++ b/drivers/usb/chipidea/usbmisc_imx6q.c @@ -26,6 +26,7 @@ struct imx6q_usbmisc { spinlock_t lock; struct clk *clk; struct usbmisc_usb_device usbdev[USB_DEV_MAX]; + const struct usbmisc_ops *ops; }; static struct imx6q_usbmisc *usbmisc; @@ -78,7 +79,7 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = { }; static const struct of_device_id usbmisc_imx6q_dt_ids[] = { - { .compatible = fsl,imx6q-usbmisc}, + { .compatible = fsl,imx6q-usbmisc, .data = (void *)imx6q_usbmisc_ops }, { /* sentinel */ } }; @@ -116,8 +117,10 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) return ret; } + data-ops = (const struct usbmisc_ops *) + of_match_device(usbmisc_imx6q_dt_ids, pdev-dev); usbmisc = data; - ret = usbmisc_set_ops(imx6q_usbmisc_ops); + ret = usbmisc_set_ops(data-ops); if (ret) { usbmisc = NULL; clk_disable_unprepare(data-clk); @@ -129,7 +132,7 @@ static int __devinit usbmisc_imx6q_probe(struct platform_device *pdev) static int __devexit usbmisc_imx6q_remove(struct platform_device *pdev) { - usbmisc_unset_ops(imx6q_usbmisc_ops); + usbmisc_unset_ops(usbmisc-ops); clk_disable_unprepare(usbmisc-clk); usbmisc = NULL; return 0; -- 1.7.10.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 -- To unsubscribe from this list: send the line unsubscribe 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: chipidea driver
On Thu, Sep 06, 2012 at 04:09:58PM +0200, Marc Kleine-Budde wrote: On 09/06/2012 04:02 PM, Greg KH wrote: Indeed there's a pile of patches, I'm going through them right now, Marc already has my acks. We should probably agree if I should collect them all before sending to you or if guys can send them to you directly (as soon as we agree on acks). The fixes patches you just Acked apply to latest v3.6-rc and I think even to Richard's branch. I can rebase them to some other tree. From my point of view the easiest method is that you setup a git tree, add the patches you just Acked, then review, Ack and add other outstanding patches like Richard's series. Then you can send them upstream. It makes development easier, at least for me, if we have a tree that holds all Acked patches. Me too, as that way I _know_ they are the correct patches, and that you have properly tested them before sending them on to me. \o/, I've put our patches (with Alexander's Acks and stable@v.k.o on Cc) into my repo: http://git.pengutronix.de/?p=mkl/linux.git;a=shortlog;h=refs/heads/chipidea-next Freshly rebased onto Greg's usb-next. That's great, but I'm not going to take a git pull request, _and_ I've seen a ton of other chipidea patches. Alex, can you take these, and the others, and resend them to me in email form? thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] usb: otg: add device tree support to otg library
On 09/06/2012 04:46 PM, Felipe Balbi wrote: Hi, We should at least add Grant to the loop, I guess. On Thu, Sep 06, 2012 at 10:46:13PM +0800, Richard Zhao wrote: On Thu, Sep 06, 2012 at 05:30:02PM +0300, Felipe Balbi wrote: On Tue, Sep 04, 2012 at 09:32:06PM +0200, Marc Kleine-Budde wrote: On 09/04/2012 07:51 PM, ABRAHAM, KISHON VIJAY wrote: Since it's already a common function, we may give phandler property a common name too. So we will not need phandle argument. Please also don't forget to document the devm_xxx and dt binding. I don't think this is a good idea. If we hardcode the phandle name, we introduce a limit of one phy per usb device. The usb3 controllers alreadyt use two phys (one for usb2, the othere for usb3) for one controller. So I think we should not make the same mistake again. That only means current binding is not good enough. Rather not, means it should not be in common code. Maybe something like: usbport0-phys = phy0; usbport1-phys = phy1 phy2; /* usb2 usb3 */ Granted. Do we need strings that describe the phys, like in pinctrl or is a index enough? What about this? struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, int index) Comments? The phandle_name string will be usbphy. I don't think phandle_name should be usbphy. Eventually we want to turn this into a kernel-wide phy subsystem and if we use usbphy, we will just have to patch a bunch of dts files once we make the move. Coud you please give a link of kernel-wide phy subsystem discussion? Is just phy better? If the property name don't include port number, how do we know what port the phy is attached to? We can use something like -phy as the phandle name. And the users can get the phy by using devm_usb_get_phy_by_phandle(dev, ). (So the frwrk appends *-phy* to the name and searches). Or we don't have any restriction on the phandle naming conventions and search for the phandle by the name the user passes in devm_usb_get_phy_by_phandle directly. Maintainer, I need a Maintainer. Can someone please decide what we want to have here. I can code all that, but please someone has to make a decision. Now, please. Like I said on another reply: phyN (phy1, phy2, ... phyN) is better since eventually we want to turn this into a kernel-wide PHY layer. I think Marc is wondering how to handle the below two case in such way. - how to get the port number the phy is attached to - how to describe it if a port has two phys. Would something like below work ? phy = phy1 0 phy2 1; where the first attribute is a phandle to the phy and the second is a port number ? We have two (and some brain damaged) use cases: a) USB2/USB3: One USB controller has two phys, one for USB2 the other for USB3. The hardware has only one USB jack. b) IMHO poorly abstracted USB devices, where there are actually two USB ports per device, there are two USB jacks on the hardware. c) mixture of a)+b) My current code (patch not yet published) implements: struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, int index) With a hard coded phy phandle string and a index to that phandle. Your above example looks like this (taking 0 as base): DT: phy = phy0 phy1; c-code: phy0 = *devm_usb_get_phy_by_phandle(struct device *dev, 0) phy1 = *devm_usb_get_phy_by_phandle(struct device *dev, 1) This solves use case: a) The driver must know index 0 - USB2 phy, index 1 - USB3 phy b) The driver must know index 0 - phy of 1st usb port, index 1 - phy of 2nd USB port But c) is not so easy: c) driver must know how many combined USB2/USB3 jacks and USB2 only jack the hardware has. My solution fails for b) and thus c) if one of the ports (e.g. the first one is/should not be used). In my ideal world of proper abstracted devices each USB port would have its own device entry in the DT and would just stay disabled. Your solution is superior here. But struggles at c), too. Both solutions lack to describe what kind of phy it is. I'm now off for holidays, and back in the office on the 12th of September. Regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
Re: [PATCH 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module
On 9/6/2012 8:25 PM, Kishon Vijay Abraham I wrote: The mailbox register for usb otg in omap is present in control module. On detection of any events VBUS or ID, this register should be written to send the notification to musb core. Till we have a separate control module driver to write to control module, omap2430 will handle the register writes to control module by itself. So a new address space to represent this control module register is added to usb_otg_hs. Cc: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 242aee4..02341bc 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5890,6 +5890,11 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { .pa_end = 0x4a0ab003, .flags = ADDR_TYPE_RT }, + { + .pa_start = 0x4a00233c, + .pa_end = 0x4a00233f, + .flags = ADDR_TYPE_RT + }, I do not have any objection/comment here, but I believe this is control module address space required for USB module, right? I am not sure this is right way of accessing control module space. Actually Control Module Access required for drivers is one of the blocking issue we have currently. Also there was some effort put up by 'Konstantine' to convert Control module to MFD driver, I haven't seen any further update on it. But it would be good to check with him. Thanks, Vaibhav { } }; -- To unsubscribe from this list: send the line unsubscribe 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: [GIT PULL] USB fixes for v3.6-rc4
On Thu, Sep 06, 2012 at 03:59:48PM +0300, Felipe Balbi wrote: On Wed, Sep 05, 2012 at 04:49:37PM -0700, Greg KH wrote: On Thu, Aug 23, 2012 at 12:03:58PM +0300, Felipe Balbi wrote: Hi Greg, Here's my (hopefully) last set of fixes for v3.6-rc cycle. Let me know if you want me to change anything and I'll do so ASAP. cheers The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee: Linux 3.6-rc1 (2012-08-02 16:38:10 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/fixes-for-v3.6-rc4 for you to fetch changes up to 07dc6cb73678e5a2bdaed74774b9064d27b8da0d: usb: renesas_usbhs: fixup DMA transport data alignment (2012-08-23 11:05:40 +0300) (from the branch description for fixes local branch) usb: fixes for v3.6-rc4 Here's a rather big set of fixes for v3.6-rc4. There are some fixes for bugs which have been pending for a long time and only now were uncovered, like the musb and dwc3 patches. We have some remaining fixes for the ep-desc patch series from Ido, and a very important fix to u_ether which would cause 100% cpu utilization in eth_stop. All patches have been pending on linux-usb for a long time and shouldn't cause any further regressions. Ajay Kumar Gupta (3): usb: musb: Fix wrong config for am33xx and ti81xx usb: musb: am335x: fix pdev resource bug usb: musb: reorder runtime pm call Andrzej Pietrasiewicz (1): usb: gadget: add multiple definition guards Julia Lawall (1): usb: gadget: s3c-hsotg.c: fix error return code Kishon Vijay Abraham I (1): usb: dwc3: core: fix incorrect usage of resource pointer Kuninori Morimoto (3): usb: renesas_usbhs: mod_host: add missing .bus_suspend/resume usb: renesas_usbhs: fixup resume method for autonomy mode usb: renesas_usbhs: fixup DMA transport data alignment Michael Grzeschik (1): usb: gadget: u_ether: fix kworker 100% CPU issue with still used interfaces in eth_stop Pratyush Anand (1): usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced Sebastian Andrzej Siewior (4): usb: gadget: dummy_hcd: fixup error probe path usb: gadget: dummy_hcd: add support for USB_DT_BOS on rh usb: gadget: at91udc: don't overwrite driver data usb: gadget: at91udc: Don't check for ep-ep.desc Sergei Shtylyov (2): usb: musb: tusb6010: fix error path in tusb_probe() usb: musb: musbhsdma: fix IRQ check yuzheng ma (1): usb: musb: host: fix for musb_start_urb Oops drivers/usb/dwc3/core.c | 9 ++-- drivers/usb/dwc3/ep0.c | 1 - drivers/usb/dwc3/gadget.c| 7 -- drivers/usb/gadget/at91_udc.c| 6 +- drivers/usb/gadget/dummy_hcd.c | 41 drivers/usb/gadget/f_fs.c| 4 drivers/usb/gadget/s3c-hsotg.c | 3 +++ drivers/usb/gadget/u_ether.c | 6 ++ drivers/usb/gadget/u_serial.c| 4 drivers/usb/musb/Kconfig | 4 ++-- drivers/usb/musb/musb_dsps.c | 19 + drivers/usb/musb/musb_host.c | 2 +- drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/musb/tusb6010.c | 2 +- drivers/usb/renesas_usbhs/common.c | 6 +++--- drivers/usb/renesas_usbhs/fifo.c | 4 ++-- drivers/usb/renesas_usbhs/mod_host.c | 8 +++ 17 files changed, 95 insertions(+), 33 deletions(-) Odd, my pull ended up with: Merge made by the 'recursive' strategy. drivers/usb/dwc3/core.c | 9 +++-- drivers/usb/dwc3/ep0.c | 1 - drivers/usb/dwc3/gadget.c| 7 +-- drivers/usb/gadget/at91_udc.c| 6 +- drivers/usb/gadget/dummy_hcd.c | 41 + drivers/usb/gadget/f_fs.c| 4 drivers/usb/gadget/s3c-hsotg.c | 3 +++ drivers/usb/gadget/u_serial.c| 4 drivers/usb/musb/musb_host.c | 2 +- drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/musb/tusb6010.c | 2 +- drivers/usb/renesas_usbhs/fifo.c | 4 ++-- 12 files changed, 66 insertions(+), 19 deletions(-) So something is missing here, right? Because of this, I've not pulled this now, what went wrong? Did you merge the branch or the tag ? Here's what I get as git request-pull's output: $ git request-pull v3.6-rc1 usb fixes-for-v3.6-rc4 The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee: Linux 3.6-rc1 (2012-08-02 16:38:10
Re: changing usbnet's API to better deal with cdc-ncm
On Thu, Sep 6, 2012 at 4:30 PM, Bjørn Mork bj...@mork.no wrote: Ming Lei tom.leim...@gmail.com writes: On Thu, Sep 6, 2012 at 4:12 AM, Oliver Neukum oneu...@suse.de wrote: Hi, looking at cdc-ncm it seeems to me that cdc-ncm is forced to play very dirty games because usbnet doesn't have a notion about aggregating packets for a single transfer. The Ethernet API we are using does not support transmitting multiple Ethernet frames in a single call, so the aggregation things should be done inside low level driver, in fact it is just what some wlan(802.11n) drivers have been doing. IMO, the current .tx_fixup is intelligent enough to handle aggregation: - return a skb_out for sending if low level drivers think it is ready to send the aggregated frames - return NULL if the low level drivers think they need to wait for more frames Of course, the low level drivers need to start a timer to trigger sending remainder frames in case of timeout and no further frames come from upper protocol stack. Looks the introduced .tx_bundle is not necessary since .tx_fixup is OK. The minidriver does not have any information about tx in progress. The Inside .tx_fixup, the low level driver will get the tx progress information. strategy above, which is what cdc_ncm uses today, is fine as long as you always want to wait as long as you always want to fill as many frames as possible in each packet. But what if the queue is empty and the device For cdc_ncm, the wait time is controlled by cdc_ncm driver, see cdc_ncm_tx_timeout_start(). is just sitting there doing nothing while you are waiting for more frames? Then you are just adding unnecessary latency. As said above, cdc_ncm can control the latency by itself. There are also several usbnet minidrivers for protocols with frame aggregation support. Most of them do not currently implement tx aggregation, possibly due to the complexity. This makes a common aggregation framework interesting in any case. Reimplementing similar loginc in multiple minidrivers is meaningless. If we can abstract some common things about aggregation, it should be meaningful. As far as I know, most of aggregation protocol is very different, so almost all aggregation work is only done by low level driver, such as cdc_ncm. If we want to implement some aggregation framework, maybe below is one solution, correct me if it is wrong. usbnet_start_xmit(): to_send = info-tx_bundle(in_skb, out_skb) if (!to_send) { usbnet_tx_timeout_start(usbnet); goto not_drop; } skb = info-tx_fixup(dev, out_skb, GFP_ATOMIC); ... Looks the above is no much advantage than doing bundling in .tx_fixup just like cdc_ncm. I believe Oliver is adding very useful functionality to usbnet here. Functionality which at least cdc_ncm and possibly other existing minidrivers can take advantage of immediately. There also seems to be a Sorry, I don't know other minidrivers, and is there some common things in building aggregation with cdc_ncm? Considered that the patch doesn't implement wait_for_more, suggest Oliver to post a new one with basic wait_for_more support for further discussion. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line unsubscribe 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/10] drivers/net/usb/sierra_net.c: removes unnecessary semicolon
From: Peter Senna Tschudin peter.se...@gmail.com removes unnecessary semicolon Found by Coccinelle: http://coccinelle.lip6.fr/ Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- drivers/net/usb/sierra_net.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -u -p a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@ -842,7 +842,7 @@ static int sierra_net_rx_fixup(struct us netdev_err(dev-net, HIP/ETH: Invalid pkt\n); dev-net-stats.rx_frame_errors++; - /* dev-net-stats.rx_errors incremented by caller */; + /* dev-net-stats.rx_errors incremented by caller */ return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND] USB/host: Cleanup unneccessary irq disable code
On Thu, Sep 06, 2012 at 02:00:16AM +, Liu, Chuansheng wrote: Because the IRQF_DISABLED as the flag is now a NOOP and has been deprecated and in hardirq context the interrupt is disabled. so in usb/host code: Removing the usage of flag IRQF_DISABLED; Removing the calling local_irq save/restore actions in irq handler usb_hcd_irq(); Signed-off-by: liu chuansheng chuansheng@intel.com Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/core/hcd.c | 15 --- drivers/usb/host/ehci-ls1x.c |2 +- drivers/usb/host/ohci-xls.c |2 +- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bc84106..f84ddea 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2153,15 +2153,8 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum); irqreturn_t usb_hcd_irq (int irq, void *__hcd) { struct usb_hcd *hcd = __hcd; - unsigned long flags; irqreturn_t rc; All of your whitespace is broken, making this patch impossible to apply. As I asked before, please fix this. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
When enabling usb autosuspend, new usb devices aren't recognized
Hi, To enable usb autosuspend i use the following in a script after booting: for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto $i; done; for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 $i; done; After this new usb devices aren't recognized anymore. Whether 'lsusb' nor 'dmesg' show up anything. When i turn the usb port back on manualy: (echo on /sys/bus/usb/devices/3-1/power/control) the usb device shows up. Since this is my first bug report I'll just add what I think is helpful. % lspci | grep -i usb 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) My system is a Lenovo Thinkpad x230. I'm using arch linux with linux-mainline kernel (https://aur.archlinux.org/packages.php?ID=50893) -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: XHCI: xhci-ring: Remove unused dma address calculation in inc_enq and inc_deq function
Resending patch with latest kernel code: In xhci-ring.c, function inc_enq and inc_deq calculate the dma address of trb but never used. Signed-off-by: Girish Verma gir...@circuitsutra.com --- drivers/usb/host/xhci-ring.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 643c2f3..5c5c47b 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -145,7 +145,6 @@ static void next_trb(struct xhci_hcd *xhci, */ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) { - unsigned long long addr; ring-deq_updates++; @@ -176,7 +175,6 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) } } while (last_trb(xhci, ring, ring-deq_seg, ring-dequeue)); - addr = (unsigned long long) xhci_trb_virt_to_dma(ring-deq_seg, ring-dequeue); } /* @@ -201,7 +199,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, { u32 chain; union xhci_trb *next; - unsigned long long addr; chain = le32_to_cpu(ring-enqueue-generic.field[3]) TRB_CHAIN; /* If this is not event ring, there is one less usable TRB */ @@ -253,7 +250,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, ring-enqueue = ring-enq_seg-trbs; next = ring-enqueue; } - addr = (unsigned long long) xhci_trb_virt_to_dma(ring-enq_seg, ring-enqueue); } /* -- 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
[GIT PULL] USB fixes for v3.6-rc4
Hi Greg, Here's my previous pull request now rebased on top of v3.6-rc4. Sorry for the inconvenience my never rebase methodology :-) Note that I'm rebased on top of v3.6-rc4, so you should probably merge that tag on your tree. After merging v3.6-rc4 on your tree, you can merge my tag and you should get the diffstat below. Let me know if there any other issues. cheers The following changes since commit 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d: Linux 3.6-rc4 (2012-09-01 10:39:58 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/fixes-for-v3.6-rc4 for you to fetch changes up to f4a53c55117b82e895ec98b1765c9d66940377fc: usb: dwc3: gadget: fix pending isoc handling (2012-09-06 19:52:30 +0300) usb: fixes for v3.6-rc4 Here's a rather big set of fixes for v3.6-rc4. There are some fixes for bugs which have been pending for a long time and only now were uncovered, like the musb and dwc3 patches. We have some remaining fixes for the ep-desc patch series from Ido, a fix for renesas DMA usage, IRQ check on musb's DMA and an oops fix on musb Host implementation. All patches have been pending on linux-usb for a long time and shouldn't cause any further regressions. Andrzej Pietrasiewicz (1): usb: gadget: add multiple definition guards Julia Lawall (1): usb: gadget: s3c-hsotg.c: fix error return code Kishon Vijay Abraham I (1): usb: dwc3: core: fix incorrect usage of resource pointer Kuninori Morimoto (1): usb: renesas_usbhs: fixup DMA transport data alignment Pratyush Anand (2): usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced usb: dwc3: gadget: fix pending isoc handling Sebastian Andrzej Siewior (4): usb: gadget: dummy_hcd: fixup error probe path usb: gadget: dummy_hcd: add support for USB_DT_BOS on rh usb: gadget: at91udc: don't overwrite driver data usb: gadget: at91udc: Don't check for ep-ep.desc Sergei Shtylyov (2): usb: musb: tusb6010: fix error path in tusb_probe() usb: musb: musbhsdma: fix IRQ check yuzheng ma (1): usb: musb: host: fix for musb_start_urb Oops drivers/usb/dwc3/core.c | 9 +++-- drivers/usb/dwc3/ep0.c | 1 - drivers/usb/dwc3/gadget.c| 19 +-- drivers/usb/gadget/at91_udc.c| 6 +- drivers/usb/gadget/dummy_hcd.c | 41 drivers/usb/gadget/f_fs.c| 4 drivers/usb/gadget/s3c-hsotg.c | 3 +++ drivers/usb/gadget/u_serial.c| 4 drivers/usb/musb/musb_host.c | 2 +- drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/musb/tusb6010.c | 2 +- drivers/usb/renesas_usbhs/fifo.c | 4 ++-- 12 files changed, 78 insertions(+), 19 deletions(-) -- balbi signature.asc Description: Digital signature
Re: [PATCH] musb: Kill __init from function that are called at other times as well.
Hi, On Thu, Sep 06, 2012 at 05:58:27PM +0300, Pantelis Antoniou wrote: Hi Felipe, A proper answer required some instrumentation printks(). So what I did is that I peppered each function marked with a removed __init or __devinit with a printk(KERN_INFO %s:%d (%s) %s\n, __FILE__, __LINE__, KBUILD_MODNAME, __func__); Both omap2430 musb_hdrc are compiled as module, and I issued the following commands on a beagleboard xm. # modprobe omap2430 # modprobe g_mass_storage file=backing_file # rmmod g_mass_storage # rmmod omap2430 # modprobe omap2430 The problem is obvious when you see that functions marked as init or devinit are called when re-loading the omap2430 module again. Those functions if marked as much can (and will as I have witnessed) be removed from memory, leading to a crash. What do you think? the problem would be with usage of __init. __devinit will only drop .devinit.text if HOTPLUG and MODULE isn't set, AFAICT. I also can't see a crash on below logs. -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module
Hi, On Thu, Sep 06, 2012 at 09:04:58PM +0530, Vaibhav Hiremath wrote: On 9/6/2012 8:25 PM, Kishon Vijay Abraham I wrote: The mailbox register for usb otg in omap is present in control module. On detection of any events VBUS or ID, this register should be written to send the notification to musb core. Till we have a separate control module driver to write to control module, omap2430 will handle the register writes to control module by itself. So a new address space to represent this control module register is added to usb_otg_hs. Cc: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 242aee4..02341bc 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5890,6 +5890,11 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { .pa_end = 0x4a0ab003, .flags = ADDR_TYPE_RT }, + { + .pa_start = 0x4a00233c, + .pa_end = 0x4a00233f, + .flags = ADDR_TYPE_RT + }, I do not have any objection/comment here, but I believe this is control module address space required for USB module, right? I am not sure this is right way of accessing control module space. Actually Control Module Access required for drivers is one of the blocking issue we have currently. Also there was some effort put up by 'Konstantine' to convert Control module to MFD driver, I haven't seen any further update on it. But it would be good to check with him. this was an agreement with Benoit since we already lost a couple merge windows for this patchset. We agreed to wait until -rc4 for SCM driver and if it wasn't ready, we'd go ahead with this and SCM author would fix it up on a patch converting users to new SCM driver. -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module
Hi, On Thu, Sep 06, 2012 at 08:13:03PM +0300, Felipe Balbi wrote: Hi, On Thu, Sep 06, 2012 at 09:04:58PM +0530, Vaibhav Hiremath wrote: On 9/6/2012 8:25 PM, Kishon Vijay Abraham I wrote: The mailbox register for usb otg in omap is present in control module. On detection of any events VBUS or ID, this register should be written to send the notification to musb core. Till we have a separate control module driver to write to control module, omap2430 will handle the register writes to control module by itself. So a new address space to represent this control module register is added to usb_otg_hs. Cc: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 242aee4..02341bc 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5890,6 +5890,11 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { .pa_end = 0x4a0ab003, .flags = ADDR_TYPE_RT }, + { + .pa_start = 0x4a00233c, + .pa_end = 0x4a00233f, + .flags = ADDR_TYPE_RT + }, I do not have any objection/comment here, but I believe this is control module address space required for USB module, right? I am not sure this is right way of accessing control module space. Actually Control Module Access required for drivers is one of the blocking issue we have currently. Also there was some effort put up by 'Konstantine' to convert Control module to MFD driver, I haven't seen any further update on it. But it would be good to check with him. this was an agreement with Benoit since we already lost a couple merge windows for this patchset. We agreed to wait until -rc4 for SCM driver and if it wasn't ready, we'd go ahead with this and SCM author would fix it up on a patch converting users to new SCM driver. Tony, can I get your Acked-by to this patch so I can take it together with the rest of the series ? Thanks ps: I'll apply this to my 'musb' branch which is immutable, so it's safe to merge it into your tree once I apply. -- balbi signature.asc Description: Digital signature
Re: A question on EHCI unlink code
On Thu, 6 Sep 2012, Pavan Kondeti wrote: Hi I am debugging EHCI host system error (4.15.2.4) issue. The issue happens during unlinking of URB from an interface driver. In our system the device is always connected to the host. some interfaces are always active (I/O can happen). Other interface's I/O depends on the user space. if user opens the device node, we submit IN URB. This issue happens when unlinking URB upon file close. This issue happens very rarely. I have a doubt in unlink path of EHCI driver. Say if an endpoint has two pending IN URB requests at the time of calling unlinking API. (usb_kill_anchored_urbs API). The QH's queue of this endpoint looks like this. Qtd1 -- Qtd2 -- Dummy EHCI driver kicks in the Async Advance Doorbell handshake after manipulating the QH horizontal pointer in start_unlink_async() function. EHCI driver wait for IAAD interrupt from the controller. Say controller is working on Qtd1. Which means transfer overlay of this QH has reference to Qtd2. controller generates IAAD interrupt (Qtd1 is not completely finished. QH active pointer points to Qtd1). EHCI driver finishes Qtd2 unlinking and points qtd1's next pointer to qtd'2 next pointer and puts this QH back to asynchronous schedule. My doubt is that software updated only QTD1 memory to point it to Qtd'2 next pointer i.e dummy. What about the QH's transfer overlay memory? Would not the controller try to access the Qtd2 when QH is put back into schedule. To further clarify my question, I am copy pasting the qh_refresh() code here. In the below code, if we enter first qtd may already be partially processed case, should not we update qh-hw-hw_qtd_next and qh-hw-hw_alt_next to reflect the current Qtd memory. static void qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) { struct ehci_qtd *qtd; if (list_empty (qh-qtd_list)) qtd = qh-dummy; else { qtd = list_entry (qh-qtd_list.next, struct ehci_qtd, qtd_list); /* first qtd may already be partially processed */ if (cpu_to_hc32(ehci, qtd-qtd_dma) == qh-hw-hw_current) qtd = NULL; } if (qtd) qh_update (ehci, qh, qtd); } You're absolutely right; this is a bug in the driver. Would you like to submit a patch to fix it? (It shouldn't be necessary to update the hw_alt_next field. The hw_alt_next part of the qTD doesn't get changed when the following qTD is removed.) 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: When enabling usb autosuspend, new usb devices aren't recognized
On Thu, 6 Sep 2012, Florian Merz wrote: Hi, To enable usb autosuspend i use the following in a script after booting: for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto $i; done; for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 $i; done; After this new usb devices aren't recognized anymore. Whether 'lsusb' nor 'dmesg' show up anything. Do you mean that if you plug in a new USB device, nothing happens? Or do you mean that some USB devices which were present during boot don't get detected? Are the undetected devices attached to a USB-2 port or a USB-3 port? When i turn the usb port back on manualy: (echo on /sys/bus/usb/devices/3-1/power/control) the usb device shows up. Since this is my first bug report I'll just add what I think is helpful. % lspci | grep -i usb 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) My system is a Lenovo Thinkpad x230. I'm using arch linux with linux-mainline kernel (https://aur.archlinux.org/packages.php?ID=50893) What is the kernel version? Can you build a kernel with CONFIG_USB_DEBUG enabled and then post the output from dmesg showing what happens during boot and after you turn the port back on manually? 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] musb: Kill __init from function that are called at other times as well.
Hi Felipe I see about __devinit. There's no crash because in those logs the __init modifiers are gone. Regards -- Pantelis On Sep 6, 2012, at 8:07 PM, Felipe Balbi wrote: Hi, On Thu, Sep 06, 2012 at 05:58:27PM +0300, Pantelis Antoniou wrote: Hi Felipe, A proper answer required some instrumentation printks(). So what I did is that I peppered each function marked with a removed __init or __devinit with a printk(KERN_INFO %s:%d (%s) %s\n, __FILE__, __LINE__, KBUILD_MODNAME, __func__); Both omap2430 musb_hdrc are compiled as module, and I issued the following commands on a beagleboard xm. # modprobe omap2430 # modprobe g_mass_storage file=backing_file # rmmod g_mass_storage # rmmod omap2430 # modprobe omap2430 The problem is obvious when you see that functions marked as init or devinit are called when re-loading the omap2430 module again. Those functions if marked as much can (and will as I have witnessed) be removed from memory, leading to a crash. What do you think? the problem would be with usage of __init. __devinit will only drop .devinit.text if HOTPLUG and MODULE isn't set, AFAICT. I also can't see a crash on below logs. -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] musb: Kill __init from function that are called at other times as well.
Hi, On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: Hi Felipe I see about __devinit. There's no crash because in those logs the __init modifiers are gone. it'd be cool to see the crash, though ;-) -- balbi signature.asc Description: Digital signature
Re: [PATCH] musb: Kill __init from function that are called at other times as well.
On Sep 6, 2012, at 8:37 PM, Felipe Balbi wrote: Hi, On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: Hi Felipe I see about __devinit. There's no crash because in those logs the __init modifiers are gone. it'd be cool to see the crash, though ;-) -- balbi Heh, OK, My word is not enough? :) Gimme a few minutes... -- Pantelis -- To unsubscribe from this list: send the line unsubscribe 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: create libcomposite, v3
On Fri, Aug 31, 2012 at 01:39:21PM +0200, Andrzej Pietrasiewicz wrote: We need a configurable composite gadget in the Tizen platform to provide sdbd connectivity and mass storage function at the same time. Your argument is pointless because sdbd is not supported by ccg at this time. You could mean that g_ffs does not support a mass storage function. But then it would be *way* less work to keep a patch OOT which adds mass storage to g_ffs instead of demanding to keep ccg in staging. Anyway, I added a copy of everything to ccg in staging to keep you happy. Thank you, Andrzej 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] musb: Kill __init from function that are called at other times as well.
Hi, On Thu, Sep 06, 2012 at 08:42:56PM +0300, Pantelis Antoniou wrote: On Sep 6, 2012, at 8:37 PM, Felipe Balbi wrote: Hi, On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: Hi Felipe I see about __devinit. There's no crash because in those logs the __init modifiers are gone. it'd be cool to see the crash, though ;-) -- balbi Heh, OK, My word is not enough? :) Gimme a few minutes... Didn't say that, but I don't know what issue you're talking about since __devinit is supposed to keep .devinit.text intact unless !HOTPLUG. This could be a bug on some linker script (though unlikely) just trying to get understand the issue before I apply the patch, that's all. -- balbi signature.asc Description: Digital signature
Re: changing usbnet's API to better deal with cdc-ncm
On Friday 07 September 2012 00:09:13 Ming Lei wrote: On Thu, Sep 6, 2012 at 4:30 PM, Bjørn Mork bj...@mork.no wrote: Ming Lei tom.leim...@gmail.com writes: Looks the introduced .tx_bundle is not necessary since .tx_fixup is OK. The minidriver does not have any information about tx in progress. The Inside .tx_fixup, the low level driver will get the tx progress information. That information changes after tx_fixup strategy above, which is what cdc_ncm uses today, is fine as long as you always want to wait as long as you always want to fill as many frames as possible in each packet. But what if the queue is empty and the device For cdc_ncm, the wait time is controlled by cdc_ncm driver, see cdc_ncm_tx_timeout_start(). Well, that is the mistake. Using a timer is a bad idea. If we can abstract some common things about aggregation, it should be meaningful. As far as I know, most of aggregation protocol is very different, so almost all aggregation work is only done by low level driver, such as cdc_ncm. If we want to implement some aggregation framework, maybe below is one solution, correct me if it is wrong. It isn't so much wrong as incomplete. It seems to me we can have - can queue, buffer not full - do nothing more - can queue, buffer full - transmit - cannot queue, buffer full - transmit and then try again to queue and an error case - cannot queue, buffer not full And that's the way I coded it. Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
libcomposite, v4
This is a rebase respin of the complete two stage series on top of current linus/greg/felipe trees. Patch #1 is new, it adds a note about compatibility issues around ccg in staging. The first few patches still touch ccg because I had to change central gadget code and there was no other sane way. Patch #7 is new and provides a copy of everything for ccg so I can keep working and ignore ccg for good. Patch #8 should be the last one touching ccg. 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 07/29] staging/ccg: include all sourced files
This Android gadget includes a bunch of .c files. Fixing normal gadgets is not the real problem but this gadget is not always fixable since the problem here are fundumential / design. *I* wanted to get this removed but other people want to keep it even though there were reports that Android itself is not using it. Some poeple think that it is better to have this instead of nothing and other argue that they need sdb and mass storage gadget. The sdb function is not provided by ccg so I don't see the point of this. I don't see any logical reasoning behind it and I decided that it is time for retreat. This patch brings all dependencies of ccg into staging so I can do whatever I want in drivers/usb/gadget without breaking ccg. Cc: de...@driverdev.osuosl.org Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/staging/ccg/Makefile |2 -- drivers/staging/ccg/ccg.c | 26 ++-- drivers/{usb/gadget = staging/ccg}/composite.c|0 .../linux/usb = drivers/staging/ccg}/composite.h |0 drivers/{usb/gadget = staging/ccg}/config.c |0 drivers/{usb/gadget = staging/ccg}/epautoconf.c |0 drivers/{usb/gadget = staging/ccg}/f_acm.c|0 drivers/{usb/gadget = staging/ccg}/f_fs.c |0 .../{usb/gadget = staging/ccg}/f_mass_storage.c |0 drivers/{usb/gadget = staging/ccg}/f_rndis.c |0 drivers/{usb/gadget = staging/ccg}/gadget_chips.h |0 drivers/{usb/gadget = staging/ccg}/ndis.h |0 drivers/{usb/gadget = staging/ccg}/rndis.c|0 drivers/{usb/gadget = staging/ccg}/rndis.h|0 .../{usb/gadget = staging/ccg}/storage_common.c |0 drivers/{usb/gadget = staging/ccg}/u_ether.c |0 drivers/{usb/gadget = staging/ccg}/u_ether.h |0 drivers/{usb/gadget = staging/ccg}/u_serial.c |0 drivers/{usb/gadget = staging/ccg}/u_serial.h |0 drivers/{usb/gadget = staging/ccg}/usbstring.c|0 20 files changed, 13 insertions(+), 15 deletions(-) copy drivers/{usb/gadget = staging/ccg}/composite.c (100%) copy {include/linux/usb = drivers/staging/ccg}/composite.h (100%) copy drivers/{usb/gadget = staging/ccg}/config.c (100%) copy drivers/{usb/gadget = staging/ccg}/epautoconf.c (100%) copy drivers/{usb/gadget = staging/ccg}/f_acm.c (100%) copy drivers/{usb/gadget = staging/ccg}/f_fs.c (100%) copy drivers/{usb/gadget = staging/ccg}/f_mass_storage.c (100%) copy drivers/{usb/gadget = staging/ccg}/f_rndis.c (100%) copy drivers/{usb/gadget = staging/ccg}/gadget_chips.h (100%) copy drivers/{usb/gadget = staging/ccg}/ndis.h (100%) copy drivers/{usb/gadget = staging/ccg}/rndis.c (100%) copy drivers/{usb/gadget = staging/ccg}/rndis.h (100%) copy drivers/{usb/gadget = staging/ccg}/storage_common.c (100%) copy drivers/{usb/gadget = staging/ccg}/u_ether.c (100%) copy drivers/{usb/gadget = staging/ccg}/u_ether.h (100%) copy drivers/{usb/gadget = staging/ccg}/u_serial.c (100%) copy drivers/{usb/gadget = staging/ccg}/u_serial.h (100%) copy drivers/{usb/gadget = staging/ccg}/usbstring.c (100%) diff --git a/drivers/staging/ccg/Makefile b/drivers/staging/ccg/Makefile index 693da63..814fa9d 100644 --- a/drivers/staging/ccg/Makefile +++ b/drivers/staging/ccg/Makefile @@ -1,4 +1,2 @@ g_ccg-y:= ccg.o -ccflags-y += -Idrivers/usb/gadget - obj-$(CONFIG_USB_G_CCG)+= g_ccg.o diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c index eadda55..80feb95 100644 --- a/drivers/staging/ccg/ccg.c +++ b/drivers/staging/ccg/ccg.c @@ -32,7 +32,7 @@ #include linux/platform_device.h #include linux/usb/ch9.h -#include linux/usb/composite.h +#include composite.h #include linux/usb/gadget.h #include gadget_chips.h @@ -44,19 +44,19 @@ * the runtime footprint, and giving us at least some parts of what * a gcc --combine ... part1.c part2.c part3.c ... build would. */ -#include ../../usb/gadget/usbstring.c -#include ../../usb/gadget/config.c -#include ../../usb/gadget/epautoconf.c -#include ../../usb/gadget/composite.c - -#include ../../usb/gadget/f_mass_storage.c -#include ../../usb/gadget/u_serial.c -#include ../../usb/gadget/f_acm.c +#include usbstring.c +#include config.c +#include epautoconf.c +#include composite.c + +#include f_mass_storage.c +#include u_serial.c +#include f_acm.c #define USB_ETH_RNDIS y -#include ../../usb/gadget/f_rndis.c -#include ../../usb/gadget/rndis.c -#include ../../usb/gadget/u_ether.c -#include ../../usb/gadget/f_fs.c +#include f_rndis.c +#include rndis.c +#include u_ether.c +#include f_fs.c MODULE_AUTHOR(Mike Lockwood, Andrzej Pietrasiewicz); MODULE_DESCRIPTION(Configurable Composite USB Gadget); diff --git a/drivers/usb/gadget/composite.c b/drivers/staging/ccg/composite.c similarity index 100% copy from drivers/usb/gadget/composite.c copy to drivers/staging/ccg/composite.c diff --git
[PATCH 04/29] usb/gadget: push all usb_composite_driver structs into __refdata
As it turns out, Sam's comment was better than I initially assumed. This patch pushes as struct usb_composite_driver data structures into __refdata section to avoid a section missmatch report from modpost because the -bind() can be marked __init. The only downside is that modpost does not check between -bind() and other member. However, it is temporary. Cc: Sam Ravnborg s...@ravnborg.org Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/acm_ms.c |2 +- drivers/usb/gadget/audio.c |2 +- drivers/usb/gadget/cdc2.c |2 +- drivers/usb/gadget/dbgp.c |2 +- drivers/usb/gadget/ether.c |2 +- drivers/usb/gadget/file_storage.c |2 +- drivers/usb/gadget/g_ffs.c |2 +- drivers/usb/gadget/gmidi.c |2 +- drivers/usb/gadget/hid.c|2 +- drivers/usb/gadget/mass_storage.c |2 +- drivers/usb/gadget/multi.c |2 +- drivers/usb/gadget/ncm.c|2 +- drivers/usb/gadget/nokia.c |2 +- drivers/usb/gadget/printer.c|2 +- drivers/usb/gadget/serial.c |2 +- drivers/usb/gadget/tcm_usb_gadget.c |2 +- drivers/usb/gadget/webcam.c |2 +- drivers/usb/gadget/zero.c |2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index 75b8a69..dc5cd51 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -232,7 +232,7 @@ static int __exit acm_ms_unbind(struct usb_composite_dev *cdev) return 0; } -static struct usb_composite_driver acm_ms_driver = { +static __refdata struct usb_composite_driver acm_ms_driver = { .name = g_acm_ms, .dev= device_desc, .max_speed = USB_SPEED_SUPER, diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 9889924..e539490 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c @@ -198,7 +198,7 @@ static int __exit audio_unbind(struct usb_composite_dev *cdev) return 0; } -static struct usb_composite_driver audio_driver = { +static __refdata struct usb_composite_driver audio_driver = { .name = g_audio, .dev= device_desc, .strings= audio_strings, diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 725550f..00b65ac 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -232,7 +232,7 @@ static int __exit cdc_unbind(struct usb_composite_dev *cdev) return 0; } -static struct usb_composite_driver cdc_driver = { +static __refdata struct usb_composite_driver cdc_driver = { .name = g_cdc, .dev= device_desc, .strings= dev_strings, diff --git a/drivers/usb/gadget/dbgp.c b/drivers/usb/gadget/dbgp.c index 19d7bb0..2d2cff3 100644 --- a/drivers/usb/gadget/dbgp.c +++ b/drivers/usb/gadget/dbgp.c @@ -402,7 +402,7 @@ fail: return err; } -static struct usb_gadget_driver dbgp_driver = { +static __refdata struct usb_gadget_driver dbgp_driver = { .function = dbgp, .max_speed = USB_SPEED_HIGH, .unbind = dbgp_unbind, diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a28f6ff..49a7dac 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -388,7 +388,7 @@ static int __exit eth_unbind(struct usb_composite_dev *cdev) return 0; } -static struct usb_composite_driver eth_driver = { +static __refdata struct usb_composite_driver eth_driver = { .name = g_ether, .dev= device_desc, .strings= dev_strings, diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index a896d73..683234b 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -3603,7 +3603,7 @@ static void fsg_resume(struct usb_gadget *gadget) /*-*/ -static struct usb_gadget_driverfsg_driver = { +static __refdata struct usb_gadget_driver fsg_driver = { .max_speed = USB_SPEED_SUPER, .function = (char *) fsg_string_product, .unbind = fsg_unbind, diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index d3ace90..d1312c4 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c @@ -163,7 +163,7 @@ static int gfs_bind(struct usb_composite_dev *cdev); static int gfs_unbind(struct usb_composite_dev *cdev); static int gfs_do_config(struct usb_configuration *c); -static struct usb_composite_driver gfs_driver = { +static __refdata struct usb_composite_driver gfs_driver = { .name = DRIVER_NAME, .dev= gfs_dev_desc, .strings= gfs_dev_strings, diff --git
[PATCH 08/29] usb/gadget: remove global variable composite in composite.c
This patch removes the global variable composite in composite.c. The private data which was saved there is now passed via an additional argument to the bind() function in struct usb_gadget_driver. Only the old-style UDC drivers have to be touched here, new style are doing it right because this change is made in udc-core. Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/staging/ccg/composite.c |3 +- drivers/usb/gadget/amd5536udc.c |6 +-- drivers/usb/gadget/composite.c| 80 - drivers/usb/gadget/dbgp.c |3 +- drivers/usb/gadget/file_storage.c |3 +- drivers/usb/gadget/fsl_udc_core.c |6 +-- drivers/usb/gadget/fusb300_udc.c |4 +- drivers/usb/gadget/goku_udc.c |6 +-- drivers/usb/gadget/inode.c|7 ++-- drivers/usb/gadget/m66592-udc.c |4 +- drivers/usb/gadget/mv_udc_core.c |6 +-- drivers/usb/gadget/omap_udc.c |6 +-- drivers/usb/gadget/pch_udc.c |6 +-- drivers/usb/gadget/pxa25x_udc.c |6 +-- drivers/usb/gadget/pxa27x_udc.c |6 +-- drivers/usb/gadget/s3c2410_udc.c |6 +-- drivers/usb/gadget/udc-core.c |4 +- include/linux/usb/composite.h |1 + include/linux/usb/gadget.h|6 ++- 19 files changed, 92 insertions(+), 77 deletions(-) diff --git a/drivers/staging/ccg/composite.c b/drivers/staging/ccg/composite.c index 2a345f2..228b457 100644 --- a/drivers/staging/ccg/composite.c +++ b/drivers/staging/ccg/composite.c @@ -1422,7 +1422,8 @@ static u8 override_id(struct usb_composite_dev *cdev, u8 *desc) return *desc; } -static int composite_bind(struct usb_gadget *gadget) +static int composite_bind(struct usb_gadget *gadget, + struct usb_gadget_driver *driver) { struct usb_composite_dev*cdev; int status = -ENOMEM; diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 187d211..fc0ec5e 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c @@ -1401,7 +1401,7 @@ static int udc_wakeup(struct usb_gadget *gadget) } static int amd5536_start(struct usb_gadget_driver *driver, - int (*bind)(struct usb_gadget *)); + int (*bind)(struct usb_gadget *, struct usb_gadget_driver *)); static int amd5536_stop(struct usb_gadget_driver *driver); /* gadget operations */ static const struct usb_gadget_ops udc_ops = { @@ -1914,7 +1914,7 @@ static int setup_ep0(struct udc *dev) /* Called by gadget driver to register itself */ static int amd5536_start(struct usb_gadget_driver *driver, - int (*bind)(struct usb_gadget *)) + int (*bind)(struct usb_gadget *, struct usb_gadget_driver *)) { struct udc *dev = udc; int retval; @@ -1932,7 +1932,7 @@ static int amd5536_start(struct usb_gadget_driver *driver, dev-driver = driver; dev-gadget.dev.driver = driver-driver; - retval = bind(dev-gadget); + retval = bind(dev-gadget, driver); /* Some gadget drivers use both ep0 directions. * NOTE: to gadget driver, ep0 is just one endpoint... diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 2a345f2..5615675 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -31,8 +31,6 @@ /* big enough to hold our biggest descriptor */ #define USB_BUFSIZ 1024 -static struct usb_composite_driver *composite; - /* Some systems will need runtime overrides for the product identifiers * published in the device descriptor, either numbers or strings or both. * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). @@ -889,6 +887,7 @@ static int lookup_string( static int get_string(struct usb_composite_dev *cdev, void *buf, u16 language, int id) { + struct usb_composite_driver *cdriver = cdev-driver; struct usb_configuration*c; struct usb_function *f; int len; @@ -907,7 +906,7 @@ static int get_string(struct usb_composite_dev *cdev, memset(s, 0, 256); s-bDescriptorType = USB_DT_STRING; - sp = composite-strings; + sp = cdriver-strings; if (sp) collect_langs(sp, s-wData); @@ -936,12 +935,12 @@ static int get_string(struct usb_composite_dev *cdev, * check if the string has not been overridden. */ if (cdev-manufacturer_override == id) - str = iManufacturer ?: composite-iManufacturer ?: + str = iManufacturer ?: cdriver-iManufacturer ?: composite_manufacturer; else if (cdev-product_override == id) - str = iProduct ?: composite-iProduct; + str = iProduct ?: cdriver-iProduct; else if
[PATCH 01/29] staging/ccg: Add a note about compatibility issues.
The first item on the todo list is a new user interface. Put this information into Kconfig's help entry to people are not too confusing once an user API changes which does not happen in kernel otherwise. Cc: de...@driverdev.osuosl.org Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/staging/ccg/Kconfig |5 + 1 file changed, 5 insertions(+) diff --git a/drivers/staging/ccg/Kconfig b/drivers/staging/ccg/Kconfig index 1f00d70..df16665 100644 --- a/drivers/staging/ccg/Kconfig +++ b/drivers/staging/ccg/Kconfig @@ -17,4 +17,9 @@ config USB_G_CCG Configurable Composite Gadget can be compiled M only or not at all. + BIG FAT NOTE: DON'T RELY ON THIS USERINTERFACE HERE! AS PART + OF THE REWORK DONE HERE WILL BE A NEW USER INTERFACE WITHOUT ANY + COMPATIBILITY TO THIS SYSFS INTERFACE HERE. BE AWARE OF THIS + BEFORE SELECTING THIS. + endif # USB_GADGET -- 1.7.10.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 09/29] usb/pxa25x: make it compile with debug again
|drivers/usb/gadget/pxa25x_udc.h: In function 'dump_state': |drivers/usb/gadget/pxa25x_udc.h:228:20: error: invalid type argument of '-' (have 'struct usb_ep') Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/pxa25x_udc.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/pxa25x_udc.h b/drivers/usb/gadget/pxa25x_udc.h index 861f4df..2eca1e7 100644 --- a/drivers/usb/gadget/pxa25x_udc.h +++ b/drivers/usb/gadget/pxa25x_udc.h @@ -225,7 +225,7 @@ dump_state(struct pxa25x_udc *dev) dev-stats.read.bytes, dev-stats.read.ops); for (i = 1; i PXA_UDC_NUM_ENDPOINTS; i++) { - if (dev-ep [i].desc == NULL) + if (dev-ep[i].ep.desc == NULL) continue; DMSG (udccs%d = %02x\n, i, *dev-ep-reg_udccs); } -- 1.7.10.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 13/29] usb/libcomposite: add epautoconf.c to libcomposite
This patch adds epautoconf.c into libcomposite and updates all gadgets. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/Makefile |2 +- drivers/usb/gadget/acm_ms.c |1 - drivers/usb/gadget/audio.c |2 +- drivers/usb/gadget/cdc2.c |1 - drivers/usb/gadget/dbgp.c |3 --- drivers/usb/gadget/epautoconf.c |6 -- drivers/usb/gadget/ether.c |1 - drivers/usb/gadget/file_storage.c | 13 - drivers/usb/gadget/g_ffs.c |1 - drivers/usb/gadget/gadget_chips.h |2 ++ drivers/usb/gadget/gmidi.c |1 - drivers/usb/gadget/hid.c|2 +- drivers/usb/gadget/mass_storage.c |1 - drivers/usb/gadget/multi.c |1 - drivers/usb/gadget/ncm.c|1 - drivers/usb/gadget/nokia.c |1 - drivers/usb/gadget/printer.c|1 - drivers/usb/gadget/serial.c |1 - drivers/usb/gadget/tcm_usb_gadget.c |1 - drivers/usb/gadget/webcam.c |1 - drivers/usb/gadget/zero.c |1 - 21 files changed, 9 insertions(+), 35 deletions(-) diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 9515ed0..23d705f 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -5,7 +5,7 @@ ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG obj-$(CONFIG_USB_GADGET) += udc-core.o obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o -libcomposite-y := usbstring.o config.o +libcomposite-y := usbstring.o config.o epautoconf.o obj-$(CONFIG_USB_DUMMY_HCD)+= dummy_hcd.o obj-$(CONFIG_USB_NET2272) += net2272.o obj-$(CONFIG_USB_NET2280) += net2280.o diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index 3078d79..5db661d 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -42,7 +42,6 @@ */ #include composite.c -#include epautoconf.c #include u_serial.c #include f_acm.c #include f_mass_storage.c diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 9e85df2..689d142 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c @@ -14,6 +14,7 @@ #include linux/kernel.h #include linux/utsname.h +#include gadget_chips.h #define DRIVER_DESCLinux USB Audio Gadget #define DRIVER_VERSION Feb 2, 2012 @@ -27,7 +28,6 @@ * a gcc --combine ... part1.c part2.c part3.c ... build would. */ #include composite.c -#include epautoconf.c /* string IDs are assigned dynamically */ diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index d06d079..8e386cf 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -44,7 +44,6 @@ */ #include composite.c -#include epautoconf.c #include u_serial.c #include f_acm.c #include f_ecm.c diff --git a/drivers/usb/gadget/dbgp.c b/drivers/usb/gadget/dbgp.c index cc17465..87d1650 100644 --- a/drivers/usb/gadget/dbgp.c +++ b/drivers/usb/gadget/dbgp.c @@ -13,9 +13,6 @@ #include linux/usb/ch9.h #include linux/usb/gadget.h -/* See comments in zero.c */ -#include epautoconf.c - #ifdef CONFIG_USB_G_DBGP_SERIAL #include u_serial.c #endif diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index d5a905d..a777f7b 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -10,6 +10,7 @@ */ #include linux/kernel.h +#include linux/module.h #include linux/init.h #include linux/types.h #include linux/device.h @@ -315,6 +316,7 @@ found_ep: ep-comp_desc = NULL; return ep; } +EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss); /** * usb_ep_autoconfig() - choose an endpoint matching the @@ -354,7 +356,7 @@ struct usb_ep *usb_ep_autoconfig( { return usb_ep_autoconfig_ss(gadget, desc, NULL); } - +EXPORT_SYMBOL_GPL(usb_ep_autoconfig); /** * usb_ep_autoconfig_reset - reset endpoint autoconfig state @@ -375,4 +377,4 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) gadget-in_epnum = 0; gadget-out_epnum = 0; } - +EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset); diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 557021e..39eb718 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -103,7 +103,6 @@ static inline bool has_rndis(void) * a gcc --combine ... part1.c part2.c part3.c ... build would. */ #include composite.c -#include epautoconf.c #include f_ecm.c #include f_subset.c diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 77cf108..ce362f7 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -256,19 +256,6 @@ #include gadget_chips.h - - -/* - * Kbuild is not very cooperative with respect to linking separately - * compiled library objects into one module. So for now
[PATCH 14/29] usb/gadget: move USB_BUFSIZ into global composite.h
This patch moves USB_BUFSIZ into global header file as USB_COMP_EP0_BUFSIZ. There is currently only one user (f_sourcesink) besides composite which need it. Ideally f_sourcesink would have its own ep0 buffer. Lets keep it that way it was for now. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/composite.c| 10 -- drivers/usb/gadget/f_sourcesink.c |2 +- include/linux/usb/composite.h |3 +++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 5615675..be71dd8 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -28,9 +28,6 @@ * with the relevant device-wide data. */ -/* big enough to hold our biggest descriptor */ -#define USB_BUFSIZ 1024 - /* Some systems will need runtime overrides for the product identifiers * published in the device descriptor, either numbers or strings or both. * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). @@ -355,10 +352,11 @@ static int config_buf(struct usb_configuration *config, { struct usb_config_descriptor*c = buf; void*next = buf + USB_DT_CONFIG_SIZE; - int len = USB_BUFSIZ - USB_DT_CONFIG_SIZE; + int len; struct usb_function *f; int status; + len = USB_COMP_EP0_BUFSIZ - USB_DT_CONFIG_SIZE; /* write the config descriptor */ c = buf; c-bLength = USB_DT_CONFIG_SIZE; @@ -1445,13 +1443,13 @@ static int composite_bind(struct usb_gadget *gadget, cdev-req = usb_ep_alloc_request(gadget-ep0, GFP_KERNEL); if (!cdev-req) goto fail; - cdev-req-buf = kmalloc(USB_BUFSIZ, GFP_KERNEL); + cdev-req-buf = kmalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL); if (!cdev-req-buf) goto fail; cdev-req-complete = composite_setup_complete; gadget-ep0-driver_data = cdev; - cdev-bufsiz = USB_BUFSIZ; + cdev-bufsiz = USB_COMP_EP0_BUFSIZ; cdev-driver = cdriver; /* diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c index 5c1b68b..3c126fd 100644 --- a/drivers/usb/gadget/f_sourcesink.c +++ b/drivers/usb/gadget/f_sourcesink.c @@ -795,7 +795,7 @@ static int sourcesink_setup(struct usb_configuration *c, u16 w_value = le16_to_cpu(ctrl-wValue); u16 w_length = le16_to_cpu(ctrl-wLength); - req-length = USB_BUFSIZ; + req-length = USB_COMP_EP0_BUFSIZ; /* composite driver infrastructure handles everything except * the two control test requests. diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 43d6b9c..89d91b6 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -46,6 +46,9 @@ */ #define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */ +/* big enough to hold our biggest descriptor */ +#define USB_COMP_EP0_BUFSIZ1024 + struct usb_configuration; /** -- 1.7.10.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 23/29] usb/gadget: push iSerialNumber into gadgets
This patch pushes the iSerialNumber module argument from composite into each gadget. Once the user uses the module paramter, the string is overwritten with the final value. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/composite.c| 20 +--- drivers/usb/gadget/mass_storage.c | 21 + drivers/usb/gadget/printer.c |6 +- include/linux/usb/composite.h |7 ++- 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1c49482..c5a00d8 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -40,10 +40,6 @@ static char *iProduct; module_param(iProduct, charp, S_IRUGO); MODULE_PARM_DESC(iProduct, USB Product string); -static char *iSerialNumber; -module_param(iSerialNumber, charp, S_IRUGO); -MODULE_PARM_DESC(iSerialNumber, SerialNumber string); - static char composite_manufacturer[50]; /*-*/ @@ -925,7 +921,7 @@ static int get_string(struct usb_composite_dev *cdev, else if (cdev-product_override == id) str = iProduct ?: cdriver-iProduct; else if (cdev-serial_override == id) - str = iSerialNumber ?: cdriver-iSerialNumber; + str = cdriver-iSerialNumber; else str = NULL; if (str) { @@ -1411,6 +1407,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, __le16 idVendor; __le16 idProduct; __le16 bcdDevice; + u8 iSerialNumber; /* * these variables may have been set in @@ -1419,6 +1416,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, idVendor = new-idVendor; idProduct = new-idProduct; bcdDevice = new-bcdDevice; + iSerialNumber = new-iSerialNumber; *new = *old; if (idVendor) @@ -1427,6 +1425,8 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, new-idProduct = idProduct; if (bcdDevice) new-bcdDevice = bcdDevice; + if (iSerialNumber) + new-iSerialNumber = iSerialNumber; } static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv) @@ -1505,8 +1505,7 @@ static int composite_bind(struct usb_gadget *gadget, cdev-product_override = override_id(cdev, cdev-desc.iProduct); - if (iSerialNumber || - (!cdev-desc.iSerialNumber cdriver-iSerialNumber)) + if (cdriver-iSerialNumber) cdev-serial_override = override_id(cdev, cdev-desc.iSerialNumber); @@ -1691,6 +1690,8 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev, struct usb_composite_overwrite *covr) { struct usb_device_descriptor*desc = cdev-desc; + struct usb_gadget_strings *gstr = cdev-driver-strings[0]; + struct usb_string *dev_str = gstr-strings; if (covr-idVendor) desc-idVendor = cpu_to_le16(covr-idVendor); @@ -1700,4 +1701,9 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev, if (covr-bcdDevice) desc-bcdDevice = cpu_to_le16(covr-bcdDevice); + + if (covr-serial_number) { + desc-iSerialNumber = dev_str[USB_GADGET_SERIAL_IDX].id; + dev_str[USB_GADGET_SERIAL_IDX].s = covr-serial_number; + } } diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c index 8ffbade..6f5a3b2 100644 --- a/drivers/usb/gadget/mass_storage.c +++ b/drivers/usb/gadget/mass_storage.c @@ -83,6 +83,22 @@ static const struct usb_descriptor_header *otg_desc[] = { NULL, }; +static struct usb_string strings_dev[] = { + [USB_GADGET_MANUFACTURER_IDX].s = , + [USB_GADGET_PRODUCT_IDX].s = , + [USB_GADGET_SERIAL_IDX].s = , + { } /* end of list */ +}; + +static struct usb_gadget_strings stringtab_dev = { + .language = 0x0409, /* en-us */ + .strings= strings_dev, +}; + +static struct usb_gadget_strings *dev_strings[] = { + stringtab_dev, + NULL, +}; /** Configurations **/ @@ -141,6 +157,10 @@ static int __init msg_bind(struct usb_composite_dev *cdev) { int status; + status = usb_string_ids_tab(cdev, strings_dev); + if (status 0) + return status; + status = usb_add_config(cdev, msg_config_driver, msg_do_config); if (status 0) return status; @@ -160,6 +180,7 @@ static __refdata struct usb_composite_driver msg_driver = { .iProduct = DRIVER_DESC, .max_speed = USB_SPEED_SUPER,
[PATCH 12/29] usb/gadget: move global vars from epautoconf into struct usb_gadget
epautoconf has two global variables which count the endpoint number of last assigned endpoint. This patch removes the global variable and keeps it as per (UDC) gadget. While here, the ifdef is removed and now the in and outpoint are enumerated unconditionally. The dwc3 for instance supports 32 endpoints in total. Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/epautoconf.c | 27 ++- include/linux/usb/gadget.h |4 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 51f3d42..d5a905d 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -22,17 +22,6 @@ #include gadget_chips.h - -/* we must assign addresses for configurable endpoints (like net2280) */ -static unsigned epnum; - -// #define MANY_ENDPOINTS -#ifdef MANY_ENDPOINTS -/* more than 15 configurable endpoints */ -static unsigned in_epnum; -#endif - - /* * This should work with endpoints from controller drivers sharing the * same endpoint naming convention. By example: @@ -176,16 +165,14 @@ ep_matches ( if (isdigit (ep-name [2])) { u8 num = simple_strtoul (ep-name [2], NULL, 10); desc-bEndpointAddress |= num; -#ifdef MANY_ENDPOINTS } else if (desc-bEndpointAddress USB_DIR_IN) { - if (++in_epnum 15) + if (++gadget-in_epnum 15) return 0; - desc-bEndpointAddress = USB_DIR_IN | in_epnum; -#endif + desc-bEndpointAddress = USB_DIR_IN | gadget-in_epnum; } else { - if (++epnum 15) + if (++gadget-out_epnum 15) return 0; - desc-bEndpointAddress |= epnum; + desc-bEndpointAddress |= gadget-out_epnum; } /* report (variable) full speed bulk maxpacket */ @@ -385,9 +372,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) list_for_each_entry (ep, gadget-ep_list, ep_list) { ep-driver_data = NULL; } -#ifdef MANY_ENDPOINTS - in_epnum = 0; -#endif - epnum = 0; + gadget-in_epnum = 0; + gadget-out_epnum = 0; } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 822c1b8..5b6e508 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -503,6 +503,8 @@ struct usb_gadget_ops { * @name: Identifies the controller hardware type. Used in diagnostics * and sometimes configuration. * @dev: Driver model state for this abstract device. + * @out_epnum: last used out ep number + * @in_epnum: last used in ep number * * Gadgets have a mostly-portable gadget driver implementing device * functions, handling all usb configurations and interfaces. Gadget @@ -537,6 +539,8 @@ struct usb_gadget { unsigneda_alt_hnp_support:1; const char *name; struct device dev; + unsignedout_epnum; + unsignedin_epnum; }; static inline void set_gadget_data(struct usb_gadget *gadget, void *data) -- 1.7.10.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 24/29] usb/gadget: push iManufacturer into gadgets
This patch pushes the iManufacturer module argument from composite into each gadget. Once the user uses the module paramter, the string is overwritten with the final value. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/composite.c | 20 +++- include/linux/usb/composite.h |7 ++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index c5a00d8..348fd86 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -32,10 +32,6 @@ * published in the device descriptor, either numbers or strings or both. * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). */ -static char *iManufacturer; -module_param(iManufacturer, charp, S_IRUGO); -MODULE_PARM_DESC(iManufacturer, USB Manufacturer string); - static char *iProduct; module_param(iProduct, charp, S_IRUGO); MODULE_PARM_DESC(iProduct, USB Product string); @@ -916,8 +912,7 @@ static int get_string(struct usb_composite_dev *cdev, * check if the string has not been overridden. */ if (cdev-manufacturer_override == id) - str = iManufacturer ?: cdriver-iManufacturer ?: - composite_manufacturer; + str = cdriver-iManufacturer ?: composite_manufacturer; else if (cdev-product_override == id) str = iProduct ?: cdriver-iProduct; else if (cdev-serial_override == id) @@ -1408,6 +1403,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, __le16 idProduct; __le16 bcdDevice; u8 iSerialNumber; + u8 iManufacturer; /* * these variables may have been set in @@ -1417,6 +1413,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, idProduct = new-idProduct; bcdDevice = new-bcdDevice; iSerialNumber = new-iSerialNumber; + iManufacturer = new-iManufacturer; *new = *old; if (idVendor) @@ -1427,6 +1424,8 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, new-bcdDevice = bcdDevice; if (iSerialNumber) new-iSerialNumber = iSerialNumber; + if (iManufacturer) + new-iManufacturer = iManufacturer; } static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv) @@ -1487,9 +1486,8 @@ static int composite_bind(struct usb_gadget *gadget, update_unchanged_dev_desc(cdev-desc, cdriver-dev); /* string overrides */ - if (iManufacturer || !cdev-desc.iManufacturer) { - if (!iManufacturer !cdriver-iManufacturer - !*composite_manufacturer) + if (!cdev-desc.iManufacturer) { + if (!cdriver-iManufacturer) snprintf(composite_manufacturer, sizeof composite_manufacturer, %s %s with %s, @@ -1706,4 +1704,8 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev, desc-iSerialNumber = dev_str[USB_GADGET_SERIAL_IDX].id; dev_str[USB_GADGET_SERIAL_IDX].s = covr-serial_number; } + if (covr-manufacturer) { + desc-iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id; + dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr-manufacturer; + } } diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 9d068a4..86553c8 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -401,6 +401,7 @@ struct usb_composite_overwrite { u16 idProduct; u16 bcdDevice; char*serial_number; + char*manufacturer; }; #define USB_GADGET_COMPOSITE_OPTIONS() \ static struct usb_composite_overwrite coverwrite; \ @@ -416,7 +417,11 @@ struct usb_composite_overwrite { \ module_param_named(iSerialNumber, coverwrite.serial_number, charp, \ S_IRUGO); \ - MODULE_PARM_DESC(iSerialNumber, SerialNumber string) + MODULE_PARM_DESC(iSerialNumber, SerialNumber string); \ + \ + module_param_named(iManufacturer, coverwrite.manufacturer, charp, \ + S_IRUGO); \ + MODULE_PARM_DESC(iManufacturer, USB Manufacturer string) void usb_composite_overwrite_options(struct usb_composite_dev *cdev, struct usb_composite_overwrite *covr); -- 1.7.10.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 28/29] usb/libcomposite: move composite.c into libcomposite
This moves composite.c into libcomposite and updates all gadgets. Finally! Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/Makefile |3 ++- drivers/usb/gadget/acm_ms.c |2 +- drivers/usb/gadget/audio.c | 11 +-- drivers/usb/gadget/cdc2.c |1 - drivers/usb/gadget/composite.c | 14 +- drivers/usb/gadget/ether.c |2 -- drivers/usb/gadget/f_hid.c |1 + drivers/usb/gadget/g_ffs.c |3 --- drivers/usb/gadget/gmidi.c |2 +- drivers/usb/gadget/hid.c|5 ++--- drivers/usb/gadget/mass_storage.c |3 +-- drivers/usb/gadget/multi.c |3 --- drivers/usb/gadget/ncm.c|4 ++-- drivers/usb/gadget/nokia.c |2 -- drivers/usb/gadget/printer.c| 12 +--- drivers/usb/gadget/serial.c |2 -- drivers/usb/gadget/tcm_usb_gadget.c |2 -- drivers/usb/gadget/webcam.c |2 -- drivers/usb/gadget/zero.c |2 -- 19 files changed, 25 insertions(+), 51 deletions(-) diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 4fec0e8..5c4a133 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -5,7 +5,8 @@ ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG obj-$(CONFIG_USB_GADGET) += udc-core.o obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o -libcomposite-y := usbstring.o config.o epautoconf.o gadget_chips.o +libcomposite-y := usbstring.o config.o epautoconf.o +libcomposite-y += gadget_chips.o composite.o obj-$(CONFIG_USB_DUMMY_HCD)+= dummy_hcd.o obj-$(CONFIG_USB_NET2272) += net2272.o obj-$(CONFIG_USB_NET2280) += net2280.o diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index d280f16..b0abc25 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -15,6 +15,7 @@ */ #include linux/kernel.h +#include linux/module.h #include u_serial.h @@ -40,7 +41,6 @@ * a gcc --combine ... part1.c part2.c part3.c ... build would. */ -#include composite.c #include u_serial.c #include f_acm.c #include f_mass_storage.c diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 1f81e0f..1b9dee9 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c @@ -12,22 +12,13 @@ /* #define VERBOSE_DEBUG */ #include linux/kernel.h +#include linux/module.h #include linux/usb/composite.h #include gadget_chips.h #define DRIVER_DESCLinux USB Audio Gadget #define DRIVER_VERSION Feb 2, 2012 -/*-*/ - -/* - * Kbuild is not very cooperative with respect to linking separately - * compiled library objects into one module. So for now we won't use - * separate compilation ... ensuring init/exit sections work to shrink - * the runtime footprint, and giving us at least some parts of what - * a gcc --combine ... part1.c part2.c part3.c ... build would. - */ -#include composite.c USB_GADGET_COMPOSITE_OPTIONS(); /* string IDs are assigned dynamically */ diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 4e2060b..ba38d2a 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -43,7 +43,6 @@ USB_GADGET_COMPOSITE_OPTIONS(); * a gcc --combine ... part1.c part2.c part3.c ... build would. */ -#include composite.c #include u_serial.c #include f_acm.c #include f_ecm.c diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 0382094..1f445aa 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -154,6 +154,7 @@ ep_found: } return 0; } +EXPORT_SYMBOL_GPL(config_ep_by_speed); /** * usb_add_function() - add a function to a configuration @@ -212,6 +213,7 @@ done: function-name, function, value); return value; } +EXPORT_SYMBOL_GPL(usb_add_function); /** * usb_function_deactivate - prevent function and gadget enumeration @@ -248,6 +250,7 @@ int usb_function_deactivate(struct usb_function *function) spin_unlock_irqrestore(cdev-lock, flags); return status; } +EXPORT_SYMBOL_GPL(usb_function_deactivate); /** * usb_function_activate - allow function and gadget enumeration @@ -278,6 +281,7 @@ int usb_function_activate(struct usb_function *function) spin_unlock_irqrestore(cdev-lock, flags); return status; } +EXPORT_SYMBOL_GPL(usb_function_activate); /** * usb_interface_id() - allocate an unused interface ID @@ -314,6 +318,7 @@ int usb_interface_id(struct usb_configuration *config, } return -ENODEV; } +EXPORT_SYMBOL_GPL(usb_interface_id); static int config_buf(struct usb_configuration *config, enum usb_device_speed speed,
[PATCH 22/29] usb/gadget: make sure each gadget is using same index for Product, Serial,…
The index in usb_string array is defined by the gadget. The gadget can choose which index entry it assigns for the serial number and which the product name. The gadget has just to ensure that the descriptor contains the proper string id which is assigned by composite. If the composite layer knows the index of the default information which will be overwritten by module parameters, it can be used later to overwrite it. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/acm_ms.c | 12 +--- drivers/usb/gadget/audio.c | 12 +--- drivers/usb/gadget/cdc2.c | 13 + drivers/usb/gadget/ether.c | 14 +- drivers/usb/gadget/g_ffs.c |8 ++-- drivers/usb/gadget/gmidi.c | 13 ++--- drivers/usb/gadget/hid.c| 13 + drivers/usb/gadget/multi.c | 13 - drivers/usb/gadget/ncm.c| 13 + drivers/usb/gadget/nokia.c | 13 ++--- drivers/usb/gadget/printer.c| 16 ++-- drivers/usb/gadget/serial.c | 13 ++--- drivers/usb/gadget/tcm_usb_gadget.c | 13 +++-- drivers/usb/gadget/tcm_usb_gadget.h |5 + drivers/usb/gadget/webcam.c | 13 ++--- drivers/usb/gadget/zero.c | 17 ++--- include/linux/usb/composite.h | 12 +++- 17 files changed, 95 insertions(+), 118 deletions(-) diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index 7bd6b71..35db6aa 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -90,14 +90,12 @@ static const struct usb_descriptor_header *otg_desc[] = { /* string IDs are assigned dynamically */ -#define STRING_MANUFACTURER_IDX0 -#define STRING_PRODUCT_IDX 1 - static char manufacturer[50]; static struct usb_string strings_dev[] = { - [STRING_MANUFACTURER_IDX].s = manufacturer, - [STRING_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ }; @@ -196,8 +194,8 @@ static int __init acm_ms_bind(struct usb_composite_dev *cdev) status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail1; - device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; - device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; + device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; + device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; /* register our configuration */ status = usb_add_config(cdev, acm_ms_config_driver, acm_ms_do_config); diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 55b593c..8857b6e 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c @@ -33,14 +33,12 @@ USB_GADGET_COMPOSITE_OPTIONS(); /* string IDs are assigned dynamically */ -#define STRING_MANUFACTURER_IDX0 -#define STRING_PRODUCT_IDX 1 - static char manufacturer[50]; static struct usb_string strings_dev[] = { - [STRING_MANUFACTURER_IDX].s = manufacturer, - [STRING_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ }; @@ -170,8 +168,8 @@ static int __init audio_bind(struct usb_composite_dev *cdev) status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail; - device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; - device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; + device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; + device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; status = usb_add_config(cdev, audio_config_driver, audio_do_config); if (status 0) diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 93a7580..8966bde 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -90,15 +90,12 @@ static const struct usb_descriptor_header *otg_desc[] = { /* string IDs are assigned dynamically */ - -#define STRING_MANUFACTURER_IDX0 -#define STRING_PRODUCT_IDX 1 - static char manufacturer[50]; static struct usb_string strings_dev[] = { - [STRING_MANUFACTURER_IDX].s = manufacturer, - [STRING_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_MANUFACTURER_IDX].s = manufacturer, + [USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC, + [USB_GADGET_SERIAL_IDX].s = , { } /* end of list */ }; @@ -197,8 +194,8 @@ static int __init
[PATCH 29/29] usb/libcomposite: move MODULE_VERSION to composite.c
MODULE_VERSION and AUTHOR looks better in composite.c than in usbstrings.c so I move it there. I put David Brownell as the module Author as I belive he wrote most of it. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/composite.c |3 +++ drivers/usb/gadget/usbstring.c |1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1f445aa..d59f83b 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1684,3 +1684,6 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev, } } EXPORT_SYMBOL_GPL(usb_composite_overwrite_options); + +MODULE_LICENSE(GPL); +MODULE_AUTHOR(David Brownell); diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index 24e9bbd..1f49fce 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c @@ -70,4 +70,3 @@ usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) return buf [0]; } EXPORT_SYMBOL_GPL(usb_gadget_get_string); -MODULE_LICENSE(GPL); -- 1.7.10.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 27/29] 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. Acked-by: Michal Nazarewicz min...@mina86.com 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); } -
[PATCH 15/29] usb/gadget: remove bufsiz from struct usb_composite_dev
there is no read user of bufsiz, its content is available via USB_COMP_EP0_BUFSIZ. Remove it. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/composite.c |1 - include/linux/usb/composite.h |2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index be71dd8..7d13af5 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1449,7 +1449,6 @@ static int composite_bind(struct usb_gadget *gadget, cdev-req-complete = composite_setup_complete; gadget-ep0-driver_data = cdev; - cdev-bufsiz = USB_COMP_EP0_BUFSIZ; cdev-driver = cdriver; /* diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 89d91b6..e970fba 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -318,7 +318,6 @@ extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); * struct usb_composite_device - represents one composite usb gadget * @gadget: read-only, abstracts the gadget's usb peripheral controller * @req: used for control responses; buffer is pre-allocated - * @bufsiz: size of buffer pre-allocated in @req * @config: the currently active configuration * * One of these devices is allocated and initialized before the @@ -349,7 +348,6 @@ extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); struct usb_composite_dev { struct usb_gadget *gadget; struct usb_request *req; - unsignedbufsiz; struct usb_configuration*config; -- 1.7.10.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 26/29] 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. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- 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 ad0623a..5a81c6e 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); @@ -1619,8 +1606,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);
[PATCH 17/29] usb/gadget: use usb_string_ids_tab instead multiple usb_string_id()
Using usb_string_ids_tab() instead multiple calls of usb_string_id() seems to be handy. It also allows to add string without many checks. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/acm_ms.c | 12 +++- drivers/usb/gadget/audio.c | 12 +++- drivers/usb/gadget/cdc2.c | 12 +++- drivers/usb/gadget/ether.c | 12 +++- drivers/usb/gadget/gmidi.c | 21 - drivers/usb/gadget/hid.c| 11 +++ drivers/usb/gadget/ncm.c| 12 +++- drivers/usb/gadget/nokia.c | 22 -- drivers/usb/gadget/serial.c | 22 -- drivers/usb/gadget/webcam.c | 21 - drivers/usb/gadget/zero.c | 26 -- 11 files changed, 46 insertions(+), 137 deletions(-) diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c index 5db661d..ea349ba 100644 --- a/drivers/usb/gadget/acm_ms.c +++ b/drivers/usb/gadget/acm_ms.c @@ -192,17 +192,11 @@ static int __init acm_ms_bind(struct usb_composite_dev *cdev) snprintf(manufacturer, sizeof manufacturer, %s %s with %s, init_utsname()-sysname, init_utsname()-release, gadget-name); - status = usb_string_id(cdev); + status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail1; - strings_dev[STRING_MANUFACTURER_IDX].id = status; - device_desc.iManufacturer = status; - - status = usb_string_id(cdev); - if (status 0) - goto fail1; - strings_dev[STRING_PRODUCT_IDX].id = status; - device_desc.iProduct = status; + device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; + device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; /* register our configuration */ status = usb_add_config(cdev, acm_ms_config_driver, acm_ms_do_config); diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 689d142..5702ce3 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c @@ -165,17 +165,11 @@ static int __init audio_bind(struct usb_composite_dev *cdev) snprintf(manufacturer, sizeof manufacturer, %s %s with %s, init_utsname()-sysname, init_utsname()-release, cdev-gadget-name); - status = usb_string_id(cdev); + status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail; - strings_dev[STRING_MANUFACTURER_IDX].id = status; - device_desc.iManufacturer = status; - - status = usb_string_id(cdev); - if (status 0) - goto fail; - strings_dev[STRING_PRODUCT_IDX].id = status; - device_desc.iProduct = status; + device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; + device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; status = usb_add_config(cdev, audio_config_driver, audio_do_config); if (status 0) diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 8e386cf..3b89fe2 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -193,17 +193,11 @@ static int __init cdc_bind(struct usb_composite_dev *cdev) snprintf(manufacturer, sizeof manufacturer, %s %s with %s, init_utsname()-sysname, init_utsname()-release, gadget-name); - status = usb_string_id(cdev); + status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail1; - strings_dev[STRING_MANUFACTURER_IDX].id = status; - device_desc.iManufacturer = status; - - status = usb_string_id(cdev); - if (status 0) - goto fail1; - strings_dev[STRING_PRODUCT_IDX].id = status; - device_desc.iProduct = status; + device_desc.iManufacturer = strings_dev[STRING_MANUFACTURER_IDX].id; + device_desc.iProduct = strings_dev[STRING_PRODUCT_IDX].id; /* register our configuration */ status = usb_add_config(cdev, cdc_config_driver, cdc_do_config); diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 39eb718..004c6ed 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -345,17 +345,11 @@ static int __init eth_bind(struct usb_composite_dev *cdev) snprintf(manufacturer, sizeof manufacturer, %s %s with %s, init_utsname()-sysname, init_utsname()-release, gadget-name); - status = usb_string_id(cdev); + status = usb_string_ids_tab(cdev, strings_dev); if (status 0) goto fail; - strings_dev[STRING_MANUFACTURER_IDX].id = status; - device_desc.iManufacturer = status; - - status = usb_string_id(cdev); - if (status 0) - goto fail; - strings_dev[STRING_PRODUCT_IDX].id = status; -
[PATCH 25/29] usb/gadget: push iProduct into gadgets
This patch pushes the iProduct module argument from composite into each gadget. Acked-by: Michal Nazarewicz min...@mina86.com Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/composite.c | 21 +++-- include/linux/usb/composite.h |6 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 348fd86..ad0623a 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -28,14 +28,6 @@ * with the relevant device-wide data. */ -/* Some systems will need runtime overrides for the product identifiers - * published in the device descriptor, either numbers or strings or both. - * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). - */ -static char *iProduct; -module_param(iProduct, charp, S_IRUGO); -MODULE_PARM_DESC(iProduct, USB Product string); - static char composite_manufacturer[50]; /*-*/ @@ -914,7 +906,7 @@ static int get_string(struct usb_composite_dev *cdev, if (cdev-manufacturer_override == id) str = cdriver-iManufacturer ?: composite_manufacturer; else if (cdev-product_override == id) - str = iProduct ?: cdriver-iProduct; + str = cdriver-iProduct; else if (cdev-serial_override == id) str = cdriver-iSerialNumber; else @@ -1404,6 +1396,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, __le16 bcdDevice; u8 iSerialNumber; u8 iManufacturer; + u8 iProduct; /* * these variables may have been set in @@ -1414,6 +1407,7 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, bcdDevice = new-bcdDevice; iSerialNumber = new-iSerialNumber; iManufacturer = new-iManufacturer; + iProduct = new-iProduct; *new = *old; if (idVendor) @@ -1426,6 +1420,8 @@ static void update_unchanged_dev_desc(struct usb_device_descriptor *new, new-iSerialNumber = iSerialNumber; if (iManufacturer) new-iManufacturer = iManufacturer; + if (iProduct) + new-iProduct = iProduct; } static struct usb_composite_driver *to_cdriver(struct usb_gadget_driver *gdrv) @@ -1499,7 +1495,7 @@ static int composite_bind(struct usb_gadget *gadget, override_id(cdev, cdev-desc.iManufacturer); } - if (iProduct || (!cdev-desc.iProduct cdriver-iProduct)) + if (!cdev-desc.iProduct cdriver-iProduct) cdev-product_override = override_id(cdev, cdev-desc.iProduct); @@ -1708,4 +1704,9 @@ void usb_composite_overwrite_options(struct usb_composite_dev *cdev, desc-iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id; dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr-manufacturer; } + + if (covr-product) { + desc-iProduct = dev_str[USB_GADGET_PRODUCT_IDX].id; + dev_str[USB_GADGET_PRODUCT_IDX].s = covr-product; + } } diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 86553c8..5cd110e 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -402,6 +402,7 @@ struct usb_composite_overwrite { u16 bcdDevice; char*serial_number; char*manufacturer; + char*product; }; #define USB_GADGET_COMPOSITE_OPTIONS() \ static struct usb_composite_overwrite coverwrite; \ @@ -421,7 +422,10 @@ struct usb_composite_overwrite { \ module_param_named(iManufacturer, coverwrite.manufacturer, charp, \ S_IRUGO); \ - MODULE_PARM_DESC(iManufacturer, USB Manufacturer string) + MODULE_PARM_DESC(iManufacturer, USB Manufacturer string); \ + \ + module_param_named(iProduct, coverwrite.product, charp, S_IRUGO); \ + MODULE_PARM_DESC(iProduct, USB Product string) void usb_composite_overwrite_options(struct usb_composite_dev *cdev, struct usb_composite_overwrite *covr); -- 1.7.10.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 19/29] usb/gadget: initialize the strings in tcm_usb_gadget properly
I have no idea what I've been thinking while I was doing this in the first place. Now the strings are initialized properly and reported by lsusb. Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de --- drivers/usb/gadget/tcm_usb_gadget.c | 33 - drivers/usb/gadget/tcm_usb_gadget.h | 14 -- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c index e64a759..2f49808 100644 --- a/drivers/usb/gadget/tcm_usb_gadget.c +++ b/drivers/usb/gadget/tcm_usb_gadget.c @@ -1974,7 +1974,6 @@ static struct usb_interface_descriptor bot_intf_desc = { .bInterfaceClass = USB_CLASS_MASS_STORAGE, .bInterfaceSubClass = USB_SC_SCSI, .bInterfaceProtocol = USB_PR_BULK, - .iInterface = USB_G_STR_INT_UAS, }; static struct usb_interface_descriptor uasp_intf_desc = { @@ -1985,7 +1984,6 @@ static struct usb_interface_descriptor uasp_intf_desc = { .bInterfaceClass = USB_CLASS_MASS_STORAGE, .bInterfaceSubClass = USB_SC_SCSI, .bInterfaceProtocol = USB_PR_UAS, - .iInterface = USB_G_STR_INT_BBB, }; static struct usb_endpoint_descriptor uasp_bi_desc = { @@ -2206,20 +2204,16 @@ static struct usb_device_descriptor usbg_device_desc = { .bDeviceClass = USB_CLASS_PER_INTERFACE, .idVendor = cpu_to_le16(UAS_VENDOR_ID), .idProduct =cpu_to_le16(UAS_PRODUCT_ID), - .iManufacturer =USB_G_STR_MANUFACTOR, - .iProduct = USB_G_STR_PRODUCT, - .iSerialNumber =USB_G_STR_SERIAL, - .bNumConfigurations = 1, }; static struct usb_string usbg_us_strings[] = { - { USB_G_STR_MANUFACTOR, Target Manufactor}, - { USB_G_STR_PRODUCT,Target Product}, - { USB_G_STR_SERIAL, 0001}, - { USB_G_STR_CONFIG, default config}, - { USB_G_STR_INT_UAS,USB Attached SCSI}, - { USB_G_STR_INT_BBB,Bulk Only Transport}, + [USB_G_STR_MANUFACTOR].s= Target Manufactor, + [USB_G_STR_PRODUCT].s = Target Product, + [USB_G_STR_SERIAL].s= 0001, + [USB_G_STR_CONFIG].s= default config, + [USB_G_STR_INT_UAS].s = USB Attached SCSI, + [USB_G_STR_INT_BBB].s = Bulk Only Transport, { }, }; @@ -2241,7 +2235,6 @@ static int guas_unbind(struct usb_composite_dev *cdev) static struct usb_configuration usbg_config_driver = { .label = Linux Target, .bConfigurationValue= 1, - .iConfiguration = USB_G_STR_CONFIG, .bmAttributes = USB_CONFIG_ATT_SELFPOWER, }; @@ -2414,6 +2407,9 @@ static int usbg_cfg_bind(struct usb_configuration *c) fu-function.disable = usbg_disable; fu-tpg = the_only_tpg_I_currently_have; + bot_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_BBB].id; + uasp_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_UAS].id; + ret = usb_add_function(c, fu-function); if (ret) goto err; @@ -2428,6 +2424,17 @@ static int usb_target_bind(struct usb_composite_dev *cdev) { int ret; + ret = usb_string_ids_tab(cdev, usbg_us_strings); + if (ret) + return ret; + + usbg_device_desc.iManufacturer = + usbg_us_strings[USB_G_STR_MANUFACTOR].id; + usbg_device_desc.iProduct = usbg_us_strings[USB_G_STR_PRODUCT].id; + usbg_device_desc.iSerialNumber = usbg_us_strings[USB_G_STR_SERIAL].id; + usbg_config_driver.iConfiguration = + usbg_us_strings[USB_G_STR_CONFIG].id; + ret = usb_add_config(cdev, usbg_config_driver, usbg_cfg_bind); return 0; diff --git a/drivers/usb/gadget/tcm_usb_gadget.h b/drivers/usb/gadget/tcm_usb_gadget.h index bb18999..9d32ec3 100644 --- a/drivers/usb/gadget/tcm_usb_gadget.h +++ b/drivers/usb/gadget/tcm_usb_gadget.h @@ -16,12 +16,14 @@ #define UASP_SS_EP_COMP_LOG_STREAMS 4 #define UASP_SS_EP_COMP_NUM_STREAMS (1 UASP_SS_EP_COMP_LOG_STREAMS) -#define USB_G_STR_MANUFACTOR1 -#define USB_G_STR_PRODUCT 2 -#define USB_G_STR_SERIAL3 -#define USB_G_STR_CONFIG4 -#define USB_G_STR_INT_UAS 5 -#define USB_G_STR_INT_BBB 6 +enum { + USB_G_STR_MANUFACTOR, + USB_G_STR_PRODUCT, + USB_G_STR_SERIAL, + USB_G_STR_CONFIG, + USB_G_STR_INT_UAS, + USB_G_STR_INT_BBB, +}; #define USB_G_ALT_INT_BBB 0 #define USB_G_ALT_INT_UAS 1 -- 1.7.10.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