Pine A64 only one USB port working

Hi folks!
I have OpenWrt installed on a Pine A64 plus, which has 2 USB 2.0 ports. One is working without issue. On the other one the supply voltage is present but no device is recognized.

Here is the output of dmesg:

root@OpenWrt:~# dmesg | grep usb
[    0.465166] usbcore: registered new interface driver usbfs
[    0.470798] usbcore: registered new interface driver hub
[    0.476217] usbcore: registered new device driver usb
[    0.644077] sun4i-usb-phy 1c19400.phy: failed to get clock usb0_phy
[    0.728614] ehci-platform 1c1a000.usb: EHCI Host Controller
[    0.734239] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    0.742098] ehci-platform 1c1a000.usb: irq 9, io mem 0x01c1a000
[    0.772224] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    0.778475] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.785290] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.792530] usb usb1: Product: EHCI Host Controller
[    0.797410] usb usb1: Manufacturer: Linux 4.14.215 ehci_hcd
[    0.802992] usb usb1: SerialNumber: 1c1a000.usb
[    0.828027] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    0.834678] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[    0.842531] ohci-platform 1c1a400.usb: irq 10, io mem 0x01c1a400
[    0.916352] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    0.925820] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.933056] usb usb2: Product: Generic Platform OHCI controller
[    0.938985] usb usb2: Manufacturer: Linux 4.14.215 ohci_hcd
[    0.944578] usb usb2: SerialNumber: 1c1a400.usb
[    0.958137] usbcore: registered new interface driver usb-storage
[    1.329762] ehci-platform 1c1b000.usb: EHCI Host Controller
[    1.335370] ehci-platform 1c1b000.usb: new USB bus registered, assigned bus number 3
[    1.343223] ehci-platform 1c1b000.usb: irq 11, io mem 0x01c1b000
[    1.372215] ehci-platform 1c1b000.usb: USB 2.0 started, EHCI 1.00
[    1.378450] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002
[    1.385246] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.392472] usb usb3: Product: EHCI Host Controller
[    1.397345] usb usb3: Manufacturer: Linux 4.14.215 ehci_hcd
[    1.402921] usb usb3: SerialNumber: 1c1b000.usb
[    1.416402] ohci-platform 1c1b400.usb: Generic Platform OHCI controller
[    1.423040] ohci-platform 1c1b400.usb: new USB bus registered, assigned bus number 4
[    1.430866] ohci-platform 1c1b400.usb: irq 12, io mem 0x01c1b400
[    1.506355] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
[    1.513153] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.520367] usb usb4: Product: Generic Platform OHCI controller
[    1.526291] usb usb4: Manufacturer: Linux 4.14.215 ohci_hcd
[    1.531858] usb usb4: SerialNumber: 1c1b400.usb
[    1.812240] usb 3-1: new high-speed USB device number 2 using ehci-platform
[    2.028508] usb 3-1: New USB device found, idVendor=148f, idProduct=5572
[    2.036607] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.043787] usb 3-1: Product: 802.11 n WLAN
[    2.047996] usb 3-1: Manufacturer: Ralink
[    2.052048] usb 3-1: SerialNumber: 1.0
[    6.662237] usb 3-1: reset high-speed USB device number 2 using ehci-platform
[    6.917539] usbcore: registered new interface driver rt2800usb

Do you have some suggestions for me? Thanks in advice!

... and if you move what ever is in the working port to the bad one, is it recognized/detected ?

If not, then it's probably not an OS issue, but electrical.

1 Like

Hi @frollic welcome back :wink:

If I connect the wlan adapter to the second port, it's not recognized. Output of "dmesg" does not change. Same with storage device etc.

then it's probably a bad port in some way.

1 Like

Yes, probably :unamused:
There is a "kmod-usb-ehci" package in sw, should I give it a try?

if the same device works in the 1st port, there's no reason to play around with additional packages.

Yes, sir! :grinning: Thank you for now. I'll take out my fluke and do some measurements...

I checked (ohms) the connections..all good. Than I installed "fedora" build to the Pine64...keyboard works flawless on both usb ports.
Conclusion: Definitely an OpenWrt issue, at least in combination with the PineA64...

fascinating :slight_smile:

In that case, compare the dmesg output for OpenWRT and Fedora, see if there are any differences in USB detection/discovery during boot.

Check if the usb ports are on the same chip or two separate ones, in case of the
latter, your idea about additional packages for the 2nd USB chip, may have been correct.

1 Like

Mystery solved:
https://openwrt.org/toh/pine64/pine64_pine_a64plus#notes

Thanks @frollic for your help anyway!

2 Likes

