[Letux-kernel] musb otg/y-cable regressions, OTG support removal
H. Nikolaus Schaller
hns at goldelico.com
Wed Feb 20 11:53:00 CET 2019
Hi Andreas,
> Am 19.02.2019 um 21:14 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
>
>> Am 19.02.2019 um 20:33 schrieb Andreas Kemnade <andreas at kemnade.info>:
>>
>> On Mon, 18 Feb 2019 09:07:27 +0100
>> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
>>
>>> Hi,
>>>
>>>> Am 18.02.2019 um 07:58 schrieb Andreas Kemnade <andreas at kemnade.info>:
>>>>
>>>> Hi,
>>>>
>>>> after quite some searching why b_host mode only works very randomly, I found
>>>> out that
>>>> - musb: disable b_host wait timeout for y-cable usage
>>>> is missing in >= letux-4.18. Seems to be forgotten in a conflict resolution.
>>>
>>> I have checked and it did no longer apply. So yes, it was probably forgotten
>>> to convert into a correct fix.
>>>
>>> This one appears to apply:
>>>
>>> commit 1a27badcf1ce03cb8bc69bdb72d76fd27660cf49 (HEAD -> letux/musb-fixes)
>>> Author: Andreas Kemnade <andreas at kemnade.info>
>>> Date: Mon Feb 13 17:16:57 2017 +0100
>>>
>>> musb: disable b_host wait timeout for y-cable usage
>>>
>>> To be able to use Y-cables to power the device and use it as host at
>>> the same time, disable the b_waitacon timeout.
>>>
>>> Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
>>>
>>> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
>>> index b7d56272f9d1..780787540b85 100644
>>> --- a/drivers/usb/musb/musb_core.c
>>> +++ b/drivers/usb/musb/musb_core.c
>>> @@ -718,9 +718,15 @@ static void musb_handle_intr_suspend(struct musb *musb, u8 devctl)
>>> if (musb->is_active) {
>>> musb->xceiv->otg->state = OTG_STATE_B_WAIT_ACON;
>>> musb_dbg(musb, "HNP: Setting timer for b_ase0_brst");
>>> + /* If trying to switch to b_host without a real
>>> + * hnp reset (y-cables and such) the timer might
>>> + * be disturbing
>>> + */
>>> +#if 0
>>> mod_timer(&musb->otg_timer, jiffies
>>> + msecs_to_jiffies(
>>> OTG_TIME_B_ASE0_BRST));
>>> +#endif
>>> }
>>> break;
>>> case OTG_STATE_A_WAIT_BCON:
>>>
>>>
>>>> - and them we have this one
>>>> commit 0a9134bd733bbb99bd18f5520a488960170271f2
>>>> Author: Bin Liu <b-liu at ti.com>
>>>> Date: Mon May 21 08:42:19 2018 -0500
>>>>
>>>> usb: musb: disable otg protocol support
>>>>
>>>> As decided in the discussion [1] we are deleting the otg protocol
>>>> support from the musb drivers.
>>>>
>>>> First this patch disables the flags for enabling the otg protocols. We
>>>> will later gradually delete the otg protocol code from the musb drivers.
>>>>
>>>> [1] https://www.spinics.net/lists/linux-usb/msg167003.html
>>>>
>>>> Signed-off-by: Bin Liu <b-liu at ti.com>
>>>> Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>>>>
>>>> that seems also to influence things.
It appears to have been introduced in v4.18-rc2.
>>>>
>>
>> ok, played a bit around with it. Reverting it enables me to do
>> all the things I do with that otg usb.
>
> I have included the above patch in 5.0-rc7 and scheduled for
> the next 4.19/4.20 (forgot to include it immediately).
>
> Regarding USB/OTG I want to do some tests myself. Then we should
> raise fingers and submit the revert...
I have done a simple test: plug in the OTG cable and then plug a memory stick or WiFi stick:
root at letux:~# [ 452.581024] musb-hdrc musb-hdrc.0.auto: configured as A device timeout
root at letux:~# [ 461.739410] usb 2-1: new high-speed USB device number 2 using musb-hdrc
[ 461.920166] usb 2-1: New USB device found, idVendor=0204, idProduct=6025, bcdDevice= 1.00
[ 461.928833] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 461.937591] usb 2-1: Product: Flash Disk
[ 461.942596] usb 2-1: Manufacturer: CBM
[ 461.946594] usb 2-1: SerialNumber: 221835001DC5F204
[ 461.960357] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 461.985290] scsi host0: usb-storage 2-1:1.0
[ 463.070312] scsi 0:0:0:0: Direct-Access CBM Flash Disk 5.00 PQ: 0 ANSI: 2
[ 463.091278] sd 0:0:0:0: [sda] 2072064 512-byte logical blocks: (1.06 GB/1012 MiB)
[ 463.104431] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 463.111389] sd 0:0:0:0: [sda] Write Protect is off
[ 463.116394] sd 0:0:0:0: [sda] Mode Sense: 0b 00 00 08
[ 463.129638] sd 0:0:0:0: [sda] No Caching mode page found
[ 463.135223] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 463.160888] sda: sda1
[ 463.167755] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 469.191070] usb 2-1: USB disconnect, device number 2
[ 488.261047] usb 2-1: new high-speed USB device number 3 using musb-hdrc
[ 488.441894] usb 2-1: New USB device found, idVendor=0204, idProduct=6025, bcdDevice= 1.00
[ 488.450683] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 488.458251] usb 2-1: Product: Flash Disk
[ 488.463684] usb 2-1: Manufacturer: CBM
[ 488.467681] usb 2-1: SerialNumber: 221835001DC5F204
[ 488.481872] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 488.503936] scsi host0: usb-storage 2-1:1.0
[ 489.552581] scsi 0:0:0:0: Direct-Access CBM Flash Disk 5.00 PQ: 0 ANSI: 2
[ 489.568054] sd 0:0:0:0: [sda] 2072064 512-byte logical blocks: (1.06 GB/1012 MiB)
[ 489.582794] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 489.593719] sd 0:0:0:0: [sda] Write Protect is off
[ 489.598754] sd 0:0:0:0: [sda] Mode Sense: 0b 00 00 08
[ 489.615386] sd 0:0:0:0: [sda] No Caching mode page found
[ 489.621124] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 489.633056] sda: sda1
[ 489.643096] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 492.219909] usb 2-1: USB disconnect, device number 3
[ 501.991546] usb 2-1: new high-speed USB device number 4 using musb-hdrc
[ 502.182739] usb 2-1: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[ 502.191528] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 502.199096] usb 2-1: Product: 802.11n NIC
[ 502.205078] usb 2-1: Manufacturer: Realtek
[ 502.209533] usb 2-1: SerialNumber: 7CDD90A871B2
[ 502.221984] usb 2-1: rejected 1 configuration due to insufficient available bus power
[ 502.230285] usb 2-1: no configuration chosen from 1 choice
[ 509.010009] usb 2-1: USB disconnect, device number 4
Both seem to work (at least to available bus power).
This means that basic OTG (role switch by ID pin) is still working with letux-4.19.23.
So could a different solution for the Y cable be to fake an active ID pin?
BR,
Nikolaus
More information about the Letux-kernel
mailing list