Re: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
Hi John, Is it possible to try the attached patch? I am not sure if it actually fixes the issue. But I think it is worth a try. Also, could you get me all the ipv6 routes when you plug in the usb using "ip -6 route show"? (If you have multiple routing tables configured, could you dump them all?) Thanks a lot. Wei On Wed, Aug 9, 2017 at 6:36 PM, Wei Wangwrote: > On Wed, Aug 9, 2017 at 6:26 PM, John Stultz wrote: >> On Wed, Aug 9, 2017 at 5:36 PM, Wei Wang wrote: >>> On Wed, Aug 9, 2017 at 4:44 PM, John Stultz wrote: On Wed, Aug 9, 2017 at 4:34 PM, Cong Wang wrote: > (Cc'ing Wei whose commit was blamed) > > On Mon, Aug 7, 2017 at 2:15 PM, John Stultz > wrote: >> On Mon, Aug 7, 2017 at 2:05 PM, John Stultz >> wrote: >>> So, with recent testing with my HiKey board, I've been noticing some >>> quirky behavior with my USB eth adapter. >>> >>> Basically, pluging the usb eth adapter in and then removing it, when >>> plugging it back in I often find that its not detected, and the system >>> slowly spits out the following message over and over: >>> unregister_netdevice: waiting for eth0 to become free. Usage count = 1 >> >> The other bit is that after this starts printing, the board will no >> longer reboot (it hangs continuing to occasionally print the above >> message), and I have to manually reset the device. >> > > So this warning is not temporarily shown but lasts until a reboot, > right? If so it is a dst refcnt leak. Correct, once I get into the state it lasts until a reboot. > How reproducible is it for you? From my reading, it seems always > reproduced when you unplug and plug your usb eth interface? > Is there anything else involved? For example, network namespace. So with 4.13-rc3/4 I seem to trigger it easily, often with the first unplug of the USB eth adapter. But as I get back closer to 4.12, it seemingly becomes harder to trigger, but sometimes still happens. So far, I've not been able to trigger it with 4.12. I don't think network namespaces are involved? Though its out of my area, so AOSP may be using them these days. Is there a simple way to check? I'll also do another bisection to see if the bad point moves back any further. >> >> So I went through another bisection around and got 9514528d92d4 ipv6: >> call dst_dev_put() properly as the first bad commit again. >> >>> If you see the problem starts to happen on commit >>> 9514528d92d4cbe086499322370155ed69f5d06c, could you try reverting all >>> the following commits: >>> (from new to old) >>> 1eb04e7c9e63 net: reorder all the dst flags >>> a4c2fd7f7891 net: remove DST_NOCACHE flag >>> b2a9c0ed75a3 net: remove DST_NOGC flag >>> 5b7c9a8ff828 net: remove dst gc related code >>> db916649b5dd ipv6: get rid of icmp6 dst garbage collector >>> 587fea741134 ipv6: mark DST_NOGC and remove the operation of dst_free() >>> ad65a2f05695 ipv6: call dst_hold_safe() properly >>> 9514528d92d4 ipv6: call dst_dev_put() properly >> >> >> And reverting this set off of 4.13-rc4 seems to make the issue go away. >> >> Is there anything I can test to help narrow down the specific problem >> with that patchset? >> > > Thanks John for confirming. > Let me spend some time on the commits and I will let you know if I > have some debug image for you to try. > > Wei > > >> thanks >> -john From 93f2836679c81915b110ff56617f9f5dae2e6927 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 9 Aug 2017 22:27:36 -0700 Subject: [PATCH] ipv6: unregister netdev bug fix Change-Id: I30fa739989ac50fbc7f4cbc6a04130005589cc25 --- include/net/ip6_route.h | 1 + net/ipv6/addrconf.c | 10 +++--- net/ipv6/anycast.c | 3 ++- net/ipv6/route.c| 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 907d39a42f6b..dec1424ce619 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -94,6 +94,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg); int ip6_route_add(struct fib6_config *cfg, struct netlink_ext_ack *extack); int ip6_ins_rt(struct rt6_info *); int ip6_del_rt(struct rt6_info *); +void rt6_uncached_list_add(struct rt6_info *rt); static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt, const struct in6_addr *daddr, diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 3c46e9513a31..06a27addb93c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3079,7 +3079,8 @@ static void init_loopback(struct net_device *dev) /* Failure cases are ignored */ if (!IS_ERR(sp_rt)) { sp_ifa->rt = sp_rt; -ip6_ins_rt(sp_rt); +if
[RFC][PATCH] usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode
We've found that while in host mode on HiKey using Android, if one runs the command: stop adbd The existing usb devices being utilized in host mode are disconnected. This is most visible with usb networking devices. This seems to be due to adbd closing the file: /dev/usb-ffs/adb/ep0 Which calls ffs_ep0_release() and the following backtrace: [] dwc2_hsotg_ep_disable+0x148/0x150 [] dwc2_hsotg_udc_stop+0x60/0x110 [] usb_gadget_remove_driver+0x58/0x78 [] usb_gadget_unregister_driver+0x74/0xe8 [] unregister_gadget+0x28/0x58 [] unregister_gadget_item+0x2c/0x40 [] ffs_data_clear+0xe8/0xf8 [] ffs_data_reset+0x20/0x58 [] ffs_data_closed+0x98/0xe8 [] ffs_ep0_release+0x20/0x30 Then when dwc2_hsotg_ep_disable() is called, we call kill_all_requests() which causes a bunch of the following messages: dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode dwc2 f72c.usb: Mode Mismatch Interrupt: currently in Host mode init: Service 'adbd' (pid 1915) killed by signal 9 init: Sending signal 9 to service 'adbd' (pid 1915) process group... init: Successfully killed process cgroup uid 0 pid 1915 in 0ms init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15) dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason is unknown dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029 dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029 dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason is unknown dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029 dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029 dwc2 f72c.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown dwc2 f72c.usb: hcint 0x0002, intsts 0x04200029 dwc2 f72c.usb: dwc2_update_urb_state_abn(): trimming xfer length And the usb devices connected are basically hung at this point. It seems like if we're in host mode, we probably shouldn't run the dwc2_hostg_ep_disable logic, so this patch returns an error in that case. With this patch (along with the two previous patches mailed out earlier: https://lkml.org/lkml/2017/8/3/1008 https://lkml.org/lkml/2017/8/3/1010 ), we avoid the mismatched interrupts and connected usb devices continue to function. I'm not sure if some other solution would be better here, but this seems to work, so I wanted to send it out for input on what the right approach should be. Cc: Wei XuCc: Guodong Xu Cc: Amit Pundir Cc: YongQin Liu Cc: John Youn Cc: Minas Harutyunyan Cc: Douglas Anderson Cc: Chen Yu Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Reported-by: YongQin Liu Signed-off-by: John Stultz --- drivers/usb/dwc2/gadget.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index e6f2cd8..61fb76f 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -4006,6 +4006,11 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) return -EINVAL; } + if (hsotg->op_state != OTG_STATE_B_PERIPHERAL) { + dev_err(hsotg->dev, "%s: called in host mode?\n", __func__); + return -EINVAL; + } + epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); spin_lock_irqsave(>lock, flags); -- 2.7.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] usb: gadget: udc: renesas_usb3: fix error return code in renesas_usb3_probe()
Hi Yoshihiro, On 08/09/2017 06:44 AM, Yoshihiro Shimoda wrote: Hi Gustavo, Thank you for the patch! I'm glad to help :) -Original Message- From: Gustavo A. R. Silva Sent: Wednesday, August 9, 2017 7:35 AM platform_get_irq() returns an error code, but the renesas_usb3 driver ignores it and always returns -ENODEV. This is not correct and, prevents -EPROBE_DEFER from being propagated properly. Thank you for the point. I got it. Also, notice that platform_get_irq() no longer returns 0 on error: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92 af I don't think this explanation needs. After this is removed, Acked-by: Yoshihiro ShimodaThank you -- Gustavo A. R. Silva Best regards, Yoshihiro Shimoda Print error message and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva --- drivers/usb/gadget/udc/renesas_usb3.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index e1de8fe..616d053 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -2468,8 +2468,10 @@ static int renesas_usb3_probe(struct platform_device *pdev) priv = match->data; irq = platform_get_irq(pdev, 0); - if (irq < 0) - return -ENODEV; + if (irq < 0) { + dev_err(>dev, "Failed to get IRQ: %d\n", irq); + return irq; + } usb3 = devm_kzalloc(>dev, sizeof(*usb3), GFP_KERNEL); if (!usb3) -- 2.5.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 -- To unsubscribe from this list: send the line "unsubscribe 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: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
On Wed, Aug 9, 2017 at 6:26 PM, John Stultzwrote: > On Wed, Aug 9, 2017 at 5:36 PM, Wei Wang wrote: >> On Wed, Aug 9, 2017 at 4:44 PM, John Stultz wrote: >>> On Wed, Aug 9, 2017 at 4:34 PM, Cong Wang wrote: (Cc'ing Wei whose commit was blamed) On Mon, Aug 7, 2017 at 2:15 PM, John Stultz wrote: > On Mon, Aug 7, 2017 at 2:05 PM, John Stultz > wrote: >> So, with recent testing with my HiKey board, I've been noticing some >> quirky behavior with my USB eth adapter. >> >> Basically, pluging the usb eth adapter in and then removing it, when >> plugging it back in I often find that its not detected, and the system >> slowly spits out the following message over and over: >> unregister_netdevice: waiting for eth0 to become free. Usage count = 1 > > The other bit is that after this starts printing, the board will no > longer reboot (it hangs continuing to occasionally print the above > message), and I have to manually reset the device. > So this warning is not temporarily shown but lasts until a reboot, right? If so it is a dst refcnt leak. >>> >>> Correct, once I get into the state it lasts until a reboot. >>> How reproducible is it for you? From my reading, it seems always reproduced when you unplug and plug your usb eth interface? Is there anything else involved? For example, network namespace. >>> >>> So with 4.13-rc3/4 I seem to trigger it easily, often with the first >>> unplug of the USB eth adapter. >>> >>> But as I get back closer to 4.12, it seemingly becomes harder to >>> trigger, but sometimes still happens. >>> >>> So far, I've not been able to trigger it with 4.12. >>> >>> I don't think network namespaces are involved? Though its out of my >>> area, so AOSP may be using them these days. Is there a simple way to >>> check? >>> >>> I'll also do another bisection to see if the bad point moves back any >>> further. > > So I went through another bisection around and got 9514528d92d4 ipv6: > call dst_dev_put() properly as the first bad commit again. > >> If you see the problem starts to happen on commit >> 9514528d92d4cbe086499322370155ed69f5d06c, could you try reverting all >> the following commits: >> (from new to old) >> 1eb04e7c9e63 net: reorder all the dst flags >> a4c2fd7f7891 net: remove DST_NOCACHE flag >> b2a9c0ed75a3 net: remove DST_NOGC flag >> 5b7c9a8ff828 net: remove dst gc related code >> db916649b5dd ipv6: get rid of icmp6 dst garbage collector >> 587fea741134 ipv6: mark DST_NOGC and remove the operation of dst_free() >> ad65a2f05695 ipv6: call dst_hold_safe() properly >> 9514528d92d4 ipv6: call dst_dev_put() properly > > > And reverting this set off of 4.13-rc4 seems to make the issue go away. > > Is there anything I can test to help narrow down the specific problem > with that patchset? > Thanks John for confirming. Let me spend some time on the commits and I will let you know if I have some debug image for you to try. Wei > thanks > -john -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
On Wed, Aug 9, 2017 at 5:36 PM, Wei Wangwrote: > On Wed, Aug 9, 2017 at 4:44 PM, John Stultz wrote: >> On Wed, Aug 9, 2017 at 4:34 PM, Cong Wang wrote: >>> (Cc'ing Wei whose commit was blamed) >>> >>> On Mon, Aug 7, 2017 at 2:15 PM, John Stultz wrote: On Mon, Aug 7, 2017 at 2:05 PM, John Stultz wrote: > So, with recent testing with my HiKey board, I've been noticing some > quirky behavior with my USB eth adapter. > > Basically, pluging the usb eth adapter in and then removing it, when > plugging it back in I often find that its not detected, and the system > slowly spits out the following message over and over: > unregister_netdevice: waiting for eth0 to become free. Usage count = 1 The other bit is that after this starts printing, the board will no longer reboot (it hangs continuing to occasionally print the above message), and I have to manually reset the device. >>> >>> So this warning is not temporarily shown but lasts until a reboot, >>> right? If so it is a dst refcnt leak. >> >> Correct, once I get into the state it lasts until a reboot. >> >>> How reproducible is it for you? From my reading, it seems always >>> reproduced when you unplug and plug your usb eth interface? >>> Is there anything else involved? For example, network namespace. >> >> So with 4.13-rc3/4 I seem to trigger it easily, often with the first >> unplug of the USB eth adapter. >> >> But as I get back closer to 4.12, it seemingly becomes harder to >> trigger, but sometimes still happens. >> >> So far, I've not been able to trigger it with 4.12. >> >> I don't think network namespaces are involved? Though its out of my >> area, so AOSP may be using them these days. Is there a simple way to >> check? >> >> I'll also do another bisection to see if the bad point moves back any >> further. So I went through another bisection around and got 9514528d92d4 ipv6: call dst_dev_put() properly as the first bad commit again. > If you see the problem starts to happen on commit > 9514528d92d4cbe086499322370155ed69f5d06c, could you try reverting all > the following commits: > (from new to old) > 1eb04e7c9e63 net: reorder all the dst flags > a4c2fd7f7891 net: remove DST_NOCACHE flag > b2a9c0ed75a3 net: remove DST_NOGC flag > 5b7c9a8ff828 net: remove dst gc related code > db916649b5dd ipv6: get rid of icmp6 dst garbage collector > 587fea741134 ipv6: mark DST_NOGC and remove the operation of dst_free() > ad65a2f05695 ipv6: call dst_hold_safe() properly > 9514528d92d4 ipv6: call dst_dev_put() properly And reverting this set off of 4.13-rc4 seems to make the issue go away. Is there anything I can test to help narrow down the specific problem with that patchset? thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
On Wed, Aug 9, 2017 at 5:36 PM, Wei Wangwrote: > > Does your USB adapter get an IPv6 address? Yes, it does. > If you see the problem starts to happen on commit > 9514528d92d4cbe086499322370155ed69f5d06c, could you try reverting all > the following commits: > (from new to old) > 1eb04e7c9e63 net: reorder all the dst flags > a4c2fd7f7891 net: remove DST_NOCACHE flag > b2a9c0ed75a3 net: remove DST_NOGC flag > 5b7c9a8ff828 net: remove dst gc related code > db916649b5dd ipv6: get rid of icmp6 dst garbage collector > 587fea741134 ipv6: mark DST_NOGC and remove the operation of dst_free() > ad65a2f05695 ipv6: call dst_hold_safe() properly > 9514528d92d4 ipv6: call dst_dev_put() properly > > and try if it starts to work? I'll give that a shot! Thanks so much for the help! I really appreciate it! -john -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
On Wed, Aug 9, 2017 at 4:44 PM, John Stultzwrote: > On Wed, Aug 9, 2017 at 4:34 PM, Cong Wang wrote: >> (Cc'ing Wei whose commit was blamed) >> >> On Mon, Aug 7, 2017 at 2:15 PM, John Stultz wrote: >>> On Mon, Aug 7, 2017 at 2:05 PM, John Stultz wrote: So, with recent testing with my HiKey board, I've been noticing some quirky behavior with my USB eth adapter. Basically, pluging the usb eth adapter in and then removing it, when plugging it back in I often find that its not detected, and the system slowly spits out the following message over and over: unregister_netdevice: waiting for eth0 to become free. Usage count = 1 >>> >>> The other bit is that after this starts printing, the board will no >>> longer reboot (it hangs continuing to occasionally print the above >>> message), and I have to manually reset the device. >>> >> >> So this warning is not temporarily shown but lasts until a reboot, >> right? If so it is a dst refcnt leak. > > Correct, once I get into the state it lasts until a reboot. > >> How reproducible is it for you? From my reading, it seems always >> reproduced when you unplug and plug your usb eth interface? >> Is there anything else involved? For example, network namespace. > > So with 4.13-rc3/4 I seem to trigger it easily, often with the first > unplug of the USB eth adapter. > > But as I get back closer to 4.12, it seemingly becomes harder to > trigger, but sometimes still happens. > > So far, I've not been able to trigger it with 4.12. > > I don't think network namespaces are involved? Though its out of my > area, so AOSP may be using them these days. Is there a simple way to > check? > > I'll also do another bisection to see if the bad point moves back any further. > > thanks > -john Hi John, Does your USB adapter get an IPv6 address? If you see the problem starts to happen on commit 9514528d92d4cbe086499322370155ed69f5d06c, could you try reverting all the following commits: (from new to old) 1eb04e7c9e63 net: reorder all the dst flags a4c2fd7f7891 net: remove DST_NOCACHE flag b2a9c0ed75a3 net: remove DST_NOGC flag 5b7c9a8ff828 net: remove dst gc related code db916649b5dd ipv6: get rid of icmp6 dst garbage collector 587fea741134 ipv6: mark DST_NOGC and remove the operation of dst_free() ad65a2f05695 ipv6: call dst_hold_safe() properly 9514528d92d4 ipv6: call dst_dev_put() properly and try if it starts to work? By only reverting 9514528d92d4 definitely won't work as all the later commits depend on this one. Thanks a lot. Wei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] usb: xhci: Disable slot even virt-dev is null
Hi, On 08/09/2017 03:58 PM, Mathias Nyman wrote: > On 27.07.2017 05:21, Lu Baolu wrote: >> xhci_disable_slot() is a helper for disabling a slot when a device >> goes away or recovers from error situations. Currently, it checks >> the corespoding virt-dev pointer and returns directly (w/o issuing >> disable slot command) if it's null. >> >> This is unnecessary and will cause problems in case where virt-dev >> allocation fails and xhci_disable_slot() is called to roll back the >> hardware state. Refer to the implementation of xhci_alloc_dev(). >> > > True, checking for xhci->devs[slot_id] doesn't work if xhci_alloc_dev() > failed xhci_alloc_virt_device() and calls xhci_disable_slot, > > but the virt dev check is needed for test mode, which will just try > to disable all slots from 1 to HCS_MAX_SLOTS: > > xhci_enter_test_mode(..) >/* Disable all Device Slots */ > for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { > retval = xhci_disable_slot(xhci, NULL, i); > > So, how about checking virt dev before this invoking? @@ -612,10 +612,12 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, xhci_dbg(xhci, "Disable all slots\n"); spin_unlock_irqrestore(>lock, *flags); for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { - retval = xhci_disable_slot(xhci, NULL, i); - if (retval) - xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", -i, retval); + if (xhci->devs[i]) { + retval = xhci_disable_slot(xhci, NULL, i); + if (retval) + xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", +i, retval); + } } spin_lock_irqsave(>lock, *flags); /* Put all ports to the Disable state by clear PP */ Best regards, Lu Baolu > >> This patch removes lines to check virt-dev in xhci_disable_slot(). >> >> Fixes: f9e609b82479 ("usb: xhci: Add helper function xhci_disable_slot().") >> Cc: Guoqing Zhang>> Signed-off-by: Lu Baolu >> --- >> drivers/usb/host/xhci.c | 4 >> 1 file changed, 4 deletions(-) >> >> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c >> index b2ff1ff..e69073f 100644 >> --- a/drivers/usb/host/xhci.c >> +++ b/drivers/usb/host/xhci.c >> @@ -3567,11 +3567,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, struct >> xhci_command *command, >> unsigned long flags; >> u32 state; >> int ret = 0; >> -struct xhci_virt_device *virt_dev; >> >> -virt_dev = xhci->devs[slot_id]; >> -if (!virt_dev) >> -return -EINVAL; >> if (!command) >> command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); >> if (!command) >> > > -- > To unsubscribe from this list: send the line "unsubscribe 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 v2 4/5] usb: gadget: udc: Replace the deprecated extcon API
Ping. Hi Felipe, I sent the first patch[1] more than three weeks ago. But I didn't receive the any review. [1] https://lkml.org/lkml/2017/7/16/523 This patch is very simple. After finishing the review I'll remove the deprecated extcon API and then send the immutable branch to both phy and usb maintainer. Usually, I send the extcon's pull request to the GregKH for the next merge after releasing 4.x-rc6. (4.x-rc4 was released) Please review this patch. On 2017년 08월 07일 11:07, Chanwoo Choi wrote: > Dear Felipe, > > Could you please review this patch? > I hope to remove the deprecated extcon API. > > Regards, > Chanwoo Choi > > On 2017년 08월 03일 17:20, Chanwoo Choi wrote: >> This patch replaces the deprecated extcon API as following: >> - extcon_get_cable_state_() -> extcon_get_state() >> >> Cc: Felipe Balbi>> Cc: Greg Kroah-Hartman >> Cc: Raviteja Garimella >> Signed-off-by: Chanwoo Choi >> --- >> drivers/usb/gadget/udc/snps_udc_plat.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c >> b/drivers/usb/gadget/udc/snps_udc_plat.c >> index 2e11f19e07ae..0ce7b3ba60ff 100644 >> --- a/drivers/usb/gadget/udc/snps_udc_plat.c >> +++ b/drivers/usb/gadget/udc/snps_udc_plat.c >> @@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev) >> goto exit_phy; >> } >> >> -ret = extcon_get_cable_state_(udc->edev, EXTCON_USB); >> +ret = extcon_get_state(udc->edev, EXTCON_USB); >> if (ret < 0) { >> dev_err(dev, "Can't get cable state\n"); >> goto exit_extcon; >> @@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev) >> udc = dev_get_drvdata(dev); >> stop_udc(udc); >> >> -if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) { >> +if (extcon_get_state(udc->edev, EXTCON_USB) > 0) { >> dev_dbg(udc->dev, "device -> idle\n"); >> stop_udc(udc); >> } >> @@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev) >> return ret; >> } >> >> -if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) { >> +if (extcon_get_state(udc->edev, EXTCON_USB) > 0) { >> dev_dbg(udc->dev, "idle -> device\n"); >> start_udc(udc); >> } >> > > > > -- Best Regards, Chanwoo Choi Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe 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: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
On Wed, Aug 9, 2017 at 4:34 PM, Cong Wangwrote: > (Cc'ing Wei whose commit was blamed) > > On Mon, Aug 7, 2017 at 2:15 PM, John Stultz wrote: >> On Mon, Aug 7, 2017 at 2:05 PM, John Stultz wrote: >>> So, with recent testing with my HiKey board, I've been noticing some >>> quirky behavior with my USB eth adapter. >>> >>> Basically, pluging the usb eth adapter in and then removing it, when >>> plugging it back in I often find that its not detected, and the system >>> slowly spits out the following message over and over: >>> unregister_netdevice: waiting for eth0 to become free. Usage count = 1 >> >> The other bit is that after this starts printing, the board will no >> longer reboot (it hangs continuing to occasionally print the above >> message), and I have to manually reset the device. >> > > So this warning is not temporarily shown but lasts until a reboot, > right? If so it is a dst refcnt leak. Correct, once I get into the state it lasts until a reboot. > How reproducible is it for you? From my reading, it seems always > reproduced when you unplug and plug your usb eth interface? > Is there anything else involved? For example, network namespace. So with 4.13-rc3/4 I seem to trigger it easily, often with the first unplug of the USB eth adapter. But as I get back closer to 4.12, it seemingly becomes harder to trigger, but sometimes still happens. So far, I've not been able to trigger it with 4.12. I don't think network namespaces are involved? Though its out of my area, so AOSP may be using them these days. Is there a simple way to check? I'll also do another bisection to see if the bad point moves back any further. thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: core: unmap request from DMA only if previously mapped
Hi Felipe, Do you have any comments on this? Thanks, Jack On Tue, Aug 01, 2017 at 02:00:56AM -0700, Jack Pham wrote: > In the SG case this is already handled since a non-zero > request->num_mapped_sgs is a clear indicator that dma_map_sg() > had been called. While it would be nice to do the same for the > singly mapped case by simply checking for non-zero request->dma, > it's conceivable that 0 is a valid dma_addr_t handle. Hence add > a flag 'dma_mapped' to struct usb_request and use this to > determine the need to call dma_unmap_single(). Otherwise, if a > request is not DMA mapped then the result of calling > usb_request_unmap_request() would safely be a no-op. > > Signed-off-by: Jack Pham> --- > Hi Felipe, > > Here's what I came up with after our discussion back in [1]. It > turned out to be pretty dead-simple and hopefully doesn't need to > approach the number of URB flags that the host core uses. > > I did a quick survey of all callers of usb_gadget_{map,unmap}_request > and besides the instance I reported & patched in dwc3, from what I > can tell it looks like all the other gadget drivers seem to be calling > these APIs sanely--i.e. a request is only queued after being > successfully mapped, and unmap only ever gets called on requests that > had been queued. > > Although in one instance (renesas_usb3.c), there is a 'used' flag as > part of struct renesas_usb3_dma that looks like it's tracking the > status of whether a request is mapped or not, but it's not obvious from > cursory glance whether it has a use besides that or if it would be > sufficient to just rely on this new flag in struct usb_gadget. > Maybe Yoshihiro-san can comment. > > [1] http://marc.info/?l=linux-usb=149872369422476=2 > > Thanks, > Jack > > drivers/usb/gadget/udc/core.c | 5 - > include/linux/usb/gadget.h| 2 ++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > index e6f04ee..c1cef6a 100644 > --- a/drivers/usb/gadget/udc/core.c > +++ b/drivers/usb/gadget/udc/core.c > @@ -812,6 +812,8 @@ int usb_gadget_map_request_by_dev(struct device *dev, > dev_err(dev, "failed to map buffer\n"); > return -EFAULT; > } > + > + req->dma_mapped = 1; > } > > return 0; > @@ -836,9 +838,10 @@ void usb_gadget_unmap_request_by_dev(struct device *dev, > is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); > > req->num_mapped_sgs = 0; > - } else { > + } else if (req->dma_mapped) { > dma_unmap_single(dev, req->dma, req->length, > is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); > + req->dma_mapped = 0; > } > } > EXPORT_SYMBOL_GPL(usb_gadget_unmap_request_by_dev); > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index 1a4a4ba..21468a7 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -48,6 +48,7 @@ struct usb_ep; > * by adding a zero length packet as needed; > * @short_not_ok: When reading data, makes short packets be > * treated as errors (queue stops advancing till cleanup). > + * @dma_mapped: Indicates if request has been mapped to DMA (internal) > * @complete: Function called when request completes, so this request and > * its buffer may be re-used. The function will always be called with > * interrupts disabled, and it must not sleep. > @@ -103,6 +104,7 @@ struct usb_request { > unsignedno_interrupt:1; > unsignedzero:1; > unsignedshort_not_ok:1; > + unsigneddma_mapped:1; > > void(*complete)(struct usb_ep *ep, > struct usb_request *req); -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: unregister_netdevice: waiting for eth0 to become free. Usage count = 1
(Cc'ing Wei whose commit was blamed) On Mon, Aug 7, 2017 at 2:15 PM, John Stultzwrote: > On Mon, Aug 7, 2017 at 2:05 PM, John Stultz wrote: >> So, with recent testing with my HiKey board, I've been noticing some >> quirky behavior with my USB eth adapter. >> >> Basically, pluging the usb eth adapter in and then removing it, when >> plugging it back in I often find that its not detected, and the system >> slowly spits out the following message over and over: >> unregister_netdevice: waiting for eth0 to become free. Usage count = 1 > > The other bit is that after this starts printing, the board will no > longer reboot (it hangs continuing to occasionally print the above > message), and I have to manually reset the device. > So this warning is not temporarily shown but lasts until a reboot, right? If so it is a dst refcnt leak. How reproducible is it for you? From my reading, it seems always reproduced when you unplug and plug your usb eth interface? Is there anything else involved? For example, network namespace. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/1] usbip: auto retry for concurrent attach
On 08/08/2017 03:11 AM, fx IWATA NOBUO wrote: > Hello, > >> -Original Message- >> From: Shuah Khan [mailto:sh...@kernel.org] >> Sent: Thursday, August 03, 2017 2:27 AM >> To: fx IWATA NOBUO; >> valentina.mane...@gmail.com; gre...@linuxfoundation.org; >> linux-usb@vger.kernel.org >> Cc: fx MICHIMURA TADAO ; Shuah >> Khan ; Shuah Khan >> Subject: Re: [PATCH v2 1/1] usbip: auto retry for concurrent attach >> >> Hi Nobuo Iwata, >> >> Sorry for the delay. This one got lost in my Inbox. >> >> On 05/28/2017 08:31 PM, Nobuo Iwata wrote: >>> This patch adds recovery from false busy state on concurrent attach >>> operation. >>> >>> The procedure of attach operation is as below. >>> >>> 1) Find an unused port in /sys/devices/platform/vhci_hcd/status. >>> (userspace) >>> >>> 2) Request attach found port to driver through >>> /sys/devices/platform/vhci_hcd/attach. (userspace) >>> >>> 3) Lock table, reserve requested port and unlock table. (vhci driver) >>> >>> Attaching more than one remote devices concurrently, same unused port >>> number will be found in step-1. Then one request will succeed and >>> others will fail even though there are some unused ports. >>> >>> It is possible to avoid this fail by introdocing userspace exclusive >>> control. But it's exaggerated for this special condition. The locking >>> itself is done in driver. >> >> Please spell check the change log. > > I will. > >>> With this patch, driver returns EBUSY when requested port has already >>> been used. In this case, attach command retries from step-1: finding >>> another unused port. If there's no unused port, the attach operation >>> will fail. Othrwise it retries automatically using new free port. >>> >>> Currunt userspace src/usbip_attach.c:import_device() doesn't use the >>> errno. >>> >>> vhci-hcd's interface (only errno) is changed as following. >>> >>> Current errno New errno Condition >>> EINVAL same as leftspecified port numbre is in >> invalid >>> range >>> EAGAIN same as leftplatform_get_drvdata() failed >>> EINVAL same as leftspecified socket fd is not valid >>> EINVAL EBUSY specified port status is not free >>> >>> --- >>> Version information >>> >>> v2) >>> Gathered usbip_vhci_driver_close() for errors under an exit label. >> >> Greg KH already pointed this out. Please fix this. > > OK. > >>> Signed-off-by: Nobuo Iwata >>> --- >>> drivers/usb/usbip/vhci_sysfs.c | 8 ++-- >>> tools/usb/usbip/src/usbip_attach.c | 33 >> +- >>> 2 files changed, 25 insertions(+), 16 deletions(-) >>> >>> diff --git a/drivers/usb/usbip/vhci_sysfs.c >> b/drivers/usb/usbip/vhci_sysfs.c >>> index b96e5b1..5d4be4b 100644 >>> --- a/drivers/usb/usbip/vhci_sysfs.c >>> +++ b/drivers/usb/usbip/vhci_sysfs.c >>> @@ -214,7 +214,7 @@ static ssize_t store_detach(struct device *dev, >> struct device_attribute *attr, >>> >>> ret = vhci_port_disconnect(hcd_to_vhci(hcd), rhport); >>> if (ret < 0) >>> - return -EINVAL; >>> + return ret; >> >> Why are you changing the return value here? vhci_port_disconnect() >> currently only returns -EINVAL, however of that changes, userspace >> will see a different value. If the correct retunr value in this failure >> path is -EINVAL, let's not change that, unless there are good reasons >> do so. > > Attach operation is done by searching a free port via sysfs and attach > specifying found free port with the port number. > > If 2 processes try to attach concurrently, they will find same port > number and one will fail. In this failed case, it can restart from > searching a free port and it will be successfully attached if there's > another free port. > > But other cases, specified port number is in invalid range (EINVAL), > platform_get_drvdata() failed (EAGAIN) or specified socket fd is not > valid (EINVAL), should not be retried. > > To distinguish the cases, the different errno (EBUSY) is need for the > case if port number is valid range but used. Sounds reasonable. thanks, -- Shuah -- To unsubscribe from this list: send the line "unsubscribe 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] constify hid usb_device_id and fix space before '[' error
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Arvind Yadav (2): [PATCH 1/2] HID: usbkbd: constify usb_device_id and fix space before '[' error. [PATCH 2/2] HID: usbmouse: constify usb_device_id and fix space before '[' error drivers/hid/usbhid/usbkbd.c | 2 +- drivers/hid/usbhid/usbmouse.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.7.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 1/2] HID: usbkbd: constify usb_device_id and fix space before '[' error.
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Signed-off-by: Arvind Yadav--- drivers/hid/usbhid/usbkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 7fb2d1e..ed01dc4 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c @@ -392,7 +392,7 @@ static void usb_kbd_disconnect(struct usb_interface *intf) } } -static struct usb_device_id usb_kbd_id_table [] = { +static const struct usb_device_id usb_kbd_id_table[] = { { USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT, USB_INTERFACE_PROTOCOL_KEYBOARD) }, { } /* Terminating entry */ -- 2.7.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] HID: usbmouse: constify usb_device_id and fix space before '[' error
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Signed-off-by: Arvind Yadav--- drivers/hid/usbhid/usbmouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index dd911c5..589ad7c 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c @@ -226,7 +226,7 @@ static void usb_mouse_disconnect(struct usb_interface *intf) } } -static struct usb_device_id usb_mouse_id_table [] = { +static const struct usb_device_id usb_mouse_id_table[] = { { USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT, USB_INTERFACE_PROTOCOL_MOUSE) }, { } /* Terminating entry */ -- 2.7.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] mmc: vub300: constify usb_device_id
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav--- drivers/mmc/host/vub300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index fbeea1a..6c99102 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c @@ -266,7 +266,7 @@ MODULE_PARM_DESC(firmware_rom_wait_states, #define ELAN_VENDOR_ID 0x2201 #define VUB300_VENDOR_ID 0x0424 #define VUB300_PRODUCT_ID 0x012C -static struct usb_device_id vub300_table[] = { +static const struct usb_device_id vub300_table[] = { {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)}, {USB_DEVICE(VUB300_VENDOR_ID, VUB300_PRODUCT_ID)}, {} /* Terminating entry */ -- 2.7.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/3] constify usb usb_device_id
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Arvind Yadav (3): [PATCH 1/3] usb: speedtch: constify usb_device_id [PATCH 2/3] usb: hwa-hc: constify usb_device_id [PATCH 3/3] usb: yurex: constify usb_device_id drivers/usb/atm/speedtch.c | 2 +- drivers/usb/host/hwa-hc.c | 2 +- drivers/usb/misc/yurex.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.7.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/3] usb: hwa-hc: constify usb_device_id
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav--- drivers/usb/host/hwa-hc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index 1db0626..b37cf20 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c @@ -860,7 +860,7 @@ static void hwahc_disconnect(struct usb_interface *usb_iface) usb_put_hcd(usb_hcd); } -static struct usb_device_id hwahc_id_table[] = { +static const struct usb_device_id hwahc_id_table[] = { /* Alereon 5310 */ { USB_DEVICE_AND_INTERFACE_INFO(0x13dc, 0x5310, 0xe0, 0x02, 0x01), .driver_info = WUSB_QUIRK_ALEREON_HWA_CONCAT_ISOC | -- 2.7.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 1/3] usb: speedtch: constify usb_device_id
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav--- drivers/usb/atm/speedtch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 5083eb5..701ed37 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c @@ -738,7 +738,7 @@ static int speedtch_post_reset(struct usb_interface *intf) ** USB ** **/ -static struct usb_device_id speedtch_usb_ids[] = { +static const struct usb_device_id speedtch_usb_ids[] = { {USB_DEVICE(0x06b9, 0x4061)}, {} }; -- 2.7.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] USB: serial: pl2303: add new ATEN device id
On Wed, Aug 09, 2017 at 10:28:00AM +0200, Johan Hovold wrote: > On Tue, Aug 08, 2017 at 12:58:51PM -0700, Greg Kroah-Hartman wrote: > > This adds a new ATEN device id for a new pl2303-based device. > > > > Reported-by: Peter Kuo> > Cc: stable > > Signed-off-by: Greg Kroah-Hartman > > > > --- > > > > Peter, can you test this patch and verify it works for you? Is there a > > better name I can give this device other than ATEN_PRODUCT_ID3? > > > > Johan, any objection for me to take this through my tree once Peter > > verifies it? > > None at all. In fact, there seems to be a few more on the way in which > it would be great if you could pick up directly while I'm on vacation. Ok, will do. > > > diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c > > index c9ebefd8f35f..4b124c645175 100644 > > --- a/drivers/usb/serial/pl2303.c > > +++ b/drivers/usb/serial/pl2303.c > > @@ -53,6 +53,8 @@ static const struct usb_device_id id_table[] = { > > { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID), > > .driver_info = PL2303_QUIRK_ENDPOINT_HACK }, > > { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) }, > > + { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID3), > > + .driver_info = PL2303_QUIRK_ENDPOINT_HACK }, > > { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, > > { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, > > { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, > > diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h > > index 09d9be88209e..dc55e3f2343c 100644 > > --- a/drivers/usb/serial/pl2303.h > > +++ b/drivers/usb/serial/pl2303.h > > @@ -28,6 +28,7 @@ > > #define ATEN_VENDOR_ID20x0547 > > #define ATEN_PRODUCT_ID0x2008 > > #define ATEN_PRODUCT_ID2 0x2118 > > +#define ATEN_PRODUCT_ID3 0x2021 > > I try to keep the defines themselves sorted by numerical PID, even if in > this case and with these generic names that may seem counterintuitive. Ok, I'll switch this around, hopefully I can get a better "name" for this from Peter. 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: f_hid.c conversion to the new function interface and crash due to race
> On Aug 9, 2017, at 2:56 AM, Felipe Balbiwrote: Thanks for replying. > > > Hi, > > noman pouigt writes: >> Hello, >> >> I am currently using 3.18 linux kernel and getting below > > return -EKERNELTOOOLD; > > Sorry, you're on your own. You should ask for support from whoever > forces you to use 3.18 kernel. I have updated f_hid.c file to latest kernel though as I knew it would be too much to ask to get support for old code. I am just not sure about how to instantiate the function driver as earlier f_fs was instantiating the hid driver. However, after hid got converted to new function driver who is responsible for calling setup, bind and unbind functions in f_hid.c ? Below is the glue code in android.c. drivers/usb/gadget/android.c static struct android_usb_function hid_function = { .name = "hid", .init = hid_function_init, .cleanup= hid_function_cleanup, .bind_config= hid_function_bind_config, .attributes = hid_function_attributes, }; Is there something similar in new function driver in upstream kernel? > > -- > 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] usb: ehci-omap: fix error return code in ehci_hcd_omap_probe()
On Tue, 8 Aug 2017, Gustavo A. R. Silva wrote: > platform_get_irq() returns an error code, but the ehci-omap driver > ignores it and always returns -ENODEV. This is not correct and, > prevents -EPROBE_DEFER from being propagated properly. > > Also, notice that platform_get_irq() no longer returns 0 on error: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af > > Print and propagate the return value of platform_get_irq on failure. > > This issue was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva> --- > drivers/usb/host/ehci-omap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c > index 94ea9ff..4d30853 100644 > --- a/drivers/usb/host/ehci-omap.c > +++ b/drivers/usb/host/ehci-omap.c > @@ -130,8 +130,8 @@ static int ehci_hcd_omap_probe(struct platform_device > *pdev) > > irq = platform_get_irq(pdev, 0); > if (irq < 0) { > - dev_err(dev, "EHCI irq failed\n"); > - return -ENODEV; > + dev_err(dev, "EHCI irq failed: %d\n", irq); > + return irq; > } > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); Acked-by: 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: new usb LTE modem device
On Wed, 2017-08-09 at 11:19 +0700, Lars Melin wrote: > On 8/9/2017 02:33, Bjørn Mork wrote: > > > > The qmi_wwan part looks fine to me. But you > > will need to split it in two patches since the two > > drivers are parts of different subsystems. > > > > The option driver use interface blacklists > > instead of multiple match entries. You should > > probably follow the same style there. But this > > is up to Johan... > > > > Use the get_maintainer script to figure out > > where the patches should be sent. > > > > > > Bjørn > > > Whitelisting all 6 interfaces in the option driver and > then blacklist 4 of them (3 qmi + 1 Android debug) is > not efficient when you so easily can selectively whitelist > the ones (0 and 2) that the option driver should handle. > Giuseppe is doing it the right way imho. Yeah, in this case you're right. Dan -- To unsubscribe from this list: send the line "unsubscribe 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 v5 2/8] usb: chipidea: udc: Support SKB alignment quirk
NVIDIA Tegra20 UDC can't cope with unaligned DMA and require a USB gadget quirk that avoids SKB buffer alignment to be set in order to make Ethernet Gadget working. Later Tegra generations do not require that quirk. Let's add a new platform data flag that allows to enable USB gadget quirk for platforms that require it. Signed-off-by: Dmitry OsipenkoAcked-by: Peter Chen --- drivers/usb/chipidea/udc.c | 3 +++ include/linux/usb/chipidea.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 6502c13331e8..fe8a90543ea3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1896,6 +1896,9 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.name = ci->platdata->name; ci->gadget.otg_caps = otg_caps; + if (ci->platdata->flags & CI_HDRC_REQUIRES_ALIGNED_DMA) + ci->gadget.quirk_avoids_skb_reserve = 1; + if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support || otg_caps->adp_support)) ci->gadget.is_otg = 1; diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index c5fdfcf99828..d725cff7268d 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -58,6 +58,7 @@ struct ci_hdrc_platform_data { #define CI_HDRC_OVERRIDE_TX_BURST BIT(10) #define CI_HDRC_OVERRIDE_RX_BURST BIT(11) #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */ +#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) enum usb_dr_modedr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 1/8] usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve
This quirk is required to make USB Ethernet gadget working with HW that can't cope with unaligned DMA. For some reason only f_ncm handles that quirk, let's handle it in the rest of the network models. All models have been tested with a ChipIdea UDC driver on NVIDIA Tegra20 SoC that require DMA to be aligned. Signed-off-by: Dmitry Osipenko--- drivers/usb/gadget/function/f_ecm.c | 7 +++ drivers/usb/gadget/function/f_eem.c | 5 + drivers/usb/gadget/function/f_rndis.c | 4 3 files changed, 16 insertions(+) diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c index 4c488d15b6f6..1d198055fd74 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -584,6 +584,13 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) */ ecm->port.is_zlp_ok = gadget_is_zlp_supported(cdev->gadget); + + /* Setup DMA alignment workaround for UDC's that +* need it. +*/ + ecm->port.no_skb_reserve = + gadget_avoids_skb_reserve(cdev->gadget); + ecm->port.cdc_filter = DEFAULT_FILTER; DBG(cdev, "activate ecm\n"); net = gether_connect(>port); diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 007ec6e4a5d4..74e2453d8ac5 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c @@ -215,6 +215,11 @@ static int eem_set_alt(struct usb_function *f, unsigned intf, unsigned alt) */ eem->port.is_zlp_ok = 1; eem->port.cdc_filter = DEFAULT_FILTER; + + /* setup DMA alignment workaround for UDC's that*need it */ + eem->port.no_skb_reserve = + gadget_avoids_skb_reserve(cdev->gadget); + DBG(cdev, "activate eem\n"); net = gether_connect(>port); if (IS_ERR(net)) diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index 16562e461121..1b379c051a84 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -593,6 +593,10 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt) */ rndis->port.cdc_filter = 0; + /* Setup DMA alignment workaround for UDC's that need it */ + rndis->port.no_skb_reserve = + gadget_avoids_skb_reserve(cdev->gadget); + DBG(cdev, "RNDIS RX/TX early activation ... \n"); net = gether_connect(>port); if (IS_ERR(net)) -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 3/8] usb: chipidea: Add support for Tegra20/30/114/124
From: Thierry RedingAll of these Tegra SoC generations have a ChipIdea UDC IP block that can be used for device mode communication with a host. Implement rudimentary support that doesn't allow switching between host and device modes. Tested-by: Michał Mirosław Signed-off-by: Thierry Reding [dig...@gmail.com: rebased patches and added DMA alignment quirk for Tegra20] Signed-off-by: Dmitry Osipenko Acked-by: Peter Chen --- drivers/usb/chipidea/Makefile| 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 155 +++ 2 files changed, 156 insertions(+) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile index 39fca5715ed3..ddcbddf8361a 100644 --- a/drivers/usb/chipidea/Makefile +++ b/drivers/usb/chipidea/Makefile @@ -15,3 +15,4 @@ obj-$(CONFIG_USB_CHIPIDEA)+= ci_hdrc_zevio.o obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o obj-$(CONFIG_USB_CHIPIDEA_OF) += usbmisc_imx.o ci_hdrc_imx.o +obj-$(CONFIG_USB_CHIPIDEA_OF) += ci_hdrc_tegra.o diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c new file mode 100644 index ..bfcee2702d50 --- /dev/null +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2016, NVIDIA Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include +#include +#include +#include + +#include + +#include "ci.h" + +struct tegra_udc { + struct ci_hdrc_platform_data data; + struct platform_device *dev; + + struct usb_phy *phy; + struct clk *clk; +}; + +struct tegra_udc_soc_info { + unsigned long flags; +}; + +static const struct tegra_udc_soc_info tegra20_udc_soc_info = { + .flags = CI_HDRC_REQUIRES_ALIGNED_DMA, +}; + +static const struct tegra_udc_soc_info tegra30_udc_soc_info = { + .flags = 0, +}; + +static const struct tegra_udc_soc_info tegra114_udc_soc_info = { + .flags = 0, +}; + +static const struct tegra_udc_soc_info tegra124_udc_soc_info = { + .flags = 0, +}; + +static const struct of_device_id tegra_udc_of_match[] = { + { + .compatible = "nvidia,tegra20-udc", + .data = _udc_soc_info, + }, { + .compatible = "nvidia,tegra30-udc", + .data = _udc_soc_info, + }, { + .compatible = "nvidia,tegra114-udc", + .data = _udc_soc_info, + }, { + .compatible = "nvidia,tegra124-udc", + .data = _udc_soc_info, + }, { + /* sentinel */ + } +}; +MODULE_DEVICE_TABLE(of, tegra_udc_of_match); + +static int tegra_udc_probe(struct platform_device *pdev) +{ + const struct tegra_udc_soc_info *soc; + struct tegra_udc *udc; + int err; + + udc = devm_kzalloc(>dev, sizeof(*udc), GFP_KERNEL); + if (!udc) + return -ENOMEM; + + soc = of_device_get_match_data(>dev); + if (!soc) { + dev_err(>dev, "failed to match OF data\n"); + return -EINVAL; + } + + udc->phy = devm_usb_get_phy_by_phandle(>dev, "nvidia,phy", 0); + if (IS_ERR(udc->phy)) { + err = PTR_ERR(udc->phy); + dev_err(>dev, "failed to get PHY: %d\n", err); + return err; + } + + udc->clk = devm_clk_get(>dev, NULL); + if (IS_ERR(udc->clk)) { + err = PTR_ERR(udc->clk); + dev_err(>dev, "failed to get clock: %d\n", err); + return err; + } + + err = clk_prepare_enable(udc->clk); + if (err < 0) { + dev_err(>dev, "failed to enable clock: %d\n", err); + return err; + } + + /* +* Tegra's USB PHY driver doesn't implement optional phy_init() +* hook, so we have to power on UDC controller before ChipIdea +* driver initialization kicks in. +*/ + usb_phy_set_suspend(udc->phy, 0); + + /* setup and register ChipIdea HDRC device */ + udc->data.name = "tegra-udc"; + udc->data.flags = soc->flags; + udc->data.usb_phy = udc->phy; + udc->data.capoffset = DEF_CAPOFFSET; + + udc->dev = ci_hdrc_add_device(>dev, pdev->resource, + pdev->num_resources, >data); + if (IS_ERR(udc->dev)) { + err = PTR_ERR(udc->dev); + dev_err(>dev, "failed to add HDRC device: %d\n", err); + goto fail_power_off; + } + + platform_set_drvdata(pdev, udc); + + return 0; + +fail_power_off: + usb_phy_set_suspend(udc->phy, 1); + clk_disable_unprepare(udc->clk); + return err; +} +
[PATCH v5 4/8] ARM: defconfig: tegra: Enable ChipIdea UDC driver
Since NVIDIA Tegra is supported now by the ChipIdea USB driver, let's enable this driver in tegra_defconfig. Signed-off-by: Dmitry Osipenko--- arch/arm/configs/tegra_defconfig | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig index fe1275aa067e..9c9c644ed9d7 100644 --- a/arch/arm/configs/tegra_defconfig +++ b/arch/arm/configs/tegra_defconfig @@ -121,7 +121,6 @@ CONFIG_TOUCHSCREEN_WM97XX=y CONFIG_TOUCHSCREEN_STMPE=y CONFIG_INPUT_MISC=y # CONFIG_LEGACY_PTYS is not set -# CONFIG_DEVKMEM is not set CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y @@ -220,6 +219,9 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_ACM=y CONFIG_USB_WDM=y CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=m +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_GADGET=m CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=16 CONFIG_MMC_SDHCI=y @@ -249,8 +251,6 @@ CONFIG_RTC_DRV_TEGRA=y CONFIG_DMADEVICES=y CONFIG_TEGRA20_APB_DMA=y CONFIG_STAGING=y -CONFIG_SENSORS_ISL29018=y -CONFIG_SENSORS_ISL29028=y CONFIG_MFD_NVEC=y CONFIG_KEYBOARD_NVEC=y CONFIG_SERIO_NVEC_PS2=y @@ -265,6 +265,8 @@ CONFIG_ARCH_TEGRA_124_SOC=y CONFIG_MEMORY=y CONFIG_IIO=y CONFIG_MPU3050_I2C=y +CONFIG_SENSORS_ISL29018=y +CONFIG_SENSORS_ISL29028=y CONFIG_AK8975=y CONFIG_PWM=y CONFIG_PWM_TEGRA=y @@ -290,13 +292,11 @@ CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_PRINTK_TIME=y CONFIG_DEBUG_INFO=y -CONFIG_DEBUG_FS=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_SLAB=y CONFIG_DEBUG_VM=y CONFIG_DETECT_HUNG_TASK=y CONFIG_SCHEDSTATS=y -CONFIG_TIMER_STATS=y # CONFIG_DEBUG_PREEMPT is not set CONFIG_DEBUG_MUTEXES=y CONFIG_DEBUG_SG=y -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 6/8] ARM: tegra: Enable UDC on Dalmore
From: Thierry RedingOverride the compatible string of the first USB controller to enable device mode. Signed-off-by: Thierry Reding --- arch/arm/boot/dts/tegra114-dalmore.dts | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index 1444fbd543e7..5af4dd321952 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts @@ -1122,6 +1122,16 @@ non-removable; }; + usb@7d00 { + compatible = "nvidia,tegra114-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d00 { + status = "okay"; + }; + usb@7d008000 { status = "okay"; }; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 8/8] ARM: tegra: Enable UDC on AC100
Override the compatible string of the first USB controller to enable device mode. Signed-off-by: Dmitry OsipenkoTested-by: Marc Dietrich Acked-by: Stephen Warren --- arch/arm/boot/dts/tegra20-paz00.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts index b4bfa5586c23..bfa9421fcf94 100644 --- a/arch/arm/boot/dts/tegra20-paz00.dts +++ b/arch/arm/boot/dts/tegra20-paz00.dts @@ -452,7 +452,9 @@ }; usb@c500 { + compatible = "nvidia,tegra20-udc"; status = "okay"; + dr_mode = "peripheral"; }; usb-phy@c500 { -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 5/8] ARM: tegra: Enable UDC on Beaver
From: Thierry RedingOverride the compatible string of the first USB controller to enable device mode. Signed-off-by: Thierry Reding Acked-by: Stephen Warren --- arch/arm/boot/dts/tegra30-beaver.dts | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts index 4f41b18d9547..3e104ddeb220 100644 --- a/arch/arm/boot/dts/tegra30-beaver.dts +++ b/arch/arm/boot/dts/tegra30-beaver.dts @@ -1927,6 +1927,16 @@ non-removable; }; + usb@7d00 { + compatible = "nvidia,tegra30-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d00 { + status = "okay"; + }; + usb@7d004000 { status = "okay"; }; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 7/8] ARM: tegra: Enable UDC on Jetson TK1
From: Thierry RedingOverride the compatible string of the first USB controller to enable device mode. Signed-off-by: Thierry Reding Tested-by: Nicolas Chauvet Acked-by: Stephen Warren --- arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts index 7bacb2954f58..61873d642a45 100644 --- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts +++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts @@ -1722,7 +1722,7 @@ lanes { usb2-0 { - nvidia,function = "xusb"; + nvidia,function = "snps"; status = "okay"; }; @@ -1829,6 +1829,16 @@ }; }; + usb@7d00 { + compatible = "nvidia,tegra124-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d00 { + status = "okay"; + }; + /* mini-PCIe USB */ usb@7d004000 { status = "okay"; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 0/8] Support UDC on Tegra 20/30/114/124
Some time ago Thierry Reding sent out patches that enabled UDC on NVIDIA Tegra, unfortunately they haven't got enough traction to get into the kernel. I've rebased those patches and added a fix for the Ethernet USB Gadget on Tegra20, Marc Dietrich tested UDC driver on AC100 (Tegra20), Nicolas Chauvet on TK1 (Tegra124) and Michał Mirosław on TF300T (Tegra30). Like an original patchset, this series adds support for the peripheral mode only. Changelog: V5: 1) Move of_device_get_match_data() above clock enabling to not leave clock enabled in case of error. The SoC data matching function shouldn't ever fail, but let's assume that it could for consistency. V4: 1) Use of_device_get_match_data() instead of of_match_node() to cleanup code a tad. V3: 1) Specified platform flags directly in the SoC info as per Michał's suggestion. V2: 1) Added comments to each of patched USB Ethernet gadget models. 2) Added explanatory comment about why usb_phy_set_suspend() invocation is necessary in tegra_udc_probe(). 3) Dropped TrimSlice from patchset because it turned out that it uses USB1 controller for USB-to-SATA. 4) Moved tegra_defconfig patch before DT patches as per Stephen's suggestion. 5) Changed dr_mode to "peripheral" in DT patches since we don't support role mode switching for now. Dmitry Osipenko (4): usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve usb: chipidea: udc: Support SKB alignment quirk ARM: defconfig: tegra: Enable ChipIdea UDC driver ARM: tegra: Enable UDC on AC100 Thierry Reding (4): usb: chipidea: Add support for Tegra20/30/114/124 ARM: tegra: Enable UDC on Beaver ARM: tegra: Enable UDC on Dalmore ARM: tegra: Enable UDC on Jetson TK1 arch/arm/boot/dts/tegra114-dalmore.dts| 10 ++ arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 ++- arch/arm/boot/dts/tegra20-paz00.dts | 2 + arch/arm/boot/dts/tegra30-beaver.dts | 10 ++ arch/arm/configs/tegra_defconfig | 10 +- drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 155 ++ drivers/usb/chipidea/udc.c| 3 + drivers/usb/gadget/function/f_ecm.c | 7 ++ drivers/usb/gadget/function/f_eem.c | 5 + drivers/usb/gadget/function/f_rndis.c | 4 + include/linux/usb/chipidea.h | 1 + 12 files changed, 214 insertions(+), 6 deletions(-) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG/PATCH: cp210x.c - reenable support for chips which don't report a partnum
Make cp210x not abort if part number could not be read from device. Signed-off-by: Sebastian Frei--- diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index f64e914a8985..d6afa823d6f0 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -1487,13 +1487,17 @@ static int cp210x_attach(struct usb_serial *serial) if (!priv) return -ENOMEM; + usb_set_serial_data(serial, priv); + result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, CP210X_GET_PARTNUM, >partnum, sizeof(priv->partnum)); - if (result < 0) - goto err_free_priv; - usb_set_serial_data(serial, priv); + if (result < 0) { + dev_err(>interface->dev, + "querying part number failed, continuing without GPIO support\n"); + return 0; + } if (priv->partnum == CP210X_PARTNUM_CP2105) { result = cp2105_shared_gpio_init(serial); @@ -1504,10 +1508,6 @@ static int cp210x_attach(struct usb_serial *serial) } return 0; -err_free_priv: - kfree(priv); - - return result; } static void cp210x_disconnect(struct usb_serial *serial) -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 3/8] usb: chipidea: Add support for Tegra20/30/114/124
On 09.08.2017 14:49, Dmitry Osipenko wrote: > From: Thierry Reding> > All of these Tegra SoC generations have a ChipIdea UDC IP block that can > be used for device mode communication with a host. Implement rudimentary > support that doesn't allow switching between host and device modes. > > Tested-by: Michał Mirosław > Signed-off-by: Thierry Reding > [dig...@gmail.com: rebased patches and added DMA alignment quirk for Tegra20] > Signed-off-by: Dmitry Osipenko > Acked-by: Peter Chen > --- > drivers/usb/chipidea/Makefile| 1 + > drivers/usb/chipidea/ci_hdrc_tegra.c | 155 > +++ > 2 files changed, 156 insertions(+) > create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c > > diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile > index 39fca5715ed3..ddcbddf8361a 100644 > --- a/drivers/usb/chipidea/Makefile > +++ b/drivers/usb/chipidea/Makefile > @@ -15,3 +15,4 @@ obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_zevio.o > obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o > > obj-$(CONFIG_USB_CHIPIDEA_OF)+= usbmisc_imx.o ci_hdrc_imx.o > +obj-$(CONFIG_USB_CHIPIDEA_OF)+= ci_hdrc_tegra.o > diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c > b/drivers/usb/chipidea/ci_hdrc_tegra.c > new file mode 100644 > index ..fc55743bd768 > --- /dev/null > +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c > @@ -0,0 +1,155 @@ > +/* > + * Copyright (c) 2016, NVIDIA Corporation > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms and conditions of the GNU General Public License, > + * version 2, as published by the Free Software Foundation. > + */ > + > +#include > +#include > +#include > +#include > + > +#include > + > +#include "ci.h" > + > +struct tegra_udc { > + struct ci_hdrc_platform_data data; > + struct platform_device *dev; > + > + struct usb_phy *phy; > + struct clk *clk; > +}; > + > +struct tegra_udc_soc_info { > + unsigned long flags; > +}; > + > +static const struct tegra_udc_soc_info tegra20_udc_soc_info = { > + .flags = CI_HDRC_REQUIRES_ALIGNED_DMA, > +}; > + > +static const struct tegra_udc_soc_info tegra30_udc_soc_info = { > + .flags = 0, > +}; > + > +static const struct tegra_udc_soc_info tegra114_udc_soc_info = { > + .flags = 0, > +}; > + > +static const struct tegra_udc_soc_info tegra124_udc_soc_info = { > + .flags = 0, > +}; > + > +static const struct of_device_id tegra_udc_of_match[] = { > + { > + .compatible = "nvidia,tegra20-udc", > + .data = _udc_soc_info, > + }, { > + .compatible = "nvidia,tegra30-udc", > + .data = _udc_soc_info, > + }, { > + .compatible = "nvidia,tegra114-udc", > + .data = _udc_soc_info, > + }, { > + .compatible = "nvidia,tegra124-udc", > + .data = _udc_soc_info, > + }, { > + /* sentinel */ > + } > +}; > +MODULE_DEVICE_TABLE(of, tegra_udc_of_match); > + > +static int tegra_udc_probe(struct platform_device *pdev) > +{ > + const struct tegra_udc_soc_info *soc; > + struct tegra_udc *udc; > + int err; > + > + udc = devm_kzalloc(>dev, sizeof(*udc), GFP_KERNEL); > + if (!udc) > + return -ENOMEM; > + > + udc->phy = devm_usb_get_phy_by_phandle(>dev, "nvidia,phy", 0); > + if (IS_ERR(udc->phy)) { > + err = PTR_ERR(udc->phy); > + dev_err(>dev, "failed to get PHY: %d\n", err); > + return err; > + } > + > + udc->clk = devm_clk_get(>dev, NULL); > + if (IS_ERR(udc->clk)) { > + err = PTR_ERR(udc->clk); > + dev_err(>dev, "failed to get clock: %d\n", err); > + return err; > + } > + > + err = clk_prepare_enable(udc->clk); > + if (err < 0) { > + dev_err(>dev, "failed to enable clock: %d\n", err); > + return err; > + } > + > + soc = of_device_get_match_data(>dev); > + if (!soc) { > + dev_err(>dev, "failed to match OF data\n"); > + return -EINVAL; > + } Oh, I made a mistake here. The code above should be before clock enabling. I'll send V5 shortly. > + > + /* > + * Tegra's USB PHY driver doesn't implement optional phy_init() > + * hook, so we have to power on UDC controller before ChipIdea > + * driver initialization kicks in. > + */ > + usb_phy_set_suspend(udc->phy, 0); > + > + /* setup and register ChipIdea HDRC device */ > + udc->data.name = "tegra-udc"; > + udc->data.flags = soc->flags; > + udc->data.usb_phy = udc->phy; > + udc->data.capoffset = DEF_CAPOFFSET; > + > + udc->dev = ci_hdrc_add_device(>dev, pdev->resource, > + pdev->num_resources, >data); > + if (IS_ERR(udc->dev)) { > + err =
[PATCH v4 1/8] usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve
This quirk is required to make USB Ethernet gadget working with HW that can't cope with unaligned DMA. For some reason only f_ncm handles that quirk, let's handle it in the rest of the network models. All models have been tested with a ChipIdea UDC driver on NVIDIA Tegra20 SoC that require DMA to be aligned. Signed-off-by: Dmitry Osipenko--- drivers/usb/gadget/function/f_ecm.c | 7 +++ drivers/usb/gadget/function/f_eem.c | 5 + drivers/usb/gadget/function/f_rndis.c | 4 3 files changed, 16 insertions(+) diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c index 4c488d15b6f6..1d198055fd74 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -584,6 +584,13 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) */ ecm->port.is_zlp_ok = gadget_is_zlp_supported(cdev->gadget); + + /* Setup DMA alignment workaround for UDC's that +* need it. +*/ + ecm->port.no_skb_reserve = + gadget_avoids_skb_reserve(cdev->gadget); + ecm->port.cdc_filter = DEFAULT_FILTER; DBG(cdev, "activate ecm\n"); net = gether_connect(>port); diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 007ec6e4a5d4..74e2453d8ac5 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c @@ -215,6 +215,11 @@ static int eem_set_alt(struct usb_function *f, unsigned intf, unsigned alt) */ eem->port.is_zlp_ok = 1; eem->port.cdc_filter = DEFAULT_FILTER; + + /* setup DMA alignment workaround for UDC's that*need it */ + eem->port.no_skb_reserve = + gadget_avoids_skb_reserve(cdev->gadget); + DBG(cdev, "activate eem\n"); net = gether_connect(>port); if (IS_ERR(net)) diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index 16562e461121..1b379c051a84 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -593,6 +593,10 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt) */ rndis->port.cdc_filter = 0; + /* Setup DMA alignment workaround for UDC's that need it */ + rndis->port.no_skb_reserve = + gadget_avoids_skb_reserve(cdev->gadget); + DBG(cdev, "RNDIS RX/TX early activation ... \n"); net = gether_connect(>port); if (IS_ERR(net)) -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 8/8] ARM: tegra: Enable UDC on AC100
Override the compatible string of the first USB controller to enable device mode. Signed-off-by: Dmitry OsipenkoTested-by: Marc Dietrich Acked-by: Stephen Warren --- arch/arm/boot/dts/tegra20-paz00.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts index b4bfa5586c23..bfa9421fcf94 100644 --- a/arch/arm/boot/dts/tegra20-paz00.dts +++ b/arch/arm/boot/dts/tegra20-paz00.dts @@ -452,7 +452,9 @@ }; usb@c500 { + compatible = "nvidia,tegra20-udc"; status = "okay"; + dr_mode = "peripheral"; }; usb-phy@c500 { -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 5/8] ARM: tegra: Enable UDC on Beaver
From: Thierry RedingOverride the compatible string of the first USB controller to enable device mode. Signed-off-by: Thierry Reding Acked-by: Stephen Warren --- arch/arm/boot/dts/tegra30-beaver.dts | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts index 4f41b18d9547..3e104ddeb220 100644 --- a/arch/arm/boot/dts/tegra30-beaver.dts +++ b/arch/arm/boot/dts/tegra30-beaver.dts @@ -1927,6 +1927,16 @@ non-removable; }; + usb@7d00 { + compatible = "nvidia,tegra30-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d00 { + status = "okay"; + }; + usb@7d004000 { status = "okay"; }; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 4/8] ARM: defconfig: tegra: Enable ChipIdea UDC driver
Since NVIDIA Tegra is supported now by the ChipIdea USB driver, let's enable this driver in tegra_defconfig. Signed-off-by: Dmitry Osipenko--- arch/arm/configs/tegra_defconfig | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig index fe1275aa067e..9c9c644ed9d7 100644 --- a/arch/arm/configs/tegra_defconfig +++ b/arch/arm/configs/tegra_defconfig @@ -121,7 +121,6 @@ CONFIG_TOUCHSCREEN_WM97XX=y CONFIG_TOUCHSCREEN_STMPE=y CONFIG_INPUT_MISC=y # CONFIG_LEGACY_PTYS is not set -# CONFIG_DEVKMEM is not set CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y @@ -220,6 +219,9 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_ACM=y CONFIG_USB_WDM=y CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=m +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_GADGET=m CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=16 CONFIG_MMC_SDHCI=y @@ -249,8 +251,6 @@ CONFIG_RTC_DRV_TEGRA=y CONFIG_DMADEVICES=y CONFIG_TEGRA20_APB_DMA=y CONFIG_STAGING=y -CONFIG_SENSORS_ISL29018=y -CONFIG_SENSORS_ISL29028=y CONFIG_MFD_NVEC=y CONFIG_KEYBOARD_NVEC=y CONFIG_SERIO_NVEC_PS2=y @@ -265,6 +265,8 @@ CONFIG_ARCH_TEGRA_124_SOC=y CONFIG_MEMORY=y CONFIG_IIO=y CONFIG_MPU3050_I2C=y +CONFIG_SENSORS_ISL29018=y +CONFIG_SENSORS_ISL29028=y CONFIG_AK8975=y CONFIG_PWM=y CONFIG_PWM_TEGRA=y @@ -290,13 +292,11 @@ CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_PRINTK_TIME=y CONFIG_DEBUG_INFO=y -CONFIG_DEBUG_FS=y CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_SLAB=y CONFIG_DEBUG_VM=y CONFIG_DETECT_HUNG_TASK=y CONFIG_SCHEDSTATS=y -CONFIG_TIMER_STATS=y # CONFIG_DEBUG_PREEMPT is not set CONFIG_DEBUG_MUTEXES=y CONFIG_DEBUG_SG=y -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 6/8] ARM: tegra: Enable UDC on Dalmore
From: Thierry RedingOverride the compatible string of the first USB controller to enable device mode. Signed-off-by: Thierry Reding --- arch/arm/boot/dts/tegra114-dalmore.dts | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index 1444fbd543e7..5af4dd321952 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts @@ -1122,6 +1122,16 @@ non-removable; }; + usb@7d00 { + compatible = "nvidia,tegra114-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d00 { + status = "okay"; + }; + usb@7d008000 { status = "okay"; }; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 7/8] ARM: tegra: Enable UDC on Jetson TK1
From: Thierry RedingOverride the compatible string of the first USB controller to enable device mode. Signed-off-by: Thierry Reding Tested-by: Nicolas Chauvet Acked-by: Stephen Warren --- arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts index 7bacb2954f58..61873d642a45 100644 --- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts +++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts @@ -1722,7 +1722,7 @@ lanes { usb2-0 { - nvidia,function = "xusb"; + nvidia,function = "snps"; status = "okay"; }; @@ -1829,6 +1829,16 @@ }; }; + usb@7d00 { + compatible = "nvidia,tegra124-udc"; + status = "okay"; + dr_mode = "peripheral"; + }; + + usb-phy@7d00 { + status = "okay"; + }; + /* mini-PCIe USB */ usb@7d004000 { status = "okay"; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/8] usb: chipidea: Add support for Tegra20/30/114/124
From: Thierry RedingAll of these Tegra SoC generations have a ChipIdea UDC IP block that can be used for device mode communication with a host. Implement rudimentary support that doesn't allow switching between host and device modes. Tested-by: Michał Mirosław Signed-off-by: Thierry Reding [dig...@gmail.com: rebased patches and added DMA alignment quirk for Tegra20] Signed-off-by: Dmitry Osipenko Acked-by: Peter Chen --- drivers/usb/chipidea/Makefile| 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 155 +++ 2 files changed, 156 insertions(+) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile index 39fca5715ed3..ddcbddf8361a 100644 --- a/drivers/usb/chipidea/Makefile +++ b/drivers/usb/chipidea/Makefile @@ -15,3 +15,4 @@ obj-$(CONFIG_USB_CHIPIDEA)+= ci_hdrc_zevio.o obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o obj-$(CONFIG_USB_CHIPIDEA_OF) += usbmisc_imx.o ci_hdrc_imx.o +obj-$(CONFIG_USB_CHIPIDEA_OF) += ci_hdrc_tegra.o diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c new file mode 100644 index ..fc55743bd768 --- /dev/null +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2016, NVIDIA Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include +#include +#include +#include + +#include + +#include "ci.h" + +struct tegra_udc { + struct ci_hdrc_platform_data data; + struct platform_device *dev; + + struct usb_phy *phy; + struct clk *clk; +}; + +struct tegra_udc_soc_info { + unsigned long flags; +}; + +static const struct tegra_udc_soc_info tegra20_udc_soc_info = { + .flags = CI_HDRC_REQUIRES_ALIGNED_DMA, +}; + +static const struct tegra_udc_soc_info tegra30_udc_soc_info = { + .flags = 0, +}; + +static const struct tegra_udc_soc_info tegra114_udc_soc_info = { + .flags = 0, +}; + +static const struct tegra_udc_soc_info tegra124_udc_soc_info = { + .flags = 0, +}; + +static const struct of_device_id tegra_udc_of_match[] = { + { + .compatible = "nvidia,tegra20-udc", + .data = _udc_soc_info, + }, { + .compatible = "nvidia,tegra30-udc", + .data = _udc_soc_info, + }, { + .compatible = "nvidia,tegra114-udc", + .data = _udc_soc_info, + }, { + .compatible = "nvidia,tegra124-udc", + .data = _udc_soc_info, + }, { + /* sentinel */ + } +}; +MODULE_DEVICE_TABLE(of, tegra_udc_of_match); + +static int tegra_udc_probe(struct platform_device *pdev) +{ + const struct tegra_udc_soc_info *soc; + struct tegra_udc *udc; + int err; + + udc = devm_kzalloc(>dev, sizeof(*udc), GFP_KERNEL); + if (!udc) + return -ENOMEM; + + udc->phy = devm_usb_get_phy_by_phandle(>dev, "nvidia,phy", 0); + if (IS_ERR(udc->phy)) { + err = PTR_ERR(udc->phy); + dev_err(>dev, "failed to get PHY: %d\n", err); + return err; + } + + udc->clk = devm_clk_get(>dev, NULL); + if (IS_ERR(udc->clk)) { + err = PTR_ERR(udc->clk); + dev_err(>dev, "failed to get clock: %d\n", err); + return err; + } + + err = clk_prepare_enable(udc->clk); + if (err < 0) { + dev_err(>dev, "failed to enable clock: %d\n", err); + return err; + } + + soc = of_device_get_match_data(>dev); + if (!soc) { + dev_err(>dev, "failed to match OF data\n"); + return -EINVAL; + } + + /* +* Tegra's USB PHY driver doesn't implement optional phy_init() +* hook, so we have to power on UDC controller before ChipIdea +* driver initialization kicks in. +*/ + usb_phy_set_suspend(udc->phy, 0); + + /* setup and register ChipIdea HDRC device */ + udc->data.name = "tegra-udc"; + udc->data.flags = soc->flags; + udc->data.usb_phy = udc->phy; + udc->data.capoffset = DEF_CAPOFFSET; + + udc->dev = ci_hdrc_add_device(>dev, pdev->resource, + pdev->num_resources, >data); + if (IS_ERR(udc->dev)) { + err = PTR_ERR(udc->dev); + dev_err(>dev, "failed to add HDRC device: %d\n", err); + goto power_off; + } + + platform_set_drvdata(pdev, udc); + + return 0; + +power_off: + usb_phy_set_suspend(udc->phy, 1); + clk_disable_unprepare(udc->clk); + return err; +} + +static int
[PATCH v4 2/8] usb: chipidea: udc: Support SKB alignment quirk
NVIDIA Tegra20 UDC can't cope with unaligned DMA and require a USB gadget quirk that avoids SKB buffer alignment to be set in order to make Ethernet Gadget working. Later Tegra generations do not require that quirk. Let's add a new platform data flag that allows to enable USB gadget quirk for platforms that require it. Signed-off-by: Dmitry OsipenkoAcked-by: Peter Chen --- drivers/usb/chipidea/udc.c | 3 +++ include/linux/usb/chipidea.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 6502c13331e8..fe8a90543ea3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1896,6 +1896,9 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.name = ci->platdata->name; ci->gadget.otg_caps = otg_caps; + if (ci->platdata->flags & CI_HDRC_REQUIRES_ALIGNED_DMA) + ci->gadget.quirk_avoids_skb_reserve = 1; + if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support || otg_caps->adp_support)) ci->gadget.is_otg = 1; diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index c5fdfcf99828..d725cff7268d 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -58,6 +58,7 @@ struct ci_hdrc_platform_data { #define CI_HDRC_OVERRIDE_TX_BURST BIT(10) #define CI_HDRC_OVERRIDE_RX_BURST BIT(11) #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */ +#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) enum usb_dr_modedr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 0/8] Support UDC on Tegra 20/30/114/124
Some time ago Thierry Reding sent out patches that enabled UDC on NVIDIA Tegra, unfortunately they haven't got enough traction to get into the kernel. I've rebased those patches and added a fix for the Ethernet USB Gadget on Tegra20, Marc Dietrich tested UDC driver on AC100 (Tegra20), Nicolas Chauvet on TK1 (Tegra124) and Michał Mirosław on TF300T (Tegra30). Like an original patchset, this series adds support for the peripheral mode only. Changelog: V4: 1) Use of_device_get_match_data() instead of of_match_node() to cleanup code a tad. V3: 1) Specified platform flags directly in the SoC info as per Michał's suggestion. V2: 1) Added comments to each of patched USB Ethernet gadget models. 2) Added explanatory comment about why usb_phy_set_suspend() invocation is necessary in tegra_udc_probe(). 3) Dropped TrimSlice from patchset because it turned out that it uses USB1 controller for USB-to-SATA. 4) Moved tegra_defconfig patch before DT patches as per Stephen's suggestion. 5) Changed dr_mode to "peripheral" in DT patches since we don't support role mode switching for now. Dmitry Osipenko (4): usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve usb: chipidea: udc: Support SKB alignment quirk ARM: defconfig: tegra: Enable ChipIdea UDC driver ARM: tegra: Enable UDC on AC100 Thierry Reding (4): usb: chipidea: Add support for Tegra20/30/114/124 ARM: tegra: Enable UDC on Beaver ARM: tegra: Enable UDC on Dalmore ARM: tegra: Enable UDC on Jetson TK1 arch/arm/boot/dts/tegra114-dalmore.dts| 10 ++ arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 ++- arch/arm/boot/dts/tegra20-paz00.dts | 2 + arch/arm/boot/dts/tegra30-beaver.dts | 10 ++ arch/arm/configs/tegra_defconfig | 10 +- drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_tegra.c | 155 ++ drivers/usb/chipidea/udc.c| 3 + drivers/usb/gadget/function/f_ecm.c | 7 ++ drivers/usb/gadget/function/f_eem.c | 5 + drivers/usb/gadget/function/f_rndis.c | 4 + include/linux/usb/chipidea.h | 1 + 12 files changed, 214 insertions(+), 6 deletions(-) create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] usb: gadget: udc: renesas_usb3: fix error return code in renesas_usb3_probe()
Hi Gustavo, Thank you for the patch! > -Original Message- > From: Gustavo A. R. Silva > Sent: Wednesday, August 9, 2017 7:35 AM > > platform_get_irq() returns an error code, but the renesas_usb3 driver > ignores it and always returns -ENODEV. This is not correct and, > prevents -EPROBE_DEFER from being propagated properly. Thank you for the point. I got it. > Also, notice that platform_get_irq() no longer returns 0 on error: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92 > af I don't think this explanation needs. After this is removed, Acked-by: Yoshihiro ShimodaBest regards, Yoshihiro Shimoda > Print error message and propagate the return value of platform_get_irq > on failure. > > This issue was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/usb/gadget/udc/renesas_usb3.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/udc/renesas_usb3.c > b/drivers/usb/gadget/udc/renesas_usb3.c > index e1de8fe..616d053 100644 > --- a/drivers/usb/gadget/udc/renesas_usb3.c > +++ b/drivers/usb/gadget/udc/renesas_usb3.c > @@ -2468,8 +2468,10 @@ static int renesas_usb3_probe(struct platform_device > *pdev) > priv = match->data; > > irq = platform_get_irq(pdev, 0); > - if (irq < 0) > - return -ENODEV; > + if (irq < 0) { > + dev_err(>dev, "Failed to get IRQ: %d\n", irq); > + return irq; > + } > > usb3 = devm_kzalloc(>dev, sizeof(*usb3), GFP_KERNEL); > if (!usb3) > -- > 2.5.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 -- To unsubscribe from this list: send the line "unsubscribe 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] usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume
Hi, Sandeep Singhwrites: > On 8/4/2017 4:44 PM, Felipe Balbi wrote: >> >> Hi, >> >> Sandeep Singh writes: >>> From: Sandeep Singh >>> >>> Certain HP keyboards would keep inputting a character automatically which >>> is the wake-up key after S3 resume >>> >>> On some AMD platforms USB host fails to respond (by holding resume-K) to >>> USB device (an HP keyboard) resume request within 1ms (TURSM) and ensures >>> that resume is signaled for at least 20 ms (TDRSMDN), which is defined in >>> USB 2.0 spec. The result is that the keyboard is out of function. >>> >>> In SNPS USB design, the host responds to the resume request only after >>> system gets back to S0 and the host gets to functional after the internal >>> HW restore operation that is more than 1 second after the initial resume >>> request from the USB device. >>> >>> As a workaround for specific keyboard ID(HP Keyboards), applying port reset >>> after resume when the keyboard is plugged in. >>> >>> Signed-off-by: Sandeep Singh >>> Signed-off-by: Shyam Sundar S K >>> cc: Nehal Shah >> >> seems correct now: >> >> Reviewed-by: Felipe Balbi >> > > Greg, Any feedback on this patch.? Mathias is the xHCI maintainer. He just came back from vacations, give him some time ;-) -- balbi signature.asc Description: PGP signature
Re: [PATCH v3] usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume
On 8/4/2017 4:44 PM, Felipe Balbi wrote: > > Hi, > > Sandeep Singhwrites: >> From: Sandeep Singh >> >> Certain HP keyboards would keep inputting a character automatically which >> is the wake-up key after S3 resume >> >> On some AMD platforms USB host fails to respond (by holding resume-K) to >> USB device (an HP keyboard) resume request within 1ms (TURSM) and ensures >> that resume is signaled for at least 20 ms (TDRSMDN), which is defined in >> USB 2.0 spec. The result is that the keyboard is out of function. >> >> In SNPS USB design, the host responds to the resume request only after >> system gets back to S0 and the host gets to functional after the internal >> HW restore operation that is more than 1 second after the initial resume >> request from the USB device. >> >> As a workaround for specific keyboard ID(HP Keyboards), applying port reset >> after resume when the keyboard is plugged in. >> >> Signed-off-by: Sandeep Singh >> Signed-off-by: Shyam Sundar S K >> cc: Nehal Shah > > seems correct now: > > Reviewed-by: Felipe Balbi > Greg, Any feedback on this patch.? -- To unsubscribe from this list: send the line "unsubscribe 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: renesas_usbhs: gadget: fix spin_lock_init() for >lock
This patch fixes an issue that the spin_lock_init() is not called for almost all pipes. Otherwise, the lockdep output the following message when we connect a usb cable using g_ncm: INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. Reported-by: Kazuya MizuguchiFixes: b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops") Signed-off-by: Yoshihiro Shimoda Tested-by: Kazuya Mizuguchi --- I'm sorry again and again. This patch is based on the latest Felipe's usb.git / testing/fixes branch (the commit id = b7d44c36a6f6d). Or, should I revert related patches first? b7d44c36a6f6 ("usb: renesas_usbhs: gadget: fix unused-but-set-variable warning") b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops") drivers/usb/renesas_usbhs/mod_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2c8161b..5984fb1 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -1082,7 +1082,6 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) ret = -ENOMEM; goto usbhs_mod_gadget_probe_err_gpriv; } - spin_lock_init(>lock); gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED); dev_info(dev, "%stransceiver found\n", @@ -1132,6 +1131,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) uep->ep.name= uep->ep_name; uep->ep.ops = _ep_ops; INIT_LIST_HEAD(>ep.ep_list); + spin_lock_init(>lock); /* init DCP */ if (usbhsg_is_dcp(uep)) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/5] usb: xhci: Fix potential memory leak in xhci_disable_slot()
On 27.07.2017 05:21, Lu Baolu wrote: xhci_disable_slot() allows the invoker to pass a command pointer as paramenter. Otherwise, it will allocate one. This will cause memory leak when a command structure was allocated inside of this function while queuing command trb fails. Another problem comes up when the invoker passed a command pointer, but xhci_disable_slot() frees it when it detects a dead host. This patch fixes these two problems by removing the command parameter from xhci_disable_slot(). Fixes: f9e609b82479 ("usb: xhci: Add helper function xhci_disable_slot().") Cc: Guoqing ZhangSigned-off-by: Lu Baolu --- drivers/usb/host/xhci-hub.c | 2 +- drivers/usb/host/xhci.c | 30 +- drivers/usb/host/xhci.h | 3 +-- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 00721e8..c862d53 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -612,7 +612,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, xhci_dbg(xhci, "Disable all slots\n"); spin_unlock_irqrestore(>lock, *flags); for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { - retval = xhci_disable_slot(xhci, NULL, i); + retval = xhci_disable_slot(xhci, i); if (retval) xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", i, retval); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e69073f..cb2461a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3519,11 +3519,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) struct xhci_virt_device *virt_dev; struct xhci_slot_ctx *slot_ctx; int i, ret; - struct xhci_command *command; - - command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); - if (!command) - return; #ifndef CONFIG_USB_DEFAULT_PERSIST /* @@ -3539,10 +3534,8 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) /* If the host is halted due to driver unload, we still need to free the * device. */ - if (ret <= 0 && ret != -ENODEV) { - kfree(command); + if (ret <= 0 && ret != -ENODEV) return; - } virt_dev = xhci->devs[udev->slot_id]; slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx); @@ -3554,22 +3547,21 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) del_timer_sync(_dev->eps[i].stop_cmd_timer); } - xhci_disable_slot(xhci, command, udev->slot_id); + xhci_disable_slot(xhci, udev->slot_id); /* * Event command completion handler will free any data structures * associated with the slot. XXX Can free sleep? */ } -int xhci_disable_slot(struct xhci_hcd *xhci, struct xhci_command *command, - u32 slot_id) +int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) { + struct xhci_command *command; unsigned long flags; u32 state; int ret = 0; - if (!command) - command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); + command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); if (!command) return -ENOMEM; @@ -3588,7 +3580,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, struct xhci_command *command, slot_id); if (ret) { spin_unlock_irqrestore(>lock, flags); - xhci_dbg(xhci, "FIXME: allocate a command ring segment\n"); + kfree(command); return ret; } xhci_ring_cmd_db(xhci); @@ -3663,6 +3655,8 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) return 0; } + xhci_free_command(xhci, command); + if ((xhci->quirks & XHCI_EP_LIMIT_QUIRK)) { spin_lock_irqsave(>lock, flags); ret = xhci_reserve_host_control_ep_resources(xhci); @@ -3698,18 +3692,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) pm_runtime_get_noresume(hcd->self.controller); #endif - - xhci_free_command(xhci, command); /* Is this a LS or FS device under a HS hub? */ /* Hub or peripherial? */ return 1; disable_slot: - /* Disable slot, if we can do it without mem alloc */ - kfree(command->completion); - command->completion = NULL; - command->status = 0; - return xhci_disable_slot(xhci, command, udev->slot_id); + return xhci_disable_slot(xhci, udev->slot_id); avoiding allocating a new command after failing to allocate a virt dev was probably the reason why xhci_disable_slot()
Re: f_hid.c conversion to the new function interface and crash due to race
Hi, noman pouigtwrites: > Hello, > > I am currently using 3.18 linux kernel and getting below return -EKERNELTOOOLD; Sorry, you're on your own. You should ask for support from whoever forces you to use 3.18 kernel. -- balbi signature.asc Description: PGP signature
[PATCH] USB: atm: make atmdev_ops const
Make these const as they are only passed to the function atm_dev_register and the corresponding argument is of type const. Done using Coccinelle. Signed-off-by: Bhumika Goyal--- drivers/usb/atm/usbatm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 75a5ff2..8607af7 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -173,7 +173,7 @@ struct usbatm_control { static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb); static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t *pos, char *page); -static struct atmdev_ops usbatm_atm_devops = { +static const struct atmdev_ops usbatm_atm_devops = { .dev_close = usbatm_atm_dev_close, .open = usbatm_atm_open, .close = usbatm_atm_close, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
f_hid.c conversion to the new function interface and crash due to race
Hello, I am currently using 3.18 linux kernel and getting below spinlock crashe in f_hid.c driver (https://goo.gl/3mdAr1). Crash is happening due to race condition between hidg_unbind and f_hidg_poll function. This is still a problem with latest kernel though as cdev_del(>cdev) is racing with f_hidg_poll function. [ 2300.676626] BUG: spinlock bad magic on CPU#0, firmware_update/2403 [ 2300.682787] Unable to handle kernel paging request at virtual address 6b6b6f03 [ 2300.689975] pgd = e8dec000 [ 2300.692663] [6b6b6f03] *pgd= [ 2300.696240] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 2300.701521] Modules linked in: [ 2300.704583] CPU: 0 PID: 2403 Comm: firmware_update Tainted: G W 3.18.31 #1 [ 2300.712466] task: e9d94140 ti: e97b6000 task.ti: e97b6000 [ 2300.717869] PC is at spin_bug+0x64/0xb0 [ 2300.721667] LR is at spin_bug+0x58/0xb0 [ 2300.725495] pc : []lr : []psr: 200f0093 [ 2300.725495] sp : e97b7ae0 ip : c130d400 fp : [ 2300.736938] r10: 0008 r9 : r8 : 0100 [ 2300.742151] r7 : e97b7bb4 r6 : c0e5e797 r5 : ea145e64 r4 : 6b6b6b6b [ 2300.748661] r3 : 6b6b6feb r2 : 6b6b6b6b r1 : e97b6000 r0 : 0036 [ 2300.755181] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user [ 2300.762380] Control: 10c5387d Table: a8dec06a DAC: 0015 [ 2300.768104] Process firmware_update (pid: 2403, stack limit = 0xe97b6238) [ 2300.774876] Stack: (0xe97b7ae0 to 0xe97b8000) [ 2300.779245] 7ae0: 0963 c0e5e797 ea145e64 ea145e64 e97b7bd8 c0064010 800f0013 ea145e64 [ 2300.787400] 7b00: e97b7bd8 e97b7bb4 0100 0008 c0aacc14 0006 [ 2300.795558] 7b20: ea145e64 c005d414 e97b7bd8 c0136c7c 0002 [ 2300.803718] 7b40: 0002 0002 e97b7e38 c0137360 c0012000 [ 2300.811876] 7b60: 0050 e97b7e60 e97b7e64 e97b7e68 00f0 [ 2300.820038] 7b80: e97b7e54 e97b7e58 e97b7e5c 0020 00f0 [ 2300.828199] 7ba0: ea391880 ea391880 6472 001b2b28 001adf64 00db [ 2300.836357] 7bc0: e9d94140 0006 e9de 00db e97b7bb4 [ 2300.844520] 7be0: c013695c ea145e74 ea145e74 ea145e64 e9de 00db e97b7bb4 [ 2300.852680] 7c00: c013695c ea145ebc ea145ebc ea145eac e9de1340 00db e97b7bb4 [ 2300.860837] 7c20: c013695c ea12a324 e97b7c84 ea12a314 e9de1a40 00db e97b7bb4 [ 2300.868999] 7c40: c013695c ea146134 ea146134 ea146124 e9de1a40 00db e97b7bb4 [ 2300.877159] 7c60: c013695c ea14617c ea14617c ea14616c ea391880 00db e97b7bb4 [ 2300.885318] 7c80: c013695c e97b7c24 ea12a324 ea12a314 e97b7cd8 e97b7fa8 c000e960 [ 2300.893473] 7ca0: c1094a28 e97b8000 0003 e97b7d00 [ 2300.901640] 7cc0: c0012000 e97b7cf0 e97b6000 ed824100 e97b7d8c c0134020 e97b7d1c c0011ff4 [ 2300.909799] 7ce0: e97b7d20 e8d1a180 c0012164 e97b7d20 c000e960 c0e90a13 c0e639c6 [ 2300.917958] 7d00: 0010 e8d1b1d8 c0134020 e8d1a180 e97b6000 ea2de540 ea4cec48 c0281200 [ 2300.926114] 7d20: ea4cec48 ec36c03c ef5ecc40 c00d9fac ea2de540 [ 2300.934277] 7d40: ea4cec44 c00da300 ea2de540 00c9 00c9 c0e61f37 01e6 [ 2300.942436] 7d60: ea2de540 00c9 c00dc4f8 e97b7d8c e9c0b4a0 e97b7db0 [ 2300.950598] 7d80: 00c9 edd6d1c8 000be476 be47659f e8c4e1e4 47279000 ef5ecc40 [ 2300.958754] 7da0: c011181c 0012 c001b0c4 0103 be47659f ede89f30 ef5ecc40 [ 2300.966915] 7dc0: ede89f40 e8c4e000 e8c4e000 c0aacc68 ede89f40 c0102428 [ 2300.975074] 7de0: ef5ecc40 c013a978 e9aee6dc e9aef784 e9aef784 ea367f00 ea4c9618 e97b7fb0 [ 2300.983232] 7e00: e9c0b4a0 47279000 e8c4e000 e9c1a080 0004 e97b7e50 [ 2300.991392] 7e20: 001b2a6c e97b6038 0008 c013759c e97b7e50 e97b7e54 [ 2300.999553] 7e40: e97b7e58 e97b7e5c e97b7e60 e97b7e64 00f0 0050 [ 2301.007713] 7e60: 8007 e9c1a080 e9c1a0c4 c0aaeec8 c0134020 [ 2301.015872] 7e80: e8d1a180 e8d1a180 fffe c13465a8 e97b6000 [ 2301.024032] 7ea0: c0134020 ed85af10 e9aee668 f02ce0fe 000b e8d1a196 c011c914 [ 2301.032190] 7ec0: ea4c95c8 e988ef38 0001 0002 008a [ 2301.040351] 7ee0: ea391880 47279380 0007 c11b6ac4 47279380 e97b7fb0 0005 001adf64 [ 2301.048513] 7f00: c000874c 0001 001adf64 ff9c 001b2c94 e97b7f50 c0134048 [ 2301.056671] 7f20: 001b2c94 0001 c012a788 ff9c 001b2c94 bebfeab0 001adf64 [ 2301.064830] 7f40: 001b2a68 00c3 c000eae4 c012ad5c 001b2a6c [ 2301.072988] 7f60: 0008 e97b6000 c013772c c01606d0 [ 2301.081152] 7f80: bffd 001b2a6c 008e c000eae4 e97b6000 [
Re: [PATCH] USB: serial: pl2303: add new ATEN device id
On Tue, Aug 08, 2017 at 12:58:51PM -0700, Greg Kroah-Hartman wrote: > This adds a new ATEN device id for a new pl2303-based device. > > Reported-by: Peter Kuo> Cc: stable > Signed-off-by: Greg Kroah-Hartman > > --- > > Peter, can you test this patch and verify it works for you? Is there a > better name I can give this device other than ATEN_PRODUCT_ID3? > > Johan, any objection for me to take this through my tree once Peter > verifies it? None at all. In fact, there seems to be a few more on the way in which it would be great if you could pick up directly while I'm on vacation. > diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c > index c9ebefd8f35f..4b124c645175 100644 > --- a/drivers/usb/serial/pl2303.c > +++ b/drivers/usb/serial/pl2303.c > @@ -53,6 +53,8 @@ static const struct usb_device_id id_table[] = { > { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID), > .driver_info = PL2303_QUIRK_ENDPOINT_HACK }, > { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) }, > + { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID3), > + .driver_info = PL2303_QUIRK_ENDPOINT_HACK }, > { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, > { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, > { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, > diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h > index 09d9be88209e..dc55e3f2343c 100644 > --- a/drivers/usb/serial/pl2303.h > +++ b/drivers/usb/serial/pl2303.h > @@ -28,6 +28,7 @@ > #define ATEN_VENDOR_ID2 0x0547 > #define ATEN_PRODUCT_ID 0x2008 > #define ATEN_PRODUCT_ID2 0x2118 > +#define ATEN_PRODUCT_ID3 0x2021 I try to keep the defines themselves sorted by numerical PID, even if in this case and with these generic names that may seem counterintuitive. > #define IODATA_VENDOR_ID 0x04bb > #define IODATA_PRODUCT_ID0x0a03 Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] usb: xhci: Disable slot even virt-dev is null
On 27.07.2017 05:21, Lu Baolu wrote: xhci_disable_slot() is a helper for disabling a slot when a device goes away or recovers from error situations. Currently, it checks the corespoding virt-dev pointer and returns directly (w/o issuing disable slot command) if it's null. This is unnecessary and will cause problems in case where virt-dev allocation fails and xhci_disable_slot() is called to roll back the hardware state. Refer to the implementation of xhci_alloc_dev(). True, checking for xhci->devs[slot_id] doesn't work if xhci_alloc_dev() failed xhci_alloc_virt_device() and calls xhci_disable_slot, but the virt dev check is needed for test mode, which will just try to disable all slots from 1 to HCS_MAX_SLOTS: xhci_enter_test_mode(..) /* Disable all Device Slots */ for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { retval = xhci_disable_slot(xhci, NULL, i); This patch removes lines to check virt-dev in xhci_disable_slot(). Fixes: f9e609b82479 ("usb: xhci: Add helper function xhci_disable_slot().") Cc: Guoqing ZhangSigned-off-by: Lu Baolu --- drivers/usb/host/xhci.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b2ff1ff..e69073f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3567,11 +3567,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, struct xhci_command *command, unsigned long flags; u32 state; int ret = 0; - struct xhci_virt_device *virt_dev; - virt_dev = xhci->devs[slot_id]; - if (!virt_dev) - return -EINVAL; if (!command) command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); if (!command) -- To unsubscribe from this list: send the line "unsubscribe 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: gadget: f_uac2: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav--- drivers/usb/gadget/function/u_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 5dd73b9..d4caa21 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -354,7 +354,7 @@ static int uac_pcm_null(struct snd_pcm_substream *substream) return 0; } -static struct snd_pcm_ops uac_pcm_ops = { +static const struct snd_pcm_ops uac_pcm_ops = { .open = uac_pcm_open, .close = uac_pcm_null, .ioctl = snd_pcm_lib_ioctl, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
AW: AW: new usb LTE modem device
> sendsetup is to prevent the driver from sending a specific USB control > message for setting up serial parameters, which some devices ignore and > cause the driver to stall. > > reserved is what you're looking for. This one tells option not to bind to the > given USB interfaces. > > So for example, ".reserved = BIT(3)" tells the option driver to ignore USB > interface 3 on that device. ".reserved = BIT(3) | BIT(5)" tells it to ignore > both > interfaces 3 and 5. > > For your device, you'll want to set "reserved" in option.c to all the > interfaces > that qmi_wwan is going to claim, to make sure option doesn't claim them. > option by default is a greedy driver. Thanks for the clear description. I will proceed accordingly and as soon as I have tested, I will submit the patch. Bye. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html