Since the device is configured and running, I would like to dig deeper in the usb topic.
In the link from my post above there are the following kernel config lines to set the second usb port to host mode:

CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_HOST=y
CONFIG_USB_MUSB_SUNXI=y
CONFIG_MUSB_PIO_ONLY=y  # no driver support for DMA mode!
CONFIG_NOP_USB_XCEIV=y

So what does that mean?
Do I have to compile the kernel from source with the lines included or to put them into the right config file somewhere in the existing fs?

There's a default config file for each device.

If these lines aren't in there, you could add them, but they could just as well be set to no or commented out.

But yeah, you have to create your own image, or try to generate the required setting as a module.

I have never compiled something for linux. It's on my list but not for the moment. I planed to buy a usb 4G modem (for what I need the second usb port) to skip my ISP router, which is sim locked. But to simply unlock it it's probably the better and easier solution. To have a several Wifi AP just in case is not a disadvantage.
When the time is right I will deal with linux compiling.

@frollic Thanks for now!

Have you tried a USB hub in the working port? If you want to run a 4G modem, an externally powered hub would be prudent as many of those modems have power consumption that pushes USB ports to (and sometimes beyond) the limits.

Are the modems that power hungry? The PineA64 has 650mA per port, should be sufficient?

Since the device has 2 Type A connectors without ID pin, what means there will never be an automatic host mode in OTG functionality and client mode on a router would make less sense, at least for my opinion....
why the port is not simply set to standard host in the OpenWrt image? I don't get it what's the reason for that?

Older cat 4 & cat 6 modems should be ok - I have Huawei E3372 & E8372 4G dongles (both cat 4) which work ok on standard USB 2 ports in reasonable signal strength areas. Newer cat 12 and higher modems however require more power to drive the multichannel radios they use for carrier aggregation. Weak signal strength also increases power consumption. Random or frequent loss of connection is quite often due to inadequate power supply.

@pythonic Thank you for the important info! I already discarded the idea to replace my ISP router with the OpenWrt router completely. Means at the moment there is no need for a 4G modem.

Today I tried to install additional driver packages but second usb still dead....further investigation needed

Hi folks!

News from the usb front.
I tried to compile my kernel with the posted kernel config lines added in ~/openwrt/target/linux/sunxi/cortexa53/config-5.4 ...and surprisingly both usb ports are working :grinning:
Because I didn't include all needed packages into the build I made a new "menuekonfig", but the compiling failed with errors.
Well, on my first build, I set lan interface to "client" and tried to install the needed drivers in terminal.
That's what I got:

root@OpenWrt:~# opkg install kmod-rt2x00-usb
Unknown package 'kmod-rt2x00-usb'.
Collected errors:
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-cfg80211 found, but incompatible with the architectures configured
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-mac80211 found, but incompatible with the architectures configured
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-rt2x00-lib found, but incompatible with the architectures configured
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-nls-base found, but incompatible with the architectures configured
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-usb-core found, but incompatible with the architectures configured
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-rt2x00-usb found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package kmod-rt2x00-usb.

Now it was clear to me why my build failed (with the same errors). The wiki says:

snapshots are built daily, and that sets time limits to installing new packages with opkg. Due to kernel version checksums, you can only install “kmod” kernel modules and other kernel version dependent modules from the exactly same snapshot build. So, a few hours after flashing the firmware you may not be able to install new modules with opkg any more (as the next snapshot has been built into the download repo and has different checksums).

It means, I have only limited time to compile my package and...even worse...I can not install any package to my "custom" build from Luci.

Is this correct?

Edit: Please can you help me with making a *.ko file (module) with the required kernel settings, because I think it's the only clean solution!?

Yes, and no ... :wink:

If you check out the source, you can fiddle with it for as long as you want.
If it's left untouched, and unupdated.
If you start applying later commits it'll sooner or later break its backward compatibility.
Starting from scratch, the image (kernel really) and the module have to come from your
own making, for the versions to match.

Usually it's the kernel and the modules that's picky with the version, the binaries aren't.

If the snapshot comes with a checkout ID (or whatever it's called), you should (at least in theory)
be able to check out the exact same version, build your modules from that, and get snapshot compatible modules.

And yes, every iteration of the snapshot, will invalidate the old snapshot and packages
So you only have a small window when you can install packages, before they are overwritten
by the next snapshot.
But there's nothing stopping you from making your own local copy of all packages available at a
given point in time, and having your own local repository.

I don't get it fully. Anyway. Is there a way to make a single *.ko file with the required settings and merge it into the official image? Will it survive until a major kernel update? Where to start? Can it be done in the "menueconfig"? Do you think that's doable for me?