WR741ND - no USB on recent versions (21.02.5)

Hi all,

Recently I was trying to build a custom image for this practically antique router (TP LINK TL-WR741ND, seems like v2, based on AR72xx). My main goal is to repurpose it as p910nd print server. I managed to install the USB socket on the board and attach it to the SoC (following the "USB host mod" guide on the device page), and I also updated the RAM to 64 megs.

I'm building 21.02.5 since there are existing configs that work; I initially tried to build 22.03.3 but I had issues.
Since the device page was written quite some time ago I didn't try to apply USB patches mentioned there - I just updated the device tree to enable the USB and USB-PHY:

...
&usb_phy {
	status = "ok";
};
&usb {
	status = "ok";
};

The results are promising, but not complete. Driver seems to load and detect USB insertion, however it fails with:

[    6.949330] ohci-platform 1b000000.usb: Generic Platform OHCI controller
[    6.956173] ohci-platform 1b000000.usb: new USB bus registered, assigned bus number 1
[    6.964114] ohci-platform 1b000000.usb: irq 3, io mem 0x1b000000
[    8.744853] usb 1-1: new full-speed USB device number 2 using ohci-platform
[    9.056825] ohci-platform 1b000000.usb: frame counter not updating; disabled
[    9.063907] ohci-platform 1b000000.usb: HC died; cleaning up
[   13.824989] usb usb1-port1: attempt power cycle

And after that it stops reacting to USB actions at all.

I tried taking existing, older images with USB support and it worked - so I don't have many doubts in my hardware setup. This is a part of dmesg of a firmware found on the 4pda.ru, compiled by one of the forum members:

root@Fazenda:~# dmesg | grep usb
[    6.460122] usbcore: registered new interface driver usbfs
[    6.465861] usbcore: registered new interface driver hub
[    6.471347] usbcore: registered new device driver usb
[    7.202545] usb 1-1: new full-speed USB device number 2 using ohci-platform
[   14.904268] usbcore: registered new interface driver cdc_wdm
[   15.040387] usbcore: registered new interface driver usbserial
[   15.046498] usbcore: registered new interface driver usbserial_generic
[   15.053182] usbserial: USB Serial support registered for generic
[   15.144420] usbcore: registered new interface driver cdc_ether
[   15.166346] usbcore: registered new interface driver cdc_ncm
[   15.215490] usbcore: registered new interface driver huawei_cdc_ncm
[   15.312924] usbcore: registered new interface driver qmi_wwan
[   15.322769] usbcore: registered new interface driver rndis_host
[   15.371447] usbcore: registered new interface driver ipw
[   15.377032] usbserial: USB Serial support registered for IPWireless converter
[   15.392648] usbcore: registered new interface driver qcserial
[   15.398682] usbserial: USB Serial support registered for Qualcomm USB modem
[  206.160794] usb 1-1: USB disconnect, device number 2
[  206.665697] usb 1-1: new full-speed USB device number 3 using ohci-platform
[  206.936133] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-ohci-platform-1, RNDIS device, xx:xx:xx:xx:xx:xx

So clearly HW works. Is there a known regression in kernel ~5.4.x that may mess up this OHCI adapter? Am I missing something?

1 Like

Ok, so I figured it. This regression happened with switch from mach-*.c files to DTS. Comparing initialization code I found this part:

/* WAR for HW bug. Here it adjusts the duration between two SOFS */
__raw_writel(0x3, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ);

And it seems like it was never moved to the new DTS initialization (which I guess makes sense, considering how old is this router) I don't even know if there are routers based on AR7240 with built-in USB - even later WR741 revisions switched to some other chipset. So it was never found out...

I'll try to upstream the patch, but the fix is quite ugly and I'm not sure if anyone will actually want to merge it, again, considering the age of the chip and the whole idea of "adding" the USB port like that.

1 Like

Just to be clear on the semantics, this router doesn't have USB ports brought out to the outside - so there obviously can't be a regression as such.

That you can get to the SOC's USB lanes on the inside of the router and make use of them, is just icing on the cake, but not a requirement to run OpenWrt on this device <-- custom(ized) hardware means custom software. So technically, nothing was missed when porting the TL-WR741NDv2 from mach files to DTS.

Given that enabling the USB lanes (without including USB drivers by default, no point to wasting flash space for everyone, just for the few who have customized their hardware with USB ports) would be rather harmless, even by default, an according patch to move this to DTS would probably be accepted. But from a device support point of view, this is rather optional.

Thanks for the reply!
I'm not saying that device support is incomplete or anything along the lines - I just state that the mod that was possible awhile ago is now not working, hence the word regression.
I'll try to work on a patch, but I'm still considering if using such router for printing is a good idea or not.
I think this thread can be closed for now.

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