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

Micke Prag micke.prag at telldus.se
Fri Nov 8 07:30:18 EST 2019


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.

Writing to the bootstrap register was a workaround I tried. In the
datasheet this register should be read/write. I don't know if my code
for writing the register is wrong or it is simply not possible to write
into this register.

>
>> How can I solve this?
>
> Only in hardware I suppose (setup correct initial value on GPIO13).
>
It could also be solved by telling the module to force it into host mode
and not reading the bootstrap register. I am not sure the best approach
for this that would be accepted upstream.

Adding a parameter to ath79_register_usb() could be one option?



_______________________________________________
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