Re: [debian bug:883345] vhci-hcd: kernel oops when attaching a mass storage on client side of usbip

2017-12-04 Thread Greg KH
On Mon, Dec 04, 2017 at 10:05:45PM +0200, borissh1...@gmail.com wrote:
> Hi , 
> 
> vhci-hcd kernel oops when attaching a mass storage on 4.13.13.
> 
> When I try to attach a mass storage device to a vhci-hcd, it generates an 
> oops. no problem with other devices.
> 
> A second user had also confirmed on a different hardware ( https://
> bugs.debian.org/cgi-bin/bugreport.cgi?bug=878866) 
> debian's bug report attached bellow. 
> 
> steps to reproduce with debian : 
> 
> On server (debian stable running kernel 4.9) :
> 
> modprobe usbip-core
> modprobe usbip-host
> usbipd -D
> usbip bind -b bus
> 
> On client (debian sid running kernel 4.13):
> modprobe usbip-core
> modprobe vhci-hcd
> usbsip attach -b bus -r serverip
> 
> config values : 
> 
> CONFIG_USBIP_CORE=m
> CONFIG_USBIP_VHCI_HCD=m
> CONFIG_USBIP_VHCI_HC_PORTS=4
> CONFIG_USBIP_VHCI_NR_HCS=8
> CONFIG_USBIP_HOST=m
> CONFIG_USBIP_VUDC=m

A number of vhci bug fixes have recently been posted to the linux-usb
mailing list and will be merged into Linus's tree soon.  Any chance you
could test those out to see if it solves your problem or not?

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 21/45] usb: typec: remove duplicate includes

2017-12-04 Thread Heikki Krogerus
On Tue, Dec 05, 2017 at 07:34:55AM +0530, Pravin Shedge wrote:
> These duplicate includes have been found with scripts/checkincludes.pl but
> they have been removed manually to avoid removing false positives.
> 
> Signed-off-by: Pravin Shedge 

Acked-by: Heikki Krogerus 

> ---
>  drivers/usb/typec/fusb302/fusb302.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/fusb302/fusb302.c 
> b/drivers/usb/typec/fusb302/fusb302.c
> index 72cb060..a3e4cc9 100644
> --- a/drivers/usb/typec/fusb302/fusb302.c
> +++ b/drivers/usb/typec/fusb302/fusb302.c
> @@ -16,7 +16,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 

Thanks,

-- 
heikki
--
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 21/45] usb: typec: remove duplicate includes

2017-12-04 Thread Pravin Shedge
These duplicate includes have been found with scripts/checkincludes.pl but
they have been removed manually to avoid removing false positives.

Signed-off-by: Pravin Shedge 
---
 drivers/usb/typec/fusb302/fusb302.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/typec/fusb302/fusb302.c 
b/drivers/usb/typec/fusb302/fusb302.c
index 72cb060..a3e4cc9 100644
--- a/drivers/usb/typec/fusb302/fusb302.c
+++ b/drivers/usb/typec/fusb302/fusb302.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] PM / runtime: Drop children check from __pm_runtime_set_status()

2017-12-04 Thread Yoshihiro Shimoda
Hi,

> From: Ulf Hansson, Sent: Monday, December 4, 2017 7:41 PM
> 
> On 1 December 2017 at 12:03, Yoshihiro Shimoda
>  wrote:

> > Sure! I tested your patch, and then the following message disappeared!
> >
> >Enabling runtime PM for inactive device (ee080200.usb-phy) with active 
> > children
> 
> Great, that confirms my theory.
> 
> I will re-work the patch and re-post it to see what people thinks about it.

Thank you!

> >
> > However, the following message still exists.
> >
> >Enabling runtime PM for inactive device (ee08.usb) with active 
> > children
> >
> > So, I guess ohci-platform.c also has similar issue.
> 
> Yes, very likely!
> 
> However, I need some more time to look into this to be able to suggest
> a solution.

I found a solution and sent a report as below:
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1551146.html

What do you think about using pm_runtime_forbid()?

Best regards,
Yoshihiro Shimoda

N�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h�&���G���h�(�階�ݢj"���m��z�ޖ���f���h���~�m�

Re: [PATCH v4] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Adam Wallis
On 12/4/2017 9:15 PM, Chunfeng Yun wrote:
> On Mon, 2017-12-04 at 09:27 -0500, Adam Wallis wrote:
>> The xHCI driver currently has the IMOD set to 160, which
>> translates to an IMOD interval of 40,000ns (160 * 250)ns
>>
>> Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
>> introduced a QUIRK for the MTK platform to adjust this interval to 20,
>> which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
>> due to the fact that the MTK controller IMOD interval is 8 times
>> as much as defined in xHCI spec.
>>
>> Instead of adding more quirk bits for additional platforms, this patch
>> introduces the ability for vendors to set the IMOD_INTERVAL as is
>> optimal for their platform. By using device_property_read_u32() on
>> "imod-interval-ns", the IMOD INTERVAL can be specified in nano seconds.
>> If no interval is specified, the default of 40,000ns (IMOD=160) will be
>> used.
>>
>> No bounds checking has been implemented due to the fact that a vendor
>> may have violated the spec and would need to specify a value outside of
>> the max 8,000 IRQs/second limit specified in the xHCI spec.
>>
>> Tested-by: Chunfeng Yun 
>> Signed-off-by: Adam Wallis 
>> ---
>> changes from v3:
>>   * Changed imod-interval to imod-interval-ns [Rob Herring/Chunfeng]
>>   * Changed "modulation" to "moderation" throughout patch [Mathias]
>> changes from v2:
>>   * Added PCI default value [Mathias]
>>   * Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
>>   * Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
>>   * Updated bindings Documentation to use proper units [Rob Herring]
>>   * Added imod-interval description and example to MTK binding documentation
>> changes from v1:
>>   * Removed device_property_read_u32() per suggestion from greg k-h
>>   * Used ER_IRQ_INTERVAL_MASK in place of (u16) cast
>>
>>  Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
>>  Documentation/devicetree/bindings/usb/usb-xhci.txt  | 1 +
>>  drivers/usb/host/xhci-mtk.c | 9 +
>>  drivers/usb/host/xhci-pci.c | 3 +++
>>  drivers/usb/host/xhci-plat.c| 5 +
>>  drivers/usb/host/xhci.c | 7 ++-
>>  drivers/usb/host/xhci.h | 2 ++
>>  7 files changed, 24 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt 
>> b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>> index 3059596..9ff5602 100644
>> --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>> +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>> @@ -46,6 +46,7 @@ Optional properties:
>>   - pinctrl-names : a pinctrl state named "default" must be defined
>>   - pinctrl-0 : pin control group
>>  See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
>> + - imod-interval-ns: default interrupt moderation interval is 5000ns
>>  
>>  Example:
>>  usb30: usb@1127 {
>> @@ -66,6 +67,7 @@ usb30: usb@1127 {
>>  usb3-lpm-capable;
>>  mediatek,syscon-wakeup = <>;
>>  mediatek,wakeup-src = <1>;
>> +imod-interval-ns = <1>;
>>  };
>>  
>>  2nd: dual-role mode with xHCI driver
>> diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
>> b/Documentation/devicetree/bindings/usb/usb-xhci.txt
>> index ae6e484..969908d 100644
>> --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
>> +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
>> @@ -29,6 +29,7 @@ Optional properties:
>>- usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
>>- usb3-lpm-capable: determines if platform is USB3 LPM capable
>>- quirk-broken-port-ped: set if the controller has broken port disable 
>> mechanism
>> +  - imod-interval-ns: default interrupt moderation interval is 5000ns
>>  
>>  Example:
>>  usb@f0931000 {
>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
>> index b62a1d2..1cb2a8b 100644
>> --- a/drivers/usb/host/xhci-mtk.c
>> +++ b/drivers/usb/host/xhci-mtk.c
>> @@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>>  
>>  xhci = hcd_to_xhci(hcd);
>>  xhci->main_hcd = hcd;
>> +
>> +/*
>> + * imod_interval is the interrupt moderation value in nanoseconds.
>> + * The increment interval is 8 times as much as that defined in
>> + * the xHCI spec on MTK's controller.
>> + */
>> +xhci->imod_interval = 5000;
>> +device_property_read_u32(dev, "imod-interval-ns", >imod_interval);
>> +
>>  xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
>>  dev_name(dev), hcd);
>>  if (!xhci->shared_hcd) {
>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>> index 7ef1274..4bcddd4 100644
>> --- a/drivers/usb/host/xhci-pci.c
>> 

Re: [PATCH v4] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Chunfeng Yun
On Mon, 2017-12-04 at 09:27 -0500, Adam Wallis wrote:
> The xHCI driver currently has the IMOD set to 160, which
> translates to an IMOD interval of 40,000ns (160 * 250)ns
> 
> Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
> introduced a QUIRK for the MTK platform to adjust this interval to 20,
> which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
> due to the fact that the MTK controller IMOD interval is 8 times
> as much as defined in xHCI spec.
> 
> Instead of adding more quirk bits for additional platforms, this patch
> introduces the ability for vendors to set the IMOD_INTERVAL as is
> optimal for their platform. By using device_property_read_u32() on
> "imod-interval-ns", the IMOD INTERVAL can be specified in nano seconds.
> If no interval is specified, the default of 40,000ns (IMOD=160) will be
> used.
> 
> No bounds checking has been implemented due to the fact that a vendor
> may have violated the spec and would need to specify a value outside of
> the max 8,000 IRQs/second limit specified in the xHCI spec.
> 
> Tested-by: Chunfeng Yun 
> Signed-off-by: Adam Wallis 
> ---
> changes from v3:
>   * Changed imod-interval to imod-interval-ns [Rob Herring/Chunfeng]
>   * Changed "modulation" to "moderation" throughout patch [Mathias]
> changes from v2:
>   * Added PCI default value [Mathias]
>   * Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
>   * Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
>   * Updated bindings Documentation to use proper units [Rob Herring]
>   * Added imod-interval description and example to MTK binding documentation
> changes from v1:
>   * Removed device_property_read_u32() per suggestion from greg k-h
>   * Used ER_IRQ_INTERVAL_MASK in place of (u16) cast
> 
>  Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
>  Documentation/devicetree/bindings/usb/usb-xhci.txt  | 1 +
>  drivers/usb/host/xhci-mtk.c | 9 +
>  drivers/usb/host/xhci-pci.c | 3 +++
>  drivers/usb/host/xhci-plat.c| 5 +
>  drivers/usb/host/xhci.c | 7 ++-
>  drivers/usb/host/xhci.h | 2 ++
>  7 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt 
> b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
> index 3059596..9ff5602 100644
> --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
> +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
> @@ -46,6 +46,7 @@ Optional properties:
>   - pinctrl-names : a pinctrl state named "default" must be defined
>   - pinctrl-0 : pin control group
>   See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
> + - imod-interval-ns: default interrupt moderation interval is 5000ns
>  
>  Example:
>  usb30: usb@1127 {
> @@ -66,6 +67,7 @@ usb30: usb@1127 {
>   usb3-lpm-capable;
>   mediatek,syscon-wakeup = <>;
>   mediatek,wakeup-src = <1>;
> + imod-interval-ns = <1>;
>  };
>  
>  2nd: dual-role mode with xHCI driver
> diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
> b/Documentation/devicetree/bindings/usb/usb-xhci.txt
> index ae6e484..969908d 100644
> --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
> +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
> @@ -29,6 +29,7 @@ Optional properties:
>- usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
>- usb3-lpm-capable: determines if platform is USB3 LPM capable
>- quirk-broken-port-ped: set if the controller has broken port disable 
> mechanism
> +  - imod-interval-ns: default interrupt moderation interval is 5000ns
>  
>  Example:
>   usb@f0931000 {
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index b62a1d2..1cb2a8b 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>  
>   xhci = hcd_to_xhci(hcd);
>   xhci->main_hcd = hcd;
> +
> + /*
> +  * imod_interval is the interrupt moderation value in nanoseconds.
> +  * The increment interval is 8 times as much as that defined in
> +  * the xHCI spec on MTK's controller.
> +  */
> + xhci->imod_interval = 5000;
> + device_property_read_u32(dev, "imod-interval-ns", >imod_interval);
> +
>   xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
>   dev_name(dev), hcd);
>   if (!xhci->shared_hcd) {
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 7ef1274..4bcddd4 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -234,6 +234,9 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
>   if 

[debian bug:883345] vhci-hcd: kernel oops when attaching a mass storage on client side of usbip

2017-12-04 Thread borissh1983
Hi , 

vhci-hcd kernel oops when attaching a mass storage on 4.13.13.

When I try to attach a mass storage device to a vhci-hcd, it generates an 
oops. no problem with other devices.

A second user had also confirmed on a different hardware ( https://
bugs.debian.org/cgi-bin/bugreport.cgi?bug=878866) 
debian's bug report attached bellow. 

steps to reproduce with debian : 

On server (debian stable running kernel 4.9) :

modprobe usbip-core
modprobe usbip-host
usbipd -D
usbip bind -b bus

On client (debian sid running kernel 4.13):
modprobe usbip-core
modprobe vhci-hcd
usbsip attach -b bus -r serverip

config values : 

CONFIG_USBIP_CORE=m
CONFIG_USBIP_VHCI_HCD=m
CONFIG_USBIP_VHCI_HC_PORTS=4
CONFIG_USBIP_VHCI_NR_HCS=8
CONFIG_USBIP_HOST=m
CONFIG_USBIP_VUDC=m

oops content : 

Kernel failure message 1:
[ cut here ]
invalid opcode:  [#1] SMP
Modules linked in: uas usb_storage bnep btusb btrtl btbcm btintel bluetooth 
drbg ansi_cprng ecdh_generic hid_generic usbhid hid vhci_hcd usbip_core ctr 
ccm snd_hrtimer snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq 
snd_seq_device ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 
nf_nat ipt_REJECT nf_reject_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack 
nf_conntrack libcrc32c cpufreq_conservative cpufreq_userspace iptable_filter 
cpufreq_powersave binfmt_misc arc4 ath5k ath mac80211 snd_hda_codec_hdmi 
snd_hda_codec_realtek cfg80211 snd_hda_codec_generic snd_hda_intel 
snd_hda_codec snd_hda_core powernow_k8 edac_mce_amd snd_hwdep snd_pcm_oss 
kvm_amd snd_mixer_oss kvm snd_pcm acer_wmi pcmcia snd_timer yenta_socket snd 
sparse_keymap rfkill irqbypass pcmcia_rsrc pcmcia_core
 soundcore k8temp pcspkr joydev serio_raw sg ac shpchp battery evdev cuse fuse 
loop parport_pc ppdev lp parport ip_tables x_tables autofs4 ext4 crc16 mbcache 
jbd2 crc32c_generic fscrypto crypto_simd glue_helper cryptd aes_x86_64 ecb cbc 
algif_skcipher af_alg dm_crypt dm_mod sd_mod ohci_pci 8139too psmouse 
ata_generic sdhci_pci sdhci mmc_core 8139cp mii pata_atiixp i2c_piix4 video 
amdkfd ehci_pci ohci_hcd ehci_hcd sata_sil usbcore usb_common wmi radeon 
libata i2c_algo_bit ttm scsi_mod thermal drm_kms_helper drm button
CPU: 1 PID: 1826 Comm: usb-storage Not tainted 4.13.13-falcot #2
Hardware name: Acer Aspire 5100 /Navarro, BIOS V3.13 
08/22/2008
task: 9da063aea240 task.stack: b8c1807cc000
RIP: 0010:vhci_urb_enqueue+0x2d6/0x4b0 [vhci_hcd]
RSP: 0018:b8c1807cfc00 EFLAGS: 00010206
RAX: 0024 RBX: 9da065607000 RCX: 9da065607000
RDX: 0140 RSI: 9da067dc1300 RDI: 9da065607000
RBP: 0002 R08: 0024 R09: 00022618
R10: b8c1807cfcf0 R11: 0112f55f46a0 R12: 9da069a03c00
R13: 0002 R14: 9da067dc1300 R15: 9d9fffbc0098
FS:  () GS:9da06fd0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7f07c84ef740 CR3: 00012a062000 CR4: 06e0
Call Trace:
 ? usb_hcd_submit_urb+0xab/0xac0 [usbcore]
 ? __kmalloc+0x1cc/0x5c0
 ? usb_alloc_urb+0x15/0x40 [usbcore]
 ? usb_sg_init+0x99/0x2b0 [usbcore]
 ? usb_sg_wait+0x93/0x170 [usbcore]
 ? usb_stor_bulk_transfer_sglist.part.1+0x63/0xb0 [usb_storage]
 ? usb_stor_bulk_srb+0x49/0x80 [usb_storage]
 ? usb_stor_Bulk_transport+0x163/0x3d0 [usb_storage]
 ? usb_stor_disconnect+0xc0/0xc0 [usb_storage]
 ? usb_stor_invoke_transport+0x37/0x4e0 [usb_storage]
 ? usb_stor_disconnect+0xc0/0xc0 [usb_storage]
 ? wait_for_completion_interruptible+0x145/0x1e0
 ? wait_for_completion_interruptible+0x176/0x1e0
 ? wake_up_q+0x70/0x70
 ? usb_stor_control_thread+0x169/0x280 [usb_storage]
 ? kthread+0x118/0x130
 ? kthread_create_on_node+0x70/0x70
 ? ret_from_fork+0x25/0x30
Code: f1 48 89 fa 48 c7 c6 e0 3c f4 c0 48 c7 c7 90 5f f4 c0 e8 1e e9 23 e1 e9 
7a fd ff ff 41 8b 86 88 00 00 00 85 c0 0f 84 84 fd ff ff <0f> 0b 48 c7 c6 16 
2c f4 c0 4c 89 ff e8 d9 9b 36 e1 4c 89 f6 48 
---[ end trace d94b6115942793e3 ]---


Kernel failure message 2:
[ cut here ]
invalid opcode:  [#1] SMP
Modules linked in: uas usb_storage ctr ccm vhci_hcd usbip_core snd_hrtimer 
snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device 
ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat 
ipt_REJECT nf_reject_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack 
nf_conntrack cpufreq_conservative cpufreq_userspace libcrc32c 
cpufreq_powersave iptable_filter binfmt_misc arc4 ath5k ath mac80211 
snd_hda_codec_hdmi snd_hda_codec_realtek cfg80211 snd_hda_codec_generic 
snd_hda_intel snd_hda_codec powernow_k8 edac_mce_amd kvm_amd snd_hda_core kvm 
snd_hwdep snd_pcm_oss snd_mixer_oss acer_wmi snd_pcm irqbypass sparse_keymap 
rfkill pcmcia joydev k8temp yenta_socket serio_raw pcspkr pcmcia_rsrc 
pcmcia_core snd_timer shpchp snd soundcore sg ac battery evdev cuse fuse loop 
parport_pc
 ppdev lp parport ip_tables x_tables autofs4 ext4 crc16 

Re: [PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume

2017-12-04 Thread Jerry Snitselaar

On Mon Dec 04 17, Mathias Nyman wrote:

Interface drivers like btusb that don't support reset-resume will be
rebound at resume if port was reset. Rebind is done during the pm_ops
.complete callback when probe returns EPROBE_DEFER as default.

Remove the "rebind failed: -517" message.
Device probe will eventually take place later.

[one-liner by Jerry Snitselaar posted in a mailing list question -Mathias]
Suggested-by: Jerry Snitselaar 
Signed-off-by: Mathias Nyman 
---
drivers/usb/core/driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 64262a9a..5d34080 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf)
if (!intf->dev.power.is_prepared) {
intf->needs_binding = 0;
rc = device_attach(>dev);
-   if (rc < 0)
+   if (rc < 0 && rc != -EPROBE_DEFER)
dev_warn(>dev, "rebind failed: %d\n", rc);
}
}
--
2.7.4



Thanks for sending this. It looks like my filters sent the ensuing
conversation off into never-never land or I wasn't cc'd and just
missed it in the mailing lists.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Timur Tabi

On 12/04/2017 09:48 AM, Adam Wallis wrote:

As noted in the patch description, xhci-plat devices will use a default of
40,000, while MTK devices will use a default of 5,000. This is also documented
in the probe for each relevant driver. This is further confirmed in the
description for each driver's binding TXT file.


Serves me right for reviewing patches before I've had my morning coffee.

--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Adam Wallis
Timur

On 12/4/2017 9:58 AM, Timur Tabi wrote:
> On 12/4/17 8:27 AM, Adam Wallis wrote:
>> If no interval is specified, the default of 40,000ns (IMOD=160) will be
>> used.
> 
> ...
> 
>> + - imod-interval-ns: default interrupt moderation interval is 5000ns
> 
> ...
> 
>> +  - imod-interval-ns: default interrupt moderation interval is 5000ns
> 
> ...
> 
>> +    xhci->imod_interval = 5000;
> 
> ...
> 
>> +    xhci->imod_interval = 4;
> 
> ...
> 
>> +    xhci->imod_interval = 4;
> 
> Is the default 5,000 or 40,000?  I can't tell.
> 
As noted in the patch description, xhci-plat devices will use a default of
40,000, while MTK devices will use a default of 5,000. This is also documented
in the probe for each relevant driver. This is further confirmed in the
description for each driver's binding TXT file.

Adam

-- 
Adam Wallis
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: "Illegal Request" with JMicron JMS567-based USB3 HDD enclosure

2017-12-04 Thread Alan Stern
On Sun, 3 Dec 2017, David Kozub wrote:

> Hi all,
> 
> I'm observing the following error with a JMS567-based USB3 HDD enclosure:
> 
> sd 6:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK 
> driverbyte=DRIVER_SENSE
> sd 6:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current]
> sd 6:0:0:0: [sda] tag#0 Add. Sense: Invalid field in cdb
> 
> It's reproducible with Linus' master - I tested with 2db767d988.
> 
> Looking into drivers/usb/storage I see there is already a bunch of 
> UNUSUAL_DEV entries for the JMS567 but my device (Icy Box IB-254U3) has a 
> different USB product ID:
> 
> Bus 004 Device 002: ID 152d:0578 JMicron Technology Corp. / JMicron USA 
> Technology Corp.
> 
> When I add an UNUSUAL_DEV entry for this ID too, the issue seems to go 
> away. But I'm not sure what is the proper way to add this:
> 
> * US_FL_BROKEN_FUA seems to be the important quirk but I see some other 
> JMS567 entries also use US_FL_NO_REPORT_OPCODES. Is there a way to test if 
> this quirk is needed for my device? The enclosure seems to work OK even 
> without this.

If it works okay without that quirk then you don't need to add it.

> * While normally the device is used via UAS (so I added the UNUSUAL_DEV to 
> unusual_uas.h), it's possible to use it in mass storage mode too (e.g. by 
> building a kernel without CONFIG_USB_UAS), and when I do so, I get the 
> same "Illegal Request", so I should add an UNUSUAL_DEV in unusual_devs.h 
> too, right?

Sure, go ahead.

> * What values should I use for bcdDeviceMin and bcdDeviceMax? I only have 
> two such enclosures bought at different times and both have bcdDevice = 
> 1.14 so should I specify bcdDeviceMin = bcdDeviceMax = 0x0114 or should 
> I use 0x and 0x as some other UNUSUAL_DEVs do?

This is a matter of judgment.  Given that other JMicron devices need
the quirk and how unlikely it seems that the company will fix their
bug, you can justify using the full range of bcdDevice values.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Timur Tabi

On 12/4/17 8:27 AM, Adam Wallis wrote:

If no interval is specified, the default of 40,000ns (IMOD=160) will be
used.


...


+ - imod-interval-ns: default interrupt moderation interval is 5000ns


...


+  - imod-interval-ns: default interrupt moderation interval is 5000ns


...


+   xhci->imod_interval = 5000;


...


+   xhci->imod_interval = 4;


...


+   xhci->imod_interval = 4;


Is the default 5,000 or 40,000?  I can't tell.

--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Adam Wallis
The xHCI driver currently has the IMOD set to 160, which
translates to an IMOD interval of 40,000ns (160 * 250)ns

Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
introduced a QUIRK for the MTK platform to adjust this interval to 20,
which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
due to the fact that the MTK controller IMOD interval is 8 times
as much as defined in xHCI spec.

Instead of adding more quirk bits for additional platforms, this patch
introduces the ability for vendors to set the IMOD_INTERVAL as is
optimal for their platform. By using device_property_read_u32() on
"imod-interval-ns", the IMOD INTERVAL can be specified in nano seconds.
If no interval is specified, the default of 40,000ns (IMOD=160) will be
used.

No bounds checking has been implemented due to the fact that a vendor
may have violated the spec and would need to specify a value outside of
the max 8,000 IRQs/second limit specified in the xHCI spec.

Tested-by: Chunfeng Yun 
Signed-off-by: Adam Wallis 
---
changes from v3:
  * Changed imod-interval to imod-interval-ns [Rob Herring/Chunfeng]
  * Changed "modulation" to "moderation" throughout patch [Mathias]
changes from v2:
  * Added PCI default value [Mathias]
  * Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
  * Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
  * Updated bindings Documentation to use proper units [Rob Herring]
  * Added imod-interval description and example to MTK binding documentation
changes from v1:
  * Removed device_property_read_u32() per suggestion from greg k-h
  * Used ER_IRQ_INTERVAL_MASK in place of (u16) cast

 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
 Documentation/devicetree/bindings/usb/usb-xhci.txt  | 1 +
 drivers/usb/host/xhci-mtk.c | 9 +
 drivers/usb/host/xhci-pci.c | 3 +++
 drivers/usb/host/xhci-plat.c| 5 +
 drivers/usb/host/xhci.c | 7 ++-
 drivers/usb/host/xhci.h | 2 ++
 7 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt 
b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
index 3059596..9ff5602 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
@@ -46,6 +46,7 @@ Optional properties:
  - pinctrl-names : a pinctrl state named "default" must be defined
  - pinctrl-0 : pin control group
See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+ - imod-interval-ns: default interrupt moderation interval is 5000ns
 
 Example:
 usb30: usb@1127 {
@@ -66,6 +67,7 @@ usb30: usb@1127 {
usb3-lpm-capable;
mediatek,syscon-wakeup = <>;
mediatek,wakeup-src = <1>;
+   imod-interval-ns = <1>;
 };
 
 2nd: dual-role mode with xHCI driver
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index ae6e484..969908d 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -29,6 +29,7 @@ Optional properties:
   - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
   - usb3-lpm-capable: determines if platform is USB3 LPM capable
   - quirk-broken-port-ped: set if the controller has broken port disable 
mechanism
+  - imod-interval-ns: default interrupt moderation interval is 5000ns
 
 Example:
usb@f0931000 {
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b62a1d2..1cb2a8b 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 
xhci = hcd_to_xhci(hcd);
xhci->main_hcd = hcd;
+
+   /*
+* imod_interval is the interrupt moderation value in nanoseconds.
+* The increment interval is 8 times as much as that defined in
+* the xHCI spec on MTK's controller.
+*/
+   xhci->imod_interval = 5000;
+   device_property_read_u32(dev, "imod-interval-ns", >imod_interval);
+
xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
dev_name(dev), hcd);
if (!xhci->shared_hcd) {
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 7ef1274..4bcddd4 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -234,6 +234,9 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
if (!xhci->sbrn)
pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, >sbrn);
 
+   /* imod_interval is the interrupt moderation value in nanoseconds. */
+   xhci->imod_interval = 4;
+
retval = xhci_gen_setup(hcd, 

Re: [PATCH v3] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Adam Wallis
On 12/4/2017 3:57 AM, Mathias Nyman wrote:
> On 03.12.2017 05:22, Chunfeng Yun wrote:
>> On Fri, 2017-12-01 at 10:44 -0500, Adam Wallis wrote:
>>> The xHCI driver currently has the IMOD set to 160, which
>>> translates to an IMOD interval of 40,000ns (160 * 250)ns
>>>
>>> Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
>>> introduced a QUIRK for the MTK platform to adjust this interval to 20,
>>> which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
>>> due to the fact that the MTK controller IMOD interval is 8 times
>>> as much as defined in xHCI spec.
>>>
>>> Instead of adding more quirk bits for additional platforms, this patch
>>> introduces the ability for vendors to set the IMOD_INTERVAL as is
>>> optimal for their platform. By using device_property_read_u32() on
>>> "imod-interval", the IMOD INTERVAL can be specified in nano seconds. If
>>> no interval is specified, the default of 40,000ns (IMOD=160) will be
>>> used.
>>>
>>> No bounds checking has been implemented due to the fact that a vendor
>>> may have violated the spec and would need to specify a value outside of
>>> the max 8,000 IRQs/second limit specified in the xHCI spec.
>>>
>>> Signed-off-by: Adam Wallis 
>>> ---
>>> changes from v2:
>>>    * Added PCI default value [Mathias]
>>>    * Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
>>>    * Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
>>>    * Updated bindings Documentation to use proper units [Rob Herring]
>>>    * Added imod-interval description and example to MTK binding 
>>> documentation
>>> changes from v1:
>>>    * Removed device_property_read_u32() per suggestion from greg k-h
>>>    * Used ER_IRQ_INTERVAL_MASK in place of (u16) cast
>>>
>>>   Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
>>>   Documentation/devicetree/bindings/usb/usb-xhci.txt  | 1 +
>>>   drivers/usb/host/xhci-mtk.c | 9 +
>>>   drivers/usb/host/xhci-pci.c | 3 +++
>>>   drivers/usb/host/xhci-plat.c    | 4 
>>>   drivers/usb/host/xhci.c | 7 ++-
>>>   drivers/usb/host/xhci.h | 2 ++
>>>   7 files changed, 23 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>>> b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>>> index 3059596..45bbf18 100644
>>> --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>>> +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>>> @@ -46,6 +46,7 @@ Optional properties:
>>>    - pinctrl-names : a pinctrl state named "default" must be defined
>>>    - pinctrl-0 : pin control group
>>>   See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
>>> + - imod-interval: Default interval is 5000ns
>> I think, as Rob suggested before, recommend to have a unit suffix
>> appended to the property name.
>> s/imod-interval/imod-interval-ns
>>  
>>>     Example:
>>>   usb30: usb@1127 {
>>> @@ -66,6 +67,7 @@ usb30: usb@1127 {
>>>   usb3-lpm-capable;
>>>   mediatek,syscon-wakeup = <>;
>>>   mediatek,wakeup-src = <1>;
>>> +    imod-interval = <1>;
>>>   };
>>>     2nd: dual-role mode with xHCI driver
>>> diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt
>>> b/Documentation/devicetree/bindings/usb/usb-xhci.txt
>>> index ae6e484..89b68f1 100644
>>> --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
>>> +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
>>> @@ -29,6 +29,7 @@ Optional properties:
>>>     - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
>>>     - usb3-lpm-capable: determines if platform is USB3 LPM capable
>>>     - quirk-broken-port-ped: set if the controller has broken port disable
>>> mechanism
>>> +  - imod-interval: Default interval is 4ns
>>>     Example:
>>>   usb@f0931000 {
>>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
>>> index b62a1d2..278ea3b 100644
>>> --- a/drivers/usb/host/xhci-mtk.c
>>> +++ b/drivers/usb/host/xhci-mtk.c
>>> @@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>>>     xhci = hcd_to_xhci(hcd);
>>>   xhci->main_hcd = hcd;
>>> +
>>> +    /*
>>> + * imod_interval is the interrupt modulation value in nanoseconds.
>>> + * The increment interval is 8 times as much as that defined in
>>> + * the xHCI spec on MTK's controller.
>>> + */
>>> +    xhci->imod_interval = 5000;
>>> +    device_property_read_u32(dev, "imod-interval", >imod_interval);
>>> +
>>>   xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
>>>   dev_name(dev), hcd);
>>>   if (!xhci->shared_hcd) {
>>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>>> index 7ef1274..efbe57b 100644
>>> --- 

Re: [PATCH v3] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Adam Wallis
On 12/2/2017 10:22 PM, Chunfeng Yun wrote:
> On Fri, 2017-12-01 at 10:44 -0500, Adam Wallis wrote:
>> The xHCI driver currently has the IMOD set to 160, which
>> translates to an IMOD interval of 40,000ns (160 * 250)ns
>>
>> Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
>> introduced a QUIRK for the MTK platform to adjust this interval to 20,
>> which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
>> due to the fact that the MTK controller IMOD interval is 8 times
>> as much as defined in xHCI spec.
>>
>> Instead of adding more quirk bits for additional platforms, this patch
>> introduces the ability for vendors to set the IMOD_INTERVAL as is
>> optimal for their platform. By using device_property_read_u32() on
>> "imod-interval", the IMOD INTERVAL can be specified in nano seconds. If
>> no interval is specified, the default of 40,000ns (IMOD=160) will be
>> used.
>>
>> No bounds checking has been implemented due to the fact that a vendor
>> may have violated the spec and would need to specify a value outside of
>> the max 8,000 IRQs/second limit specified in the xHCI spec.
>>
>> Signed-off-by: Adam Wallis 
>> ---
>> changes from v2:
>>   * Added PCI default value [Mathias]
>>   * Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
>>   * Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
>>   * Updated bindings Documentation to use proper units [Rob Herring]
>>   * Added imod-interval description and example to MTK binding documentation
>> changes from v1:
>>   * Removed device_property_read_u32() per suggestion from greg k-h
>>   * Used ER_IRQ_INTERVAL_MASK in place of (u16) cast
>>
>>  Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
>>  Documentation/devicetree/bindings/usb/usb-xhci.txt  | 1 +
>>  drivers/usb/host/xhci-mtk.c | 9 +
>>  drivers/usb/host/xhci-pci.c | 3 +++
>>  drivers/usb/host/xhci-plat.c| 4 
>>  drivers/usb/host/xhci.c | 7 ++-
>>  drivers/usb/host/xhci.h | 2 ++
>>  7 files changed, 23 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt 
>> b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>> index 3059596..45bbf18 100644
>> --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>> +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
>> @@ -46,6 +46,7 @@ Optional properties:
>>   - pinctrl-names : a pinctrl state named "default" must be defined
>>   - pinctrl-0 : pin control group
>>  See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
>> + - imod-interval: Default interval is 5000ns
> I think, as Rob suggested before, recommend to have a unit suffix
> appended to the property name.
> s/imod-interval/imod-interval-ns

Thanks, I definitely misunderstood his comments the first go around. I will make
the change.

>>  
>>  Example:
>>  usb30: usb@1127 {
>> @@ -66,6 +67,7 @@ usb30: usb@1127 {
>>  usb3-lpm-capable;
>>  mediatek,syscon-wakeup = <>;
>>  mediatek,wakeup-src = <1>;
>> +imod-interval = <1>;
>>  };
>>  
>>  2nd: dual-role mode with xHCI driver
>> diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
>> b/Documentation/devicetree/bindings/usb/usb-xhci.txt
>> index ae6e484..89b68f1 100644
>> --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
>> +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
>> @@ -29,6 +29,7 @@ Optional properties:
>>- usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
>>- usb3-lpm-capable: determines if platform is USB3 LPM capable
>>- quirk-broken-port-ped: set if the controller has broken port disable 
>> mechanism
>> +  - imod-interval: Default interval is 4ns
>>  
>>  Example:
>>  usb@f0931000 {
>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
>> index b62a1d2..278ea3b 100644
>> --- a/drivers/usb/host/xhci-mtk.c
>> +++ b/drivers/usb/host/xhci-mtk.c
>> @@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>>  
>>  xhci = hcd_to_xhci(hcd);
>>  xhci->main_hcd = hcd;
>> +
>> +/*
>> + * imod_interval is the interrupt modulation value in nanoseconds.
>> + * The increment interval is 8 times as much as that defined in
>> + * the xHCI spec on MTK's controller.
>> + */
>> +xhci->imod_interval = 5000;
>> +device_property_read_u32(dev, "imod-interval", >imod_interval);
>> +
>>  xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
>>  dev_name(dev), hcd);
>>  if (!xhci->shared_hcd) {
>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>> index 7ef1274..efbe57b 100644
>> --- a/drivers/usb/host/xhci-pci.c
>> +++ b/drivers/usb/host/xhci-pci.c
>> @@ 

Re: [PATCH v3 35/36] usb/gadget/NCM: Replace tasklet with softirq hrtimer

2017-12-04 Thread Felipe Balbi
Anna-Maria Gleixner  writes:

> From: Thomas Gleixner 
>
> The tx_tasklet tasklet is used in invoke the hrtimer (task_timer) in
> softirq context. This can be also achieved without the tasklet but
> with HRTIMER_MODE_SOFT as hrtimer mode.
>
> Signed-off-by: Thomas Gleixner 
> Signed-off-by: Anna-Maria Gleixner 
> Cc: Felipe Balbi 
> Cc: linux-usb@vger.kernel.org

This doesn't compile, so I'm assuming it depends on previous patches on
this series?

In that case:

Acked-by: Felipe Balbi 

-- 
balbi


signature.asc
Description: PGP signature


[balbi-usb:testing/next 6/16] drivers/usb/gadget/function/f_ncm.c:1105:10: error: 'HRTIMER_MODE_REL_SOFT' undeclared

2017-12-04 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
testing/next
head:   4929fb631d4cedc385910fd998518e22bd71d680
commit: 562d8eeed9a6bb9ca3370a3f75d96f0e7ba0a059 [6/16] usb/gadget/NCM: Replace 
tasklet with softirq hrtimer
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 562d8eeed9a6bb9ca3370a3f75d96f0e7ba0a059
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_wrap_ntb':
>> drivers/usb/gadget/function/f_ncm.c:1105:10: error: 'HRTIMER_MODE_REL_SOFT' 
>> undeclared (first use in this function)
 HRTIMER_MODE_REL_SOFT);
 ^
   drivers/usb/gadget/function/f_ncm.c:1105:10: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_bind':
   drivers/usb/gadget/function/f_ncm.c:1502:50: error: 'HRTIMER_MODE_REL_SOFT' 
undeclared (first use in this function)
 hrtimer_init(>task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 ^

vim +/HRTIMER_MODE_REL_SOFT +1105 drivers/usb/gadget/function/f_ncm.c

  1011  
  1012  static struct sk_buff *ncm_wrap_ntb(struct gether *port,
  1013  struct sk_buff *skb)
  1014  {
  1015  struct f_ncm*ncm = func_to_ncm(>func);
  1016  struct sk_buff  *skb2 = NULL;
  1017  int ncb_len = 0;
  1018  __le16  *ntb_data;
  1019  __le16  *ntb_ndp;
  1020  int dgram_pad;
  1021  
  1022  unsignedmax_size = ncm->port.fixed_in_len;
  1023  const struct ndp_parser_opts *opts = ncm->parser_opts;
  1024  const int ndp_align = 
le16_to_cpu(ntb_parameters.wNdpInAlignment);
  1025  const int div = le16_to_cpu(ntb_parameters.wNdpInDivisor);
  1026  const int rem = 
le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder);
  1027  const int dgram_idx_len = 2 * 2 * opts->dgram_item_len;
  1028  
  1029  if (!skb && !ncm->skb_tx_data)
  1030  return NULL;
  1031  
  1032  if (skb) {
  1033  /* Add the CRC if required up front */
  1034  if (ncm->is_crc) {
  1035  uint32_tcrc;
  1036  __le16  *crc_pos;
  1037  
  1038  crc = ~crc32_le(~0,
  1039  skb->data,
  1040  skb->len);
  1041  crc_pos = skb_put(skb, sizeof(uint32_t));
  1042  put_unaligned_le32(crc, crc_pos);
  1043  }
  1044  
  1045  /* If the new skb is too big for the current NCM NTB 
then
  1046   * set the current stored skb to be sent now and clear 
it
  1047   * ready for new data.
  1048   * NOTE: Assume maximum align for speed of calculation.
  1049   */
  1050  if (ncm->skb_tx_data
  1051  && (ncm->ndp_dgram_count >= TX_MAX_NUM_DPE
  1052  || (ncm->skb_tx_data->len +
  1053  div + rem + skb->len +
  1054  ncm->skb_tx_ndp->len + ndp_align + (2 * 
dgram_idx_len))
  1055  > max_size)) {
  1056  skb2 = package_for_tx(ncm);
  1057  if (!skb2)
  1058  goto err;
  1059  }
  1060  
  1061  if (!ncm->skb_tx_data) {
  1062  ncb_len = opts->nth_size;
  1063  dgram_pad = ALIGN(ncb_len, div) + rem - ncb_len;
  1064  ncb_len += dgram_pad;
  1065  
  1066  /* Create a new skb for the NTH and datagrams. 
*/
  1067  ncm->skb_tx_data = alloc_skb(max_size, 
GFP_ATOMIC);
  1068  if (!ncm->skb_tx_data)
  1069  goto err;
  1070  
  1071  ncm->skb_tx_data->dev = ncm->netdev;
  1072  ntb_data = skb_put_zero(ncm->skb_tx_data, 
ncb_len);
  1073  /* dwSignature */
  1074  put_unaligned_le32(opts->nth_sign, ntb_data);
  1075  ntb_data += 2;
  1076  /* wHeaderLength */
  1077  put_unaligned_le16(opts->nth_size, ntb_data++);
  1078  
  1079  /* Allocate an skb for storing the NDP,
  1080   * 

[balbi-usb:testing/next 6/16] drivers/usb/gadget/function/f_ncm.c:1105:10: error: 'HRTIMER_MODE_REL_SOFT' undeclared; did you mean 'HRTIMER_MODE_REL'?

2017-12-04 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
testing/next
head:   4929fb631d4cedc385910fd998518e22bd71d680
commit: 562d8eeed9a6bb9ca3370a3f75d96f0e7ba0a059 [6/16] usb/gadget/NCM: Replace 
tasklet with softirq hrtimer
config: i386-randconfig-x073-201749 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
git checkout 562d8eeed9a6bb9ca3370a3f75d96f0e7ba0a059
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_wrap_ntb':
>> drivers/usb/gadget/function/f_ncm.c:1105:10: error: 'HRTIMER_MODE_REL_SOFT' 
>> undeclared (first use in this function); did you mean 'HRTIMER_MODE_REL'?
 HRTIMER_MODE_REL_SOFT);
 ^
 HRTIMER_MODE_REL
   drivers/usb/gadget/function/f_ncm.c:1105:10: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_bind':
   drivers/usb/gadget/function/f_ncm.c:1502:50: error: 'HRTIMER_MODE_REL_SOFT' 
undeclared (first use in this function); did you mean 'HRTIMER_MODE_REL'?
 hrtimer_init(>task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 ^
 HRTIMER_MODE_REL

vim +1105 drivers/usb/gadget/function/f_ncm.c

  1011  
  1012  static struct sk_buff *ncm_wrap_ntb(struct gether *port,
  1013  struct sk_buff *skb)
  1014  {
  1015  struct f_ncm*ncm = func_to_ncm(>func);
  1016  struct sk_buff  *skb2 = NULL;
  1017  int ncb_len = 0;
  1018  __le16  *ntb_data;
  1019  __le16  *ntb_ndp;
  1020  int dgram_pad;
  1021  
  1022  unsignedmax_size = ncm->port.fixed_in_len;
  1023  const struct ndp_parser_opts *opts = ncm->parser_opts;
  1024  const int ndp_align = 
le16_to_cpu(ntb_parameters.wNdpInAlignment);
  1025  const int div = le16_to_cpu(ntb_parameters.wNdpInDivisor);
  1026  const int rem = 
le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder);
  1027  const int dgram_idx_len = 2 * 2 * opts->dgram_item_len;
  1028  
  1029  if (!skb && !ncm->skb_tx_data)
  1030  return NULL;
  1031  
  1032  if (skb) {
  1033  /* Add the CRC if required up front */
  1034  if (ncm->is_crc) {
  1035  uint32_tcrc;
  1036  __le16  *crc_pos;
  1037  
  1038  crc = ~crc32_le(~0,
  1039  skb->data,
  1040  skb->len);
  1041  crc_pos = skb_put(skb, sizeof(uint32_t));
  1042  put_unaligned_le32(crc, crc_pos);
  1043  }
  1044  
  1045  /* If the new skb is too big for the current NCM NTB 
then
  1046   * set the current stored skb to be sent now and clear 
it
  1047   * ready for new data.
  1048   * NOTE: Assume maximum align for speed of calculation.
  1049   */
  1050  if (ncm->skb_tx_data
  1051  && (ncm->ndp_dgram_count >= TX_MAX_NUM_DPE
  1052  || (ncm->skb_tx_data->len +
  1053  div + rem + skb->len +
  1054  ncm->skb_tx_ndp->len + ndp_align + (2 * 
dgram_idx_len))
  1055  > max_size)) {
  1056  skb2 = package_for_tx(ncm);
  1057  if (!skb2)
  1058  goto err;
  1059  }
  1060  
  1061  if (!ncm->skb_tx_data) {
  1062  ncb_len = opts->nth_size;
  1063  dgram_pad = ALIGN(ncb_len, div) + rem - ncb_len;
  1064  ncb_len += dgram_pad;
  1065  
  1066  /* Create a new skb for the NTH and datagrams. 
*/
  1067  ncm->skb_tx_data = alloc_skb(max_size, 
GFP_ATOMIC);
  1068  if (!ncm->skb_tx_data)
  1069  goto err;
  1070  
  1071  ncm->skb_tx_data->dev = ncm->netdev;
  1072  ntb_data = skb_put_zero(ncm->skb_tx_data, 
ncb_len);
  1073  /* dwSignature */
  1074  put_unaligned_le32(opts->nth_sign, ntb_data);
  1075  ntb_data += 2;
  1076  /* wHeaderLength */
  1077  put_unaligned_le16(opts->nth_size, ntb_data++);
  1078  
  1079  /* Allocate an skb for 

[PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume

2017-12-04 Thread Mathias Nyman
Interface drivers like btusb that don't support reset-resume will be
rebound at resume if port was reset. Rebind is done during the pm_ops
.complete callback when probe returns EPROBE_DEFER as default.

Remove the "rebind failed: -517" message.
Device probe will eventually take place later.

[one-liner by Jerry Snitselaar posted in a mailing list question -Mathias]
Suggested-by: Jerry Snitselaar 
Signed-off-by: Mathias Nyman 
---
 drivers/usb/core/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 64262a9a..5d34080 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf)
if (!intf->dev.power.is_prepared) {
intf->needs_binding = 0;
rc = device_attach(>dev);
-   if (rc < 0)
+   if (rc < 0 && rc != -EPROBE_DEFER)
dev_warn(>dev, "rebind failed: %d\n", rc);
}
 }
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: dra7: Disable USB metastability workaround for USB2

2017-12-04 Thread Felipe Balbi
Roger Quadros  writes:

> The metastability workaround causes Erratic errors [1]
> on the HighSpeed USB PHY which can cause upto 2 seconds
> delay in enumerating to a USB host while in Gadget mode.
>
> Disable the Run/Stop metastability workaround to avoid this
> ill effect. We are aware that this opens up the opportunity
> for Run/Stop metastability, however this issue has never been
> observed in TI releases so we think that Run/Stop metastability
> is a lesser evil than the PHY Erratic errors. So disable it.
>
> [1] USB controller trace during gadget enumeration
> irq/90-dwc3-969   [000] d...52.323145: dwc3_event: event (0901): 
> Erratic Error [U0]
> irq/90-dwc3-969   [000] d...52.560646: dwc3_event: event (0901): 
> Erratic Error [U0]
> irq/90-dwc3-969   [000] d...52.798144: dwc3_event: event (0901): 
> Erratic Error [U0]
>
> Signed-off-by: Roger Quadros 

FWIW:

Acked-by: Felipe Balbi 

I'm taking the dwc3 counterpart to v4.16

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH 0/1] USB Audio Device Class 3.0 Gadget support

2017-12-04 Thread Felipe Balbi

Hi,

Ruslan Bilovol  writes:
> On Tue, Nov 7, 2017 at 3:52 AM, Ruslan Bilovol  
> wrote:
>> Hi,
>>
>> This patch adds USB Audio Device Class 3.0 [1] function
>> support to gadget subsystem.
>> I didn't add UAC3 support to legacy gadget as it will
>> make preprocessor configuration too complex (UAC3 device
>> must have two configurations for backward compatibility,
>> first is UAC1/2 and second is UAC3), yet also I'm too lazy
>> to do that and verify all possible configurations.
>>
>> For modern ConfigFS interface I'll provide my configuration
>> for testing below; testing was done on a BeagleBone Black
>> board.
>>
>> This patch depends on uac3 header files from include dir
>> which I'll post as part of ALSA host UAC3 patch and will
>> provide the link to it here.
>
> http://www.spinics.net/lists/alsa-devel/msg69071.html

Once that patch hits upstream, then we can queue this for merge window
otherwise we will just have issues and create unbisectable points in the
tree.

-- 
balbi


signature.asc
Description: PGP signature


Re: [PATCH] PM / runtime: Drop children check from __pm_runtime_set_status()

2017-12-04 Thread Ulf Hansson
On 1 December 2017 at 12:03, Yoshihiro Shimoda
 wrote:
> Hi,
>
>> From: Ulf Hansson, Sent: Friday, December 1, 2017 6:22 PM
>>
>> + Kishon
>>
>> On 30 November 2017 at 13:51, Yoshihiro Shimoda
>>  wrote:
>> > Hi,
>> >
>> >> From: Ulf Hansson, Sent: Wednesday, November 29, 2017 6:59 PM
>> >>
>> >> On 29 November 2017 at 10:43, Geert Uytterhoeven  
>> >> wrote:
>> >> > Hi Ulf,
>> > 
>> >> Okay, so the problem remains no matter which solution for wakeup you
>> >> pick in genpd.
>> >
>> > Yes. Today I could reproduce this issue without usb host driver.
>> > - The renesas_usb3 usb peripheral driver has generic phy handling.
>> >   (The peripheral driver uses different generic phy driver 
>> > (phy-rcar-gen3-usb3.c) though.)
>> >  --> If I used the current renesas_usb3 (this means doesn't call 
>> > phy_power_{on,off}(),
>> >  the issue didn't happen.
>> >  --> If I added phy_power_{on,off}() calling, the issue happened.
>> >   --> So, I'm thinking the APIs are related to the issue.
>>
>> Yes.
>>
>> >
>> > - The generic phy APIs are in drivers/phy/phy-core.c.
>> >  --> The phy-rcar-gen3-usb[23] drivers call only pm_runtime_enable() 
>> > before devm_phy_create().
>> >   --> The phy-core will call pm_runtime_{get_sync,put}() in 
>> > phy_{init,exit,power_{on,off}}.
>> >--> So, IIUC, both devices of phy-. and  will 
>> > be handled by runtime PM APIs.
>> >  --> The runtime PM implementation of phy-core seems good to me. But...?
>>
>>
>> I have digested the information that you and Geert provided, thanks!
>>
>> So, my conclusions so far is:
>>
>> The phy core is using runtime PM reference counting at
>> phy_power_on|off(). Although it does that on the phy core device,
>> which is a child device of the phy provider device.
>>
>> Because phy_power_off() is called during system suspend from phy
>> consumer drivers like usb, the phy core device (child) and the phy
>> provider device (parent) will never become runtime suspended (because
>> the PM core has invoked pm_runtime_get_no_resume() for all device in
>> the device prepare phase).
>>
>> Then, when genpd calls pm_runtime_force_suspend() at the suspend noirq
>> phase for the phy provider device, the call to
>> pm_runtime_set_suspended() in there, triggers the earlier error
>> message, which is because the child (phy core device) is still runtime
>> resumed.
>
> Thank you very much for the conclusions!
> It's helpful to me about runtime PM behavior.
>
>> >> Then this seems to point to that the driver may be misbehaving in some
>> >> way. I can help to check what is going on.
>> >
>> > I guess so. But, I don't find yet...
>>
>> I think the below patch will help, although I am not sure if that is
>> sufficient as a long term fix.
>
> Thank you very much for your help!
> Also, I'm not sure how to fix for a long term kernels though...
>
>> Can you please try and see if it solves the problems?
>
> Sure! I tested your patch, and then the following message disappeared!
>
>Enabling runtime PM for inactive device (ee080200.usb-phy) with active 
> children

Great, that confirms my theory.

I will re-work the patch and re-post it to see what people thinks about it.

>
> However, the following message still exists.
>
>Enabling runtime PM for inactive device (ee08.usb) with active children
>
> So, I guess ohci-platform.c also has similar issue.

Yes, very likely!

However, I need some more time to look into this to be able to suggest
a solution.

>
> JFYI, the ehci-platform.c doesn't have runtime PM handling.
> So, I think that error message doesn't output from ehci devices.

Right, thanks!

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] dt-bindings: usb: add DT binding for RK3328 dwc3 controller

2017-12-04 Thread Heiko Stuebner
Am Montag, 4. Dezember 2017, 10:40:38 CET schrieb Heiko Stuebner:
> From: William Wu 
> 
> Adds the device tree bindings description for RK3328 and
> compatible USB DWC3 controller.
> 
> Signed-off-by: William Wu 
> Acked-by: Rob Herring 
> Signed-off-by: Heiko Stuebner 
> ---
> changes in v2:
> - add Rob's Ack
> 
> Ideally usb maintainers would pick up this patch to the binding
> document and I'll take the devicetree changes after that.
> 
> But if so desired, I can also pick up the binding change myself
> but would need an Ack for that.

just realized, the last version from august was actually v3, so this
should be v4, not v2 ... sorry about that.

Heiko
--
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 2/4] arm64: dts: rockchip: add usb3 controller node for RK3328 SoCs

2017-12-04 Thread Heiko Stuebner
From: William Wu 

RK3328 has one USB 3.0 OTG controller which uses DWC_USB3
core's general architecture. It can act as static xHCI host
controller, static device controller, USB 3.0/2.0 OTG basing
on ID of USB3.0 PHY.

Signed-off-by: William Wu 
Signed-off-by: Heiko Stuebner 
---
changes in v2:
none

 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
index 41d61840fb99..cafc572a68e0 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
@@ -805,6 +805,33 @@
status = "disabled";
};
 
+   usbdrd3: usb@ff60 {
+   compatible = "rockchip,rk3328-dwc3", "rockchip,rk3399-dwc3";
+   clocks = < SCLK_USB3OTG_REF>, < SCLK_USB3OTG_SUSPEND>,
+< ACLK_USB3OTG>;
+   clock-names = "ref_clk", "suspend_clk",
+ "bus_clk";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+   status = "disabled";
+
+   usbdrd_dwc3: dwc3@ff60 {
+   compatible = "snps,dwc3";
+   reg = <0x0 0xff60 0x0 0x10>;
+   interrupts = ;
+   dr_mode = "otg";
+   phy_type = "utmi_wide";
+   snps,dis_enblslpm_quirk;
+   snps,dis-u2-freeclk-exists-quirk;
+   snps,dis_u2_susphy_quirk;
+   snps,dis_u3_susphy_quirk;
+   snps,dis-del-phy-power-chg-quirk;
+   snps,dis-tx-ipgap-linecheck-quirk;
+   status = "disabled";
+   };
+   };
+
gic: interrupt-controller@ff811000 {
compatible = "arm,gic-400";
#interrupt-cells = <3>;
-- 
2.14.2

--
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 3/4] arm64: dts: rockchip: enable usb3 for RK3328 evaluation board

2017-12-04 Thread Heiko Stuebner
From: William Wu 

Rockchip's RK3328 evaluation board has one USB 3.0 OTG controller,
we enable it and set it act as static xHCI host controller to
support USB 3.0 HOST on RK3328 evaluation board.

Signed-off-by: William Wu 
Signed-off-by: Heiko Stuebner 
---
changes in v2:
none

 arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts 
b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
index 3d551e3e6c23..95fba84239a7 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
@@ -306,3 +306,12 @@
 _host0_ohci {
status = "okay";
 };
+
+ {
+   status = "okay";
+};
+
+_dwc3 {
+   dr_mode = "host";
+   status = "okay";
+};
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/4] dt-bindings: usb: add DT binding for RK3328 dwc3 controller

2017-12-04 Thread Heiko Stuebner
From: William Wu 

Adds the device tree bindings description for RK3328 and
compatible USB DWC3 controller.

Signed-off-by: William Wu 
Acked-by: Rob Herring 
Signed-off-by: Heiko Stuebner 
---
changes in v2:
- add Rob's Ack

Ideally usb maintainers would pick up this patch to the binding
document and I'll take the devicetree changes after that.

But if so desired, I can also pick up the binding change myself
but would need an Ack for that.

 Documentation/devicetree/bindings/usb/rockchip,dwc3.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt 
b/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
index 50a31536e975..2c3f6a467fda 100644
--- a/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
@@ -1,7 +1,9 @@
 Rockchip SuperSpeed DWC3 USB SoC controller
 
 Required properties:
-- compatible:  should contain "rockchip,rk3399-dwc3" for rk3399 SoC
+- compatible:  should be one of the following:
+  - "rockchip,rk3399-dwc3": for rk3399 SoC
+  - "rockchip,rk3328-dwc3", "rockchip,rk3399-dwc3": for rk3328 SoC
 - clocks:  A list of phandle + clock-specifier pairs for the
clocks listed in clock-names
 - clock-names: Should contain the following:
-- 
2.14.2

--
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 4/4] arm64: dts: rockchip: enable usb3 nodes on rk3328-rock64

2017-12-04 Thread Heiko Stuebner
Enable the nodes to make the usb3 port usable on that board.

Signed-off-by: Heiko Stuebner 
---
changes in v2:
- new patch

 arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts 
b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
index d4f80786e7c2..e393c3586c11 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
@@ -331,3 +331,12 @@
 _host0_ohci {
status = "okay";
 };
+
+ {
+   status = "okay";
+};
+
+_dwc3 {
+   dr_mode = "host";
+   status = "okay";
+};
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] usb: xhci: fix panic in xhci_free_virt_devices_depth_first

2017-12-04 Thread Mathias Nyman

On 01.12.2017 17:23, Greg Kroah-Hartman wrote:

On Fri, Dec 01, 2017 at 06:38:16AM -0800, Guenter Roeck wrote:

On Fri, Dec 1, 2017 at 3:41 AM, Mathias Nyman
 wrote:

From: Yu Chen 

Check vdev->real_port 0 to avoid panic
[9.261347] [] 
xhci_free_virt_devices_depth_first+0x58/0x108
[9.261352] [] xhci_mem_cleanup+0x1bc/0x570
[9.261355] [] xhci_stop+0x140/0x1c8
[9.261365] [] usb_remove_hcd+0xfc/0x1d0
[9.261369] [] xhci_plat_remove+0x6c/0xa8
[9.261377] [] platform_drv_remove+0x2c/0x70
[9.261384] [] __device_release_driver+0x80/0x108
[9.261387] [] device_release_driver+0x2c/0x40
[9.261392] [] bus_remove_device+0xe0/0x120
[9.261396] [] device_del+0x114/0x210
[9.261399] [] platform_device_del+0x30/0xa0
[9.261403] [] dwc3_otg_work+0x204/0x488
[9.261407] [] event_work+0x304/0x5b8
[9.261414] [] process_one_work+0x148/0x490
[9.261417] [] worker_thread+0x50/0x4a0
[9.261421] [] kthread+0xe8/0x100
[9.261427] [] ret_from_fork+0x10/0x50

The problem can occur if xhci_plat_remove() is called shortly after
xhci_plat_probe(). While xhci_free_virt_devices_depth_first been
called before the device has been setup and get real_port initialized.
The problem occurred on Hikey960 and was reproduced by Guenter Roeck
on Kevin with chromeos-4.4.

Cc: Guenter Roeck 
Cc:  # v4.10+


Fixes: ee8665e28e8d ("xhci: free xhci virtual devices with leaf nodes first")

would probably be better. That patch is in v4.4.y as well as in
v4.9.y, and thus both releases are affected.


I've added this fixes line, thanks.



Thanks
-Mathias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] usb: xhci: allow imod-interval to be configurable

2017-12-04 Thread Mathias Nyman

On 03.12.2017 05:22, Chunfeng Yun wrote:

On Fri, 2017-12-01 at 10:44 -0500, Adam Wallis wrote:

The xHCI driver currently has the IMOD set to 160, which
translates to an IMOD interval of 40,000ns (160 * 250)ns

Commit 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller")
introduced a QUIRK for the MTK platform to adjust this interval to 20,
which translates to an IMOD interval of 5,000ns (20 * 250)ns. This is
due to the fact that the MTK controller IMOD interval is 8 times
as much as defined in xHCI spec.

Instead of adding more quirk bits for additional platforms, this patch
introduces the ability for vendors to set the IMOD_INTERVAL as is
optimal for their platform. By using device_property_read_u32() on
"imod-interval", the IMOD INTERVAL can be specified in nano seconds. If
no interval is specified, the default of 40,000ns (IMOD=160) will be
used.

No bounds checking has been implemented due to the fact that a vendor
may have violated the spec and would need to specify a value outside of
the max 8,000 IRQs/second limit specified in the xHCI spec.

Signed-off-by: Adam Wallis 
---
changes from v2:
   * Added PCI default value [Mathias]
   * Removed xhci-mtk.h from xhci-plat.c [Chunfeng Yun]
   * Removed MTK quirk from xhci-plat and moved logic to xhci-mtk [Chunfeng]
   * Updated bindings Documentation to use proper units [Rob Herring]
   * Added imod-interval description and example to MTK binding documentation
changes from v1:
   * Removed device_property_read_u32() per suggestion from greg k-h
   * Used ER_IRQ_INTERVAL_MASK in place of (u16) cast

  Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt | 2 ++
  Documentation/devicetree/bindings/usb/usb-xhci.txt  | 1 +
  drivers/usb/host/xhci-mtk.c | 9 +
  drivers/usb/host/xhci-pci.c | 3 +++
  drivers/usb/host/xhci-plat.c| 4 
  drivers/usb/host/xhci.c | 7 ++-
  drivers/usb/host/xhci.h | 2 ++
  7 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt 
b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
index 3059596..45bbf18 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt
@@ -46,6 +46,7 @@ Optional properties:
   - pinctrl-names : a pinctrl state named "default" must be defined
   - pinctrl-0 : pin control group
See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+ - imod-interval: Default interval is 5000ns

I think, as Rob suggested before, recommend to have a unit suffix
appended to the property name.
s/imod-interval/imod-interval-ns
  
  
  Example:

  usb30: usb@1127 {
@@ -66,6 +67,7 @@ usb30: usb@1127 {
usb3-lpm-capable;
mediatek,syscon-wakeup = <>;
mediatek,wakeup-src = <1>;
+   imod-interval = <1>;
  };
  
  2nd: dual-role mode with xHCI driver

diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt 
b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index ae6e484..89b68f1 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -29,6 +29,7 @@ Optional properties:
- usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM
- usb3-lpm-capable: determines if platform is USB3 LPM capable
- quirk-broken-port-ped: set if the controller has broken port disable 
mechanism
+  - imod-interval: Default interval is 4ns
  
  Example:

usb@f0931000 {
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b62a1d2..278ea3b 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -674,6 +674,15 @@ static int xhci_mtk_probe(struct platform_device *pdev)
  
  	xhci = hcd_to_xhci(hcd);

xhci->main_hcd = hcd;
+
+   /*
+* imod_interval is the interrupt modulation value in nanoseconds.
+* The increment interval is 8 times as much as that defined in
+* the xHCI spec on MTK's controller.
+*/
+   xhci->imod_interval = 5000;
+   device_property_read_u32(dev, "imod-interval", >imod_interval);
+
xhci->shared_hcd = usb_create_shared_hcd(driver, dev,
dev_name(dev), hcd);
if (!xhci->shared_hcd) {
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 7ef1274..efbe57b 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -234,6 +234,9 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
if (!xhci->sbrn)
pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, >sbrn);
  
+	/* imod_interval is the interrupt modulation value in nanoseconds. */

+   xhci->imod_interval = 4;
+
retval = xhci_gen_setup(hcd, 

Re: [PATCH v9] xhci : AMD Promontory USB disable port support

2017-12-04 Thread Greg KH
On Mon, Dec 04, 2017 at 04:49:33PM +0800, Joe Lee wrote:
> For AMD Promontory xHCI host,
> although you can disable USB 2.0 ports in BIOSsettings,
> those ports will be enabled anyway after you remove a device on
> that port and re-plug it in again. It's a known limitation of the chip.
> As a workaround we can clear the PORT_WAKE_BITS.

Very odd line-wrapping, please fix.

> ---
> v9: Fix multi-line comment style 
> v8: usb_amd_pt_check_port() function return a bool
> v7: add a empty function for the case 
> when CONFIG_USB_PCI is not defined in pci-quirks.h
> v6: Fix coding format.
> v5: Add check disable port setting before set PORT_WAKE_BITS
> v4: Remove the patch code in case USB_PORT_FEAT_REMOTE_WAKE_MASK
> v3: Fix some checkpatch.pl

This all goes below the next --- line.

> 
> Signed-off-by: Joe Lee 

This ends up being dropped because you put --- above.

And shouldn't you be using a company email address?

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


[PATCH v9] xhci : AMD Promontory USB disable port support

2017-12-04 Thread Joe Lee
For AMD Promontory xHCI host,
although you can disable USB 2.0 ports in BIOSsettings,
those ports will be enabled anyway after you remove a device on
that port and re-plug it in again. It's a known limitation of the chip.
As a workaround we can clear the PORT_WAKE_BITS.

---
v9: Fix multi-line comment style 
v8: usb_amd_pt_check_port() function return a bool
v7: add a empty function for the case 
when CONFIG_USB_PCI is not defined in pci-quirks.h
v6: Fix coding format.
v5: Add check disable port setting before set PORT_WAKE_BITS
v4: Remove the patch code in case USB_PORT_FEAT_REMOTE_WAKE_MASK
v3: Fix some checkpatch.pl

Signed-off-by: Joe Lee 
---
 drivers/usb/host/pci-quirks.c | 128 ++
 drivers/usb/host/pci-quirks.h |   5 ++
 drivers/usb/host/xhci-hub.c   |   7 +++
 drivers/usb/host/xhci-pci.c   |  11 
 drivers/usb/host/xhci.h   |   2 +-
 5 files changed, 152 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 6dda362..bf8354e 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -65,6 +65,23 @@
 #defineAX_INDXC0x30
 #defineAX_DATAC0x34
 
+#define PT_ADDR_INDX   0xE8
+#define PT_READ_INDX   0xE4
+#define PT_SIG_1_ADDR  0xA520
+#define PT_SIG_2_ADDR  0xA521
+#define PT_SIG_3_ADDR  0xA522
+#define PT_SIG_4_ADDR  0xA523
+#define PT_SIG_1_DATA  0x78
+#define PT_SIG_2_DATA  0x56
+#define PT_SIG_3_DATA  0x34
+#define PT_SIG_4_DATA  0x12
+#define PT4_P1_REG 0xB521
+#define PT4_P2_REG 0xB522
+#define PT2_P1_REG 0xD520
+#define PT2_P2_REG 0xD521
+#define PT1_P1_REG 0xD522
+#define PT1_P2_REG 0xD523
+
 #defineNB_PCIE_INDX_ADDR   0xe0
 #defineNB_PCIE_INDX_DATA   0xe4
 #definePCIE_P_CNTL 0x10040
@@ -511,6 +528,117 @@ void usb_amd_dev_put(void)
 }
 EXPORT_SYMBOL_GPL(usb_amd_dev_put);
 
+bool usb_amd_pt_check_port(struct device *device, int port)
+{
+   unsigned char value;
+   struct pci_dev *pdev;
+
+   pdev = to_pci_dev(device);
+   pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_1_ADDR);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value != PT_SIG_1_DATA)
+   return false;
+
+   pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_2_ADDR);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value != PT_SIG_2_DATA)
+   return false;
+
+   pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_3_ADDR);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value != PT_SIG_3_DATA)
+   return false;
+
+   pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_4_ADDR);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value != PT_SIG_4_DATA)
+   return false;
+
+   if ((pdev->device == 0x43b9) || (pdev->device == 0x43ba)) {
+   /* device is AMD_PROMONTORYA_4(0x43b9) or
+* PROMONTORYA_3(0x43ba)
+* disable port setting
+* PT_4_P1_REG[7..1] is USB2.0 port6 to 0
+* PT4_P2_REG[6..0] is USB 13 to port 7
+* 0 : disable ;1 : enable
+*/
+   if (port > 6) {
+   pci_write_config_word(pdev, PT_ADDR_INDX,
+   PT4_P2_REG);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value & (1<<(port - 7)))
+   return false;
+   else
+   return true;
+   } else {
+   pci_write_config_word(pdev, PT_ADDR_INDX,
+   PT4_P1_REG);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value & (1<<(port + 1)))
+   return false;
+   else
+   return true;
+   }
+   } else if (pdev->device == 0x43bb) {
+   /* device is AMD_PROMONTORYA_2(0x43bb)
+* disable port setting
+* PT2_P1_REG[7..5] is USB2.0 port2 to 0
+* PT2_P2_REG[5..0] is USB 9 to port3
+* 0 : disable ;1 : enable
+*/
+   if (port > 2) {
+   pci_write_config_word(pdev, PT_ADDR_INDX, PT2_P2_REG);
+
+   pci_read_config_byte(pdev, PT_READ_INDX, );
+   if (value & (1<<(port - 3)))
+   return false;
+   else
+   return true;
+   } else {
+   pci_write_config_word(pdev, PT_ADDR_INDX, PT2_P1_REG);
+
+ 

Re: [PATCH v2] HID: add quirk for another PIXART OEM mouse used by HP

2017-12-04 Thread Benjamin Tissoires
On Fri, Dec 1, 2017 at 1:19 PM, Dave Young  wrote:
> This mouse keep disconnecting in runleve 3 like below, add it needs the
> quirk to mute the anoying messages.
>
> [  111.230555] usb 2-2: USB disconnect, device number 6
> [  112.718156] usb 2-2: new low-speed USB device number 7 using xhci_hcd
> [  112.941594] usb 2-2: New USB device found, idVendor=03f0, idProduct=094a
> [  112.984866] usb 2-2: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=0
> [  113.027731] usb 2-2: Product: HP USB Optical Mouse
> [  113.069977] usb 2-2: Manufacturer: PixArt
> [  113.113500] input: PixArt HP USB Optical Mouse as 
> /devices/pci:00/:00:14.0/usb2/2-2/2-2:1.0/0003:03F0:094A.0002/input/input14
> [  113.156787] hid-generic 0003:03F0:094A.0002: input: USB HID v1.11 Mouse 
> [PixArt HP USB Optical Mouse] on usb-:00:14.0-2/input0
> [  173.262642] usb 2-2: USB disconnect, device number 7
> [  174.750244] usb 2-2: new low-speed USB device number 8 using xhci_hcd
> [  174.935740] usb 2-2: New USB device found, idVendor=03f0, idProduct=094a
> [  174.990435] usb 2-2: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=0
> [  175.014984] usb 2-2: Product: HP USB Optical Mouse
> [  175.037886] usb 2-2: Manufacturer: PixArt
> [  175.061794] input: PixArt HP USB Optical Mouse as 
> /devices/pci:00/:00:14.0/usb2/2-2/2-2:1.0/0003:03F0:094A.0003/input/input15
> [  175.084946] hid-generic 0003:03F0:094A.0003: input: USB HID v1.11 Mouse 
> [PixArt HP USB Optical Mouse] on usb-:00:14.0-2/input0
>
> Signed-off-by: Dave Young 
> Cc: sta...@vger.kernel.org
> ---

Reviewed-by: Benjamin Tissoires 

> v1->v2: rebase to usb tree hid-quirks-cleanup branch
>  drivers/hid/hid-ids.h|1 +
>  drivers/hid/hid-quirks.c |1 +
>  2 files changed, 2 insertions(+)
>
> --- linux-x86.orig/drivers/hid/hid-ids.h
> +++ linux-x86/drivers/hid/hid-ids.h
> @@ -535,6 +535,7 @@
>  #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A  0x0a4a
>  #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A  0x0b4a
>  #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
> +#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A0x094a
>
>  #define USB_VENDOR_ID_HUION0x256c
>  #define USB_DEVICE_ID_HUION_TABLET 0x006e
> --- linux-x86.orig/drivers/hid/hid-quirks.c
> +++ linux-x86/drivers/hid/hid-quirks.c
> @@ -90,6 +90,7 @@ const struct hid_device_id hid_quirks[]
> { HID_USB_DEVICE(USB_VENDOR_ID_HP, 
> USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A), HID_QUIRK_ALWAYS_POLL 
> },
> { HID_USB_DEVICE(USB_VENDOR_ID_HP, 
> USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A), HID_QUIRK_ALWAYS_POLL 
> },
> { HID_USB_DEVICE(USB_VENDOR_ID_HP, 
> USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
> +   { HID_USB_DEVICE(USB_VENDOR_ID_HP, 
> USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A), HID_QUIRK_ALWAYS_POLL },
> { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, 
> USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT },
> { HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, 
> USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT },
> { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X), 
> HID_QUIRK_MULTI_INPUT },
--
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