USB Hub not detected on ATH79 port of ZBT WE826-Q

Summary: My Ath79 port for the ZBT we826-q doesn't successfully initialise the built-in USB hub if the bootloader hasn't already initialised USB. Conversely my ar71xx port (based on the AP147 target) successfully brings up the hub, even if the bootloader doesn't contain any USB code. This problem may affect ath79 devices more broadly creating dependencies on old or closed source bootloaders like pepe2k and Breed.

Hardware: the ZBT is a QCA9531 device (128MB RAM and 16MB flash). It comes with the closed source Breed bootloader and an old firmware based on OpenWrt CC.

OpenWrt 18.06 (ar71xx): with the help of @Dairyman I was able to get 18.06 working on this device. Needed to alter one of the standard ar71xx 4.9 patches from this to this (without which the whole USB subsystem didn't come up) and a script to placate the gpio toggle watchdog

OpenWrt Master: a very simple ath79 port works really well. You can find the device tree here

Bootloader: The pepe2k bootloader works perfectly on the device. However if I use a pepe2k build which doesn't perform USB setup, or mainline u-boot (given that the pepe2k codebase is very old) then the ar71xx 18.06 openwrt is able to bring up the USB subsystem whereas ath79 master does not. The table below summarises the situation

Scenario Bootloader Architecture USB hub
1 Breed/Pepe2k(with USB) ar71xx Detected
2 Breed/Pepe2k(with USB) ath79 Detected
3 Mainline U-Boot/Pepe2k(no USB) ar71xx Detected
4 Mainline U-Boot/Pepe2k(no USB) ath79 Not detected

When the USB works I get:

root@GetBox-FfQjJ:/# lsusb
Bus 001 Device 003: ID 2c7c:0125 Quectel Wireless Solutions Co., Ltd. EC25 LTE modem
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@OpenWrt:/# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 480M
        |__ Port 3: Dev 3, If 1, Class=Vendor Specific Class, Driver=, 480M
        |__ Port 3: Dev 3, If 2, Class=Vendor Specific Class, Driver=, 480M
        |__ Port 3: Dev 3, If 3, Class=Vendor Specific Class, Driver=, 480M
        |__ Port 3: Dev 3, If 4, Class=Vendor Specific Class, Driver=qmi_wwan, 480M

When it doesn't I get:

root@OpenWrt:/# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@OpenWrt:/# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M

I noticed that the older kernels used the ath79_usb_setup() function to set up USB in the AR71XXX build that has been removed in newer kernels. U-boot has similar functionality in its codebase using the functions ath79_usb_reset() and usb_reset_qca953x(). These functions can be found here. My first attempt was to try and make the U-boot functions as similar as possible to the USB setup in the previously used ath79_usb_setup() function, but I keep running into the same error:

[   25.744989] usb 1-1: device descriptor read/64, error -145
[   25.985730] usb 1-1: new high-speed USB device number 3 using ehci-platform
[   31.413071] usb 1-1: device descriptor read/64, error -145

You can see my additions to U-boot here
This is a complete bootlog with the my U-boot changes and my ath79 port.

My guess is that ar71xx does some USB setup that ath79 doesn't do. For reference here's a branch of linux 4.9 with the (modified) OpenWrt patches applied and here's the same for linux 5.4.

Since however I'm interested in USB working in OpenWrt and not in the bootloader I thought best to switch my attention to the OS! Would really appreciate some help in getting this really nice device properly ported to modern OpenWrt.

In your boot log I don't see usb phy init message. Try to add something like

&usb_phy {
	status = "okay";
	reset-names = "usb-phy-analog", "usb-phy", "usb-suspend-override";
	resets = <&rst 11>, <&rst 4>, <&rst 3>;
};

into your dts-file.
It will enable qca,ar7200-usb-phy driver and init usb phy procedure.

Interesting. @123serge123 implementing your suggestion gives the following bootlog (link) containing the following errors:

[    4.642724] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    4.650228] hub 1-0:1.0: USB hub found
[    4.654938] hub 1-0:1.0: 1 port detected
[    4.663478] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.681651] init: - preinit -
[    5.123451] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    5.290905] usb 1-1: device descriptor read/64, error -71
[    5.562812] usb 1-1: device descriptor read/64, error -71
[    5.812239] random: jshn: uninitialized urandom read (4 bytes read)
[    5.818862] usb 1-1: new high-speed USB device number 3 using ehci-platform
[    5.880417] random: jshn: uninitialized urandom read (4 bytes read)
[    5.970847] usb 1-1: device descriptor read/64, error -71
[    5.978510] random: jshn: uninitialized urandom read (4 bytes read)
[    6.226785] usb 1-1: device descriptor read/64, error -71
[    6.338969] usb usb1-port1: attempt power cycle
[    6.851316] urandom_read: 6 callbacks suppressed
[    6.851327] random: jshn: uninitialized urandom read (4 bytes read)
[    6.998887] usb 1-1: new high-speed USB device number 4 using ehci-platform
[    7.438890] usb 1-1: device not accepting address 4, error -71

