diff mbox series

fix for lantiq (danube) usb

Message ID 344d6c0d-d49b-6c32-5607-82c96a935494@ventoso.org
State Not Applicable
Delegated to: Petr Štetiar
Headers show
Series fix for lantiq (danube) usb | expand

Commit Message

Luca Olivetti July 3, 2020, 4:10 p.m. UTC
Hello,

around 2 years ago, this patch

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6eaf8b3d89571992a0aa7142cfab3f1dcef3c802#patch7

broke the usb on my arv7518pw: when it tries to power up the usb it 
returns error -537 (EPROBE_DEFER, see 
https://bugs.openwrt.org/index.php?do=details&task_id=1634).

[ 5.431505] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[ 5.438418] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[ 5.446581] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
GRSTCTL=80000001
[ 5.593255] dwc2 1e101000.usb: DWC OTG Controller
[ 5.596565] dwc2 1e101000.usb: new USB bus registered, assigned bus number 1
[ 5.603417] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[ 5.608632] dwc2 1e101000.usb: startup error -517
[ 5.613124] dwc2 1e101000.usb: USB bus 1 deregistered
[ 5.618080] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517


If I revert the above patch, the usb initializes correctly, but there's 
no 5V on the port so it doesn't work.

I hacked a fake led on gpio 14 so I can turn on the 5V from user space, 
and the usb works (I tried with a memory stick and an rt73 wifi stick, 
an rtl8812au doesn't work but I think because its driver is ... meh).

What's the proper way to turn on the 5V on gpio 14 (i.e. fix the 
-EPROBE_DEFER error)?


I suppose that the issue also affects other danube based devices, but I 
can only test the one I have.

This is against 19.07.3

Comments

John Crispin July 3, 2020, 5:37 p.m. UTC | #1
On 03.07.20 19:23, Luca Olivetti wrote:
> El 3/7/20 a les 18:42, John Crispin ha escrit:
>>
>> On 03.07.20 18:10, Luca Olivetti wrote:
>>> Hello,
>>>
>>> around 2 years ago, this patch
>>>
>>> https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6eaf8b3d89571992a0aa7142cfab3f1dcef3c802#patch7 
>>>
>>>
>>> broke the usb on my arv7518pw: when it tries to power up the usb it 
>>> returns error -537 (EPROBE_DEFER, see 
>>> https://bugs.openwrt.org/index.php?do=details&task_id=1634).
>>>
>>> [ 5.431505] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
>>> using dummy regulator
>>> [ 5.438418] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
>>> using dummy regulator
>>> [ 5.446581] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
>>> GRSTCTL=80000001
>>> [ 5.593255] dwc2 1e101000.usb: DWC OTG Controller
>>> [ 5.596565] dwc2 1e101000.usb: new USB bus registered, assigned bus 
>>> number 1
>>> [ 5.603417] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
>>> [ 5.608632] dwc2 1e101000.usb: startup error -517
>>> [ 5.613124] dwc2 1e101000.usb: USB bus 1 deregistered
>>> [ 5.618080] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>>>
>>>
>>> If I revert the above patch, the usb initializes correctly, but 
>>> there's no 5V on the port so it doesn't work.
>>>
>>> I hacked a fake led on gpio 14 so I can turn on the 5V from user 
>>> space, and the usb works (I tried with a memory stick and an rt73 
>>> wifi stick, an rtl8812au doesn't work but I think because its driver 
>>> is ... meh).
>>>
>>> What's the proper way to turn on the 5V on gpio 14 (i.e. fix the 
>>> -EPROBE_DEFER error)?
>>>
>>>
>>> I suppose that the issue also affects other danube based devices, 
>>> but I can only test the one I have.
>>>
>>> This is against 19.07.3
>>
>>
>> Why not use the gpio regulator ?
>
> Because I don't know how :-(
>
https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
Luca Olivetti July 3, 2020, 5:47 p.m. UTC | #2
El 3/7/20 a les 19:37, John Crispin ha escrit:

>>>
>>> Why not use the gpio regulator ?
>>
>> Because I don't know how :-(
>>
> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
> 

Oh, I see, but that's the one I had to *remove* because it didn't work.

Bye
John Crispin July 3, 2020, 5:49 p.m. UTC | #3
On 03.07.20 19:47, Luca Olivetti wrote:
> El 3/7/20 a les 19:37, John Crispin ha escrit:
>
>>>>
>>>> Why not use the gpio regulator ?
>>>
>>> Because I don't know how :-(
>>>
>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>
>
> Oh, I see, but that's the one I had to *remove* because it didn't work.
>
> Bye


CONFIG_REGULATOR_GPIO is not enabled in the kernel config
Luca Olivetti July 3, 2020, 5:57 p.m. UTC | #4
El 3/7/20 a les 19:49, John Crispin ha escrit:
> 
> On 03.07.20 19:47, Luca Olivetti wrote:
>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>
>>>>>
>>>>> Why not use the gpio regulator ?
>>>>
>>>> Because I don't know how :-(
>>>>
>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>
>>
>> Oh, I see, but that's the one I had to *remove* because it didn't work.
>>
>> Bye
> 
> 
> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
> 


So it's just a matter of adding it to 
target/linux/lantiq/xway/config-4.14 after


CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y


?


(and put back the entry I removed in the dts)

Bye
John Crispin July 3, 2020, 6:06 p.m. UTC | #5
On 03.07.20 19:57, Luca Olivetti wrote:
> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>
>> On 03.07.20 19:47, Luca Olivetti wrote:
>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>
>>>>>>
>>>>>> Why not use the gpio regulator ?
>>>>>
>>>>> Because I don't know how :-(
>>>>>
>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>
>>>
>>> Oh, I see, but that's the one I had to *remove* because it didn't work.
>>>
>>> Bye
>>
>>
>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
>>
>
>
> So it's just a matter of adding it to 
> target/linux/lantiq/xway/config-4.14 after
>
>
> CONFIG_REGULATOR=y
> CONFIG_REGULATOR_FIXED_VOLTAGE=y
>
>
> ?
>
>
> (and put back the entry I removed in the dts)
>
> Bye


correct
Luca Olivetti July 3, 2020, 6:07 p.m. UTC | #6
El 3/7/20 a les 20:06, John Crispin ha escrit:
> 
> On 03.07.20 19:57, Luca Olivetti wrote:
>> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>>
>>> On 03.07.20 19:47, Luca Olivetti wrote:
>>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>>
>>>>>>>
>>>>>>> Why not use the gpio regulator ?
>>>>>>
>>>>>> Because I don't know how :-(
>>>>>>
>>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>>
>>>>
>>>> Oh, I see, but that's the one I had to *remove* because it didn't work.
>>>>
>>>> Bye
>>>
>>>
>>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
>>>
>>
>>
>> So it's just a matter of adding it to 
>> target/linux/lantiq/xway/config-4.14 after
>>
>>
>> CONFIG_REGULATOR=y
>> CONFIG_REGULATOR_FIXED_VOLTAGE=y
>>
>>
>> ?
>>
>>
>> (and put back the entry I removed in the dts)
>>
>> Bye
> 
> 
> correct
> 


Thank you, I'm building it now (but my system is slow). I'll report back 
if it works.


Bye
Luca Olivetti July 3, 2020, 7:07 p.m. UTC | #7
El 3/7/20 a les 20:07, Luca Olivetti ha escrit:
> El 3/7/20 a les 20:06, John Crispin ha escrit:
>>
>> On 03.07.20 19:57, Luca Olivetti wrote:
>>> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>>>
>>>> On 03.07.20 19:47, Luca Olivetti wrote:
>>>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>>>
>>>>>>>>
>>>>>>>> Why not use the gpio regulator ?
>>>>>>>
>>>>>>> Because I don't know how :-(
>>>>>>>
>>>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>>>
>>>>>
>>>>> Oh, I see, but that's the one I had to *remove* because it didn't 
>>>>> work.
>>>>>
>>>>> Bye
>>>>
>>>>
>>>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
>>>>
>>>
>>>
>>> So it's just a matter of adding it to 
>>> target/linux/lantiq/xway/config-4.14 after
>>>
>>>
>>> CONFIG_REGULATOR=y
>>> CONFIG_REGULATOR_FIXED_VOLTAGE=y
>>>
>>>
>>> ?
>>>
>>>
>>> (and put back the entry I removed in the dts)
>>>
>>> Bye
>>
>>
>> correct
>>
> 
> 
> Thank you, I'm building it now (but my system is slow). I'll report back 
> if it works.

Nope, it doesn't

# dmesg | grep dwc2
[    5.751540] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[    5.758454] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[    5.766666] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
GRSTCTL=80000001
[    5.912432] dwc2 1e101000.usb: DWC OTG Controller
[    5.915747] dwc2 1e101000.usb: new USB bus registered, assigned bus 
number 1
[    5.922594] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[    5.927811] dwc2 1e101000.usb: startup error -517
[    5.932278] dwc2 1e101000.usb: USB bus 1 deregistered
[    5.937340] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
[   50.308465] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[   50.315362] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[   50.360539] dwc2 1e101000.usb: DWC OTG Controller
[   50.363823] dwc2 1e101000.usb: new USB bus registered, assigned bus 
number 1
[   50.370726] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[   50.375988] dwc2 1e101000.usb: startup error -517
[   50.380385] dwc2 1e101000.usb: USB bus 1 deregistered
[   50.385438] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
[   50.457833] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[   50.464747] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[   50.472906] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
GRSTCTL=80000001
[   50.632565] dwc2 1e101000.usb: DWC OTG Controller
[   50.635942] dwc2 1e101000.usb: new USB bus registered, assigned bus 
number 1
[   50.642733] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[   50.647992] dwc2 1e101000.usb: startup error -517
[   50.652411] dwc2 1e101000.usb: USB bus 1 deregistered
[   50.657463] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
[   50.767275] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[   50.774183] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[   50.782345] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
GRSTCTL=80000001
[   51.098453] dwc2 1e101000.usb: DWC OTG Controller
[   51.101832] dwc2 1e101000.usb: new USB bus registered, assigned bus 
number 1
[   51.108645] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[   51.113845] dwc2 1e101000.usb: startup error -517
[   51.118306] dwc2 1e101000.usb: USB bus 1 deregistered
[   51.123355] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
[   86.412437] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[   86.419349] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[   86.427592] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
GRSTCTL=80000001
[   86.620575] dwc2 1e101000.usb: DWC OTG Controller
[   86.623972] dwc2 1e101000.usb: new USB bus registered, assigned bus 
number 1
[   86.630735] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[   86.636020] dwc2 1e101000.usb: startup error -517
[   86.640421] dwc2 1e101000.usb: USB bus 1 deregistered
[   86.645483] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517


Bye
John Crispin July 3, 2020, 7:10 p.m. UTC | #8
On 03.07.20 21:07, Luca Olivetti wrote:
> El 3/7/20 a les 20:07, Luca Olivetti ha escrit:
>> El 3/7/20 a les 20:06, John Crispin ha escrit:
>>>
>>> On 03.07.20 19:57, Luca Olivetti wrote:
>>>> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>>>>
>>>>> On 03.07.20 19:47, Luca Olivetti wrote:
>>>>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>>>>
>>>>>>>>>
>>>>>>>>> Why not use the gpio regulator ?
>>>>>>>>
>>>>>>>> Because I don't know how :-(
>>>>>>>>
>>>>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>>>>
>>>>>>
>>>>>> Oh, I see, but that's the one I had to *remove* because it didn't 
>>>>>> work.
>>>>>>
>>>>>> Bye
>>>>>
>>>>>
>>>>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
>>>>>
>>>>
>>>>
>>>> So it's just a matter of adding it to 
>>>> target/linux/lantiq/xway/config-4.14 after
>>>>
>>>>
>>>> CONFIG_REGULATOR=y
>>>> CONFIG_REGULATOR_FIXED_VOLTAGE=y
>>>>
>>>>
>>>> ?
>>>>
>>>>
>>>> (and put back the entry I removed in the dts)
>>>>
>>>> Bye
>>>
>>>
>>> correct
>>>
>>
>>
>> Thank you, I'm building it now (but my system is slow). I'll report 
>> back if it works.
>
> Nope, it doesn't
>

printk the driver with a salt shaker and see if it loads and if so where 
it breaks



> # dmesg | grep dwc2
> [    5.751540] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
> found, using dummy regulator
> [    5.758454] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
> found, using dummy regulator
> [    5.766666] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
> GRSTCTL=80000001
> [    5.912432] dwc2 1e101000.usb: DWC OTG Controller
> [    5.915747] dwc2 1e101000.usb: new USB bus registered, assigned bus 
> number 1
> [    5.922594] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
> [    5.927811] dwc2 1e101000.usb: startup error -517
> [    5.932278] dwc2 1e101000.usb: USB bus 1 deregistered
> [    5.937340] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
> [   50.308465] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
> found, using dummy regulator
> [   50.315362] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
> found, using dummy regulator
> [   50.360539] dwc2 1e101000.usb: DWC OTG Controller
> [   50.363823] dwc2 1e101000.usb: new USB bus registered, assigned bus 
> number 1
> [   50.370726] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
> [   50.375988] dwc2 1e101000.usb: startup error -517
> [   50.380385] dwc2 1e101000.usb: USB bus 1 deregistered
> [   50.385438] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
> [   50.457833] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
> found, using dummy regulator
> [   50.464747] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
> found, using dummy regulator
> [   50.472906] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
> GRSTCTL=80000001
> [   50.632565] dwc2 1e101000.usb: DWC OTG Controller
> [   50.635942] dwc2 1e101000.usb: new USB bus registered, assigned bus 
> number 1
> [   50.642733] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
> [   50.647992] dwc2 1e101000.usb: startup error -517
> [   50.652411] dwc2 1e101000.usb: USB bus 1 deregistered
> [   50.657463] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
> [   50.767275] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
> found, using dummy regulator
> [   50.774183] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
> found, using dummy regulator
> [   50.782345] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
> GRSTCTL=80000001
> [   51.098453] dwc2 1e101000.usb: DWC OTG Controller
> [   51.101832] dwc2 1e101000.usb: new USB bus registered, assigned bus 
> number 1
> [   51.108645] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
> [   51.113845] dwc2 1e101000.usb: startup error -517
> [   51.118306] dwc2 1e101000.usb: USB bus 1 deregistered
> [   51.123355] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
> [   86.412437] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
> found, using dummy regulator
> [   86.419349] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
> found, using dummy regulator
> [   86.427592] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
> GRSTCTL=80000001
> [   86.620575] dwc2 1e101000.usb: DWC OTG Controller
> [   86.623972] dwc2 1e101000.usb: new USB bus registered, assigned bus 
> number 1
> [   86.630735] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
> [   86.636020] dwc2 1e101000.usb: startup error -517
> [   86.640421] dwc2 1e101000.usb: USB bus 1 deregistered
> [   86.645483] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>
>
> Bye
John Crispin July 3, 2020, 7:14 p.m. UTC | #9
On 03.07.20 21:10, John Crispin wrote:
>
> On 03.07.20 21:07, Luca Olivetti wrote:
>> El 3/7/20 a les 20:07, Luca Olivetti ha escrit:
>>> El 3/7/20 a les 20:06, John Crispin ha escrit:
>>>>
>>>> On 03.07.20 19:57, Luca Olivetti wrote:
>>>>> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>>>>>
>>>>>> On 03.07.20 19:47, Luca Olivetti wrote:
>>>>>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Why not use the gpio regulator ?
>>>>>>>>>
>>>>>>>>> Because I don't know how :-(
>>>>>>>>>
>>>>>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>>>>>
>>>>>>>
>>>>>>> Oh, I see, but that's the one I had to *remove* because it 
>>>>>>> didn't work.
>>>>>>>
>>>>>>> Bye
>>>>>>
>>>>>>
>>>>>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
>>>>>>
>>>>>
>>>>>
>>>>> So it's just a matter of adding it to 
>>>>> target/linux/lantiq/xway/config-4.14 after
>>>>>
>>>>>
>>>>> CONFIG_REGULATOR=y
>>>>> CONFIG_REGULATOR_FIXED_VOLTAGE=y
>>>>>
>>>>>
>>>>> ?
>>>>>
>>>>>
>>>>> (and put back the entry I removed in the dts)
>>>>>
>>>>> Bye
>>>>
>>>>
>>>> correct
>>>>
>>>
>>>
>>> Thank you, I'm building it now (but my system is slow). I'll report 
>>> back if it works.
>>
>> Nope, it doesn't
>>
>
> printk the driver with a salt shaker and see if it loads and if so 
> where it breaks
>
>
>
make kernel_menuconfig CONFIG_TARGET=subtarget

that will drop you into the kernel menu config. you can make sure the 
driver is selected


>> # dmesg | grep dwc2
>> [    5.751540] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
>> found, using dummy regulator
>> [    5.758454] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
>> found, using dummy regulator
>> [    5.766666] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
>> GRSTCTL=80000001
>> [    5.912432] dwc2 1e101000.usb: DWC OTG Controller
>> [    5.915747] dwc2 1e101000.usb: new USB bus registered, assigned 
>> bus number 1
>> [    5.922594] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
>> [    5.927811] dwc2 1e101000.usb: startup error -517
>> [    5.932278] dwc2 1e101000.usb: USB bus 1 deregistered
>> [    5.937340] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>> [   50.308465] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
>> found, using dummy regulator
>> [   50.315362] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
>> found, using dummy regulator
>> [   50.360539] dwc2 1e101000.usb: DWC OTG Controller
>> [   50.363823] dwc2 1e101000.usb: new USB bus registered, assigned 
>> bus number 1
>> [   50.370726] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
>> [   50.375988] dwc2 1e101000.usb: startup error -517
>> [   50.380385] dwc2 1e101000.usb: USB bus 1 deregistered
>> [   50.385438] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>> [   50.457833] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
>> found, using dummy regulator
>> [   50.464747] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
>> found, using dummy regulator
>> [   50.472906] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
>> GRSTCTL=80000001
>> [   50.632565] dwc2 1e101000.usb: DWC OTG Controller
>> [   50.635942] dwc2 1e101000.usb: new USB bus registered, assigned 
>> bus number 1
>> [   50.642733] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
>> [   50.647992] dwc2 1e101000.usb: startup error -517
>> [   50.652411] dwc2 1e101000.usb: USB bus 1 deregistered
>> [   50.657463] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>> [   50.767275] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
>> found, using dummy regulator
>> [   50.774183] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
>> found, using dummy regulator
>> [   50.782345] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
>> GRSTCTL=80000001
>> [   51.098453] dwc2 1e101000.usb: DWC OTG Controller
>> [   51.101832] dwc2 1e101000.usb: new USB bus registered, assigned 
>> bus number 1
>> [   51.108645] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
>> [   51.113845] dwc2 1e101000.usb: startup error -517
>> [   51.118306] dwc2 1e101000.usb: USB bus 1 deregistered
>> [   51.123355] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>> [   86.412437] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not 
>> found, using dummy regulator
>> [   86.419349] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not 
>> found, using dummy regulator
>> [   86.427592] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
>> GRSTCTL=80000001
>> [   86.620575] dwc2 1e101000.usb: DWC OTG Controller
>> [   86.623972] dwc2 1e101000.usb: new USB bus registered, assigned 
>> bus number 1
>> [   86.630735] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
>> [   86.636020] dwc2 1e101000.usb: startup error -517
>> [   86.640421] dwc2 1e101000.usb: USB bus 1 deregistered
>> [   86.645483] dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517
>>
>>
>> Bye
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Luca Olivetti July 3, 2020, 7:31 p.m. UTC | #10
El 3/7/20 a les 21:10, John Crispin ha escrit:
> 
> On 03.07.20 21:07, Luca Olivetti wrote:
>> El 3/7/20 a les 20:07, Luca Olivetti ha escrit:
>>> El 3/7/20 a les 20:06, John Crispin ha escrit:
>>>>
>>>> On 03.07.20 19:57, Luca Olivetti wrote:
>>>>> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>>>>>
>>>>>> On 03.07.20 19:47, Luca Olivetti wrote:
>>>>>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Why not use the gpio regulator ?
>>>>>>>>>
>>>>>>>>> Because I don't know how :-(
>>>>>>>>>
>>>>>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>>>>>
>>>>>>>
>>>>>>> Oh, I see, but that's the one I had to *remove* because it didn't 
>>>>>>> work.
>>>>>>>
>>>>>>> Bye
>>>>>>
>>>>>>
>>>>>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
>>>>>>
>>>>>
>>>>>
>>>>> So it's just a matter of adding it to 
>>>>> target/linux/lantiq/xway/config-4.14 after
>>>>>
>>>>>
>>>>> CONFIG_REGULATOR=y
>>>>> CONFIG_REGULATOR_FIXED_VOLTAGE=y
>>>>>
>>>>>
>>>>> ?
>>>>>
>>>>>
>>>>> (and put back the entry I removed in the dts)
>>>>>
>>>>> Bye
>>>>
>>>>
>>>> correct
>>>>
>>>
>>>
>>> Thank you, I'm building it now (but my system is slow). I'll report 
>>> back if it works.
>>
>> Nope, it doesn't
>>
> 
> printk the driver with a salt shaker and see if it loads and if so where 
> it breaks

I'm not sure I understand, but I visually checked the code and the only 
part where it could return -EPROBE_DEFER is here in dwc/hcd.c

static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg)
{
         int ret;

         hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, 
"vbus");
         if (IS_ERR(hsotg->vbus_supply)) {
                 ret = PTR_ERR(hsotg->vbus_supply);
                 hsotg->vbus_supply = NULL;
                 return ret == -ENODEV ? 0 : ret;
         }

         return regulator_enable(hsotg->vbus_supply);
}


