Re: cdc_mbim with Huawei E3372, nothing works
On Tue, 2015-03-24 at 13:57 +0200, Sami Farin wrote: On Tue, Mar 24, 2015 at 12:29:19 +0100, Oliver Neukum wrote: On Tue, 2015-03-24 at 13:26 +0200, Sami Farin wrote: ... 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? Good question. Please post the full dmesg. But do you want it to? Ideally cdc_mbim would work, wouldn't it? http://pastebin.com/dBUS3uy7 Please read the thread from the beginning, cdc_mbim does not work. Only errors, and no packets moving. How have you determined that if you cannot switch? If that really is the case, you will have to remove cdc-mbim or hack usb_modeswitch. Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/12] USB: chipidea: patchset for performance improvement
On Tue, Mar 24, 2015 at 04:02:53PM +0530, victorascr...@gmail.com wrote: Hello Peter, On 15-03-19 09:19:11, Peter Chen wrote: Hi all, In this patch set, I add some interfaces for tuning the performance of chipidea usb driver. With this set, the USB performance can be improved at some user cases with suitable parameters. The main changes: - Interface to tune interrupt threshold control, and set 'Immediate' for default value - The glue layer can disable stream mode according to USB role - Interface to tune AHB burst configuration at SBUSCFG - Interface to tune tx/rx burst size - i.mx changes for achieving better performance, it can reduce the latecy between bus and USB FIFO, and reduce the overrun and underrun occurrences, it is useful for the system bus is busy. we see great improvement for ISO transfer, eg, high resolution USB camera when the bus is busy. Below are some test results at imx6sx sdb board (set ehci_hcd.park=3 at bootargs), the tests are done at v4.0 kernel, no other bus loading during the tests, so we have not seen performance change for some use cases. USB Mass Storage (Host mode) With Patch Set Without Patch Set R: 26.9 MB/s27 MB/s W: 25.2 MB/s24.5 MB/s 1G USB Ethernet Card With Patch Set Without Patch Set TX: 186 Mb/s185 Mb/s RX: 219 Mb/s216 Mb/s g_ncm (Device Mode) With Patch Set Without Patch Set TX: 166MB/s 163MB/s RX: 230MB/s 184MB/s I tested these patches on a Colibri Vybrid VF61. Have not applied the 7th and 11th patch, but, the changes these patches introduce, I added them to our device tree node. These would be the addition of ahb-burst-config = 0x0 and tx-burst-size-dword = 0x10 and rx-burst-size-dword = 0x10 to the usb node in vfxxx.dtsi file for both the peripheral and host usb nodes. I used hdparm and dd for the tests. Some of the readings are below. With this patchset applied Reads hdparm -t --direct /dev/sda /dev/sda: Timing O_DIRECT disk reads: 36 MB in 3.05 seconds = 11.80 MB/sec Writes root@colibri-vf:~# time dd if=/dev/zero bs=128k count=4096 of=/media/sda1/tmpfile 4096+0 records in 4096+0 records out real1m11.671s user0m0.010s sys 0m10.130s USB Client - RNDIS root@colibri-vf:~# iperf -c 192.168.1.1 Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 43.8 KByte (default) [ 3] local 192.168.1.2 port 41317 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 105 MBytes 88.2 Mbits/sec Without this patchset applied Reads hdparm -t --direct /dev/sda /dev/sda: Timing O_DIRECT disk reads: 78 MB in 3.06 seconds = 25.50 MB/sec Writes root@colibri-vf:~# time dd if=/dev/zero bs=128k count=4096 of=/media/sda1/tmpfil 4096+0 records in 4096+0 records out real0m43.807s user0m0.050s sys 0m9.960s USB Client - RNDIS root@colibri-vf:~# iperf -c 192.168.1.1 Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 43.8 KByte (default) [ 3] local 192.168.1.2 port 49857 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 138 MBytes 116 Mbits/sec Perhaps I am missing something? I have the ehci_hcd.park=3 set. root@colibri-vf:~# cat /proc/cmdline ehci_hcd.park=3 ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs ubi.fm_autoconvert=1 mtdparts=vf610_nfc:128k(vf-bcb)ro,1408k( u-boot)ro,512k(u-boot-env),-(ubi) fec_mac= consoleblank=0 console=tty1 console=ttyLP0,115200n8 mem=256M Is there any other parameter or variable I need to set? Hi Sanchayan, The dts setting is specific for i.mx6 (maybe i.mx5 is applicate), and it needs below patch to co-work with it, it is an i.mx controller specific improvement (not in core). usb: chipidea: usbmisc_imx: add unburst setting for imx6 Other chipidea SoCs may have optimized parameters than default ones, it needs to check with IC guys. Enable stream mode should improve tx performance, you can have a try. - Sanchayan Peter Chen (12): Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc usb: chipidea: set ITC to 0 for device mode usb: chipidea: define stream mode disable for both roles usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx usb: chipidea: introduce ci_platform_config Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc ARM: imx6: set ahb-burst-config as 0 for USB usb: chipidea: add ahb burst configuration usb: chipidea: usbmisc_imx: add unburst setting for
Re: cdc_mbim with Huawei E3372, nothing works
On Tue, Mar 24, 2015 at 19:08:21 +0700, Lars Melin wrote: On 2015-03-24 18:57, Sami Farin wrote: On Tue, Mar 24, 2015 at 12:29:19 +0100, Oliver Neukum wrote: On Tue, 2015-03-24 at 13:26 +0200, Sami Farin wrote: ... 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? Good question. Please post the full dmesg. But do you want it to? Ideally cdc_mbim would work, wouldn't it? http://pastebin.com/dBUS3uy7 Please read the thread from the beginning, cdc_mbim does not work. Only errors, and no packets moving. Then run it in compatible mode while waiting for a solution to the cdc_mbim driver. Either remove the cdc_mbim driver or add NoMBIMCheck=1 in the device config file for 12d1:157d. NoMBIMCheck=1 helped! cdc_ether works .. thanks! One thing causing confusion was that usb_modeswitch read the vim backup file first ( /etc/usb_modeswitch.d/12d1:157d~ ) .. 8-) But why 3.18.9 and 4.0.0-rc5 behave differently, in 3.18.9 (Fedora 21) it's enough to blacklist cdc_mbim, and cdc_ether is used instead.. -- Do what you love because life is too short for anything else. -- 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: Errata for Freescale root-hub TT?
On Tue, 24 Mar 2015, Peter Chen wrote: On Mon, Mar 23, 2015 at 10:11:04AM -0400, Alan Stern wrote: On Mon, 23 Mar 2015, Peter Chen wrote: For going on debugging this problem, we need I will have the hardware only for one more day, so I may not be able to get all the information you want. - Your bus analyzer file, I think there should be no enough IN/OUT tokens within one frame, does the remaining time to frame boundaries is enough? Here's an example: There are four OUT transfers near the start of the frame, and they take about 300 us. The remaining 700 us in the frame are completely idle, even though they should contain four IN transfers. How do you know the frame has filled already at that time? The software makes sure it fills frame in time before next time frame? I'm not sure I understand the question. The USB analyzer log showed something like this (this is a rough approximation because I didn't keep the original analyzer output file): Timestamp Transaction s.mmm uuu --- 0.000 000 SOF 0.000 030 Isoc OUT 0.000 091 Isoc OUT 0.000 162 Isoc OUT 0.000 224 Isoc OUT 0.001 000 SOF In this example, there are 4 OUT transfers taking about 290 us and then nothing else for the rest of the frame. I also know, from looking at the periodic file in the EHCI debugfs directory, that each frame was linked to 8 siTDs: siTD OUT, Smask = 0x01, Cmask = 0x00, transfer length = 64 siTD OUT, Smask = 0x01, Cmask = 0x00, transfer length = 64 siTD OUT, Smask = 0x02, Cmask = 0x00, transfer length = 64 siTD OUT, Smask = 0x02, Cmask = 0x00, transfer length = 64 siTD IN, Smask = 0x04, Cmask = 0x70, transfer length = 64 siTD IN, Smask = 0x04, Cmask = 0x70, transfer length = 64 siTD IN, Smask = 0x08, Cmask = 0xe0, transfer length = 64 siTD IN, Smask = 0x08, Cmask = 0xe0, transfer length = 64 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: cdc_mbim with Huawei E3372, nothing works
On Tue, 2015-03-24 at 18:02 +0700, Lars Melin wrote: On 2015-03-24 17:20, Oliver Neukum wrote: On Mon, 2015-03-23 at 21:11 +0200, Sami Farin wrote: I tried reverting f46ad73ac696 in 4.0.0-rc5, did not help. Have to reboot first into 3.18.9. This happens: [ 2765.268081] usb 2-1.4.4: USB disconnect, device number 16 [ 2777.209388] usb 2-1.4.4: new high-speed USB device number 17 using ehci-pci [ 2777.303172] usb 2-1.4.4: New USB device found, idVendor=12d1, idProduct=157d [ 2777.303174] usb 2-1.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2777.303176] usb 2-1.4.4: Product: HUAWEI_MOBILE [ 2777.303177] usb 2-1.4.4: Manufacturer: HUAWEI_MOBILE [ 2777.303178] usb 2-1.4.4: SerialNumber: 0123456789ABCDEF [ 2777.325198] usb-storage 2-1.4.4:1.0: USB Mass Storage device detected [ 2777.325282] scsi host37: usb-storage 2-1.4.4:1.0 [ 2777.903039] usb 2-1.4.4: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2 This fails. It comes from proc_setconfig(). It suggests that a change in storage causes this. To verify, could you blacklist usb-storage in a test with 4.0? Regards Oliver 12d1:157d has 2 configurations, config #1 being the virtual cd-rom containing windows drivers and config #2 containing cdc_mbim interfaces. cdc_mbim is the primary protocol for this Win8 approved dongle but it can be switched via a bulkmsg into an old Win compatibility mode which usually is cdc_ether. Yes. But the dmesg makes clear that usb_modeswitch had decided to go to config#2. It just fails. So we must look for the reason of the failure. And that is likely in the storage driver binding to the virtual CD. At this point that is just theory so I would like to see this confirmed by blacklisting usb-storage. Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: cdc_mbim with Huawei E3372, nothing works
On Tue, 2015-03-24 at 13:26 +0200, Sami Farin wrote: On Tue, Mar 24, 2015 at 18:02:51 +0700, Lars Melin wrote: On 2015-03-24 17:20, Oliver Neukum wrote: ... [ 2777.325282] scsi host37: usb-storage 2-1.4.4:1.0 [ 2777.903039] usb 2-1.4.4: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2 This fails. It comes from proc_setconfig(). It suggests that a change in storage causes this. To verify, could you blacklist usb-storage in a test with 4.0? Regards Oliver 12d1:157d has 2 configurations, config #1 being the virtual cd-rom containing windows drivers and config #2 containing cdc_mbim interfaces. cdc_mbim is the primary protocol for this Win8 approved dongle but it can be switched via a bulkmsg into an old Win compatibility mode which usually is cdc_ether. 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? Good question. Please post the full dmesg. But do you want it to? Ideally cdc_mbim would work, wouldn't it? Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: cdc_mbim with Huawei E3372, nothing works
On Tue, Mar 24, 2015 at 18:02:51 +0700, Lars Melin wrote: On 2015-03-24 17:20, Oliver Neukum wrote: ... [ 2777.325282] scsi host37: usb-storage 2-1.4.4:1.0 [ 2777.903039] usb 2-1.4.4: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2 This fails. It comes from proc_setconfig(). It suggests that a change in storage causes this. To verify, could you blacklist usb-storage in a test with 4.0? Regards Oliver 12d1:157d has 2 configurations, config #1 being the virtual cd-rom containing windows drivers and config #2 containing cdc_mbim interfaces. cdc_mbim is the primary protocol for this Win8 approved dongle but it can be switched via a bulkmsg into an old Win compatibility mode which usually is cdc_ether. 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? [57023.245141] usb 5-1: USB disconnect, device number 3 [57036.756071] usb 5-1: new high-speed USB device number 4 using xhci_hcd [57036.926823] usb 5-1: New USB device found, idVendor=12d1, idProduct=157d [57036.926827] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [57036.926828] usb 5-1: Product: HUAWEI_MOBILE [57036.926829] usb 5-1: Manufacturer: HUAWEI_MOBILE [57036.926831] usb 5-1: SerialNumber: 0123456789ABCDEF usb_modeswitch will check if the cdc_mbim driver is present in the system when it finds a dongle which has cdc_mbim attributes on its interfaces. If the driver is found then the port will be set to config #2 which is the required config number for cdc_mbim. If no driver is found then the bulk msg will be sent for switching the dongle into compatibility mode where it also will have a different usb id. -- Do what you love because life is too short for anything else. -- 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_printer: fix dependencies
If f_printer is selected without legacy g_printer, it should depend on USB_CONFIGFS which pulls in libcomposite. Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 3bb0e67..bcf83c0 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -440,6 +440,7 @@ config USB_CONFIGFS_F_UVC config USB_CONFIGFS_F_PRINTER bool Printer function select USB_F_PRINTER + depends on USB_CONFIGFS help The Printer function channels data between the USB host and a userspace program driving the print engine. The user space -- 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: cdc_mbim with Huawei E3372, nothing works
On Mon, 2015-03-23 at 21:11 +0200, Sami Farin wrote: I tried reverting f46ad73ac696 in 4.0.0-rc5, did not help. Have to reboot first into 3.18.9. This happens: [ 2765.268081] usb 2-1.4.4: USB disconnect, device number 16 [ 2777.209388] usb 2-1.4.4: new high-speed USB device number 17 using ehci-pci [ 2777.303172] usb 2-1.4.4: New USB device found, idVendor=12d1, idProduct=157d [ 2777.303174] usb 2-1.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2777.303176] usb 2-1.4.4: Product: HUAWEI_MOBILE [ 2777.303177] usb 2-1.4.4: Manufacturer: HUAWEI_MOBILE [ 2777.303178] usb 2-1.4.4: SerialNumber: 0123456789ABCDEF [ 2777.325198] usb-storage 2-1.4.4:1.0: USB Mass Storage device detected [ 2777.325282] scsi host37: usb-storage 2-1.4.4:1.0 [ 2777.903039] usb 2-1.4.4: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2 This fails. It comes from proc_setconfig(). It suggests that a change in storage causes this. To verify, could you blacklist usb-storage in a test with 4.0? Regards Oliver -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: cdc_mbim with Huawei E3372, nothing works
On 2015-03-24 18:57, Sami Farin wrote: On Tue, Mar 24, 2015 at 12:29:19 +0100, Oliver Neukum wrote: On Tue, 2015-03-24 at 13:26 +0200, Sami Farin wrote: ... 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? Good question. Please post the full dmesg. But do you want it to? Ideally cdc_mbim would work, wouldn't it? http://pastebin.com/dBUS3uy7 Please read the thread from the beginning, cdc_mbim does not work. Only errors, and no packets moving. Then run it in compatible mode while waiting for a solution to the cdc_mbim driver. Either remove the cdc_mbim driver or add NoMBIMCheck=1 in the device config file for 12d1:157d. -- 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 00/12] USB: chipidea: patchset for performance improvement
Hello Peter, On 15-03-19 09:19:11, Peter Chen wrote: Hi all, In this patch set, I add some interfaces for tuning the performance of chipidea usb driver. With this set, the USB performance can be improved at some user cases with suitable parameters. The main changes: - Interface to tune interrupt threshold control, and set 'Immediate' for default value - The glue layer can disable stream mode according to USB role - Interface to tune AHB burst configuration at SBUSCFG - Interface to tune tx/rx burst size - i.mx changes for achieving better performance, it can reduce the latecy between bus and USB FIFO, and reduce the overrun and underrun occurrences, it is useful for the system bus is busy. we see great improvement for ISO transfer, eg, high resolution USB camera when the bus is busy. Below are some test results at imx6sx sdb board (set ehci_hcd.park=3 at bootargs), the tests are done at v4.0 kernel, no other bus loading during the tests, so we have not seen performance change for some use cases. USB Mass Storage (Host mode) With Patch SetWithout Patch Set R: 26.9 MB/s 27 MB/s W: 25.2 MB/s 24.5 MB/s 1G USB Ethernet Card With Patch SetWithout Patch Set TX: 186 Mb/s 185 Mb/s RX: 219 Mb/s 216 Mb/s g_ncm (Device Mode) With Patch SetWithout Patch Set TX: 166MB/s 163MB/s RX: 230MB/s 184MB/s I tested these patches on a Colibri Vybrid VF61. Have not applied the 7th and 11th patch, but, the changes these patches introduce, I added them to our device tree node. These would be the addition of ahb-burst-config = 0x0 and tx-burst-size-dword = 0x10 and rx-burst-size-dword = 0x10 to the usb node in vfxxx.dtsi file for both the peripheral and host usb nodes. I used hdparm and dd for the tests. Some of the readings are below. With this patchset applied Reads hdparm -t --direct /dev/sda /dev/sda: Timing O_DIRECT disk reads: 36 MB in 3.05 seconds = 11.80 MB/sec Writes root@colibri-vf:~# time dd if=/dev/zero bs=128k count=4096 of=/media/sda1/tmpfile 4096+0 records in 4096+0 records out real1m11.671s user0m0.010s sys 0m10.130s USB Client - RNDIS root@colibri-vf:~# iperf -c 192.168.1.1 Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 43.8 KByte (default) [ 3] local 192.168.1.2 port 41317 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 105 MBytes 88.2 Mbits/sec Without this patchset applied Reads hdparm -t --direct /dev/sda /dev/sda: Timing O_DIRECT disk reads: 78 MB in 3.06 seconds = 25.50 MB/sec Writes root@colibri-vf:~# time dd if=/dev/zero bs=128k count=4096 of=/media/sda1/tmpfil 4096+0 records in 4096+0 records out real0m43.807s user0m0.050s sys 0m9.960s USB Client - RNDIS root@colibri-vf:~# iperf -c 192.168.1.1 Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 43.8 KByte (default) [ 3] local 192.168.1.2 port 49857 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 138 MBytes 116 Mbits/sec Perhaps I am missing something? I have the ehci_hcd.park=3 set. root@colibri-vf:~# cat /proc/cmdline ehci_hcd.park=3 ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs ubi.fm_autoconvert=1 mtdparts=vf610_nfc:128k(vf-bcb)ro,1408k( u-boot)ro,512k(u-boot-env),-(ubi) fec_mac= consoleblank=0 console=tty1 console=ttyLP0,115200n8 mem=256M Is there any other parameter or variable I need to set? - Sanchayan Peter Chen (12): Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc usb: chipidea: set ITC to 0 for device mode usb: chipidea: define stream mode disable for both roles usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx usb: chipidea: introduce ci_platform_config Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc ARM: imx6: set ahb-burst-config as 0 for USB usb: chipidea: add ahb burst configuration usb: chipidea: usbmisc_imx: add unburst setting for imx6 Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc ARM: imx6: change default burst size for USB usb: chipidea: add burst size configuration interface .../devicetree/bindings/usb/ci-hdrc-imx.txt| 12 +++ arch/arm/boot/dts/imx6qdl.dtsi | 12 +++ arch/arm/boot/dts/imx6sl.dtsi | 9 ++ arch/arm/boot/dts/imx6sx.dtsi | 9 ++ drivers/usb/chipidea/bits.h| 7 ++ drivers/usb/chipidea/ci.h | 3 + drivers/usb/chipidea/ci_hdrc_imx.c | 14 ++-
Re: cdc_mbim with Huawei E3372, nothing works
On 2015-03-24 17:20, Oliver Neukum wrote: On Mon, 2015-03-23 at 21:11 +0200, Sami Farin wrote: I tried reverting f46ad73ac696 in 4.0.0-rc5, did not help. Have to reboot first into 3.18.9. This happens: [ 2765.268081] usb 2-1.4.4: USB disconnect, device number 16 [ 2777.209388] usb 2-1.4.4: new high-speed USB device number 17 using ehci-pci [ 2777.303172] usb 2-1.4.4: New USB device found, idVendor=12d1, idProduct=157d [ 2777.303174] usb 2-1.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2777.303176] usb 2-1.4.4: Product: HUAWEI_MOBILE [ 2777.303177] usb 2-1.4.4: Manufacturer: HUAWEI_MOBILE [ 2777.303178] usb 2-1.4.4: SerialNumber: 0123456789ABCDEF [ 2777.325198] usb-storage 2-1.4.4:1.0: USB Mass Storage device detected [ 2777.325282] scsi host37: usb-storage 2-1.4.4:1.0 [ 2777.903039] usb 2-1.4.4: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2 This fails. It comes from proc_setconfig(). It suggests that a change in storage causes this. To verify, could you blacklist usb-storage in a test with 4.0? Regards Oliver 12d1:157d has 2 configurations, config #1 being the virtual cd-rom containing windows drivers and config #2 containing cdc_mbim interfaces. cdc_mbim is the primary protocol for this Win8 approved dongle but it can be switched via a bulkmsg into an old Win compatibility mode which usually is cdc_ether. usb_modeswitch will check if the cdc_mbim driver is present in the system when it finds a dongle which has cdc_mbim attributes on its interfaces. If the driver is found then the port will be set to config #2 which is the required config number for cdc_mbim. If no driver is found then the bulk msg will be sent for switching the dongle into compatibility mode where it also will have a different usb id. -- 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: cdc_mbim with Huawei E3372, nothing works
On Tue, Mar 24, 2015 at 12:29:19 +0100, Oliver Neukum wrote: On Tue, 2015-03-24 at 13:26 +0200, Sami Farin wrote: ... 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? Good question. Please post the full dmesg. But do you want it to? Ideally cdc_mbim would work, wouldn't it? http://pastebin.com/dBUS3uy7 Please read the thread from the beginning, cdc_mbim does not work. Only errors, and no packets moving. -- Do what you love because life is too short for anything else. -- 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: cdc_mbim with Huawei E3372, nothing works
On 2015-03-24 18:26, Sami Farin wrote: On Tue, Mar 24, 2015 at 18:02:51 +0700, Lars Melin wrote: On 2015-03-24 17:20, Oliver Neukum wrote: ... [ 2777.325282] scsi host37: usb-storage 2-1.4.4:1.0 [ 2777.903039] usb 2-1.4.4: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2 This fails. It comes from proc_setconfig(). It suggests that a change in storage causes this. To verify, could you blacklist usb-storage in a test with 4.0? Regards Oliver 12d1:157d has 2 configurations, config #1 being the virtual cd-rom containing windows drivers and config #2 containing cdc_mbim interfaces. cdc_mbim is the primary protocol for this Win8 approved dongle but it can be switched via a bulkmsg into an old Win compatibility mode which usually is cdc_ether. 4.0.0-rc5+ does not switch to old Win mode even if I blacklist usb_storage, have to reboot to 3.18.9. Why? [57023.245141] usb 5-1: USB disconnect, device number 3 [57036.756071] usb 5-1: new high-speed USB device number 4 using xhci_hcd [57036.926823] usb 5-1: New USB device found, idVendor=12d1, idProduct=157d [57036.926827] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [57036.926828] usb 5-1: Product: HUAWEI_MOBILE [57036.926829] usb 5-1: Manufacturer: HUAWEI_MOBILE [57036.926831] usb 5-1: SerialNumber: 0123456789ABCDEF usb_modeswitch will check if the cdc_mbim driver is present in the system when it finds a dongle which has cdc_mbim attributes on its interfaces. If the driver is found then the port will be set to config #2 which is the required config number for cdc_mbim. If no driver is found then the bulk msg will be sent for switching the dongle into compatibility mode where it also will have a different usb id. Blacklisting usb_storage will not change the behavior of usb_modeswitch. Your dongle has cdc_mbim interfaces and you have the cdc_mbim driver in 4.0.0-rc5 so usb_modeswitch will select config #2. If you remove the cdc_mbim driver from your system then you will get a traditional mode switch into cdc_ether compatibility mode. -- 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: musb: only set test mode once
-Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 4:28 PM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 12:16:25PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 12:11 PM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 12:05:20PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:54 AM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 11:52:04AM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } USB2 spec says you *must* go through a bus reset in order to get out of testmode. So if you want to change test_j to test_k, you must first bus reset. Yes, this will be handled in if branch - dev_err(): dev_err(musb-controller, Error: test mode is already running. Please do USB Bus Reset to start a new test\n); that's alright, but that if (new test is different) check is pointless ;-) Ok, I see your point now. What I wanted to enhance is to not print the annoying message when user runs the *same* test mode command multiple times. I don't have a strong opinion on either one. You make the call ;) let the user get annoyed so he quits the nonsense :-) Yup, that was what I picked in v2 ;) Please review it. Thanks, -Bin. -- 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: musb: only set test mode once
On Tue, Mar 24, 2015 at 12:16:25PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 12:11 PM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 12:05:20PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:54 AM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 11:52:04AM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } USB2 spec says you *must* go through a bus reset in order to get out of testmode. So if you want to change test_j to test_k, you must first bus reset. Yes, this will be handled in if branch - dev_err(): dev_err(musb-controller, Error: test mode is already running. Please do USB Bus Reset to start a new test\n); that's alright, but that if (new test is different) check is pointless ;-) Ok, I see your point now. What I wanted to enhance is to not print the annoying message when user runs the *same* test mode command multiple times. I don't have a strong opinion on either one. You make the call ;) let the user get annoyed so he quits the nonsense :-) -- balbi signature.asc Description: Digital signature
Re: [GIT PULL] USB fix for v4.0-rc6
On Tue, Mar 24, 2015 at 12:02:15PM -0500, Felipe Balbi wrote: Hi Greg, Here's a single fix for isp1760. Please consider merging it to usb/linus. cheers The following changes since commit bc465aa9d045feb0e13b4a8f32cc33c1943f62d6: Linux 4.0-rc5 (2015-03-22 16:50:21 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/fixes-for-v4.0-rc6 Pulled and pushed out, thanks. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: add softconnect for host mode
On Tue, Mar 24, 2015 at 11:49:53PM +0200, Tal Shorer wrote: Mostly out of curiosity, why a debugfs interface and not an attribute in sysfs? mostly out of curiosity, why deleting the entire context ? -- balbi signature.asc Description: Digital signature
Re: [GIT PULL] USB patches for v4.1 merge window
On Tue, Mar 24, 2015 at 12:08:32PM -0500, Felipe Balbi wrote: Hi Greg, Because of ELC, I have to cut short on patch queueing this time. In any case, we have some pretty good content for v4.1. Patches have been tested with platforms I have around (heh, took me a while to do that remotely) and most have been in next for several days. Let me know if you want anything to be changed. cheers ps: I was hoping you'd be at ELC, but aparently I was wrong :-) I'm in France for 2 months, couldn't make it, it's the first I've missed in years :( The following changes since commit 9eccca0843205f87c00404b663188b88eb248051: Linux 4.0-rc3 (2015-03-08 16:09:09 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v4.1 Pulled and pushed out, thanks. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: add softconnect for host mode
Mostly out of curiosity, why a debugfs interface and not an attribute in sysfs? -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL] USB patches for v4.1 merge window
On Tue, Mar 24, 2015 at 10:58:46PM +0100, Greg KH wrote: On Tue, Mar 24, 2015 at 12:08:32PM -0500, Felipe Balbi wrote: Hi Greg, Because of ELC, I have to cut short on patch queueing this time. In any case, we have some pretty good content for v4.1. Patches have been tested with platforms I have around (heh, took me a while to do that remotely) and most have been in next for several days. Let me know if you want anything to be changed. cheers ps: I was hoping you'd be at ELC, but aparently I was wrong :-) I'm in France for 2 months, couldn't make it, it's the first I've missed in years :( Have fun, there will be other conferences :-) The following changes since commit 9eccca0843205f87c00404b663188b88eb248051: Linux 4.0-rc3 (2015-03-08 16:09:09 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v4.1 Pulled and pushed out, thanks. tks -- balbi signature.asc Description: Digital signature
Re: Errata for Freescale root-hub TT?
On Tue, Mar 24, 2015 at 10:15:38AM -0400, Alan Stern wrote: On Tue, 24 Mar 2015, Peter Chen wrote: On Mon, Mar 23, 2015 at 10:11:04AM -0400, Alan Stern wrote: On Mon, 23 Mar 2015, Peter Chen wrote: For going on debugging this problem, we need I will have the hardware only for one more day, so I may not be able to get all the information you want. - Your bus analyzer file, I think there should be no enough IN/OUT tokens within one frame, does the remaining time to frame boundaries is enough? Here's an example: There are four OUT transfers near the start of the frame, and they take about 300 us. The remaining 700 us in the frame are completely idle, even though they should contain four IN transfers. How do you know the frame has filled already at that time? The software makes sure it fills frame in time before next time frame? I'm not sure I understand the question. The USB analyzer log showed something like this (this is a rough approximation because I didn't keep the original analyzer output file): Timestamp Transaction s.mmm uuu --- 0.000 000 SOF 0.000 030 Isoc OUT 0.000 091 Isoc OUT 0.000 162 Isoc OUT 0.000 224 Isoc OUT 0.001 000 SOF In this example, there are 4 OUT transfers taking about 290 us and then nothing else for the rest of the frame. I also know, from looking at the periodic file in the EHCI debugfs directory, that each frame was linked to 8 siTDs: siTD OUT, Smask = 0x01, Cmask = 0x00, transfer length = 64 siTD OUT, Smask = 0x01, Cmask = 0x00, transfer length = 64 siTD OUT, Smask = 0x02, Cmask = 0x00, transfer length = 64 siTD OUT, Smask = 0x02, Cmask = 0x00, transfer length = 64 siTD IN, Smask = 0x04, Cmask = 0x70, transfer length = 64 siTD IN, Smask = 0x04, Cmask = 0x70, transfer length = 64 siTD IN, Smask = 0x08, Cmask = 0xe0, transfer length = 64 siTD IN, Smask = 0x08, Cmask = 0xe0, transfer length = 64 I did not debug too many for Host ISOC, I just want to make sure the siTD is ready before the controller read it? Does it fail at the beginning or running several cycles? -- 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 v4 02/22] usb: dwc2: debugfs: add support for complete register dump
Dump all registers to take a complete snapshot of dwc2 state. Code is inspired by dwc3/debugfs.c Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/core.h| 1 + drivers/usb/dwc2/debugfs.c | 357 + 2 files changed, 358 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 3695c6f..1fd8d2b 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -615,6 +615,7 @@ struct dwc2_hsotg { enum dwc2_lx_state lx_state; struct dentry *debug_root; + struct debugfs_regset32 *regset; /* DWC OTG HW Release versions */ #define DWC2_CORE_REV_2_71a0x4f54271a diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c index e57e554..af89537 100644 --- a/drivers/usb/dwc2/debugfs.c +++ b/drivers/usb/dwc2/debugfs.c @@ -391,9 +391,344 @@ static inline void s3c_hsotg_create_debug(struct dwc2_hsotg *hsotg) {} /* s3c_hsotg_delete_debug is removed as cleanup in done in dwc2_debugfs_exit */ +#define dump_register(nm) \ +{ \ + .name = #nm, \ + .offset = nm, \ +} + +static const struct debugfs_reg32 dwc2_regs[] = { + /* +* Accessing registers like this can trigger mode mismatch interrupt. +* However, according to dwc2 databook, the register access, in this +* case, is completed on the processor bus but is ignored by the core +* and does not affect its operation. +*/ + dump_register(GOTGCTL), + dump_register(GOTGINT), + dump_register(GAHBCFG), + dump_register(GUSBCFG), + dump_register(GRSTCTL), + dump_register(GINTSTS), + dump_register(GINTMSK), + dump_register(GRXSTSR), + dump_register(GRXSTSP), + dump_register(GRXFSIZ), + dump_register(GNPTXFSIZ), + dump_register(GNPTXSTS), + dump_register(GI2CCTL), + dump_register(GPVNDCTL), + dump_register(GGPIO), + dump_register(GUID), + dump_register(GSNPSID), + dump_register(GHWCFG1), + dump_register(GHWCFG2), + dump_register(GHWCFG3), + dump_register(GHWCFG4), + dump_register(GLPMCFG), + dump_register(GPWRDN), + dump_register(GDFIFOCFG), + dump_register(ADPCTL), + dump_register(HPTXFSIZ), + dump_register(DPTXFSIZN(1)), + dump_register(DPTXFSIZN(2)), + dump_register(DPTXFSIZN(3)), + dump_register(DPTXFSIZN(4)), + dump_register(DPTXFSIZN(5)), + dump_register(DPTXFSIZN(6)), + dump_register(DPTXFSIZN(7)), + dump_register(DPTXFSIZN(8)), + dump_register(DPTXFSIZN(9)), + dump_register(DPTXFSIZN(10)), + dump_register(DPTXFSIZN(11)), + dump_register(DPTXFSIZN(12)), + dump_register(DPTXFSIZN(13)), + dump_register(DPTXFSIZN(14)), + dump_register(DPTXFSIZN(15)), + dump_register(DCFG), + dump_register(DCTL), + dump_register(DSTS), + dump_register(DIEPMSK), + dump_register(DOEPMSK), + dump_register(DAINT), + dump_register(DAINTMSK), + dump_register(DTKNQR1), + dump_register(DTKNQR2), + dump_register(DTKNQR3), + dump_register(DTKNQR4), + dump_register(DVBUSDIS), + dump_register(DVBUSPULSE), + dump_register(DIEPCTL(0)), + dump_register(DIEPCTL(1)), + dump_register(DIEPCTL(2)), + dump_register(DIEPCTL(3)), + dump_register(DIEPCTL(4)), + dump_register(DIEPCTL(5)), + dump_register(DIEPCTL(6)), + dump_register(DIEPCTL(7)), + dump_register(DIEPCTL(8)), + dump_register(DIEPCTL(9)), + dump_register(DIEPCTL(10)), + dump_register(DIEPCTL(11)), + dump_register(DIEPCTL(12)), + dump_register(DIEPCTL(13)), + dump_register(DIEPCTL(14)), + dump_register(DIEPCTL(15)), + dump_register(DOEPCTL(0)), + dump_register(DOEPCTL(1)), + dump_register(DOEPCTL(2)), + dump_register(DOEPCTL(3)), + dump_register(DOEPCTL(4)), + dump_register(DOEPCTL(5)), + dump_register(DOEPCTL(6)), + dump_register(DOEPCTL(7)), + dump_register(DOEPCTL(8)), + dump_register(DOEPCTL(9)), + dump_register(DOEPCTL(10)), + dump_register(DOEPCTL(11)), + dump_register(DOEPCTL(12)), + dump_register(DOEPCTL(13)), + dump_register(DOEPCTL(14)), + dump_register(DOEPCTL(15)), + dump_register(DIEPINT(0)), + dump_register(DIEPINT(1)), + dump_register(DIEPINT(2)), + dump_register(DIEPINT(3)), + dump_register(DIEPINT(4)), + dump_register(DIEPINT(5)), + dump_register(DIEPINT(6)), + dump_register(DIEPINT(7)), + dump_register(DIEPINT(8)), + dump_register(DIEPINT(9)), + dump_register(DIEPINT(10)), + dump_register(DIEPINT(11)), + dump_register(DIEPINT(12)), + dump_register(DIEPINT(13)), +
[PATCH v4 01/22] usb: dwc2: move debugfs code to a separate file
Prepare to add more debug code. Moreover, don't save dentry * for each file in struct dwc2_hsotg as clean up is done with debugfs_remove_recursive(). s3c_hsotg_delete_debug() is removed altogether for the same reason. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/Makefile | 4 + drivers/usb/dwc2/core.h | 7 +- drivers/usb/dwc2/debug.h| 27 +++ drivers/usb/dwc2/debugfs.c | 416 drivers/usb/dwc2/gadget.c | 405 +- drivers/usb/dwc2/platform.c | 4 + 6 files changed, 456 insertions(+), 407 deletions(-) create mode 100644 drivers/usb/dwc2/debug.h create mode 100644 drivers/usb/dwc2/debugfs.c diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile index f07b425..324fbb4 100644 --- a/drivers/usb/dwc2/Makefile +++ b/drivers/usb/dwc2/Makefile @@ -13,6 +13,10 @@ ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),) dwc2-y += gadget.o endif +ifneq ($(CONFIG_DEBUG_FS),) + dwc2-y += debugfs.o +endif + # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to # this location and renamed gadget.c. When building for dynamically linked # modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 836c012..3695c6f 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -615,9 +615,6 @@ struct dwc2_hsotg { enum dwc2_lx_state lx_state; struct dentry *debug_root; - struct dentry *debug_file; - struct dentry *debug_testmode; - struct dentry *debug_fifo; /* DWC OTG HW Release versions */ #define DWC2_CORE_REV_2_71a0x4f54271a @@ -1005,6 +1002,7 @@ extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, bool reset); extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg); extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2); +extern int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); #else static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) { return 0; } @@ -1018,6 +1016,9 @@ static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, bool reset) {} static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {} static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {} +static inline int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, + int testmode) +{ return 0; } #endif #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) diff --git a/drivers/usb/dwc2/debug.h b/drivers/usb/dwc2/debug.h new file mode 100644 index 000..12dbd1d --- /dev/null +++ b/drivers/usb/dwc2/debug.h @@ -0,0 +1,27 @@ +/** + * debug.h - Designware USB2 DRD controller debug header + * + * Copyright (C) 2015 Intel Corporation + * Mian Yousaf Kaukab yousaf.kau...@intel.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 of + * the License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include core.h + +#ifdef CONFIG_DEBUG_FS +extern int dwc2_debugfs_init(struct dwc2_hsotg *); +extern void dwc2_debugfs_exit(struct dwc2_hsotg *); +#else +static inline int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) +{ return 0; } +static inline void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg) +{ } +#endif diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c new file mode 100644 index 000..e57e554 --- /dev/null +++ b/drivers/usb/dwc2/debugfs.c @@ -0,0 +1,416 @@ +/** + * debugfs.c - Designware USB2 DRD controller debugfs + * + * Copyright (C) 2015 Intel Corporation + * Mian Yousaf Kaukab yousaf.kau...@intel.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 of + * the License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/spinlock.h +#include linux/debugfs.h +#include linux/seq_file.h +#include linux/uaccess.h + +#include core.h +#include debug.h + +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ + IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) +/** + * testmode_write - debugfs: change usb test mode + * @seq: The seq file
[PATCH v4 04/22] usb: dwc2: implement hibernation during bus suspend/resume
From: Gregory Herrero gregory.herr...@intel.com Allow controller to enter in hibernation during usb bus suspend and inform both phy and gadget about the suspended state. While in hibernation, the controller can't detect the resume condition. An external mechanism must call usb_phy_set_suspend on resume. Exit hibernation when controller gets the resume interrupt and inform only gadget driver about it. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/core_intr.c | 32 2 files changed, 34 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index b0ee951..e6abc28 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1088,6 +1088,7 @@ extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg); extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2); extern int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); +#define dwc2_is_device_connected(hsotg) (hsotg-connected) #else static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) { return 0; } @@ -1104,6 +1105,7 @@ static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {} static inline int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode) { return 0; } +#define dwc2_is_device_connected(hsotg) (0) #endif #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 02e3e2d..42f2fd5 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -334,6 +334,7 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) */ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) { + int ret; dev_dbg(hsotg-dev, ++Resume or Remote Wakeup Detected Interrupt++\n); dev_dbg(hsotg-dev, %s lxstate = %d\n, __func__, hsotg-lx_state); @@ -345,6 +346,11 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Clear Remote Wakeup Signaling */ dctl = ~DCTL_RMTWKUPSIG; writel(dctl, hsotg-regs + DCTL); + ret = dwc2_exit_hibernation(hsotg, true); + if (ret) + dev_err(hsotg-dev, exit hibernation failed\n); + + call_gadget(hsotg, resume); } /* Change to L0 state */ hsotg-lx_state = DWC2_L0; @@ -394,6 +400,7 @@ static void dwc2_handle_disconnect_intr(struct dwc2_hsotg *hsotg) static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) { u32 dsts; + int ret; dev_dbg(hsotg-dev, USB SUSPEND\n); @@ -408,6 +415,30 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) DSTS.Suspend Status=%d HWCFG4.Power Optimize=%d\n, !!(dsts DSTS_SUSPSTS), hsotg-hw_params.power_optimized); + if ((dsts DSTS_SUSPSTS) hsotg-hw_params.power_optimized) { + /* Ignore suspend request before enumeration */ + if (!dwc2_is_device_connected(hsotg)) { + dev_dbg(hsotg-dev, + ignore suspend request before enumeration\n); + goto clear_int; + } + + ret = dwc2_enter_hibernation(hsotg); + if (ret) { + dev_err(hsotg-dev, + enter hibernation failed\n); + goto skip_power_saving; + } + + udelay(100); + + /* Ask phy to be suspended */ + if (!IS_ERR_OR_NULL(hsotg-uphy)) + usb_phy_set_suspend(hsotg-uphy, true); +skip_power_saving: + /* Call gadget suspend callback */ + call_gadget(hsotg, suspend); + } } else { if (hsotg-op_state == OTG_STATE_A_PERIPHERAL) { dev_dbg(hsotg-dev, a_peripheral-a_host\n); @@ -423,6 +454,7 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) /* Change to L2 (suspend) state */ hsotg-lx_state = DWC2_L2; +clear_int: /* Clear interrupt */ writel(GINTSTS_USBSUSP, hsotg-regs + GINTSTS); } -- 2.3.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 03/22] usb: dwc2: add controller hibernation support
From: Gregory Herrero gregory.herr...@intel.com When suspending usb bus, phy driver may disable controller power. In this case, registers need to be saved on suspend and restored on resume. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/core.c | 377 drivers/usb/dwc2/core.h | 84 +++ 2 files changed, 461 insertions(+) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index d5197d4..889dc5f 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -56,6 +56,383 @@ #include core.h #include hcd.h +#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) +/** + * dwc2_backup_host_registers() - Backup controller host registers. + * When suspending usb bus, registers needs to be backuped + * if controller power is disabled once suspended. + * + * @hsotg: Programming view of the DWC_otg controller + */ +static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_hregs_backup *hr; + int i; + + dev_dbg(hsotg-dev, %s\n, __func__); + + /* Backup Host regs */ + hr = hsotg-hr_backup; + if (!hr) { + hr = devm_kzalloc(hsotg-dev, sizeof(*hr), GFP_KERNEL); + if (!hr) { + dev_err(hsotg-dev, %s: can't allocate host regs\n, + __func__); + return -ENOMEM; + } + + hsotg-hr_backup = hr; + } + hr-hcfg = readl(hsotg-regs + HCFG); + hr-haintmsk = readl(hsotg-regs + HAINTMSK); + for (i = 0; i hsotg-core_params-host_channels; ++i) + hr-hcintmsk[i] = readl(hsotg-regs + HCINTMSK(i)); + + hr-hprt0 = readl(hsotg-regs + HPRT0); + hr-hfir = readl(hsotg-regs + HFIR); + + return 0; +} + +/** + * dwc2_restore_host_registers() - Restore controller host registers. + * When resuming usb bus, device registers needs to be restored + * if controller power were disabled. + * + * @hsotg: Programming view of the DWC_otg controller + */ +static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_hregs_backup *hr; + int i; + + dev_dbg(hsotg-dev, %s\n, __func__); + + /* Restore host regs */ + hr = hsotg-hr_backup; + if (!hr) { + dev_err(hsotg-dev, %s: no host registers to restore\n, + __func__); + return -EINVAL; + } + + writel(hr-hcfg, hsotg-regs + HCFG); + writel(hr-haintmsk, hsotg-regs + HAINTMSK); + + for (i = 0; i hsotg-core_params-host_channels; ++i) + writel(hr-hcintmsk[i], hsotg-regs + HCINTMSK(i)); + + writel(hr-hprt0, hsotg-regs + HPRT0); + writel(hr-hfir, hsotg-regs + HFIR); + + return 0; +} +#else +static inline int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) +{ return 0; } + +static inline int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) +{ return 0; } +#endif + +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ + IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) +/** + * dwc2_backup_device_registers() - Backup controller device registers. + * When suspending usb bus, registers needs to be backuped + * if controller power is disabled once suspended. + * + * @hsotg: Programming view of the DWC_otg controller + */ +static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_dregs_backup *dr; + int i; + + dev_dbg(hsotg-dev, %s\n, __func__); + + /* Backup dev regs */ + dr = hsotg-dr_backup; + if (!dr) { + dr = devm_kzalloc(hsotg-dev, sizeof(*dr), GFP_KERNEL); + if (!dr) { + dev_err(hsotg-dev, %s: can't allocate device regs\n, + __func__); + return -ENOMEM; + } + + hsotg-dr_backup = dr; + } + + dr-dcfg = readl(hsotg-regs + DCFG); + dr-dctl = readl(hsotg-regs + DCTL); + dr-daintmsk = readl(hsotg-regs + DAINTMSK); + dr-diepmsk = readl(hsotg-regs + DIEPMSK); + dr-doepmsk = readl(hsotg-regs + DOEPMSK); + + for (i = 0; i hsotg-num_of_eps; i++) { + /* Backup IN EPs */ + dr-diepctl[i] = readl(hsotg-regs + DIEPCTL(i)); + + /* Ensure DATA PID is correctly configured */ + if (dr-diepctl[i] DXEPCTL_DPID) + dr-diepctl[i] |= DXEPCTL_SETD1PID; + else + dr-diepctl[i] |= DXEPCTL_SETD0PID; + + dr-dieptsiz[i] = readl(hsotg-regs + DIEPTSIZ(i)); + dr-diepdma[i] = readl(hsotg-regs + DIEPDMA(i)); + + /* Backup OUT EPs */ + dr-doepctl[i] = readl(hsotg-regs + DOEPCTL(i)); + + /* Ensure DATA PID is correctly configured */ + if (dr-doepctl[i] DXEPCTL_DPID) +
[PATCH v4 00/22] usb: third series of updates for dwc2 driver
Hi, This patchset consists of some bug fixes and feature enhancements for the dwc2 driver. All the patches are verified on dwc2 v3.0a with dedicated fifos. Main focus of testing was with dma enabled. Although basic testing without dma was also done. This is based on testing/next branch in Felipe's git. Thank you, Best regards, Yousaf History: v4: - Fixed comment from Julius Werner v3: - Fixed comments from Julius Werner and Sergei Shtylyov - Dropped usb: dwc2: allow dwc2_pci to be a module even when dwc2 is statically linked due to http://marc.info/?l=linux-usbm=142661773703793w=2 - usb: dwc2: host: ensure qtb exists before dereferencing it is added to fix a NULL pointer dereferencing bug v2: - Fixed comments from John Youn and Julius Werner - Fixed regression, found by John, when switching to gadget mode after running host mode - Added patch to add core parameter for enabling/disabling hibernation - Added patch to build dwc2_pci.ko independent from dwc2.ko v1: - Fixed comments from John Youn and Robert Baldyga - Dropped all changes to pci.c due to http://permalink.gmane.org/gmane.linux.usb.general/123411 - Added patch to remove unnecessary EXPORT_SYMBOL_GPL calls Gregory Herrero (15): usb: dwc2: add controller hibernation support usb: dwc2: implement hibernation during bus suspend/resume usb: dwc2: controller must update lx_state before releasing lock usb: dwc2: add external_id_pin_ctl core parameter usb: dwc2: gadget: use reset detect interrupt usb: dwc2: gadget: ignore pm suspend/resume in L2 usb: dwc2: gadget: prevent new request submission during suspend usb: dwc2: gadget: powerup controller if needed usb: dwc2: gadget: enable otg flag in dual role configuration usb: dwc2: host: add bus_suspend/bus_resume callback usb: dwc2: host: resume root hub on port connect usb: dwc2: host: spinlock urb_enqueue usb: dwc2: host: don't use dma_alloc_coherent with irqs disabled usb: dwc2: add hibernation core parameter usb: dwc2: host: ensure qtb exists before dereferencing it Jingwu Lin (1): usb: dwc2: host: implement test mode Mian Yousaf Kaukab (6): usb: dwc2: move debugfs code to a separate file usb: dwc2: debugfs: add support for complete register dump usb: dwc2: set parameter values in probe function usb: dwc2: gadget: remove s3c_hsotg_ep_disable_force usb: dwc2: host: register handle to the phy usb: dwc2: remove dwc2_platform.ko drivers/usb/dwc2/Kconfig | 8 - drivers/usb/dwc2/Makefile| 9 +- drivers/usb/dwc2/core.c | 439 +++- drivers/usb/dwc2/core.h | 120 ++- drivers/usb/dwc2/core_intr.c | 45 ++- drivers/usb/dwc2/debug.h | 27 ++ drivers/usb/dwc2/debugfs.c | 771 +++ drivers/usb/dwc2/gadget.c| 459 +++--- drivers/usb/dwc2/hcd.c | 100 +++--- drivers/usb/dwc2/hcd.h | 7 +- drivers/usb/dwc2/hcd_intr.c | 66 +++- drivers/usb/dwc2/hcd_queue.c | 15 +- drivers/usb/dwc2/platform.c | 25 +- 13 files changed, 1570 insertions(+), 521 deletions(-) create mode 100644 drivers/usb/dwc2/debug.h create mode 100644 drivers/usb/dwc2/debugfs.c -- 2.3.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 14/22] usb: dwc2: host: register handle to the phy
If phy driver is present register hcd handle to it. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/hcd.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 1cca5e0..919658e 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2913,6 +2913,9 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) /* Don't support SG list at this point */ hcd-self.sg_tablesize = 0; + if (!IS_ERR_OR_NULL(hsotg-uphy)) + otg_set_host(hsotg-uphy-otg, hcd-self); + /* * Finish generic HCD initialization and start the HCD. This function * allocates the DMA buffer pool, registers the USB bus, requests the @@ -2966,6 +2969,9 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) return; } + if (!IS_ERR_OR_NULL(hsotg-uphy)) + otg_set_host(hsotg-uphy-otg, NULL); + usb_remove_hcd(hcd); hsotg-priv = NULL; dwc2_hcd_release(hsotg); -- 2.3.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 22/22] usb: dwc2: host: ensure qtb exists before dereferencing it
From: Gregory Herrero gregory.herr...@intel.com dwc2_hc_nak_intr could be called with a NULL qtd. Ensure qtd exists before dereferencing it to avoid kernel panic. This happens when using usb to ethernet adapter. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/hcd_intr.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 6ea8eb6..4cc95df 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -1208,6 +1208,16 @@ static void dwc2_hc_nak_intr(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, int chnum, struct dwc2_qtd *qtd) { + if (!qtd) { + dev_dbg(hsotg-dev, %s: qtd is NULL\n, __func__); + return; + } + + if (!qtd-urb) { + dev_dbg(hsotg-dev, %s: qtd-urb is NULL\n, __func__); + return; + } + if (dbg_hc(chan)) dev_vdbg(hsotg-dev, --Host Channel %d Interrupt: NAK Received--\n, chnum); -- 2.3.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 17/22] usb: dwc2: host: spinlock urb_enqueue
From: Gregory Herrero gregory.herr...@intel.com During urb_enqueue, if the urb can't be queued to the endpoint, the urb is freed without any spinlock protection. This leads to memory corruption when concurrent urb_dequeue try to free same urb-hcpriv. Thus, ensure the whole urb_enqueue in spinlocked. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/hcd.c | 15 ++- drivers/usb/dwc2/hcd_queue.c | 8 +--- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index bc04b3f8..763b63b 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -357,12 +357,12 @@ void dwc2_hcd_stop(struct dwc2_hsotg *hsotg) writel(0, hsotg-regs + HPRT0); } +/* Caller must hold driver lock */ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, struct dwc2_hcd_urb *urb, void **ep_handle, gfp_t mem_flags) { struct dwc2_qtd *qtd; - unsigned long flags; u32 intr_mask; int retval; int dev_speed; @@ -413,11 +413,9 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, */ return 0; - spin_lock_irqsave(hsotg-lock, flags); tr_type = dwc2_hcd_select_transactions(hsotg); if (tr_type != DWC2_TRANSACTION_NONE) dwc2_hcd_queue_transactions(hsotg, tr_type); - spin_unlock_irqrestore(hsotg-lock, flags); } return 0; @@ -2484,7 +2482,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, %s: unaligned transfer with no transfer_buffer, __func__); retval = -EINVAL; - goto fail1; + goto fail0; } } @@ -2512,7 +2510,6 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, spin_lock_irqsave(hsotg-lock, flags); retval = usb_hcd_link_urb_to_ep(hcd, urb); - spin_unlock_irqrestore(hsotg-lock, flags); if (retval) goto fail1; @@ -2521,22 +2518,22 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, goto fail2; if (alloc_bandwidth) { - spin_lock_irqsave(hsotg-lock, flags); dwc2_allocate_bus_bandwidth(hcd, dwc2_hcd_get_ep_bandwidth(hsotg, ep), urb); - spin_unlock_irqrestore(hsotg-lock, flags); } + spin_unlock_irqrestore(hsotg-lock, flags); + return 0; fail2: - spin_lock_irqsave(hsotg-lock, flags); dwc2_urb-priv = NULL; usb_hcd_unlink_urb_from_ep(hcd, urb); - spin_unlock_irqrestore(hsotg-lock, flags); fail1: + spin_unlock_irqrestore(hsotg-lock, flags); urb-hcpriv = NULL; +fail0: kfree(dwc2_urb); return retval; diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index bb97838..63207dc 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c @@ -761,6 +761,7 @@ void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb) /** * dwc2_hcd_qtd_add() - Adds a QTD to the QTD-list of a QH + * Caller must hold driver lock. * * @hsotg:The DWC HCD structure * @qtd: The QTD to add @@ -777,7 +778,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, struct dwc2_qh **qh, gfp_t mem_flags) { struct dwc2_hcd_urb *urb = qtd-urb; - unsigned long flags; int allocated = 0; int retval; @@ -792,15 +792,12 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, allocated = 1; } - spin_lock_irqsave(hsotg-lock, flags); - retval = dwc2_hcd_qh_add(hsotg, *qh); if (retval) goto fail; qtd-qh = *qh; list_add_tail(qtd-qtd_list_entry, (*qh)-qtd_list); - spin_unlock_irqrestore(hsotg-lock, flags); return 0; @@ -817,10 +814,7 @@ fail: qtd_list_entry) dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp); - spin_unlock_irqrestore(hsotg-lock, flags); dwc2_hcd_qh_free(hsotg, qh_tmp); - } else { - spin_unlock_irqrestore(hsotg-lock, flags); } return retval; -- 2.3.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 16/22] usb: dwc2: host: resume root hub on port connect
From: Gregory Herrero gregory.herr...@intel.com Once hub is runtime suspended, dwc2 must resume it on port connect event. Else, roothub will stay in suspended state and will not resume transfers. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/hcd_intr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 551ba87..6927bba 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -350,6 +350,9 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg) dev_vdbg(hsotg-dev, --Port Interrupt HPRT0=0x%08x Port Connect Detected--\n, hprt0); + if (hsotg-lx_state != DWC2_L0) + usb_hcd_resume_root_hub(hsotg-priv); + hsotg-flags.b.port_connect_status_change = 1; hsotg-flags.b.port_connect_status = 1; hprt0_modify |= HPRT0_CONNDET; -- 2.3.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 20/22] usb: dwc2: remove dwc2_platform.ko
As dwc2 pci module is now exporting dwc2 platform device, include platform.o in dwc2-y and remove USB_DWC2_PLATFORM configuration option. Driver will be built as two modules, dwc2.ko and dwc2_pci.ko. dwc2.ko is the new platform driver. Remove all EXPORT_SYMBOL_GPL as they are not needed any more. Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/Kconfig | 8 drivers/usb/dwc2/Makefile| 5 + drivers/usb/dwc2/core.c | 3 --- drivers/usb/dwc2/core_intr.c | 1 - drivers/usb/dwc2/debugfs.c | 2 -- drivers/usb/dwc2/gadget.c| 5 - drivers/usb/dwc2/hcd.c | 2 -- 7 files changed, 1 insertion(+), 25 deletions(-) diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig index 1bcb36a..fd95ba6 100644 --- a/drivers/usb/dwc2/Kconfig +++ b/drivers/usb/dwc2/Kconfig @@ -50,18 +50,10 @@ config USB_DWC2_DUAL_ROLE option requires USB_GADGET to be enabled. endchoice -config USB_DWC2_PLATFORM - tristate DWC2 Platform - default USB_DWC2_HOST || USB_DWC2_PERIPHERAL -help - The Designware USB2.0 platform interface module for - controllers directly connected to the CPU. - config USB_DWC2_PCI tristate DWC2 PCI depends on PCI default n - select USB_DWC2_PLATFORM select NOP_USB_XCEIV help The Designware USB2.0 PCI interface module for controllers diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile index 324fbb4..50fdaac 100644 --- a/drivers/usb/dwc2/Makefile +++ b/drivers/usb/dwc2/Makefile @@ -2,7 +2,7 @@ ccflags-$(CONFIG_USB_DWC2_DEBUG)+= -DDEBUG ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG obj-$(CONFIG_USB_DWC2) += dwc2.o -dwc2-y := core.o core_intr.o +dwc2-y := core.o core_intr.o platform.o ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),) dwc2-y += hcd.o hcd_intr.o @@ -25,6 +25,3 @@ endif obj-$(CONFIG_USB_DWC2_PCI) += dwc2_pci.o dwc2_pci-y := pci.o - -obj-$(CONFIG_USB_DWC2_PLATFORM)+= dwc2_platform.o -dwc2_platform-y:= platform.o diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 6acbe90..7f461e3 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -3044,7 +3044,6 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_uframe_sched(hsotg, params-uframe_sched); dwc2_set_param_external_id_pin_ctl(hsotg, params-external_id_pin_ctl); } -EXPORT_SYMBOL_GPL(dwc2_set_parameters); /** * During device initialization, read various hardware configuration @@ -3211,7 +3210,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) return 0; } -EXPORT_SYMBOL_GPL(dwc2_get_hwparams); /* * Sets all parameters to the given value. @@ -3227,7 +3225,6 @@ void dwc2_set_all_params(struct dwc2_core_params *params, int value) for (i = 0; i size; i++) p[i] = value; } -EXPORT_SYMBOL_GPL(dwc2_set_all_params); u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index f5ef26e..e66eb38 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -556,4 +556,3 @@ out: spin_unlock(hsotg-lock); return retval; } -EXPORT_SYMBOL_GPL(dwc2_handle_common_intr); diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c index af89537..ef2ee3d 100644 --- a/drivers/usb/dwc2/debugfs.c +++ b/drivers/usb/dwc2/debugfs.c @@ -763,11 +763,9 @@ err1: err0: return ret; } -EXPORT_SYMBOL_GPL(dwc2_debugfs_init); void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg) { debugfs_remove_recursive(hsotg-debug_root); hsotg-debug_root = NULL; } -EXPORT_SYMBOL_GPL(dwc2_debugfs_exit); diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 2b73615..4d47b7c 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2190,7 +2190,6 @@ void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg) call_gadget(hsotg, disconnect); } -EXPORT_SYMBOL_GPL(s3c_hsotg_disconnect); /** * s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @@ -3666,7 +3665,6 @@ err_clk: return ret; } -EXPORT_SYMBOL_GPL(dwc2_gadget_init); /** * s3c_hsotg_remove - remove function for hsotg driver @@ -3679,7 +3677,6 @@ int s3c_hsotg_remove(struct dwc2_hsotg *hsotg) return 0; } -EXPORT_SYMBOL_GPL(s3c_hsotg_remove); int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) { @@ -3722,7 +3719,6 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) return ret; } -EXPORT_SYMBOL_GPL(s3c_hsotg_suspend); int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) { @@ -3754,4 +3750,3 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) return ret; }
[PATCH v4 18/22] usb: dwc2: host: don't use dma_alloc_coherent with irqs disabled
From: Gregory Herrero gregory.herr...@intel.com Align buffer must be allocated using kmalloc since irqs are disabled. Coherency is handled through dma_map_single which can be used with irqs disabled. Reviewed-by: Julius Werner jwer...@chromium.org Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/hcd.c | 13 --- drivers/usb/dwc2/hcd_intr.c | 53 +++- drivers/usb/dwc2/hcd_queue.c | 7 +++--- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 763b63b..7f8c154 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -719,9 +719,7 @@ static int dwc2_hc_setup_align_buf(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, /* 3072 = 3 max-size Isoc packets */ buf_size = 3072; - qh-dw_align_buf = dma_alloc_coherent(hsotg-dev, buf_size, - qh-dw_align_buf_dma, - GFP_ATOMIC); + qh-dw_align_buf = kmalloc(buf_size, GFP_ATOMIC | GFP_DMA); if (!qh-dw_align_buf) return -ENOMEM; qh-dw_align_buf_size = buf_size; @@ -746,6 +744,15 @@ static int dwc2_hc_setup_align_buf(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, } } + qh-dw_align_buf_dma = dma_map_single(hsotg-dev, + qh-dw_align_buf, qh-dw_align_buf_size, + chan-ep_is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE); + if (dma_mapping_error(hsotg-dev, qh-dw_align_buf_dma)) { + dev_err(hsotg-dev, can't map align_buf\n); + chan-align_buf = (dma_addr_t)NULL; + return -EINVAL; + } + chan-align_buf = qh-dw_align_buf_dma; return 0; } diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 6927bba..6ea8eb6 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -466,10 +466,15 @@ static int dwc2_update_urb_state(struct dwc2_hsotg *hsotg, } /* Non DWORD-aligned buffer case handling */ - if (chan-align_buf xfer_length chan-ep_is_in) { + if (chan-align_buf xfer_length) { dev_vdbg(hsotg-dev, %s(): non-aligned buffer\n, __func__); - memcpy(urb-buf + urb-actual_length, chan-qh-dw_align_buf, - xfer_length); + dma_unmap_single(hsotg-dev, chan-qh-dw_align_buf_dma, + chan-qh-dw_align_buf_size, + chan-ep_is_in ? + DMA_FROM_DEVICE : DMA_TO_DEVICE); + if (chan-ep_is_in) + memcpy(urb-buf + urb-actual_length, + chan-qh-dw_align_buf, xfer_length); } dev_vdbg(hsotg-dev, urb-actual_length=%d xfer_length=%d\n, @@ -555,13 +560,18 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( chan, chnum, qtd, halt_status, NULL); /* Non DWORD-aligned buffer case handling */ - if (chan-align_buf frame_desc-actual_length - chan-ep_is_in) { + if (chan-align_buf frame_desc-actual_length) { dev_vdbg(hsotg-dev, %s(): non-aligned buffer\n, __func__); - memcpy(urb-buf + frame_desc-offset + - qtd-isoc_split_offset, chan-qh-dw_align_buf, - frame_desc-actual_length); + dma_unmap_single(hsotg-dev, chan-qh-dw_align_buf_dma, + chan-qh-dw_align_buf_size, + chan-ep_is_in ? + DMA_FROM_DEVICE : DMA_TO_DEVICE); + if (chan-ep_is_in) + memcpy(urb-buf + frame_desc-offset + + qtd-isoc_split_offset, + chan-qh-dw_align_buf, + frame_desc-actual_length); } break; case DWC2_HC_XFER_FRAME_OVERRUN: @@ -584,13 +594,18 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( chan, chnum, qtd, halt_status, NULL); /* Non DWORD-aligned buffer case handling */ - if (chan-align_buf frame_desc-actual_length - chan-ep_is_in) { + if (chan-align_buf frame_desc-actual_length) { dev_vdbg(hsotg-dev, %s(): non-aligned buffer\n, __func__); - memcpy(urb-buf + frame_desc-offset + - qtd-isoc_split_offset,
[PATCH v4 11/22] usb: dwc2: gadget: powerup controller if needed
From: Gregory Herrero gregory.herr...@intel.com During vbus session, usb controller needs to exit hibernation if it was previously in suspend state. Since controller will be resetted and configured, there is no need to restore registers. Moreover, set lx_state to L0 on B session. vbus_session callback may not be used by all platforms. Thus, controller software state needs to be set to L0 if the controller detects a valid B session. Otherwise, lx_state will remain L2 and prevent any request submission. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/gadget.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 732761f..56a08ac 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2515,6 +2515,7 @@ irq_retry: kill_all_requests(hsotg, hsotg-eps_out[0], -ECONNRESET); + hsotg-lx_state = DWC2_L0; s3c_hsotg_core_init_disconnected(hsotg, true); } } @@ -3205,6 +3206,14 @@ static int s3c_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) spin_lock_irqsave(hsotg-lock, flags); if (is_active) { + /* +* If controller is hibernated, it must exit from hibernation +* before being initialized +*/ + if (hsotg-lx_state == DWC2_L2) { + dwc2_exit_hibernation(hsotg, false); + hsotg-lx_state = DWC2_L0; + } /* Kill any ep0 requests as controller will be reinitialized */ kill_all_requests(hsotg, hsotg-eps_out[0], -ECONNRESET); s3c_hsotg_core_init_disconnected(hsotg, false); -- 2.3.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 12/22] usb: dwc2: gadget: enable otg flag in dual role configuration
From: Gregory Herrero gregory.herr...@intel.com Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/gadget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 56a08ac..eb906bd 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3525,6 +3525,8 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) hsotg-gadget.max_speed = USB_SPEED_HIGH; hsotg-gadget.ops = s3c_hsotg_gadget_ops; hsotg-gadget.name = dev_name(dev); + if (hsotg-dr_mode == USB_DR_MODE_OTG) + hsotg-gadget.is_otg = 1; /* reset the system */ -- 2.3.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 10/22] usb: dwc2: gadget: prevent new request submission during suspend
From: Gregory Herrero gregory.herr...@intel.com If usb controller is in partial power down, any write to registers may cause unpredictable behavior. Thus, prevent any new request submission once controller is in partial power down. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/gadget.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index a360f49..732761f 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -790,6 +790,13 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, ep-name, req, req-length, req-buf, req-no_interrupt, req-zero, req-short_not_ok); + /* Prevent new request submission when controller is suspended */ + if (hs-lx_state == DWC2_L2) { + dev_dbg(hs-dev, %s: don't submit request while suspended\n, + __func__); + return -EAGAIN; + } + /* initialise status of the request */ INIT_LIST_HEAD(hs_req-queue); req-actual = 0; -- 2.3.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 06/22] usb: dwc2: add external_id_pin_ctl core parameter
From: Gregory Herrero gregory.herr...@intel.com This is required due to an Intel specific hardware issue. Where id- pin setup causes glitches on the interrupt line when CONIDSTSCHG interrupt is enabled. Specify external_id_pin_ctl when an external driver (for example phy) can handle id change, so that CONIDSTSCHG interrupt can be disabled from the controller. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/core.c | 22 +- drivers/usb/dwc2/core.h | 6 ++ drivers/usb/dwc2/platform.c | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 889dc5f..8c3bc84 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -454,8 +454,10 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg *hsotg) if (hsotg-core_params-dma_enable = 0) intmsk |= GINTSTS_RXFLVL; + if (hsotg-core_params-external_id_pin_ctl = 0) + intmsk |= GINTSTS_CONIDSTSCHNG; - intmsk |= GINTSTS_CONIDSTSCHNG | GINTSTS_WKUPINT | GINTSTS_USBSUSP | + intmsk |= GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTSTS_SESSREQINT; writel(intmsk, hsotg-regs + GINTMSK); @@ -2979,6 +2981,23 @@ static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val) hsotg-core_params-uframe_sched = val; } +static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg, + int val) +{ + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { + if (val = 0) { + dev_err(hsotg-dev, + '%d' invalid for parameter external_id_pin_ctl\n, + val); + dev_err(hsotg-dev, external_id_pin_ctl must be 0 or 1\n); + } + val = 0; + dev_dbg(hsotg-dev, Setting external_id_pin_ctl to %d\n, val); + } + + hsotg-core_params-external_id_pin_ctl = val; +} + /* * This function is called during module intialization to pass module parameters * for the DWC_otg core. @@ -3023,6 +3042,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_ahbcfg(hsotg, params-ahbcfg); dwc2_set_param_otg_ver(hsotg, params-otg_ver); dwc2_set_param_uframe_sched(hsotg, params-uframe_sched); + dwc2_set_param_external_id_pin_ctl(hsotg, params-external_id_pin_ctl); } /** diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index e6abc28..e46304d 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -331,6 +331,11 @@ enum dwc2_ep0_state { * by the driver and are ignored in this * configuration value. * @uframe_sched: True to enable the microframe scheduler + * @external_id_pin_ctl: Specifies whether ID pin is handled externally. + * Disable CONIDSTSCHNG controller interrupt in such + * case. + * 0 - No (default) + * 1 - Yes * * The following parameters may be specified when starting the module. These * parameters define how the DWC_otg controller should be configured. A @@ -368,6 +373,7 @@ struct dwc2_core_params { int reload_ctl; int ahbcfg; int uframe_sched; + int external_id_pin_ctl; }; /** diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 4fb058b..ce39e8a0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -77,6 +77,7 @@ static const struct dwc2_core_params params_bcm2835 = { .reload_ctl = 0, .ahbcfg = 0x10, .uframe_sched = 0, + .external_id_pin_ctl= -1, }; static const struct dwc2_core_params params_rk3066 = { @@ -105,6 +106,7 @@ static const struct dwc2_core_params params_rk3066 = { .reload_ctl = -1, .ahbcfg = 0x7, /* INCR16 */ .uframe_sched = -1, + .external_id_pin_ctl= -1, }; /** -- 2.3.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 09/22] usb: dwc2: gadget: ignore pm suspend/resume in L2
From: Gregory Herrero gregory.herr...@intel.com Nothing to be done in pm suspend/resume when controller is in L2. Don't disconnect or reset. State is already saved when putting controller in hibernation and will be restored on USB bus resume. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index f867e95..a360f49 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3672,6 +3672,9 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) unsigned long flags; int ret = 0; + if (hsotg-lx_state != DWC2_L0) + return ret; + mutex_lock(hsotg-init_mutex); if (hsotg-driver) { @@ -3712,6 +3715,9 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) unsigned long flags; int ret = 0; + if (hsotg-lx_state == DWC2_L2) + return ret; + mutex_lock(hsotg-init_mutex); if (hsotg-driver) { -- 2.3.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 08/22] usb: dwc2: gadget: use reset detect interrupt
From: Gregory Herrero gregory.herr...@intel.com ResetDet interrupt is used to detect a reset of the bus while the controller is suspended. This may happens for example when using Command Verifier. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/gadget.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index bed56dc..f867e95 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2308,8 +2308,9 @@ void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, writel(GINTSTS_ERLYSUSP | GINTSTS_SESSREQINT | GINTSTS_GOUTNAKEFF | GINTSTS_GINNAKEFF | GINTSTS_CONIDSTSCHNG | GINTSTS_USBRST | - GINTSTS_ENUMDONE | GINTSTS_OTGINT | - GINTSTS_USBSUSP | GINTSTS_WKUPINT, + GINTSTS_RESETDET | GINTSTS_ENUMDONE | + GINTSTS_OTGINT | GINTSTS_USBSUSP | + GINTSTS_WKUPINT, hsotg-regs + GINTMSK); if (using_dma(hsotg)) @@ -2475,7 +2476,19 @@ irq_retry: } } - if (gintsts GINTSTS_USBRST) { + if (gintsts GINTSTS_RESETDET) { + dev_dbg(hsotg-dev, %s: USBRstDet\n, __func__); + + writel(GINTSTS_RESETDET, hsotg-regs + GINTSTS); + + /* This event must be used only if controller is suspended */ + if (hsotg-lx_state == DWC2_L2) { + dwc2_exit_hibernation(hsotg, true); + hsotg-lx_state = DWC2_L0; + } + } + + if (gintsts (GINTSTS_USBRST | GINTSTS_RESETDET)) { u32 usb_status = readl(hsotg-regs + GOTGCTL); -- 2.3.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 05/22] usb: dwc2: controller must update lx_state before releasing lock
From: Gregory Herrero gregory.herr...@intel.com During suspend, there could a race condition between ep_queue and suspend interrupt if lx_state is updated after releasing spinlock in call_gadget(hsotg, suspend). Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/core_intr.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 42f2fd5..f5ef26e 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -436,6 +436,12 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) if (!IS_ERR_OR_NULL(hsotg-uphy)) usb_phy_set_suspend(hsotg-uphy, true); skip_power_saving: + /* +* Change to L2 (suspend) state before releasing +* spinlock +*/ + hsotg-lx_state = DWC2_L2; + /* Call gadget suspend callback */ call_gadget(hsotg, suspend); } @@ -443,6 +449,8 @@ skip_power_saving: if (hsotg-op_state == OTG_STATE_A_PERIPHERAL) { dev_dbg(hsotg-dev, a_peripheral-a_host\n); + /* Change to L2 (suspend) state */ + hsotg-lx_state = DWC2_L2; /* Clear the a_peripheral flag, back to a_host */ spin_unlock(hsotg-lock); dwc2_hcd_start(hsotg); @@ -451,9 +459,6 @@ skip_power_saving: } } - /* Change to L2 (suspend) state */ - hsotg-lx_state = DWC2_L2; - clear_int: /* Clear interrupt */ writel(GINTSTS_USBSUSP, hsotg-regs + GINTSTS); -- 2.3.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 07/22] usb: dwc2: set parameter values in probe function
So the parameters can be used in both host and gadget modes. Also consolidate param functions in the core.h Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/core.c | 19 +++ drivers/usb/dwc2/core.h | 13 ++--- drivers/usb/dwc2/hcd.c | 36 +--- drivers/usb/dwc2/hcd.h | 7 +-- drivers/usb/dwc2/platform.c | 17 - 5 files changed, 47 insertions(+), 45 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 8c3bc84..6acbe90 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -3044,6 +3044,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_uframe_sched(hsotg, params-uframe_sched); dwc2_set_param_external_id_pin_ctl(hsotg, params-external_id_pin_ctl); } +EXPORT_SYMBOL_GPL(dwc2_set_parameters); /** * During device initialization, read various hardware configuration @@ -3210,6 +3211,24 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) return 0; } +EXPORT_SYMBOL_GPL(dwc2_get_hwparams); + +/* + * Sets all parameters to the given value. + * + * Assumes that the dwc2_core_params struct contains only integers. + */ +void dwc2_set_all_params(struct dwc2_core_params *params, int value) +{ + int *p = (int *)params; + size_t size = sizeof(*params) / sizeof(*p); + int i; + + for (i = 0; i size; i++) + p[i] = value; +} +EXPORT_SYMBOL_GPL(dwc2_set_all_params); + u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) { diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index e46304d..d7fb1f7 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1071,6 +1071,15 @@ extern void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val); extern void dwc2_set_param_otg_ver(struct dwc2_hsotg *hsotg, int val); +extern void dwc2_set_parameters(struct dwc2_hsotg *hsotg, + const struct dwc2_core_params *params); + +extern void dwc2_set_all_params(struct dwc2_core_params *params, int value); + +extern int dwc2_get_hwparams(struct dwc2_hsotg *hsotg); + + + /* * Dump core registers and SPRAM */ @@ -1119,14 +1128,12 @@ extern int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg); extern void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg); extern void dwc2_hcd_start(struct dwc2_hsotg *hsotg); #else -static inline void dwc2_set_all_params(struct dwc2_core_params *params, int value) {} static inline int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg) { return 0; } static inline void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg) {} static inline void dwc2_hcd_start(struct dwc2_hsotg *hsotg) {} static inline void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) {} -static inline int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, - const struct dwc2_core_params *params) +static inline int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) { return 0; } #endif diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 559b55e..1cca5e0 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2748,8 +2748,6 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) destroy_workqueue(hsotg-wq_otg); } - kfree(hsotg-core_params); - hsotg-core_params = NULL; del_timer(hsotg-wkp_timer); } @@ -2762,29 +2760,12 @@ static void dwc2_hcd_release(struct dwc2_hsotg *hsotg) } /* - * Sets all parameters to the given value. - * - * Assumes that the dwc2_core_params struct contains only integers. - */ -void dwc2_set_all_params(struct dwc2_core_params *params, int value) -{ - int *p = (int *)params; - size_t size = sizeof(*params) / sizeof(*p); - int i; - - for (i = 0; i size; i++) - p[i] = value; -} -EXPORT_SYMBOL_GPL(dwc2_set_all_params); - -/* * Initializes the HCD. This function allocates memory for and initializes the * static parts of the usb_hcd and dwc2_hsotg structures. It also registers the * USB bus with the core and calls the hc_driver-start() function. It returns * a negative error on failure. */ -int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, - const struct dwc2_core_params *params) +int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) { struct usb_hcd *hcd; struct dwc2_host_chan *channel; @@ -2797,12 +2778,6 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, dev_dbg(hsotg-dev, DWC OTG HCD INIT\n); - /* Detect config values from hardware */ - retval = dwc2_get_hwparams(hsotg); - - if (retval) - return retval; - retval = -ENOMEM; hcfg = readl(hsotg-regs + HCFG); @@ -2821,15 +2796,6 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, hsotg-last_frame_num = HFNUM_MAX_FRNUM; #endif - hsotg-core_params = kzalloc(sizeof(*hsotg-core_params),
[PATCH v4 13/22] usb: dwc2: gadget: remove s3c_hsotg_ep_disable_force
Force argument is not used anymore. Clean up leftovers from https://lkml.org/lkml/2014/12/9/283 Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com --- drivers/usb/dwc2/gadget.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index eb906bd..2b73615 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2764,7 +2764,7 @@ error: * s3c_hsotg_ep_disable - disable given endpoint * @ep: The endpoint to disable. */ -static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) +static int s3c_hsotg_ep_disable(struct usb_ep *ep) { struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct dwc2_hsotg *hsotg = hs_ep-parent; @@ -2807,10 +2807,6 @@ static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) return 0; } -static int s3c_hsotg_ep_disable(struct usb_ep *ep) -{ - return s3c_hsotg_ep_disable_force(ep, false); -} /** * on_list - check request is on the given endpoint * @ep: The endpoint to check. -- 2.3.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 21/22] usb: dwc2: add hibernation core parameter
From: Gregory Herrero gregory.herr...@intel.com dwc2 may not be able to exit from hibernation if the hardware does not provide a way to detect resume signalling in this state. Thus, add the possibility to disable hibernation feature. Signed-off-by: Gregory Herrero gregory.herr...@intel.com --- drivers/usb/dwc2/core.c | 24 drivers/usb/dwc2/core.h | 7 +++ drivers/usb/dwc2/core_intr.c | 7 --- drivers/usb/dwc2/platform.c | 2 ++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 7f461e3..e5b546f 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -342,6 +342,9 @@ int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore) u32 pcgcctl; int ret = 0; + if (!hsotg-core_params-hibernation) + return -ENOTSUPP; + pcgcctl = readl(hsotg-regs + PCGCTL); pcgcctl = ~PCGCTL_STOPPCLK; writel(pcgcctl, hsotg-regs + PCGCTL); @@ -392,6 +395,9 @@ int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg) u32 pcgcctl; int ret = 0; + if (!hsotg-core_params-hibernation) + return -ENOTSUPP; + /* Backup all registers */ ret = dwc2_backup_global_registers(hsotg); if (ret) { @@ -2998,6 +3004,23 @@ static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg, hsotg-core_params-external_id_pin_ctl = val; } +static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg, + int val) +{ + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { + if (val = 0) { + dev_err(hsotg-dev, + '%d' invalid for parameter hibernation\n, + val); + dev_err(hsotg-dev, hibernation must be 0 or 1\n); + } + val = 0; + dev_dbg(hsotg-dev, Setting hibernation to %d\n, val); + } + + hsotg-core_params-hibernation = val; +} + /* * This function is called during module intialization to pass module parameters * for the DWC_otg core. @@ -3043,6 +3066,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_otg_ver(hsotg, params-otg_ver); dwc2_set_param_uframe_sched(hsotg, params-uframe_sched); dwc2_set_param_external_id_pin_ctl(hsotg, params-external_id_pin_ctl); + dwc2_set_param_hibernation(hsotg, params-hibernation); } /** diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index d7fb1f7..53b8de0 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -336,6 +336,12 @@ enum dwc2_ep0_state { * case. * 0 - No (default) * 1 - Yes + * @hibernation: Specifies whether the controller support hibernation. + * If hibernation is enabled, the controller will enter + * hibernation in both peripheral and host mode when + * needed. + * 0 - No (default) + * 1 - Yes * * The following parameters may be specified when starting the module. These * parameters define how the DWC_otg controller should be configured. A @@ -374,6 +380,7 @@ struct dwc2_core_params { int ahbcfg; int uframe_sched; int external_id_pin_ctl; + int hibernation; }; /** diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index e66eb38..940582f 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -347,7 +347,7 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) dctl = ~DCTL_RMTWKUPSIG; writel(dctl, hsotg-regs + DCTL); ret = dwc2_exit_hibernation(hsotg, true); - if (ret) + if (ret (ret != -ENOTSUPP)) dev_err(hsotg-dev, exit hibernation failed\n); call_gadget(hsotg, resume); @@ -425,8 +425,9 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) ret = dwc2_enter_hibernation(hsotg); if (ret) { - dev_err(hsotg-dev, - enter hibernation failed\n); + if (ret != -ENOTSUPP) + dev_err(hsotg-dev, + enter hibernation failed\n); goto skip_power_saving; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 2562c90..9093530 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -78,6 +78,7 @@ static const struct dwc2_core_params params_bcm2835 = { .ahbcfg =
Re: [PATCH v2] USB: serial: add nt124 usb to serial driver
On Tue, Mar 03, 2015 at 11:57:04AM -0600, George McCollister wrote: This driver is for the NovaTech 124 4x serial expansion board for the NovaTech OrionLXm. Firmware source code can be found here: https://github.com/novatechweb/nt124 Signed-off-by: George McCollister george.mccollis...@gmail.com Thanks for the v2, George. And sorry for not getting back to you sooner. I'll try to find time to review it this week. 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] usb: musb: only set test mode once
On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: musb: do not backup/restore registers in runtime PM callbacks
On Mon, Mar 23, 2015 at 08:40:58PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Monday, March 23, 2015 7:37 PM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: do not backup/restore registers in runtime PM callbacks On Mon, Mar 23, 2015 at 04:52:54PM -0500, Bin Liu wrote: The MUSB controller does not lost power during runtime suspend/resume, so unnecessary to backup/restore its registers. Signed-off-by: Bin Liu b-...@ti.com are you sure this is true for *all* users of musb ? Well, I am not 100% sure, so posted this patch for comments ;) I checked MUSB only lost power during system suspend, in which case musb_suspend/resume() are already called to backup/resume MUSB registers. bus this is only true for AM335x devices. OMAP3/4 have been doing off-while-idle for years :-) -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: isp1760: fix spin unlock in the error path of isp1760_udc_start
On Fri, Mar 20, 2015 at 02:27:40PM +, Sudeep Holla wrote: Hi Laurent, On 20/03/15 14:20, Laurent Pinchart wrote: Hi Sudeep, Thank you for the patch. On Friday 20 March 2015 11:42:17 Sudeep Holla wrote: Commit a124820de5fd (usb: isp1760: fix possible deadlock in isp1760_udc_irq) replaced spin_{un,}lock with spin_{un,}lock_irq{save,restore}. However it missed an error path resulting in the smatch warning as below: drivers/usb/isp1760/isp1760-udc.c:1230 isp1760_udc_start() warn: inconsistent returns 'irqsave:flags'. Locked on: line 1207 Unlocked on: line 1199 This patch fixes the spin unlock in the error path in isp1760_udc_start thereby removing the smatch warning mentioned above. Reported-by: Dan Carpenter dan.carpen...@oracle.com Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com Cc: Felipe Balbi ba...@ti.com Signed-off-by: Sudeep Holla sudeep.ho...@arm.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Thanks --- drivers/usb/isp1760/isp1760-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Hi Laurent, Felipe, I am extremely sorry for missing this in my original patch. I hope you will be ashamed for the 7 generations to come for this totally unacceptable low quality standard. Yes ;) shameful indeed, doesn't build ;-) drivers/usb/isp1760/isp1760-udc.c:1205:52: error: undefined identifier 'flags' drivers/usb/isp1760/isp1760-udc.c: In function ‘isp1760_udc_start’: drivers/usb/isp1760/isp1760-udc.c:1205:38: error: ‘flags’ undeclared (first use in this function) spin_unlock_irqrestore(udc-lock, flags); ^ drivers/usb/isp1760/isp1760-udc.c:1205:38: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [drivers/usb/isp1760/isp1760-udc.o] Error 1 make[1]: *** [drivers/usb/isp1760] Error 2 make[1]: *** Waiting for unfinished jobs make: *** [drivers/usb/] Error 2 -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: isp1760: fix spin unlock in the error path of isp1760_udc_start
On Tue, Mar 24, 2015 at 11:37:43AM -0500, Felipe Balbi wrote: On Fri, Mar 20, 2015 at 02:27:40PM +, Sudeep Holla wrote: Hi Laurent, On 20/03/15 14:20, Laurent Pinchart wrote: Hi Sudeep, Thank you for the patch. On Friday 20 March 2015 11:42:17 Sudeep Holla wrote: Commit a124820de5fd (usb: isp1760: fix possible deadlock in isp1760_udc_irq) replaced spin_{un,}lock with spin_{un,}lock_irq{save,restore}. However it missed an error path resulting in the smatch warning as below: drivers/usb/isp1760/isp1760-udc.c:1230 isp1760_udc_start() warn: inconsistent returns 'irqsave:flags'. Locked on: line 1207 Unlocked on: line 1199 This patch fixes the spin unlock in the error path in isp1760_udc_start thereby removing the smatch warning mentioned above. Reported-by: Dan Carpenter dan.carpen...@oracle.com Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com Cc: Felipe Balbi ba...@ti.com Signed-off-by: Sudeep Holla sudeep.ho...@arm.com Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Thanks --- drivers/usb/isp1760/isp1760-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Hi Laurent, Felipe, I am extremely sorry for missing this in my original patch. I hope you will be ashamed for the 7 generations to come for this totally unacceptable low quality standard. Yes ;) shameful indeed, doesn't build ;-) drivers/usb/isp1760/isp1760-udc.c:1205:52: error: undefined identifier 'flags' drivers/usb/isp1760/isp1760-udc.c: In function ‘isp1760_udc_start’: drivers/usb/isp1760/isp1760-udc.c:1205:38: error: ‘flags’ undeclared (first use in this function) spin_unlock_irqrestore(udc-lock, flags); ^ drivers/usb/isp1760/isp1760-udc.c:1205:38: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [drivers/usb/isp1760/isp1760-udc.o] Error 1 make[1]: *** [drivers/usb/isp1760] Error 2 make[1]: *** Waiting for unfinished jobs make: *** [drivers/usb/] Error 2 oh, nevermind, it depends on a previous fix :-) -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: musb: only set test mode once
On Tue, Mar 24, 2015 at 12:05:20PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:54 AM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 11:52:04AM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } USB2 spec says you *must* go through a bus reset in order to get out of testmode. So if you want to change test_j to test_k, you must first bus reset. Yes, this will be handled in if branch - dev_err(): dev_err(musb-controller, Error: test mode is already running. Please do USB Bus Reset to start a new test\n); that's alright, but that if (new test is different) check is pointless ;-) -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: Check for NULL pointer in disconnect
On Mon, Mar 23, 2015 at 04:00:37PM -0700, Badhri Jagan Sridharan wrote: Do you really see some udc drivers call it after composite_unbind is called? If it is, you may add dump_stack() to track that error. Besides this, function suspended_show is needed to add cdev NULL pointer checking. We see this happening occasionally in *not yet* upstreamed UDC code of some vendors (Yes, disconnect being called after unbind) fix your UDC. We leave these sort of thing open so people realise they have to fix their drivers. -- balbi signature.asc Description: Digital signature
RE: [PATCH] usb: musb: do not backup/restore registers in runtime PM callbacks
Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:33 AM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: do not backup/restore registers in runtime PM callbacks On Mon, Mar 23, 2015 at 08:40:58PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Monday, March 23, 2015 7:37 PM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: do not backup/restore registers in runtime PM callbacks On Mon, Mar 23, 2015 at 04:52:54PM -0500, Bin Liu wrote: The MUSB controller does not lost power during runtime suspend/resume, so unnecessary to backup/restore its registers. Signed-off-by: Bin Liu b-...@ti.com are you sure this is true for *all* users of musb ? Well, I am not 100% sure, so posted this patch for comments ;) I checked MUSB only lost power during system suspend, in which case musb_suspend/resume() are already called to backup/resume MUSB registers. bus this is only true for AM335x devices. OMAP3/4 have been doing off-while- idle for years :-) Yeah, I just read Hema HK's patch which originally added this context save/restore, and feel uncomfortable with my change either. Let's drop this patch, I am trying to find a different way to solve my problem, and having a good progress right now. Thanks, -Bin. -- 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: musb: only set test mode once
Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } Regards, -Bin. -- 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: musb: only set test mode once
On Tue, Mar 24, 2015 at 11:52:04AM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } USB2 spec says you *must* go through a bus reset in order to get out of testmode. So if you want to change test_j to test_k, you must first bus reset. -- balbi signature.asc Description: Digital signature
RE: [PATCH] usb: musb: only set test mode once
Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 12:11 PM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 12:05:20PM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:54 AM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 11:52:04AM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } USB2 spec says you *must* go through a bus reset in order to get out of testmode. So if you want to change test_j to test_k, you must first bus reset. Yes, this will be handled in if branch - dev_err(): dev_err(musb-controller, Error: test mode is already running. Please do USB Bus Reset to start a new test\n); that's alright, but that if (new test is different) check is pointless ;-) Ok, I see your point now. What I wanted to enhance is to not print the annoying message when user runs the *same* test mode command multiple times. I don't have a strong opinion on either one. You make the call ;) Regards, -Bin. -- 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
[GIT PULL] USB patches for v4.1 merge window
Hi Greg, Because of ELC, I have to cut short on patch queueing this time. In any case, we have some pretty good content for v4.1. Patches have been tested with platforms I have around (heh, took me a while to do that remotely) and most have been in next for several days. Let me know if you want anything to be changed. cheers ps: I was hoping you'd be at ELC, but aparently I was wrong :-) The following changes since commit 9eccca0843205f87c00404b663188b88eb248051: Linux 4.0-rc3 (2015-03-08 16:09:09 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v4.1 for you to fetch changes up to 3e457371f436e89ce9239674828f9729a36b2595: usb: musb: Fix fifo reads for dm816x with musb_dsps (2015-03-24 11:36:38 -0500) usb: patches for v4.1 merge window As usual, a big pile of commits. This time a total of 111 non-merge commits. Other than the usual set of cleanups and non-critical fixes, we have some interesting work for AM335x's MUSB babble recovery. Now that takes a lot less time and we don't have to Reset MUSB all the time. The printer gadget has been converted to configfs interface and the atmel udc has learned suspend/resume with wakeup. Signed-off-by: Felipe Balbi ba...@ti.com Andrzej Pietrasiewicz (31): usb: gadget: composite: don't try standard handling for non-standard requests usb: gadget: printer: enqueue printer's response for setup request usb: gadget: printer: remove unused and empty printer_unbind usb: gadget: printer: eliminate random pointer dereference usb: gadget: printer: revert usb_add_function() effect in error recovery usb: gadget: printer: add missing error handling usb: gadget: printer: eliminate pdev member of struct printer_dev usb: gadget: printer: follow the naming convention for usb_add_config callback usb: gadget: printer: standardize printer_do_config usb: gadget: printer: move function-related bind code to function's bind usb: gadget: printer: call usb_add_function() last usb: gadget: printer: move function-related unbind code to function's unbind usb: gadget: printer: define pnp string buffer length usb: gadget: printer: don't access file global pnp_string in function's code usb: gadget: printer: add setup and cleanup functions usb: gadget: printer: call gprinter_setup() from gadget's bind usb: gadget: printer: eliminate file global printer_mutex usb: gadget: printer: don't access file global usb_printer_gadget in function's code usb: gadget: printer: add container_of helper for printer_dev usb: gadget: composite: add req_match method to usb_function usb: gadget: printer: name class specific requests usb: gadget: printer: add req_match for printer function usb: gadget: printer: allocate printer_dev instances dynamically usb: gadget: printer: factor out f_printer usb: gadget: f_printer: convert to new function interface with backward compatibility usb: gadget: printer: convert to new interface of f_printer usb: gadget: f_printer: remove compatibility layer usb: gadget: printer: use module_usb_composite_driver helper macro usb: gadget: printer: add configfs support usb: gadget: f_printer: use non-zero flag for bitwise and usb: gadget: f_printer: fix dependencies Axel Lin (1): usb: phy: Find the right match in devm_usb_phy_match Ben Dooks (1): usb: gadget: atmel_usba: use endian agnostic IO on ARM Dan Carpenter (2): usb: gadget: printer: delete some dead code usb: gadget: printer: use after free in gprinter_alloc_inst() Fabian Frederick (1): usb: gadget: constify of_device_id array Fabio Estevam (1): usb: phy: phy-generic: No need to call gpiod_direction_output() twice Felipe Balbi (36): usb: musb: gadget: get rid of stop_activity() usb: musb: core: fix TX/RX endpoint order usb: musb: core: improve musb_interrupt() a bit usb: dwc3: core: only reset res-start in case of error usb: dwc3: omap: call of_platform_depopulate() instead usb: dwc3: gadget: drop unnecessary loop when cleaning up TRBs usb: musb: core: remove unnecessary logical comparison usb: musb: core: add missing curly braces usb: musb: core: fix highspeed check usb: musb: dsps: return error code if reset fails usb: musb: core: move babble recovery inside babble check usb: musb: core: break long line usb: musb: core: remove unnecessary reg access from resume IRQ usb: musb: core: there is no connect interrupt in peripheral mode usb: musb: dsps: remove babble check from dsps irq handler usb: musb: dsps: check for the single bit usb: musb: core: controller drops session automatically
Re: [PATCH] cx82310_eth: fix semicolon.cocci warnings
From: kbuild test robot fengguang...@intel.com Date: Tue, 24 Mar 2015 09:51:32 +0800 drivers/net/usb/cx82310_eth.c:175:2-3: Unneeded semicolon Removes unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci CC: Ondrej Zary li...@rainbow-software.org Signed-off-by: Fengguang Wu fengguang...@intel.com Applied, 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: Delivery Status Notification (Failure)
Hello Developers of linux USB: My report: https://bugzilla.kernel.org/show_bug.cgi?id=95441 Thanks, -- Cristian -- 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: Check for NULL pointer in disconnect
On Mon, Mar 23, 2015 at 04:00:37PM -0700, Badhri Jagan Sridharan wrote: Do you really see some udc drivers call it after composite_unbind is called? If it is, you may add dump_stack() to track that error. Besides this, function suspended_show is needed to add cdev NULL pointer checking. We see this happening occasionally in *not yet* upstreamed UDC code of some vendors (Yes, disconnect being called after unbind) Does it a spurious interrupt? I guess if you add struct usb_gadget_driver NULL pointer check check, it will not occur: if (you_udc-driver) you_udc-driver-disconnect(you_udc-gadget); After reviewing the entire composite.c file, I did notice that none of the functions check for NULL pointer when cdev is obtained from get_gadget_data. Is crashing/bringing down the whole kernel intentionally left to happen ? Hmm, I don't think, the design may think it never occurs. Isn't printing a WARN/ERROR msg and returning not the preferable approach ? I think BUG_ON is more suitable, let's see Felipe's comment. On 03/22/2015 12:43 AM, Peter Chen wrote: On Fri, Mar 20, 2015 at 04:40:52PM -0700, Badhri Jagan Sridharan wrote: Added a safety net to make sure that composite_disconnect does not end up disconneting a NULL device. Prevents NULL pointer crash. Signed-off-by: Badhri Jagan Sridharan bad...@google.com --- drivers/usb/gadget/composite.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 13adfd1..90b37bd 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1823,6 +1823,11 @@ void composite_disconnect(struct usb_gadget *gadget) struct usb_composite_dev*cdev = get_gadget_data(gadget); unsigned long flags; + if (!cdev) { + WARN(1, Trying to disconnect a NULL composite device\n); + return; + } + Do you really see some udc drivers call it after composite_unbind is called? If it is, you may add dump_stack() to track that error. Besides this, function suspended_show is needed to add cdev NULL pointer checking. /* REVISIT: should we have config and device level * disconnect callbacks? */ -- 2.2.0.rc0.207.ga3a616c -- 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] usb: musb: add softconnect for host mode
Add a debugfs interface - softconnect - for host mode to connect/disconnect the devices without physically remove the them. This adds the capability to re-enumerate the devices which are permanently mounted on the board with the MUSB controller together. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 92 + 1 file changed, 92 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 04382ec..82b3be2 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -245,6 +245,91 @@ static const struct file_operations musb_test_mode_fops = { .release= single_release, }; +static int musb_softconnect_show(struct seq_file *s, void *unused) +{ + struct musb *musb = s-private; + u8 reg; + int connect; + + switch (musb-xceiv-otg-state) { + case OTG_STATE_A_HOST: + case OTG_STATE_A_WAIT_BCON: + reg = musb_readb(musb-mregs, MUSB_DEVCTL); + connect = reg MUSB_DEVCTL_SESSION ? 1 : 0; + break; + default: + connect = -1; + } + + seq_printf(s, %d\n, connect); + + return 0; +} + +static int musb_softconnect_open(struct inode *inode, struct file *file) +{ + return single_open(file, musb_softconnect_show, inode-i_private); +} + +static ssize_t musb_softconnect_write(struct file *file, + const char __user *ubuf, size_t count, loff_t *ppos) +{ + struct seq_file *s = file-private_data; + struct musb *musb = s-private; + charbuf[2]; + u8 reg; + + memset(buf, 0x00, sizeof(buf)); + + if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) + return -EFAULT; + + if (!strncmp(buf, 0, 1)) { + switch (musb-xceiv-otg-state) { + case OTG_STATE_A_HOST: + musb_root_disconnect(musb); + reg = musb_readb(musb-mregs, MUSB_DEVCTL); + reg = ~MUSB_DEVCTL_SESSION; + musb_writeb(musb-mregs, MUSB_DEVCTL, reg); + break; + default: + break; + } + + } else if (!strncmp(buf, 1, 1)) { + switch (musb-xceiv-otg-state) { + case OTG_STATE_A_WAIT_BCON: + /* +* musb_save_context() called in musb_runtime_suspend() +* might cache devctl with SESSION bit cleared during +* soft-disconnect, so specifically set SESSION bit +* here to preserve it for musb_runtime_resume(). +*/ + musb-context.devctl |= MUSB_DEVCTL_SESSION; + reg = musb_readb(musb-mregs, MUSB_DEVCTL); + reg |= MUSB_DEVCTL_SESSION; + musb_writeb(musb-mregs, MUSB_DEVCTL, reg); + break; + default: + break; + } + } + + return count; +} + +/* + * In host mode, connect/disconnect the bus without physically + * remove the devices. + */ +static const struct file_operations musb_softconnect_fops = { + .open = musb_softconnect_open, + .write = musb_softconnect_write, + .read = seq_read, + .llseek = seq_lseek, + .release= single_release, +}; + int musb_init_debugfs(struct musb *musb) { struct dentry *root; @@ -271,6 +356,13 @@ int musb_init_debugfs(struct musb *musb) goto err1; } + file = debugfs_create_file(softconnect, S_IRUGO | S_IWUSR, + root, musb, musb_softconnect_fops); + if (!file) { + ret = -ENOMEM; + goto err1; + } + musb-debugfs_root = root; return 0; -- 1.8.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 v2] usb: musb: only set test mode once
The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- v2: revise the dev_err message. drivers/usb/musb/musb_debugfs.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..04382ec 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -191,9 +191,16 @@ static ssize_t musb_test_mode_write(struct file *file, { struct seq_file *s = file-private_data; struct musb *musb = s-private; - u8 test = 0; + u8 test; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is already set. + Please do USB Bus Reset to start a new test.\n); + return count; + } + memset(buf, 0x00, sizeof(buf)); if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) -- 1.8.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: musb: only set test mode once
Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:54 AM To: Liu, Bin Cc: Balbi, Felipe; linux-usb@vger.kernel.org Subject: Re: [PATCH] usb: musb: only set test mode once On Tue, Mar 24, 2015 at 11:52:04AM -0500, Liu, Bin wrote: Felipe, -Original Message- From: Balbi, Felipe Sent: Tuesday, March 24, 2015 11:31 AM To: Liu, Bin Cc: linux-usb@vger.kernel.org; Balbi, Felipe Subject: Re: [PATCH] usb: musb: only set test mode once On Fri, Mar 20, 2015 at 04:49:58PM -0500, Bin Liu wrote: The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu b-...@ti.com --- drivers/usb/musb/musb_debugfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 78a283e..cd0c381 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -194,6 +194,12 @@ static ssize_t musb_test_mode_write(struct file *file, u8 test = 0; charbuf[18]; + test = musb_readb(musb-mregs, MUSB_TESTMODE); + if (test) { + dev_err(musb-controller, Error: test mode is running\n); with this message, user doesn't really know exactly what to do. Perhaps mention that a USB Bus Reset is needed to get the thing out of test mode? Ok, will change it. How about only print the error message when the new test mode is different from the running one, and silently do nothing if the new test mode is the same. Something like if (test) { if (new test is different) { dev_err(...); return -EINVAL; } else { return 0; } } USB2 spec says you *must* go through a bus reset in order to get out of testmode. So if you want to change test_j to test_k, you must first bus reset. Yes, this will be handled in if branch - dev_err(): dev_err(musb-controller, Error: test mode is already running. Please do USB Bus Reset to start a new test\n); Regards, -Bin. -- 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
[GIT PULL] USB fix for v4.0-rc6
Hi Greg, Here's a single fix for isp1760. Please consider merging it to usb/linus. cheers The following changes since commit bc465aa9d045feb0e13b4a8f32cc33c1943f62d6: Linux 4.0-rc5 (2015-03-22 16:50:21 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/fixes-for-v4.0-rc6 for you to fetch changes up to 65582a7f4ce5bd7a1fb61516d9c2476f4f166f4e: usb: isp1760: fix spin unlock in the error path of isp1760_udc_start (2015-03-24 11:38:58 -0500) usb: fix for v4.0-rc6 Here's a single fix to isp1760 calling spin_unlock_irqsave() as we should have. Signed-off-by: Felipe Balbi ba...@ti.com Sudeep Holla (1): usb: isp1760: fix spin unlock in the error path of isp1760_udc_start drivers/usb/isp1760/isp1760-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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: Errata for Freescale root-hub TT?
On Mon, Mar 23, 2015 at 10:11:04AM -0400, Alan Stern wrote: On Mon, 23 Mar 2015, Peter Chen wrote: For going on debugging this problem, we need I will have the hardware only for one more day, so I may not be able to get all the information you want. - Your bus analyzer file, I think there should be no enough IN/OUT tokens within one frame, does the remaining time to frame boundaries is enough? Here's an example: There are four OUT transfers near the start of the frame, and they take about 300 us. The remaining 700 us in the frame are completely idle, even though they should contain four IN transfers. How do you know the frame has filled already at that time? The software makes sure it fills frame in time before next time frame? -- 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