However, the node you've suggested looks like the one in the ar934x.dtsi. In the qca953x.dtsi the node for USB phy is slightly different:

			usb_phy: usb-phy@18030000 {
				compatible = "qca,ar7200-usb-phy";
				reg = <0x18030000 0x100>;
				#phy-cells = <0>;

				reset-names = "usb-phy", "usb-suspend-override";
				resets = <&rst 4>, <&rst 3>;

				status = "disabled";
			};

Already activated in @toolchains tree:

&usb_phy {
	status = "okay";
};

For reference, here's the bootlog from the device when USB starts successfully with @toolchains tree using the Pepe2K bootloader (link - simply using the pre-built image for the ZBT WE1536) And here's a bootlog from just a clean AP143 mainline U-Boot build and the USB doesn't start (link). In neither case are there any usb phy init messages.

here's the diff between working and not:

@@ -23,10 +23,10 @@
 [xxxxx] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
 [xxxxx] NR_IRQS: 51
 [xxxxx] random: get_random_bytes called from start_kernel+0x32c/0x518 with crng_init=0
-[xxxxx] CPU clock: 673.046 MHz
-[xxxxx] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5679427452 ns
-[xxxxx] sched_clock: 32 bits at 336MHz, resolution 2ns, wraps every 6381379582ns
-[xxxxx] Calibrating delay loop... 446.46 BogoMIPS (lpj=892928)
+[xxxxx] CPU clock: 650.000 MHz
+[xxxxx] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5880801374 ns
+[xxxxx] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 6607641598ns
+[xxxxx] Calibrating delay loop... 431.10 BogoMIPS (lpj=862208)
 [xxxxx] pid_max: default: 32768 minimum: 301
 [xxxxx] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
 [xxxxx] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
@@ -120,6 +120,15 @@
 [xxxxx] hub 1-0:1.0: 1 port detected
 [xxxxx] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
 [xxxxx] init: - preinit -
+[xxxxx] usb 1-1: new high-speed USB device number 2 using ehci-platform
+[xxxxx] hub 1-1:1.0: USB hub found
+[xxxxx] hub 1-1:1.0: 4 ports detected
+[xxxxx] usb 1-1.3: new full-speed USB device number 3 using ehci-platform
+[xxxxx] usb 1-1.3: new high-speed USB device number 4 using ehci-platform
+[xxxxx] urandom_read: 3 callbacks suppressed
 [xxxxx] random: jshn: uninitialized urandom read (4 bytes read)
 [xxxxx] random: jshn: uninitialized urandom read (4 bytes read)
 [xxxxx] random: jshn: uninitialized urandom read (4 bytes read)
@@ -148,9 +157,11 @@ Please press Enter to activate this console.
 [xxxxx] Backport generated by backports.git v5.8-1-0-g79400d9e
 [xxxxx] xt_time: kernel timezone is -0000
 [xxxxx] random: crng init done