I suppose it's the call to devm_regulator_get_optional, which should 
lead to regulator/core.c

static struct regulator_dev *regulator_dev_lookup(struct device *dev,
                                                   const char *supply)
{
         struct regulator_dev *r = NULL;
         struct device_node *node;
         struct regulator_map *map;
         const char *devname = NULL;

         regulator_supply_alias(&dev, &supply);

         /* first do a dt based lookup */
         if (dev && dev->of_node) {
                 node = of_get_regulator(dev, supply);
                 if (node) {
                         r = of_find_regulator_by_node(node);
                         if (r)
                                 return r;

                         /*
                          * We have a node, but there is no device.
                          * assume it has not registered yet.
                          */
                         return ERR_PTR(-EPROBE_DEFER);
                 }
         }



But since I don't really understand what's happening here, I don't know 
how to fix it.
I only know that if I remove the regulator from the dts the function 
completes (since "node" is not found) and I can then enable the gpio 
manually.


Bye
Luca Olivetti July 3, 2020, 8:05 p.m. UTC | #11
El 3/7/20 a les 21:31, Luca Olivetti ha escrit:

> I suppose it's the call to devm_regulator_get_optional, which should 
> lead to regulator/core.c
> 
> static struct regulator_dev *regulator_dev_lookup(struct device *dev,
>                                                    const char *supply)
> {
>          struct regulator_dev *r = NULL;
>          struct device_node *node;
>          struct regulator_map *map;
>          const char *devname = NULL;
> 
>          regulator_supply_alias(&dev, &supply);
> 
>          /* first do a dt based lookup */
>          if (dev && dev->of_node) {
>                  node = of_get_regulator(dev, supply);
>                  if (node) {
>                          r = of_find_regulator_by_node(node);
>                          if (r)
>                                  return r;
> 
>                          /*
>                           * We have a node, but there is no device.
>                           * assume it has not registered yet.
>                           */

I added a printk here and it's exactly as I supposed.
Now what?


>                          return ERR_PTR(-EPROBE_DEFER);
>                  }
>          }
> 

Bye
John Crispin July 3, 2020, 8:10 p.m. UTC | #12
On 03.07.20 22:05, Luca Olivetti wrote:
> El 3/7/20 a les 21:31, Luca Olivetti ha escrit:
>
>> I suppose it's the call to devm_regulator_get_optional, which should 
>> lead to regulator/core.c
>>
>> static struct regulator_dev *regulator_dev_lookup(struct device *dev,
>>                                                    const char *supply)
>> {
>>          struct regulator_dev *r = NULL;
>>          struct device_node *node;
>>          struct regulator_map *map;
>>          const char *devname = NULL;
>>
>>          regulator_supply_alias(&dev, &supply);
>>
>>          /* first do a dt based lookup */
>>          if (dev && dev->of_node) {
>>                  node = of_get_regulator(dev, supply);
>>                  if (node) {
>>                          r = of_find_regulator_by_node(node);
>>                          if (r)
>>                                  return r;
>>
>>                          /*
>>                           * We have a node, but there is no device.
>>                           * assume it has not registered yet.
>>                           */
>
> I added a printk here and it's exactly as I supposed.
> Now what?
>
>
>>                          return ERR_PTR(-EPROBE_DEFER);
>>                  }
>>          }
>>
>
> Bye
chicken and egg ? is your dts correct ? go on. inspire us with you 
skills ...
Luca Olivetti July 3, 2020, 9:18 p.m. UTC | #13
El 3/7/20 a les 19:49, John Crispin ha escrit:
> 
> On 03.07.20 19:47, Luca Olivetti wrote:
>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>
>>>>>
>>>>> Why not use the gpio regulator ?
>>>>
>>>> Because I don't know how :-(
>>>>
>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>
>>
>> Oh, I see, but that's the one I had to *remove* because it didn't work.
>>
>> Bye
> 
> 
> CONFIG_REGULATOR_GPIO is not enabled in the kernel config


I think the correct one is CONFIG_REGULATOR_FIXED_VOLTAGE, which was 
already in the configuration, hence adding CONFIG_REGULATOR_GPIO has no 
effect.

Bye
Luca Olivetti July 5, 2020, 11:05 a.m. UTC | #14
El 3/7/20 a les 23:18, Luca Olivetti ha escrit:
> El 3/7/20 a les 19:49, John Crispin ha escrit:
>>
>> On 03.07.20 19:47, Luca Olivetti wrote:
>>> El 3/7/20 a les 19:37, John Crispin ha escrit:
>>>
>>>>>>
>>>>>> Why not use the gpio regulator ?
>>>>>
>>>>> Because I don't know how :-(
>>>>>
>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml 
>>>>
>>>
>>> Oh, I see, but that's the one I had to *remove* because it didn't work.
>>>
>>> Bye
>>
>>
>> CONFIG_REGULATOR_GPIO is not enabled in the kernel config
> 
> 
> I think the correct one is CONFIG_REGULATOR_FIXED_VOLTAGE, which was 
> already in the configuration, hence adding CONFIG_REGULATOR_GPIO has no 
> effect.

I put a printk in every step of reg_fixed_regulator_probe 
(drivers/regulator/fixed.c) and it seems it isn't called at all (my 
strings are indeed compiled in fixed.o).

Why is that? Perhaps an error in the dts?


I checked and it seems the same as other devices in 19.07.3, the only 
difference is the section (most devices have it in the first section 
while here it is in the &gpio section) and the name after the colon 
(most use no name at all after the colon or the same as before, i.e. 
here it would be usb_vbus: usb_vbus ).

This is the definition in the dts


         usb_vbus: regulator-usb-vbus {
                 compatible = "regulator-fixed";

                 regulator-name = "USB_VBUS";

                 regulator-min-microvolt = <5000000>;
                 regulator-max-microvolt = <5000000>;

                 gpio = <&gpio 14 GPIO_ACTIVE_HIGH>;
                 enable-active-high;
         };


Oh, and is there a quick way to test modifications to the dts? Every 
time I invoke make, even for a trivial change, it takes 40 minutes.

Bye
Luca Olivetti July 5, 2020, 11:42 a.m. UTC | #15
El 5/7/20 a les 13:29, Martin Blumenstingl ha escrit:
> Hi Luca,
> 
> On Sun, Jul 5, 2020 at 1:07 PM Luca Olivetti <luca@ventoso.org> wrote:
> [...]
>> I put a printk in every step of reg_fixed_regulator_probe
>> (drivers/regulator/fixed.c) and it seems it isn't called at all (my
>> strings are indeed compiled in fixed.o).
>>
>> Why is that? Perhaps an error in the dts?
> unfortunately you have only given an extract of your changes instead
> of the full patch, which means I don't have much context and have to
> guess

No, now I was talking about the original dts.

> 
>> I checked and it seems the same as other devices in 19.07.3, the only
>> difference is the section (most devices have it in the first section
>> while here it is in the &gpio section) and the name after the colon
>> (most use no name at all after the colon or the same as before, i.e.
>> here it would be usb_vbus: usb_vbus ).
>>
>> This is the definition in the dts
>>
>>
>>           usb_vbus: regulator-usb-vbus {
>>                   compatible = "regulator-fixed";
>>
>>                   regulator-name = "USB_VBUS";
>>
>>                   regulator-min-microvolt = <5000000>;
>>                   regulator-max-microvolt = <5000000>;
>>
>>                   gpio = <&gpio 14 GPIO_ACTIVE_HIGH>;
>>                   enable-active-high;
>>           };
> assuming that board uses GPIO 14 with polarity "active high" this part
> seems correct to me
> 
> have you tried moving it out of the &gpio node (and placing it similar
> to what for example
> target/linux/lantiq/files-5.4/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
> in master uses)?

Yes, no change

Bye
Luca Olivetti July 5, 2020, 11:59 a.m. UTC | #16
El 5/7/20 a les 13:53, Martin Blumenstingl ha escrit:

>>>
>>> have you tried moving it out of the &gpio node (and placing it similar
>>> to what for example
>>> target/linux/lantiq/files-5.4/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts
>>> in master uses)?
>>
>> Yes, no change
> no change means the regulator-fixed driver is still not probed?

Yes, it's not probed/available

> it's working fine for me on my BT Home Hub 5A, so I'm surprised to
> find that it's not working for you.
> Here's what I'm seeing:
> # find /proc/device-tree/ -name "regulator-usb-vbus"
> /proc/device-tree/regulator-usb-vbus
> # grep "regulator-usb-vbus" /sys/kernel/debug/gpio
> gpio-495 (                    |regulator-usb-vbus  ) out hi
> 
> 

I'm recompiling again in case I misplaced the section in my previous 
test. In ~30-40 minutes it should be ready and I'll report back.

Bye
Luca Olivetti July 5, 2020, 1:07 p.m. UTC | #17
El 5/7/20 a les 13:59, Luca Olivetti ha escrit: escrit:

> I'm recompiling again in case I misplaced the section in my previous 
> test. In ~30-40 minutes it should be ready and I'll report back.

Success!
I probably did something wrong before.
I'm attaching the patch against 19.07.3 and my device, but I think the 
same should be done for trunk and other devices with a similar dts.

Signed-off-by: Luca Olivetti <luca@ventoso.org>

Bye
Luca Olivetti July 5, 2020, 1:14 p.m. UTC | #18
El 5/7/20 a les 15:07, Luca Olivetti ha escrit:
> El 5/7/20 a les 13:59, Luca Olivetti ha escrit: escrit:
> 
>> I'm recompiling again in case I misplaced the section in my previous 
>> test. In ~30-40 minutes it should be ready and I'll report back.
> 
> Success!
> I probably did something wrong before.
> I'm attaching the patch against 19.07.3 and my device, but I think the 
> same should be done for trunk and other devices with a similar dts.

Now it would be nice to also remove these harmless warnings ("supply 
vusb_[da] not found" and "Mode Mismatch Interrupt"):


# dmesg | grep dwc2
[    5.769881] dwc2 1e101000.usb: 1e101000.usb supply vusb_d not found, 
using dummy regulator
[    5.776840] dwc2 1e101000.usb: 1e101000.usb supply vusb_a not found, 
using dummy regulator
[    5.784970] dwc2 1e101000.usb: dwc2_core_reset() HANG! Soft Reset 
GRSTCTL=80000001
[    5.930874] dwc2 1e101000.usb: DWC OTG Controller
[    5.934191] dwc2 1e101000.usb: new USB bus registered, assigned bus 
number 1
[    5.941041] dwc2 1e101000.usb: irq 62, io mem 0x1e101000
[  239.438602] dwc2 1e101000.usb: Mode Mismatch Interrupt: currently in 
Host mode
[  239.444386] dwc2 1e101000.usb: Mode Mismatch Interrupt: currently in 
Host mode
[  239.638464] usb 1-1: new high-speed USB device number 2 using dwc2
[  239.643522] dwc2 1e101000.usb: Mode Mismatch Interrupt: currently in 
Host mode
[  239.650233] dwc2 1e101000.usb: Mode Mismatch Interrupt: currently in 
Host mode


but I'm happy enough that this is fixed now.
Any chance of having a working rtl8812au driver? ;-)


Bye
Luca Olivetti July 5, 2020, 4:47 p.m. UTC | #19
El 5/7/20 a les 15:14, Luca Olivetti ha escrit:

> 
> but I'm happy enough that this is fixed now.
> Any chance of having a working rtl8812au driver? ;-)

