Re: [PATCH 3/3] usb: phy: msm: enable build on other architectures
On Wed, 2014-04-30 at 11:38 -0500, Felipe Balbi wrote: > By adding COMPILE_TEST to the list of dependencies > we can build test this driver on all other architectures > which is very valuable for maintainers applying patches > and to find silly mistakes during development. > > Signed-off-by: Felipe Balbi Reviewed-by: Ivan T. Ivanov > --- > drivers/usb/phy/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig > index 0c668a3..fbbced8 100644 > --- a/drivers/usb/phy/Kconfig > +++ b/drivers/usb/phy/Kconfig > @@ -172,7 +172,7 @@ config USB_ISP1301 > > config USB_MSM_OTG > tristate "Qualcomm on-chip USB OTG controller support" > - depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM) > + depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM || > COMPILE_TEST) > select USB_PHY > help > Enable this to support the USB OTG transceiver on Qualcomm chips. It -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net,stable] net: cdc_mbim: __vlan_find_dev_deep need rcu_read_lock
Eric Dumazet writes: > While this 'removes' the warning, this doesn't solve the fundamental > problem. > > If you write : > > rcu_read_lock(); > netdev = __vlan_find_dev_deep(...) > rcu_read_unlock(); > > Then you cannot dereference netdev safely after the unlock. > > In order to do so, you need to take a reference on netdev (aka > dev_hold()) before doing rcu_read_unlock(); > > And of course, release it later (aka dev_put()) when you are done with > netdev. Doh! Now that you tell me, this is pretty obvious. Thanks. Will fix and resubmit. Bjørn -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net,stable v2] net: cdc_mbim: __vlan_find_dev_deep need rcu_read_lock
Fixes this warning introduced by commit 5b8f15f78e6f ("net: cdc_mbim: handle IPv6 Neigbor Solicitations"): === [ INFO: suspicious RCU usage. ] 3.15.0-rc3 #213 Tainted: GW O --- net/8021q/vlan_core.c:69 suspicious rcu_dereference_check() usage! other info that might help us debug this: rcu_scheduler_active = 1, debug_locks = 1 no locks held by ksoftirqd/0/3. stack backtrace: CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: GW O 3.15.0-rc3 #213 Hardware name: LENOVO 2776LEG/2776LEG, BIOS 6EET55WW (3.15 ) 12/19/2011 0001 880232533bf0 813a5ee6 0006 880232530090 880232533c20 81076b94 0081 8802085ac000 88007fc8ea00 880232533c50 Call Trace: [] dump_stack+0x4e/0x68 [] lockdep_rcu_suspicious+0xfa/0x103 [] __vlan_find_dev_deep+0x54/0x94 [] cdc_mbim_rx_fixup+0x379/0x66a [cdc_mbim] [] ? _raw_spin_unlock_irqrestore+0x3a/0x49 [] ? trace_hardirqs_on_caller+0x192/0x1a1 [] usbnet_bh+0x59/0x287 [usbnet] [] tasklet_action+0xbb/0xcd [] __do_softirq+0x14c/0x30d [] run_ksoftirqd+0x1f/0x50 [] smpboot_thread_fn+0x172/0x18e [] ? SyS_setgroups+0xdf/0xdf [] kthread+0xb5/0xbd [] ? __wait_for_common+0x13b/0x170 [] ? __kthread_parkme+0x5c/0x5c [] ret_from_fork+0x7c/0xb0 [] ? __kthread_parkme+0x5c/0x5c Fixes: 5b8f15f78e6f ("net: cdc_mbim: handle IPv6 Neigbor Solicitations") Signed-off-by: Bjørn Mork --- v2: get a ref to the netdev before releasing the lock. Thanks to Eric Dumazet Please add this to the stable v3.13 and v3.14 queues as well. Thanks. drivers/net/usb/cdc_mbim.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index c9f3281506af..13f7705fd679 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c @@ -204,17 +204,23 @@ static void do_neigh_solicit(struct usbnet *dev, u8 *buf, u16 tci) return; /* need to send the NA on the VLAN dev, if any */ - if (tci) + rcu_read_lock(); + if (tci) { netdev = __vlan_find_dev_deep(dev->net, htons(ETH_P_8021Q), tci); - else + if (!netdev) { + rcu_read_unlock(); + return; + } + } else { netdev = dev->net; - if (!netdev) - return; + } + dev_hold(netdev); + rcu_read_unlock(); in6_dev = in6_dev_get(netdev); if (!in6_dev) - return; + goto out; is_router = !!in6_dev->cnf.forwarding; in6_dev_put(in6_dev); @@ -224,6 +230,8 @@ static void do_neigh_solicit(struct usbnet *dev, u8 *buf, u16 tci) true /* solicited */, false /* override */, true /* inc_opt */); +out: + dev_put(netdev); } static bool is_neigh_solicit(u8 *buf, size_t len) -- 2.0.0.rc0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: ehci-hub: wait for RESUME finished when hub try to clear SUSPEND
On Sat, 3 May 2014, xiao jin wrote: > We use usb ehci to connect with modem and run stress test on ehci > remote wake. Sometimes usb disconnect. We add more debug ftrace > (Kernel version: 3.10) and list the key log to show how problem > happened. > > -0 [000] d.h2 26879.385095: ehci_irq: irq status 1008c PPCE FLR PCD > -0 [000] d.h2 26879.385099: ehci_irq: rh_state[2] hcd->state[132] > pstatus[0][238014c5] suspended_ports[1] reset_done[0] > <...>-12873 [000] d..1 26879.393536: ehci_hub_control: GetStatus port:1 > status 238014c5 17 ERR POWER sig=k SUSPEND RESUME PE CONNECT > <...>-12873 [000] d..1 26879.393549: ehci_hub_control: typeReq [2301] > wIndex[1] wValue[2] > <...>-12873 [000] d..1 26879.393553: ehci_hub_control: > [ehci_hub_control]line[891] port[0] hostpc_reg [44000202]->[44000202] > -0 [001] ..s. 26879.403122: ehci_hub_status_data: > wgq[ehci_hub_status_data] ignore_oc[0] resuming_ports[1] > <...>-12873 [000] d..1 26879.413379: ehci_hub_control: > [ehci_hub_control]line[907] port[0] write portsc_reg[238014c5] > reset_done[2105769] > <...>-12873 [000] d..1 26879.453173: ehci_hub_control: GetStatus port:1 > status 23801885 17 ERR POWER sig=j SUSPEND PE CONNECT > <...>-12873 [000] 26879.473158: check_port_resume_type: port 1 status > .0507 after resume, -19 > <...>-12873 [000] 26879.473160: usb_port_resume: status = -19 after > check_port_resume_type > <...>-12873 [000] 26879.473161: usb_port_resume: can't resume, status -19 > <...>-12873 [000] 26879.473162: hub_port_logical_disconnect: logical > disconnect on port 1 This is a little difficult to understand... > There is a in-band remote wakeup and controller run in k-state. Then kernel What do you mean by "in-band"? > driver(ClearPortFeature/USB_PORT_FEAT_SUSPEND) write RESUME|LS(k-state) bit > into controller. Why did it do that? Did the kernel try to resume the port at the same time as the device issued a remote wakeup request? In other words, was there a race between resume and remote wakeup? > It makes controller status weird. Why? Your log shows that the RESUME bit was already turned on, so writing a 1 to it shouldn't make any difference. (And the LS(k-state) bit is RO, so writing a 1 to it shouldn't matter.) > It's defined in EHCI > controller spec(Revision 1.0), "If it has enabled remote wake-up, a K-state > on the bus will turn the transceiver clock and generate an interrupt. The > software will then have to wait 20 ms for the resume to complete and the > port to go back to an active state." Where in the spec did you find that quote? It's not present in my copy of the EHCI Rev 1.0 spec. > In this case Kernel should wait for > the wakeup finished, then judge what should do next step. > > We have some thought and give a patch. This patch is to wait for controller > RESUME finished when hub try to clear port SUSPEND feature. > > Signed-off-by: xiao jin > Reviewed-by: David Cohen > --- > drivers/usb/host/ehci-hub.c |7 +++ > include/linux/usb/ehci_def.h |5 + > 2 files changed, 12 insertions(+) > > diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c > index 7ae0c4d..09a8b6b 100644 > --- a/drivers/usb/host/ehci-hub.c > +++ b/drivers/usb/host/ehci-hub.c > @@ -935,6 +935,13 @@ static int ehci_hub_control ( > break; > } > #endif > + if ((temp & PORT_RESUME) > + && ((temp & PORT_LS_MASK) == PORT_K_STATE)) { > + ehci_handshake(ehci, status_reg, > + PORT_RESUME, 0, 2 /* 20msec */); > + temp = ehci_readl(ehci, status_reg); > + temp &= ~PORT_RWC_BITS; > + } > if (!(temp & PORT_SUSPEND)) > break; > if ((temp & PORT_PE) == 0) > diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h > index daec99a..0f0f919 100644 > --- a/include/linux/usb/ehci_def.h > +++ b/include/linux/usb/ehci_def.h > @@ -149,6 +149,11 @@ struct ehci_regs { > #define PORT_POWER (1<<12) /* true: has power (see PPC) */ > #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ > /* 11:10 for detecting lowspeed devices (reset vs release ownership) */ > +#define PORT_LS_MASK (0x3<<10) /* line status */ > +#define PORT_SE0_STATE (0<<10) > +#define PORT_K_STATE (1<<10) > +#define PORT_J_STATE (2<<10) > +#define PORT_UNDEFINED_STATE (3<<10) > /* 9 reserved */ > #define PORT_LPM (1<<9) /* LPM transaction */ > #define PORT_RESET (1<<8) /* reset port */ This is definitely wrong. For one thing, you mustn't have a 20-ms delay with interrupts disabled. For another, the spec states (Table 2-16, the entry for bits 11:10) that the Line Status value is valid only when the port enable b
Re: Bugs in xhci-hcd isochronous support
> > Russel, here's a patch you can test. It's only a partial fix for the > problem, because it doesn't handle over/underruns. Still, it would be > nice to see if the patch makes any difference in normal operation. > > Even if it doesn't fix the problem, please post a short stretch (a few > hundred lines) from a usbmon trace with the patch installed. > > Alan Stern > Hi, We tried downloading the latest kernel 3.15 and got this when applying the patch File to patch: ^C :~/linux kernel/usb-3.15.orig$ patch -p1 < patch.dif patching file drivers/usb/host/xhci-ring.c Hunk #1 FAILED at 3153. Hunk #2 FAILED at 3164. Hunk #3 FAILED at 3406. Hunk #4 FAILED at 3545. Hunk #5 FAILED at 3662. Hunk #6 FAILED at 3742. Hunk #7 FAILED at 3756. Hunk #8 FAILED at 3765. Hunk #9 FAILED at 3826. Hunk #10 FAILED at 3895. Hunk #11 FAILED at 3935. Hunk #12 FAILED at 3958. Hunk #13 FAILED at 3982. 13 out of 13 hunks FAILED -- saving rejects to file drivers/usb/host/xhci-ring.c.rej patching file drivers/usb/host/xhci.h Reversed (or previously applied) patch detected! Assume -R? [n] I was told that the lines in the source file were not in the place that they were expected, are we using the right kernel? Thanks in advance! BR Russel -- To unsubscribe from this list: send the line "unsubscribe 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: Bugs in xhci-hcd isochronous support
On Sat, 3 May 2014, Russel Hughes wrote: > Hi, > > We tried downloading the latest kernel 3.15 and got this when > applying the patch > > File to patch: ^C > :~/linux kernel/usb-3.15.orig$ patch -p1 < patch.dif > patching file drivers/usb/host/xhci-ring.c > Hunk #1 FAILED at 3153. > Hunk #2 FAILED at 3164. > Hunk #3 FAILED at 3406. > Hunk #4 FAILED at 3545. > Hunk #5 FAILED at 3662. > Hunk #6 FAILED at 3742. > Hunk #7 FAILED at 3756. > Hunk #8 FAILED at 3765. > Hunk #9 FAILED at 3826. > Hunk #10 FAILED at 3895. > Hunk #11 FAILED at 3935. > Hunk #12 FAILED at 3958. > Hunk #13 FAILED at 3982. > 13 out of 13 hunks FAILED -- saving rejects to file > drivers/usb/host/xhci-ring.c.rej > patching file drivers/usb/host/xhci.h > Reversed (or previously applied) patch detected! Assume -R? [n] > > I was told that the lines in the source file were not in the place > that they were expected, are we using the right kernel? Thanks in > advance! The patch was made against 3.15-rc2, which is no longer the latest kernel version. However, the nature of those error messages suggests that the patch file you tried to apply was messed up somehow, probably by your email client. You can get the unmodified original here: http://marc.info/?l=linux-usb&m=139906101630351&q=raw 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: Bugs in xhci-hcd isochronous support
> The patch was made against 3.15-rc2, which is no longer the latest > kernel version. > > However, the nature of those error messages suggests that the patch > file you tried to apply was messed up somehow, probably by your email > client. You can get the unmodified original here: > > http://marc.info/?l=linux-usb&m=139906101630351&q=raw > > Alan Stern > Hi, Thanks, yes I don't know what is going on in gmail, plain text is selected and indicated, it has worked but now no longer seems to. No noticeable difference in buffer level performance visually, still all over the place compared to USB2.0, audio everyone is asleep so I cannot really test but I think it still drops out, will say tomorrow. HDMI audio still works, which it didn't last time I swapped kernels, so some good news! Patch went as follows. Hunk #1 succeeded at 3148 (offset -5 lines). Hunk #2 succeeded at 3159 (offset -5 lines). Hunk #3 succeeded at 3402 (offset -5 lines). Hunk #4 succeeded at 3541 (offset -5 lines). Hunk #5 succeeded at 3658 (offset -5 lines). Hunk #6 succeeded at 3738 (offset -5 lines). Hunk #7 succeeded at 3754 (offset -5 lines). Hunk #8 succeeded at 3766 (offset -5 lines). Hunk #9 succeeded at 3829 (offset -5 lines). Hunk #10 succeeded at 3894 (offset -5 lines). Hunk #11 succeeded at 3978 (offset -5 lines). Hunk #12 succeeded at 4000 (offset -5 lines). Hunk #13 succeeded at 4015 (offset -5 lines). patching file drivers/usb/host/xhci.h Hunk #2 succeeded at 887 (offset -2 lines). Hunk #3 succeeded at 1169 (offset -2 lines). built the kernel and placed it in, I can rebuild it with rc2 as I forgot you had used rc2 if you wish uname -r 3.15.0-rc3 T: Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0451 ProdID=adac Rev= a.09 S: Manufacturer=Lakewest Audio S: Product=Audiolab M-DAC C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr= 0mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=1ms E: Ad=02(O) Atr=03(Int.) MxPS= 64 Ivl=1ms I:* If#= 1 Alt= 0 #EPs= 1 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio E: Ad=83(I) Atr=03(Int.) MxPS= 2 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio I:* If#= 2 Alt= 1 #EPs= 2 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio E: Ad=01(O) Atr=05(Isoc) MxPS= 582 Ivl=1ms E: Ad=81(I) Atr=11(Isoc) MxPS= 3 Ivl=1ms sudo cat /sys/kernel/debug/usb/usbmon/2u > /tmp/1.mon.out first few hundred lines 880200adef00 2596394321 C Zi:2:004:1 0:1:1833:0 1 0:0:3 4 = 00030b00 880200adef00 2596394330 S Zi:2:004:1 -115:1:1833 1 -18:0:3 4 < 8801f3c8e600 2596395313 C Zo:2:004:1 0:1:1830:0 5 0:0:264 0:264:264 0:528:264 0:792:270 0:1062:264 1326 > 8801f3c8e600 2596395324 S Zo:2:004:1 -115:1:1830 5 -18:0:264 -18:264:264 -18:528:264 -18:792:264 -18:1056:264 1320 = 023dff06 fffdfdc4 0003bafe fdbf0003 c0fe00ad ff06eefd 0496fe07 57fd0843 8800d14aba00 2596395327 C Zi:2:004:1 0:1:1834:0 1 0:0:3 4 = 00030b00 8800d14aba00 2596395328 S Zi:2:004:1 -115:1:1834 1 -18:0:3 4 < 8800d058e700 2596396343 C Zi:2:004:1 0:1:1835:0 1 0:0:3 4 = 00030b00 8800d058e700 2596396346 S Zi:2:004:1 -115:1:1835 1 -18:0:3 4 < 8801f3564300 2596397329 C Zi:2:004:1 0:1:1836:0 1 0:0:3 4 = 00030b00 8801f3564300 2596397341 S Zi:2:004:1 -115:1:1836 1 -18:0:3 4 < 880200adef00 2596398321 C Zi:2:004:1 0:1:1837:0 1 0:0:3 4 = 00030b00 880200adef00 2596398323 S Zi:2:004:1 -115:1:1837 1 -18:0:3 4 < 8800d14aba00 2596399319 C Zi:2:004:1 0:1:1838:0 1 0:0:3 4 = 00030b00 8800d14aba00 2596399323 S Zi:2:004:1 -115:1:1838 1 -18:0:3 4 < 8800d058e700 2596400323 C Zi:2:004:1 0:1:1839:0 1 0:0:3 4 = 00030b00 8800d058e700 2596400327 S Zi:2:004:1 -115:1:1839 1 -18:0:3 4 < 8801f3c8fa00 2596401328 C Zo:2:004:1 0:1:1835:0 6 0:0:264 0:264:264 0:528:264 0:792:264 0:1056:264 1584 > 8801f3c8fa00 2596401335 S Zo:2:004:1 -115:1:1835 5 -18:0:264 -18:264:264 -18:528:264 -18:792:270 -18:1062:264 1326 = f7e502f3 4f04f89a 02f89e02 fe7e0001 56fffc0f 0100e3ff f30604f1 b204f1b2 8801f3564300 2596401338 C Zi:2:004:1 0:1:1840:0 1 0:0:3 4 = 00030b00 8801f3564300 2596401338 S Zi:2:004:1 -115:1:1840 1 -18:0:3 4 < 880200adef00 2596402340 C Zi:2:004:1 0:1:1841:0 1 0:0:3 4 = 00030b00 880200adef00 2596402342 S Zi:2:004:1 -115:1:1841 1 -18:0:3 4 < 8800d14aba00 2596403345 C Zi:2:004:1 0:1:1842:0 1 0:0:3 4 = 00030b00 8800d14aba00 2596403350 S Zi:2:004:1 -115:1:1842 1 -18:0:3 4 < 8800d058e700 2596404352 C Zi:2:004:1 0:1:1843:0 1 0:0:3 4 = 00030b00 8800d058e700 2596404356 S Zi:2:004:1 -115:1:1843 1 -18:0:3 4 < 8801f3564300 2596405351 C Zi:2:004:1 0:1:1844:0 1 0:0:3 4 = 00030b00 8801f3564300 2596405355 S Zi:2:004:1 -115:1:1844 1 -18:0:3 4 < 8801f3c8f000 2596406339 C Zo:2:004:1 0:1:1841:0 5 0:0:264 0:264:264 0:528:264 0:792:264 0:1056:264 1320 > 8801f3c8f000 2596406347 S Zo:2:004:1 -115:1:1841 5 -18
Re: [PATCH] USB: ehci-hub: wait for RESUME finished when hub try to clear SUSPEND
On Sat, May 03, 2014 at 11:52:25AM +0800, xiao jin wrote: > We use usb ehci to connect with modem and run stress test on ehci > remote wake. Sometimes usb disconnect. We add more debug ftrace > (Kernel version: 3.10) and list the key log to show how problem > happened. > > -0 [000] d.h2 26879.385095: ehci_irq: irq status 1008c PPCE FLR PCD > -0 [000] d.h2 26879.385099: ehci_irq: rh_state[2] hcd->state[132] > pstatus[0][238014c5] suspended_ports[1] reset_done[0] > <...>-12873 [000] d..1 26879.393536: ehci_hub_control: GetStatus port:1 > status 238014c5 17 ERR POWER sig=k SUSPEND RESUME PE CONNECT > <...>-12873 [000] d..1 26879.393549: ehci_hub_control: typeReq [2301] > wIndex[1] wValue[2] > <...>-12873 [000] d..1 26879.393553: ehci_hub_control: > [ehci_hub_control]line[891] port[0] hostpc_reg [44000202]->[44000202] > -0 [001] ..s. 26879.403122: ehci_hub_status_data: > wgq[ehci_hub_status_data] ignore_oc[0] resuming_ports[1] > <...>-12873 [000] d..1 26879.413379: ehci_hub_control: > [ehci_hub_control]line[907] port[0] write portsc_reg[238014c5] > reset_done[2105769] > <...>-12873 [000] d..1 26879.453173: ehci_hub_control: GetStatus port:1 > status 23801885 17 ERR POWER sig=j SUSPEND PE CONNECT > <...>-12873 [000] 26879.473158: check_port_resume_type: port 1 status > .0507 after resume, -19 > <...>-12873 [000] 26879.473160: usb_port_resume: status = -19 after > check_port_resume_type > <...>-12873 [000] 26879.473161: usb_port_resume: can't resume, status -19 > <...>-12873 [000] 26879.473162: hub_port_logical_disconnect: logical > disconnect on port 1 > > There is a in-band remote wakeup and controller run in k-state. Then kernel > driver(ClearPortFeature/USB_PORT_FEAT_SUSPEND) write RESUME|LS(k-state) bit > into controller. It makes controller status weird. It's defined in EHCI Are you sure you are at this path? If there is a remote wakeup, the sending resume signal from host controller will be skipped (USB_PORT_FEAT_SUSPEND), see usb_port_resume at drivers/usb/core/hub.c. > controller spec(Revision 1.0), "If it has enabled remote wake-up, a K-state > on the bus will turn the transceiver clock and generate an interrupt. The > software will then have to wait 20 ms for the resume to complete and the > port to go back to an active state." In this case Kernel should wait for > the wakeup finished, then judge what should do next step. Do you use a chipidea core? Try to do not clear run/stop to see if this problem is fixed or not. > > We have some thought and give a patch. This patch is to wait for controller > RESUME finished when hub try to clear port SUSPEND feature. > > Signed-off-by: xiao jin > Reviewed-by: David Cohen > --- > drivers/usb/host/ehci-hub.c |7 +++ > include/linux/usb/ehci_def.h |5 + > 2 files changed, 12 insertions(+) > > diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c > index 7ae0c4d..09a8b6b 100644 > --- a/drivers/usb/host/ehci-hub.c > +++ b/drivers/usb/host/ehci-hub.c > @@ -935,6 +935,13 @@ static int ehci_hub_control ( > break; > } > #endif > + if ((temp & PORT_RESUME) > + && ((temp & PORT_LS_MASK) == PORT_K_STATE)) { > + ehci_handshake(ehci, status_reg, > + PORT_RESUME, 0, 2 /* 20msec */); > + temp = ehci_readl(ehci, status_reg); > + temp &= ~PORT_RWC_BITS; > + } > if (!(temp & PORT_SUSPEND)) > break; > if ((temp & PORT_PE) == 0) > diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h > index daec99a..0f0f919 100644 > --- a/include/linux/usb/ehci_def.h > +++ b/include/linux/usb/ehci_def.h > @@ -149,6 +149,11 @@ struct ehci_regs { > #define PORT_POWER (1<<12) /* true: has power (see PPC) */ > #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ > /* 11:10 for detecting lowspeed devices (reset vs release ownership) */ > +#define PORT_LS_MASK (0x3<<10) /* line status */ > +#define PORT_SE0_STATE (0<<10) > +#define PORT_K_STATE (1<<10) > +#define PORT_J_STATE (2<<10) > +#define PORT_UNDEFINED_STATE (3<<10) > /* 9 reserved */ > #define PORT_LPM (1<<9) /* LPM transaction */ > #define PORT_RESET (1<<8) /* reset port */ > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] usb: chipidea: msm: Add device tree support
From: "Ivan T. Ivanov" Allows controller to be specified via device tree. Pass PHY phandle specified in DT to core driver. Signed-off-by: Peter Chen Signed-off-by: Ivan T. Ivanov --- drivers/usb/chipidea/ci_hdrc_msm.c | 23 ++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 2d51d85..736aeb2 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -57,9 +57,21 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { static int ci_hdrc_msm_probe(struct platform_device *pdev) { struct platform_device *plat_ci; + struct usb_phy *phy; dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n"); + /* +* OTG(PHY) driver takes care of PHY initialization, clock management, +* powering up VBUS, mapping of registers address space and power +* management. +*/ + phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); + if (IS_ERR(phy)) + return PTR_ERR(phy); + + ci_hdrc_msm_platdata.phy = phy; + plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, pdev->num_resources, &ci_hdrc_msm_platdata); @@ -86,10 +98,19 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id msm_ci_dt_match[] = { + { .compatible = "qcom,ci-hdrc", }, + { } +}; +MODULE_DEVICE_TABLE(of, msm_ci_dt_match); + static struct platform_driver ci_hdrc_msm_driver = { .probe = ci_hdrc_msm_probe, .remove = ci_hdrc_msm_remove, - .driver = { .name = "msm_hsusb", }, + .driver = { + .name = "msm_hsusb", + .of_match_table = msm_ci_dt_match, + }, }; module_platform_driver(ci_hdrc_msm_driver); -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe 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/6] chipidea: usbmisc_imx: Allow USB OTG to work on mx51
From: Fabio Estevam The field PLLDIVVALUE of register PHY_CTRL_1 selects the reference clock source for the PHY: 00 = sysclock uses 19.2 MHz 01 = sysclock uses 24 MHz 10 = sysclock uses 26 MHz 11 = sysclock uses 27 MHz The reset value for this field is 10 according to the reference manual, and even though this reset value works for mx53, it does not work for mx51. So instead of relying on the reset value for the PLLDIVVALUE field, explicitly set it to 01 so that a 24MHz clock can be selected for the PHY and allowing both mx51 and mx53 to have USB OTG port functional. Succesfully tested 'g_ether' on a imx51-babbage and on a imx53-qsb boards. Signed-off-by: Peter Chen Signed-off-by: Fabio Estevam --- drivers/usb/chipidea/usbmisc_imx.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 419b895..85293b8 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -46,11 +46,14 @@ #define MX27_OTG_PM_BITBIT(24) #define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08 +#define MX53_USB_OTG_PHY_CTRL_1_OFFSET 0x0c #define MX53_USB_UH2_CTRL_OFFSET 0x14 #define MX53_USB_UH3_CTRL_OFFSET 0x18 #define MX53_BM_OVER_CUR_DIS_H1BIT(5) #define MX53_BM_OVER_CUR_DIS_OTG BIT(8) #define MX53_BM_OVER_CUR_DIS_UHx BIT(30) +#define MX53_USB_PHYCTRL1_PLLDIV_MASK 0x3 +#define MX53_USB_PLL_DIV_24_MHZ0x01 #define MX6_BM_OVER_CUR_DISBIT(7) @@ -164,6 +167,13 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) if (data->index > 3) return -EINVAL; + /* Select a 24 MHz reference clock for the PHY */ + reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET; + val = readl(reg); + val &= ~MX53_USB_PHYCTRL1_PLLDIV_MASK; + val |= MX53_USB_PLL_DIV_24_MHZ; + writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET); + if (data->disable_oc) { spin_lock_irqsave(&usbmisc->lock, flags); switch (data->index) { -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe 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/6] Chipidea Patches for 3.16
Hi Greg, Below are some chpidea patches for 3.16, the main changes are for re-enabling qualcomm platform which hasn't worked for more than 1 year and enabling USB OTG at FSL imx51. Fabio Estevam (1): chipidea: usbmisc_imx: Allow USB OTG to work on mx51 Ivan T. Ivanov (3): usb: chipidea: msm: Add device tree binding information usb: chipidea: msm: Add device tree support usb: chipidea: msm: Initialize offset of the capability registers Peter Chen (2): Doc: usb: chipidea: need to build both kernel Image and modules usb: chipidea: udc: update gadget states according to ch9 .../devicetree/bindings/usb/ci-hdrc-qcom.txt | 17 ++ Documentation/usb/chipidea.txt |2 +- drivers/usb/chipidea/ci_hdrc_msm.c | 24 +++- drivers/usb/chipidea/udc.c | 10 ++- drivers/usb/chipidea/usbmisc_imx.c | 10 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] usb: chipidea: msm: Initialize offset of the capability registers
From: "Ivan T. Ivanov" Since commit 62bb84e (usb: gadget: ci13xxx: convert to platform device) start address of the capability registers is not passed correctly to udc_probe(). Fix this. Signed-off-by: Peter Chen Signed-off-by: Ivan T. Ivanov --- drivers/usb/chipidea/ci_hdrc_msm.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 736aeb2..d72b9d2 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -47,6 +47,7 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { .name = "ci_hdrc_msm", + .capoffset = DEF_CAPOFFSET, .flags = CI_HDRC_REGS_SHARED | CI_HDRC_REQUIRE_TRANSCEIVER | CI_HDRC_DISABLE_STREAMING, -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe 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/6] usb: chipidea: msm: Add device tree binding information
From: "Ivan T. Ivanov" Document device tree binding information as required by the Qualcomm USB controller. Signed-off-by: Peter Chen Signed-off-by: Ivan T. Ivanov --- .../devicetree/bindings/usb/ci-hdrc-qcom.txt | 17 + 1 files changed, 17 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt new file mode 100644 index 000..f2899b5 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-qcom.txt @@ -0,0 +1,17 @@ +Qualcomm CI13xxx (Chipidea) USB controllers + +Required properties: +- compatible: should contain "qcom,ci-hdrc" +- reg: offset and length of the register set in the memory map +- interrupts: interrupt-specifier for the controller interrupt. +- usb-phy: phandle for the PHY device +- dr_mode: Should be "peripheral" + +Examples: + gadget@f9a55000 { + compatible = "qcom,ci-hdrc"; + reg = <0xf9a55000 0x400>; + dr_mode = "peripheral"; + interrupts = <0 134 0>; + usb-phy = <&usbphy0>; + }; -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe 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 6/6] usb: chipidea: udc: update gadget states according to ch9
Update device states according to ch9 in USB 2.0 specification Signed-off-by: Peter Chen --- drivers/usb/chipidea/udc.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 150592f..d683968 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -709,6 +709,8 @@ __acquires(ci->lock) if (ci->status == NULL) retval = -ENOMEM; + usb_gadget_set_state(&ci->gadget, USB_STATE_DEFAULT); + done: spin_lock(&ci->lock); @@ -865,6 +867,8 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) if (ci->setaddr) { hw_usb_set_address(ci, ci->address); ci->setaddr = false; + if (ci->address) + usb_gadget_set_state(&ci->gadget, USB_STATE_ADDRESS); } spin_lock_irqsave(&ci->lock, flags); @@ -1467,7 +1471,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) pm_runtime_get_sync(&_gadget->dev); hw_device_reset(ci, USBMODE_CM_DC); hw_device_state(ci, ci->ep0out->qh.dma); - dev_dbg(ci->dev, "Connected to host\n"); + usb_gadget_set_state(_gadget, USB_STATE_POWERED); } else { if (ci->driver) ci->driver->disconnect(&ci->gadget); @@ -1477,7 +1481,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) CI_HDRC_CONTROLLER_STOPPED_EVENT); _gadget_stop_activity(&ci->gadget); pm_runtime_put_sync(&_gadget->dev); - dev_dbg(ci->dev, "Disconnected from host\n"); + usb_gadget_set_state(_gadget, USB_STATE_NOTATTACHED); } } @@ -1750,6 +1754,8 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci) ci->suspended = 1; spin_unlock(&ci->lock); ci->driver->suspend(&ci->gadget); + usb_gadget_set_state(&ci->gadget, + USB_STATE_SUSPENDED); spin_lock(&ci->lock); } } -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe 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 5/6] Doc: usb: chipidea: need to build both kernel Image and modules
When tried to enable OTG FSM, we need to rebuild both kernel Image and modules, since there are some codes at gadget modules which are controlled by related configurations. Signed-off-by: Peter Chen --- Documentation/usb/chipidea.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt index 4c0e2ea..995c8bc 100644 --- a/Documentation/usb/chipidea.txt +++ b/Documentation/usb/chipidea.txt @@ -5,7 +5,7 @@ with 2 Freescale i.MX6Q sabre SD boards. 1.1 How to enable OTG FSM in menuconfig --- -Select CONFIG_USB_OTG_FSM. +Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules. If you want to check some internal variables for otg fsm, select CONFIG_USB_CHIPIDEA_DEBUG, there are 2 files which can show otg fsm variables and some controller registers value: -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] usb: chipidea: udc: delete useless code
Delete usbless code Signed-off-by: Peter Chen --- drivers/usb/chipidea/udc.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index d683968..69425b3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -825,7 +825,6 @@ __acquires(hwep->lock) if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) { /* Assume that device is bus powered for now. */ *(u16 *)req->buf = ci->remote_wakeup << 1; - retval = 0; } else if ((setup->bRequestType & USB_RECIP_MASK) \ == USB_RECIP_ENDPOINT) { dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ? -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usb: chipidea: update TODO list
Update TODO list Signed-off-by: Peter Chen --- drivers/usb/chipidea/core.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 128b92b..95b4dd7 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -23,7 +23,7 @@ * - BUS:bus glue code, bus abstraction layer * * Compile Options - * - CONFIG_USB_GADGET_DEBUG_FILES: enable debug facilities + * - CONFIG_USB_CHIPIDEA_DEBUG: enable debug facilities * - STALL_IN: non-empty bulk-in pipes cannot be halted * if defined mass storage compliance succeeds but with warnings * => case 4: Hi > Dn @@ -42,9 +42,6 @@ * - Not Supported: 15 & 16 (ISO) * * TODO List - * - Interrupt Traffic - * - GET_STATUS(device) - always reports 0 - * - Gadget API (majority of optional features) * - Suspend & Remote Wakeup */ #include -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html