[OpenWrt-Devel] ath79: Force usb host mode for ar9331

Micke Prag micke.prag at telldus.se
Mon Nov 18 08:57:42 EST 2019


Den 11/16/19 kl. 4:44 PM, skrev Piotr Dymacz:
> Hi Micke,
>
> On 08.11.2019 13:30, Micke Prag wrote:
>> Den 11/8/19 kl. 11:01 AM, skrev Piotr Dymacz:
>>> Hi Micke,
>>>
>>> On 08.11.2019 08:36, Micke Prag wrote:
>>>> In commit 00ea16557d [1] the way usb is initiated was changed. Instead
>>>> of initiate both ehci-platform and ci_hdrc the bootstrap status
>>>> register
>>>> is checked and used to determine which platform to initiate.
>>>
>>> There were other changes later, see for example 57c641ba6e.
>> Yes, I was looking at the code after this commit when making my
>> conclusions above. But 00ea16557d is the commit that breaks the board
>> initially.
>>>
>>>> Unfortunately this break my board since the gpio used to determine
>>>> this
>>>> is used for other purposes.
>>>
>>> This means your board has a wrong bootstrap configuration and you
>>> should make sure GPIO for host/device mode has correct initialization
>>> value.
>>
>> Yes, it is correct the bootstrap is not correct at hardware level. But
>> there is 30 k+ boards out in the world so fixing this now is a bit
>> late... ;)
>>
>>>
>>>> dev-usb.h only exposes one function:
>>>> void ath79_register_usb(void);
>>>> so there is not much to alter the way usb is initiated.
>>>>
>>>> I tried to write to the bootstrap register but unfortunately this did
>>>> not seem to work:
>>>>
>>>> u32 t;
>>>> t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
>>>> pr_warn("ath79: Register before %X", t);
>>>> t |= AR933X_BOOTSTRAP_USB_MODE_HOST;
>>>> ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
>>>> pr_warn("ath79: Register after %X",
>>>> ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP));
>>>>
>>>> Gives the following output:
>>>>
>>>> ath79: Register before 42202
>>>> ath79: Register after 42202
>>> USB mode in AR9331 is selected at power on, based on GPIO13 value and
>>> I'm not aware of any other/software ways to change it. AFAIK, only
>>> QCA9563 allows to switch between host and device modes 'on the fly'.
>>
>> Is was working before 00ea16557d so simply initialize ehci-platform
>> instead ci_hdrc will fix it. Unfortunately I cannot find a way to tell
>> ath79_register_usb to force it into host mode in my board file instead
>> of reading the bootstrap register.
>
> Do you want to tell me that a board with wrong bootstrap configuration
> and USB switched to device mode was able to use the bus in host mode?
>
> IIRC, during my tests I found that this bootstrap option makes the D+
> line to gets pulled-up to VBUS and there was no way to change it back.
> I would need to make some more tests to confirm that, though.
>
Yes, I am.

Or, to be correct. This gpio is used as an output so it is connected to
a transistor. It's not "driven" to either high nor low other than what
the base-pin from the transistor is doing.

Regardless the bootstrap register is set incorrect and forcing to host
mode _do_ work.

I can provide more testing if you want me to?



_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list