Well, not even the rt73 one works fine: I configured it as an AP, I can 
connect just fine but then, when I try to push some data (connecting to 
fast.com[*]) it hangs the router and it reboots after a few seconds.
I don't think the cause is the rt73 driver (it's been quite stable on 
linux forever) but the dwc2 driver on this board.
Just a guess though.


[*] I'm currently using the router as a repeater  with the single radio 
configured both as a wds client and as an AP, I wanted to see if using 
another radio would improve the performance.

Bye
Luca Olivetti July 6, 2020, 6:41 a.m. UTC | #20
El 5/7/20 a les 22:37, Martin Blumenstingl ha escrit:
> Hi Luca,
> 
> On Sun, Jul 5, 2020 at 3:07 PM Luca Olivetti <luca@ventoso.org> wrote:
>>
>> El 5/7/20 a les 13:59, Luca Olivetti ha escrit: escrit:
>>
>>> I'm recompiling again in case I misplaced the section in my previous
>>> test. In ~30-40 minutes it should be ready and I'll report back.
>>
>> Success!
>> I probably did something wrong before.
>> I'm attaching the patch against 19.07.3 and my device, but I think the
>> same should be done for trunk and other devices with a similar dts.
> please let me know if I should be sending the patch for master
> (previously known as "trunk").
> I have no way of testing it, but with your test results I'm confident
> that it'll work

Well, yes, I think so. Even if the usb still has issues, at least it 
initializes and somewhat works.
If you look at the "related tasks" in bug 
https://bugs.openwrt.org/index.php?do=details&task_id=1634  you'll see 
that it also affects the arv752dpw and ar9 (and most probably all other 
boards where the regulator is misplaced), I'm confident the fix is the 
same, though I have no way of testing it.

Bye
diff mbox series

Patch

--- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts
+++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts
@@ -105,6 +105,10 @@ 
                         label = "arv7518pw:red:wps";
                         gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>;
                 };
+               usbpw {
+                       label = "arv7518pw:green:usbpw";
+                       gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+               };
         };
  };

@@ -147,17 +151,6 @@ 
                 };
         };

-       usb_vbus: regulator-usb-vbus {
-               compatible = "regulator-fixed";
-
-               regulator-name = "USB_VBUS";
-
-               regulator-min-microvolt = <5000000>;
-               regulator-max-microvolt = <5000000>;
-
-               gpio = <&gpio 14 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
-       };
  };

  &gpiomm {
@@ -232,7 +225,6 @@ 

  &usb {
         status = "okay";
-       vbus-supply = <&usb_vbus>;
  };

  &vmmc {