-[xxxxx] random: 7 urandom warning(s) missed due to ratelimiting
+[xxxxx] random: 1 urandom warning(s) missed due to ratelimiting
 [xxxxx] PPP generic driver version 2.4.2
 [xxxxx] NET: Registered protocol family 24
+[xxxxx] qmi_wwan 1-1.3:1.4: cdc-wdm0: USB WDM device
+[xxxxx] qmi_wwan 1-1.3:1.4 wwan0: register 'qmi_wwan' at usb-1b000000.usb-1.3, WWAN/QMI device, 16:a7:45:fa:57:97
 [xxxxx] usbcore: registered new interface driver qmi_wwan
 [xxxxx] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=13
 [xxxxx] kmodloader: done loading kernel modules from /etc/modules.d/*

It just seems that the USB hub is silently ignored by ath79 for this device when not activated in bootloader...

Yes. But "correct" uboot use this bit, qca,ar7200-usb-phy support this bit and qca9531 chipset have this bit. Different node in qca953x.dtsi may be a bug.

1 Like

I've just noted that pepe2k uboot correctlly define ref clock frequency based on bootstrap and correct usb clk (link):

u32 qca_xtal_is_40mhz(void)
{
	return ((qca_soc_reg_read(QCA_RST_BOOTSTRAP_REG) &
			QCA_RST_BOOTSTRAP_REF_CLK_MASK) >> QCA_RST_BOOTSTRAP_REF_CLK_SHIFT);
}

Values for xtal (link)

#define QCA_PLL_SWITCH_CLK_CTRL_USB_CLK_SEL_25M_VAL				0x2
#define QCA_PLL_SWITCH_CLK_CTRL_USB_CLK_SEL_40M_VAL				0x5

so mainline uboot and ath79 always set usb clocks for xtal 25MHz (link)

	bootstrap = readl(reset_regs + QCA953X_RESET_REG_BOOTSTRAP);
	clrsetbits_be32(pregs + QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG,
                        0xf00, 0x200);
        mdelay(10);

Hi @123serge123, thank you so much for your suggestions!

If I change the usb_phy node in my device tree, I get the same error as @leperet above:

[    4.403431] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    4.689784] usb 1-1: device descriptor read/64, error -71
[    4.963450] usb 1-1: device descriptor read/64, error -71
[    5.162426] random: jshn: uninitialized urandom read (4 bytes read)
[    5.236022] usb 1-1: new high-speed USB device number 3 using ehci-platform
[    5.459610] usb 1-1: device descriptor read/64, error -71
[    5.474830] random: jshn: uninitialized urandom read (4 bytes read)
[    5.696388] random: jshn: uninitialized urandom read (4 bytes read)
[    5.715460] usb 1-1: device descriptor read/64, error -71
[    5.827508] usb usb1-port1: attempt power cycle

Here's the full log for that boot.
This happens when the USB reset process does not occur during initialization (when ath79_usb_reset() is not used in U-boot).
From the first log, without the resetting, the error code 71 from the kernel is for the wrong protocol, but on ar71xxx, the USB Hub still uses the ehci-platform driver that tries to load it here.

However, when I include the USB reset functionality in U-boot, I get the following error:

[   30.869912] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   46.228683] usb 1-1: device descriptor read/64, error -145
[   46.340735] usb usb1-port1: attempt power cycle
[   46.996688] usb 1-1: new high-speed USB device number 4 using ehci-platform
[   57.828687] usb 1-1: device not accepting address 4, error -145
[   57.960677] usb 1-1: new high-speed USB device number 5 using ehci-platform
[   68.580684] usb 1-1: device not accepting address 5, error -145
[   68.586929] usb usb1-port1: unable to enumerate USB device

Here's the full boot with that configuration.

I've also tested your xtal suggestion, and my device's xtal is 25MHz, so it didn't provide a solution.

Would you happen to know why the hub is not working with the ehci-platform driver?
Thanks again!

Yet another interesting note: QCA9531 specs says that QCA_PLL_SWITCH_CLK_CTRL_USB_CLK_SEL_25M_VAL is 5. And it's default value after reset. So you really need

clrsetbits_be32(pregs + QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG,
                        0xf00, 0x500);

Can you test this case?

Interesting...

ar7xxx always assume that qca953x ref clock is 25MHz (link), ath79 analyze bootstrap for 25/40MHz (link). Wrong bootstrap value or really 40MHz? Try to override with:

&ref {
clock-frequency = <25000000>;
}

Hi @123serge123,
I've made the clock change you've suggested here and made U-boot explicitly check for the frequency during reset here. The frequency is consistently read as 25MHz.

I'm still consistently getting the following error as above after the USB reset:

[   46.228683] usb 1-1: device descriptor read/64, error -145
[   46.340735] usb usb1-port1: attempt power cycle
[   46.996688] usb 1-1: new high-speed USB device number 4 using ehci-platform
[   57.828687] usb 1-1: device not accepting address 4, error -145
[   57.960677] usb 1-1: new high-speed USB device number 5 using ehci-platform
[   68.580684] usb 1-1: device not accepting address 5, error -145
[   68.586929] usb usb1-port1: unable to enumerate USB device

Would you happen to know why that is?

So some interesting findings! @123serge123's analog phy dts change in post 2 above allows OpenWrt to bring up the USB in pepe2k bootloaders that don't perform any USB setup! Mainline u-boot still leads to no joy:

  1. pepe2k ap143 (no USB code) + standard qca953x.dtsi --> no usb (bootlog)
  2. pepe2k ap143 (no USB code) + qca953x.dtsi with @123serge123 analog reset --> usb works! (bootlog)
  3. mainline u-boot ap143 + standard qca953x --> no usb (bootlog)
  4. mainline u-boot ap143 + qca953x.dtsi with @123serge123 analog reset --> device descriptor read/64, error -71 (bootlog)

Some bootlog diffs from the scenarios above:

1 --> 2

--- a/210119-p2kap143-outside.log
+++ b/210119-p2kap143-analog-outside.log
@@ -120,10 +120,17 @@
 [] hub 1-0:1.0: 1 port detected
 [] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
 [] init: - preinit -
+[] usb 1-1: new high-speed USB device number 2 using ehci-platform
+[] hub 1-1:1.0: USB hub found
+[] hub 1-1:1.0: 4 ports detected
+[] random: procd: uninitialized urandom read (4 bytes read)
+[] usb 1-1.3: new full-speed USB device number 3 using ehci-platform
+[] usb 1-1.3: new high-speed USB device number 4 using ehci-platform
 [] random: jshn: uninitialized urandom read (4 bytes read)
 [] random: jshn: uninitialized urandom read (4 bytes read)
+[] urandom_read: 3 callbacks suppressed
+[] random: jshn: uninitialized urandom read (4 bytes read)
 [] random: jshn: uninitialized urandom read (4 bytes read)
-[] urandom_read: 6 callbacks suppressed
 [] random: jshn: uninitialized urandom read (4 bytes read)
 [] eth0: link up (1000Mbps/Full duplex)
 [] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
@@ -134,7 +141,7 @@ Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
 [] done.
 [] jffs2_build_filesystem(): erasing all blocks after the end marker...
 [] done.
-[] jffs2: notice: (563) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
+[] jffs2: notice: (574) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
 [] mount_root: overlay filesystem has not been fully initialized yet
 [] mount_root: switching to jffs2 overlay
 [] overlayfs: upper fs does not support tmpfile.
@@ -148,4 +155,22 @@ Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
 Failed to connect to ubus
 [] procd: - init -
 Please press Enter to activate this console.
-[] kmodloader: loading kernel modules from /etc/modules.d/*
\ No newline at end of file
+[] kmodloader: loading kernel modules from /etc/modules.d/*
+[] urngd: v1.0.2 started.
+[] Mirror/redirect action on
+[] u32 classifier
+[]     input device check on
+[]     Actions configured
+[] usbcore: registered new interface driver cdc_wdm
+[] Loading modules backported from Linux version v5.8-0-gbcf876870b95
+[] Backport generated by backports.git v5.8-1-0-g79400d9e
+[] xt_time: kernel timezone is -0000
+[] random: crng init done
+[] random: 1 urandom warning(s) missed due to ratelimiting
+[] PPP generic driver version 2.4.2
+[] NET: Registered protocol family 24
+[] qmi_wwan 1-1.3:1.4: cdc-wdm0: USB WDM device
+[] qmi_wwan 1-1.3:1.4 wwan0: register 'qmi_wwan' at usb-1b000000.usb-1.3, WWAN/QMI device, 76:5f:af:30:dc:a5
+[] usbcore: registered new interface driver qmi_wwan
+[] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=13
+[] kmodloader: done loading kernel modules from /etc/modules.d/*

3 --> 4, odd that reported CPU speed varies between boots on mainline u-boot!

--- a/210119-main143.log
+++ b/210119-main143-analog.log
@@ -23,10 +23,10 @@
 [] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
 [] NR_IRQS: 51
 [] random: get_random_bytes called from start_kernel+0x32c/0x518 with crng_init=0
-[] CPU clock: 657.031 MHz
-[] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5817867708 ns
-[] sched_clock: 32 bits at 328MHz, resolution 3ns, wraps every 6536930302ns
-[] Calibrating delay loop... 436.22 BogoMIPS (lpj=872448)
+[] CPU clock: 658.593 MHz
+[] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5804064938 ns
+[] sched_clock: 32 bits at 329MHz, resolution 3ns, wraps every 6521420798ns
+[] Calibrating delay loop... 438.78 BogoMIPS (lpj=877568)
 [] pid_max: default: 32768 minimum: 301
 [] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
 [] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
@@ -120,15 +120,27 @@
 [] hub 1-0:1.0: 1 port detected
 [] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
 [] init: - preinit -
+[] usb 1-1: new high-speed USB device number 2 using ehci-platform
+[] usb 1-1: device descriptor read/64, error -71
+[] usb 1-1: device descriptor read/64, error -71
+[] usb 1-1: new high-speed USB device number 3 using ehci-platform
 [] random: jshn: uninitialized urandom read (4 bytes read)
 [] random: jshn: uninitialized urandom read (4 bytes read)
+[] usb 1-1: device descriptor read/64, error -71
 [] random: jshn: uninitialized urandom read (4 bytes read)
+[] usb 1-1: device descriptor read/64, error -71
+[] usb usb1-port1: attempt power cycle
 [] urandom_read: 6 callbacks suppressed
 [] random: jshn: uninitialized urandom read (4 bytes read)
+[] usb 1-1: new high-speed USB device number 4 using ehci-platform
+[] usb 1-1: device not accepting address 4, error -71
 [] eth0: link up (1000Mbps/Full duplex)
 [] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
+[] usb 1-1: new high-speed USB device number 5 using ehci-platform
 Press the [f] key and hit [enter] to enter failsafe mode
 Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
+[] usb 1-1: device not accepting address 5, error -71
+[] usb usb1-port1: unable to enumerate USB device
 [] jffs2_scan_eraseblock(): End of filesystem marker found at 0x10000
 [] jffs2_build_filesystem(): unlocking the mtd device...
 [] done.
@@ -158,8 +170,8 @@ Please press Enter to activate this console.
 [] Loading modules backported from Linux version v5.8-0-gbcf876870b95
 [] Backport generated by backports.git v5.8-1-0-g79400d9e
 [] xt_time: kernel timezone is -0000
-[] PPP generic driver version 2.4.2
 [] random: crng init done
+[] PPP generic driver version 2.4.2
 [] NET: Registered protocol family 24
 [] usbcore: registered new interface driver qmi_wwan
 [] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=13

and finally, 2 --> 4

--- a/210119-p2kap143-analog.log
+++ b/210119-main143-analog.log
@@ -16,17 +16,17 @@
 [] Kernel command line: console=ttyS0,115200n8 rootfstype=squashfs,jffs2
 [] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
 [] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
-[] Writing ErrCtl register=00000000
-[] Readback ErrCtl register=00000000
+[] Writing ErrCtl register=00000004
+[] Readback ErrCtl register=00000004
 [] mem auto-init: stack:off, heap alloc:off, heap free:off
 [] Memory: 122196K/131072K available (4819K kernel code, 193K rwdata, 1112K rodata, 1228K init, 196K bss, 8876K reserved, 0K cma-reserved)
 [] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
 [] NR_IRQS: 51
 [] random: get_random_bytes called from start_kernel+0x32c/0x518 with crng_init=0
-[] CPU clock: 650.000 MHz
-[] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5880801374 ns
-[] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 6607641598ns
-[] Calibrating delay loop... 431.10 BogoMIPS (lpj=862208)
+[] CPU clock: 658.593 MHz
+[] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5804064938 ns
+[] sched_clock: 32 bits at 329MHz, resolution 3ns, wraps every 6521420798ns
+[] Calibrating delay loop... 438.78 BogoMIPS (lpj=877568)
 [] pid_max: default: 32768 minimum: 301
 [] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
 [] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
@@ -121,27 +121,32 @@
 [] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
 [] init: - preinit -
 [] usb 1-1: new high-speed USB device number 2 using ehci-platform
-[] random: procd: uninitialized urandom read (4 bytes read)
-[] hub 1-1:1.0: USB hub found
-[] hub 1-1:1.0: 4 ports detected
-[] usb 1-1.3: new full-speed USB device number 3 using ehci-platform
+[] usb 1-1: device descriptor read/64, error -71
+[] usb 1-1: device descriptor read/64, error -71
+[] usb 1-1: new high-speed USB device number 3 using ehci-platform
 [] random: jshn: uninitialized urandom read (4 bytes read)
 [] random: jshn: uninitialized urandom read (4 bytes read)
-[] usb 1-1.3: new high-speed USB device number 4 using ehci-platform
-[] urandom_read: 3 callbacks suppressed
-[] random: jshn: uninitialized urandom read (4 bytes read)
+[] usb 1-1: device descriptor read/64, error -71
 [] random: jshn: uninitialized urandom read (4 bytes read)
+[] usb 1-1: device descriptor read/64, error -71
+[] usb usb1-port1: attempt power cycle
+[] urandom_read: 6 callbacks suppressed
 [] random: jshn: uninitialized urandom read (4 bytes read)
+[] usb 1-1: new high-speed USB device number 4 using ehci-platform
+[] usb 1-1: device not accepting address 4, error -71
 [] eth0: link up (1000Mbps/Full duplex)
 [] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
+[] usb 1-1: new high-speed USB device number 5 using ehci-platform
 Press the [f] key and hit [enter] to enter failsafe mode
 Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
+[] usb 1-1: device not accepting address 5, error -71
+[] usb usb1-port1: unable to enumerate USB device
 [] jffs2_scan_eraseblock(): End of filesystem marker found at 0x10000
 [] jffs2_build_filesystem(): unlocking the mtd device...
 [] done.
 [] jffs2_build_filesystem(): erasing all blocks after the end marker...
 [] done.
-[] jffs2: notice: (574) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
+[] jffs2: notice: (563) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
 [] mount_root: overlay filesystem has not been fully initialized yet
 [] mount_root: switching to jffs2 overlay
 [] overlayfs: upper fs does not support tmpfile.
@@ -156,21 +161,18 @@ Failed to connect to ubus
 [] procd: - init -
 Please press Enter to activate this console.
 [] kmodloader: loading kernel modules from /etc/modules.d/*
-[] urngd: v1.0.2 started.
 [] Mirror/redirect action on
 [] u32 classifier
 []     input device check on
 []     Actions configured
+[] urngd: v1.0.2 started.
 [] usbcore: registered new interface driver cdc_wdm
 [] Loading modules backported from Linux version v5.8-0-gbcf876870b95
 [] Backport generated by backports.git v5.8-1-0-g79400d9e
 [] xt_time: kernel timezone is -0000
 [] random: crng init done
-[] random: 1 urandom warning(s) missed due to ratelimiting
 [] PPP generic driver version 2.4.2
 [] NET: Registered protocol family 24
-[] qmi_wwan 1-1.3:1.4: cdc-wdm0: USB WDM device
-[] qmi_wwan 1-1.3:1.4 wwan0: register 'qmi_wwan' at usb-1b000000.usb-1.3, WWAN/QMI device, 22:50:c4:0b:84:69
 [] usbcore: registered new interface driver qmi_wwan
 [] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=13
 [] kmodloader: done loading kernel modules from /etc/modules.d/*

For reference, AP143 mainline u-boot (commit). Pepe2k AP143 (commit) - of course many QCA9531 boards for pepe2k)

But it's notable that each time I boot under mainline u-boot I get a different reported CPU clock speed:

[    0.000000] CPU clock: 658.203 MHz
...
[    0.000000] CPU clock: 657.031 MHz
...
[    0.000000] CPU clock: 656.640 MHz
...
[    0.000000] CPU clock: 674.218 MHz

@123serge123 Re your suggestion about crystal, I saw the following node in qca953x.dtsi:

	extosc: ref {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-output-names = "ref";
		clock-frequency = <25000000>;
	};

this i suppose fixes frequency at 25MHz. i tried changing the value above to 40000000 and my uart connection turned to meaningless data during boot. (Unlike @toolchains I'm hesitant to make my own edits to u-boot in case of a brick!)

@leperet @toolchains
If you have uboot console can you compare content of regs for mainline uboot and pepe2k:

QCA953X_USB_CTRL_CONFIG_REG     0x18030004
QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x18050024
QCA953X_RST_RESET_REG           0x1806001c
QCA953X_RST_BOOTSTRAP_REG       0x180600b0

with uboot command (e.g. read from 0x1806001c):

ar7240> md.l 0x1806001c 1

In mainline uboot you can modify regs to correspond pepe2k's mod (e.g. write to 0x1806001c value 0x24044808)

ar7240> mw.l 0x1806001c 0x24044808

and continue boot to test.

I think that these usb config mod is not needed for ar724x and later (link):

	writel(0xf0000, usbc_regs + AR71XX_USB_CTRL_REG_CONFIG);
	writel(0x20c00, usbc_regs + AR71XX_USB_CTRL_REG_FLADJ);

Hi @123serge123,
I tested your suggestions for manually modifying the registers and it seems to work!
Here's the bootlog from that.

After comparing the values in the registers from pepe2k, mainline u-boot without reset and mainline boot with reset, I made the following changes to U-boot to replicate that:

  • writel(0xf0000, usbc_regs + AR71XX_USB_CTRL_REG_CONFIG); this line would write a wrong value to the QCA953X_USB_CTRL_CONFIG_REG register, so I removed it here.

  • Added writing the correct value to the QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG register based on pepe2k's changes here.

I want to keep testing my solution, but thank you so much for your help!
Don't think I'd have figured that out by myself!

2 Likes

Ok! But just for reference can show correct content of the regs?

Sure!
These were the register values I got without any changes.

Register pepe2k U-boot
QCA953X_USB_CTRL_CONFIG_REG 0x0000001D 0x00000001
QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x00000231 0x00000531
QCA953X_RST_RESET_REG 0x200000C8 0x200000C8
QCA953X_RST_BOOTSTRAP_REG 0x000000A0 0x000000A0
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.