OpenWrt Forum Archive

Topic: Kamikaze 2.6 Asus wl-500g Premium usb uhci problems

The content of this topic has been archived on 27 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi there!

I have a big problem bothering me... the usb 1.1 support on ASUS WL-500G Premium

The router has the VIA VT82xx USB 2.0 controller on board and the EHCI (usb 2.0) stuff is working good. The problem is I need to attach a USB 1.1 device to the usb 2.0 controller and so I have to use the UHCI driver, which won't initialise the via chip!!

The same behaviour is reported here http://forum.openwrt.org/viewtopic.php?id=5840 but all the discussion stopped at that point.

BUT the same build is WORKING on a WGT634U with a NEC USB (but there the OHCI version is used)

As far as I understood, it seems there are no PCI I/O regions available to initialise the UHCI controller... Are there any fixes for this? Any hints? Links? Whatever... I'm rather desperate with this.

As the Broadcom CPU used in the wl-500gP has an onboard USB 1.1 I'm wondering if this usb pins are even pulled out from the bga cpu? Is there a "hidden" usb 1.1 port on the board somewhere?

I have to attach a USB ISDN modem on the router (isdn dial-up for backup) and a usb disk for storage. The WGT + usb hub could be the solution but when the modem is attached via the usb-hub the isdn (hfc_usb) driver says (something like) "all host controller bandwidth is consumed" and won't transfer any "user" data to the modem (modem connects but no data goes through).


Any help would be greatly appreciated.
Regards,
M.Culibrk


Here are some dumps:

Linux OpenWrt 2.6.17 #1 Fri Sep 1 15:16:37 CEST 2006 mips unknown


when uhci-hcd loads it says:

<4>PCI: Fixing up device 0000:01:03.0
<7>uhci_hcd 0000:01:03.0: no i/o regions available
<3>uhci_hcd 0000:01:03.0: init 0000:01:03.0 fail, -16
<4>uhci_hcd: probe of 0000:01:03.0 failed with error -16
<4>PCI: Fixing up device 0000:01:03.1
<7>uhci_hcd 0000:01:03.1: no i/o regions available
<3>uhci_hcd 0000:01:03.1: init 0000:01:03.1 fail, -16
<4>uhci_hcd: probe of 0000:01:03.1 failed with error -16



As mentioned, the problem seems to be the "unavailable I/O" for the uhci chip. A quick lspci gives this:

sysfs view:

root@OpenWrt:~# lspci -s 01:03.0 -G -v
Trying method 1......using /sys/bus/pci...OK
Decided to use Linux-sysfs
01:03.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 61) (prog-if 00 [UHCI])
        Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
        Flags: medium devsel, IRQ 2
        I/O ports at <ignored> [disabled]
        Capabilities: [80] Power Management version 2


pci view:

root@OpenWrt:~# lspci -s 01:03.0 -G -v -M
Trying method 1......using /sys/bus/pci...OK
Decided to use Linux-sysfs
Mapping bus 01
Discovered device 01:03.0
01:03.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 61) (prog-if 00 [UHCI])
        Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
        Flags: medium devsel, IRQ 2
        I/O ports at fce0 [disabled]
        Capabilities: [80] Power Management version 2

for 1.1 compatablility... you don't need the 1.1 driver installed.  you should ONLY load the ehci driver.   as far as I know.

Hmmm... I think the 1.1 driver is neccessary otherwise the EHCI driver/chip would not even "notice" a 1.1 device was been (un)plugged from the bus. (Already tried that).

As far as I know the USB 2.0 controllers "emulate" or "really contain" an "auxiliary" USB 1.1 controller to handle 1.1 devices on the 2.0 bus.

I have to say I did not try the drivers/behaviour with the 2.4 (WhiteRussian) kernel but other says this works perfectly... but I need "native" ipsec which is (only) available in kernel 2.6.

Regards

After some additional researching ( empiric one wink ) I noticed something (very) strange.

At this moment I think the problem of the UHCI driver and its init errors are due to "no I/O ports available" error. The UHCI driver is the only one which is using I/O ports to control the hardware, all other drivers are using MMIO (memory mapped IO).

As I said, the lspci says "I/O port ignored", the uhci-hcd is unable to find a "valid" region for its IO ports and the init fails.

Given the information that UHCI+EHCI is working good on the W.Russian (RC5) I noticed that the IO reservations are tottaly different on the WR and Kamikaze images:

On the W.Russian the /proc/ioports says:
0100-011f : usb-uhci
0120-013f : usb-uhci

while the Kamikaze has /proc/ioports like this:
0000-00ff : SB PCI I/O resources
0100-01ff : Ext PCI I/O resources

To me, this looks like something reserved the "entire" I/O space of interest and no other driver could allocate anything in that range, so the uhci-hcd initialization fails...

I found this range is "reserved" for the patches for the BroadCom SOC (bcm947xx-patch).
I'll try to put this out to see what will happen.


Regards,
M.Culibrk

I "fixed" this IO reservation but this did not help.
The UHCI-HCD still fails at init, no i/o regions available....
I'll try to get the list of "supported" resources from at the initialization to compare with the same data from kernel 2.4 and the lspci metadata dump...

Is it possible that 2.4 and 2.6 kernels differently "program"/"set" pci devices or controller(s) on detection/initialization? (Florian?)

I suppose the PCI "metadata" (device parameters) remains the same, as this should came from the device itself, right?

Thanks,
M.Culibrk

I have the same issue.
It seems that the only USB devices working with ASUS WL-500GD are storage devices, using USB 2.0. Which means: no USB modems, printers, webcams etc. on ASUS WL-500GD running the newest snapshots of OpenWRT.

Loading uhci_hcd fails for me, too:

USB Universal Host Controller Interface driver v2.3
PCI: Fixing up device 0000:01:02.0
uhci_hcd 0000:01:02.0: init 0000:01:02.0 fail, -16
uhci_hcd: probe of 0000:01:02.0 failed with error -16
PCI: Fixing up device 0000:01:02.1
uhci_hcd 0000:01:02.1: init 0000:01:02.1 fail, -16
uhci_hcd: probe of 0000:01:02.1 failed with error -16

I tried that with Kamikaze (2.6.16.7) and buildroot-ng (2.6.17), both fail in the similar way.

I also tried whiterussian, with 2.4.x kernel, and there everything works fine.

Any ideas on how to fix it of course are welcome smile

I found a quick "work arround" for this UHCI problem and now I have my 500g P working with usb 1.1 devices ! smile (finally!)

The "problem" was in the resource allocation/reservation provided in 001-brcm947xx.patch where Ext PCI has the reservation of 0x100-0x1FF (which is really not THE problem).

The UHCI device itself "offers" 0xfce0 as the I/O range (during first pci initialization, read pci registers).

The pci code (pci init) found in arch/mips change this resource to 0x400-0x41f in the pci dev structures.

I checked in the platform specific pci code (in arch/mips/bcm947xx/pci.c) and found the code which effectively fixes the "external PCI" device resources on the brcm boards such that the devices get I/O ranges from 0x100 onwards. That's all cool but...

when something (uhci-hcd) tries to initialize/activate the device the pci subsystem tries to reserve and activate the uhci resources which are "currently" set outside the allowed "Ext PCI I/O resources" so the brcm-pci-fix never gets called and the uhci-init fails as "no io resource available".

The "dirty" trick I did is to set the "Ext PCI I/O resources" in arch/mips/bcm947xx/pci.c to be from 0x100 to 0x7FF. In this way the before mentioned resource reservation succedes and the brcm-pci-fix gets called and the uhci resources are set to (the expected) 0x100 range.

I'm not sure is this "trick" will break anything else on other hardware as I currently tested this only on the Asus WL-500G Premium box.

My question is what would be the best method to fix this? By adding some "pci-quirks" which will fix the addressing before or some other way? Make this only apply for Asus (or other) platforms using the VIA6212 USB?
Any (gurus) hint would be appreciated.

The same goes to the VIA6212 fixes by nbd 218-more-usb.patch which change some registers in the VIA USB controller. Does anybody know if this is really neccessary or what exactly those bits change? That changes are present in the Asus released gpl tarbal but without any explanations...

Here is the little "fix"...

diff -Nur linux-2.6.17/arch/mips/bcm947xx/pci.c linux-2.6.17/arch/mips/bcm947xx/pci-fixed.c
--- linux-2.6.16/arch/mips/bcm947xx/pci.c 2006-09-20 15:08:32.000000000 +0200
+++ linux-2.6.16/arch/mips/bcm947xx/pci-fixed.c 2006-09-20 17:55:51.000000000 +0200
@@ -82,8 +82,8 @@

static struct resource ext_pci_io_resource = {
        .name   = "Ext PCI I/O resources",
-       .start  = 0x100,
-       .end    = 0x1FF,
+       .start  = 0x100,
+       .end    = 0x7FF,
        .flags  = IORESOURCE_IO,
};

This is great news, I'm gonna test it today or tomorow.

Hmm, seems to work, but something's weird.

The good thing is, when I plug a USB webcam in, it gets detected, the pwc module is loaded automatically:

usb 3-2: new full speed USB device using uhci_hcd and address 2
usb 3-2: SerialNumber: 0169000099000000
usb 3-2: configuration #1 chosen from 1 choice
Linux video capture interface: v1.00
pwc Philips webcam module version 9.0.2-unofficial loaded.
pwc Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.
pwc Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,
pwc the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.
pwc Philips PCVC730K (ToUCam Fun)/PCVC830 (ToUCam II) USB webcam detected.
pwc Registered as /dev/video0.
usbcore: registered new driver Philips webcam
usbcore: registered new driver snd-usb-audio

Also it detects when I plug a USB printer in.

So, it looks like it's indeed working.


But, after I insert any new USB device, lsusb shows only USB-sticks, as before:

Bus 003 Device 002: ID 0781:5150 SanDisk Corp. SDCZ2 Cruzer Mini Flash Drive (thin)
Bus 003 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0781:5150 SanDisk Corp. SDCZ2 Cruzer Mini Flash Drive (thin)

For some reason, it shows the same USB-stick twice. It shows this USB-stick only once when I don't plug any other devices.


lsusb -v:

00:03.0 USB Controller: Broadcom Corporation Sentry5 USB Controller (rev 01) (prog-if 10 [OHCI])
        Flags: bus master, fast devsel, latency 64, IRQ 6
        Memory at 18003000 (32-bit, non-prefetchable) [size=4K]
        [virtual] Expansion ROM at 18008800 [disabled] [size=2K]

01:02.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 61) (prog-if 00 [UHCI])
        Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
        Flags: bus master, medium devsel, latency 22, IRQ 2
        I/O ports at 0100 [size=32]
        Capabilities: [80] Power Management version 2

01:02.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 61) (prog-if 00 [UHCI])
        Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
        Flags: bus master, medium devsel, latency 22, IRQ 2
        I/O ports at 0120 [size=32]
        Capabilities: [80] Power Management version 2

01:02.2 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 63) (prog-if 20 [EHCI])
        Subsystem: VIA Technologies, Inc. USB 2.0
        Flags: bus master, medium devsel, latency 22, IRQ 2
        Memory at 40000000 (32-bit, non-prefetchable) [size=256]
        Capabilities: [80] Power Management version 2


I have ASUS WL-500G deluxe.

Strange... did you try with some other usb devices? I used only isdn modem(s) and various storage devices (sticks, hdds...) no web cams jet...
Does the webcam acctually work (do you get something from /dev/video0)?
I do not believe it's related to my "dirty fix" as it appls only to the "start uhci" time...

No, I didn't try yet.
I was just trying if they are detected.

I was hoping to use a USB modem with ASUS router, but I don't have it anymore (although I should have it back in about two weeks).

And I'm not sure it a webcam actually works - cat /dev/video0 doesn't display anything on ASUS; on a PC it displays lots of data, so it doesn't look good... sad

USB-serial cable works using uhci_hcd driver (with pl2303 driver for the cable itself)...

So, perhaps ehci and uhci devices work, but ohci don't.
pwc/webcam uses ohci.

Hmm...
It's not the device that dictate the host driver to be used (uhci, ehci, ohci...) but the usb controller itself. The usb2.0 is using EHCI host controller drivers and for the usb 1.1 there are two variants of host controllers used - UHCI (mostly Intel & Via chips) and OHCI (all the other chip manufacturers).

Did you load all the v4l support neccessary on your asus when trying the camera? I'm not 100% sure right now but I think you need more than just the web-cam usb driver for that.

> It's not the device that dictate the host driver to be used (uhci, ehci, ohci...) but the usb controller itself.

Well, so how do you explain that USB-serial cable works only if I load uhci driver, and webcam is only detected if I load ohci driver? smile


Loading pwc driver with modprobe should autoload all required drivers... But I'll double check later.

If you take a look at your post you'll see the webcam is using the UHCI host:

mangoo wrote:

usb 3-2: new full speed USB device using uhci_hcd and address 2
usb 3-2: SerialNumber: 0169000099000000
usb 3-2: configuration #1 chosen from 1 choice

which will be the same for any other usb 1.1 device you may plug in the usb slots on the Asus wl-500gP. When you plug in a usb 2.0 it will be managed by the ehci_hcd instead (if loaded, of course).

The OHCI controller which is listed by lspci is inside the BRCM SoC but it's not used/connected anywhere so you really can't use it... (if you do, please let me know how/where you found the usb data pins).

Indeed, it is as you said, I was mistaken.

Hi mangoo,

i posted a topic about my problems with the pwc modul. In my case - netgear wgt634u, trunk 4832, kernel 2.6.17 - the pwc modul will not be compiled, even if i included it in the .config as modul or direct in the kernel. when i use make V=99 there are no hints for the complication of the pwc-modul.
I have tried so much. Can u post your .config?

I need to run the webcam with my netgear wgt634u for my master thesis.

Thx. 4 any help.

Martin

Hi mangoo,

thx a lot.
In the meanwhile i tried "make menuconfig" in the build_mipsel/linux and
enabled
CONFIG_VIDEO_V4L1=y
and now i am asked by "make oldconfig" for the v4l devices, e.g. pwc.

now its compiling...... :-))

i think it will be fixed with kernel 2.6.18.

I try the webcam today, and will post my approach.

Greetz Martin

you have to do "make ARCH=mips menuconfig".

"make menuconfig" will configure the kernel for the platform you're running on (most likely, x86 your PC is running).

(Last edited by mangoo on 25 Sep 2006, 11:08)

I didnt know that ;-)

i am just rebuilding it.
does anybody know how to clear the kernel-build and rebuild the kernel, without downloading the new kernel-image.
at the moment i doing it with:
    * make target/clean
    * make target/install
          o rebuilds install image (and kernel too?)

but this will clear the openwrt/build_mipsel/linux directory.
Its important because i downloaded the most recent pwc-module from saillard.org/pwc and want to unpack it into the kernel-tree (under ./build_mipsel/linux/drivers/media/video/pwc/ )

and does anybody know where to find infos about howto cross-compile sources e.g. the pwc module with the openwrt-toolchain.

really thx a lot.

(Last edited by ares321 on 25 Sep 2006, 13:13)

Just go to buildroot-ng/openwrt/build_mipsel/linux - there are kernel sources.

"make clean" will work thare.

Remove .linux-compile and .modules_done, which are the "stamp files".

After you're done, go to "openwrt" directory, and start "make V=99" there.

THANKS a lot mangoo



It works :-). There are something to do.

will post the procedure later.

greetz Martin

Does the webcam actually work for you (with pwc module)?

Do you get any output when you do cat /dev/video or /dev/video0?

Yes ;-))

everything works find.

cat /dev/v4l/video0 .... makes "signs"

and even palantir works (jpeg-webserver).


the procedure was ...


svn co https://svn.openwrt.org/openwrt/branches/buildroot-ng
make V=99 | tee log_run0

this will download and build everything ...

BUT ... as described, the pwc module will not be included even if u selected it.

the problem is the "switch" to v4l2 ... you can see it. when
"make ARCH=mips menuconfig"     ### in buildroot-ng/openwrt/build_mipsel/linux

default
   [ ]   Enable Video For Linux API 1 (DEPRECATED)                                     ? ?
  ? ?             [*]   Enable Video For Linux API 1 compatible Layer
choose
  [*]   Enable Video For Linux API 1 (DEPRECATED)                                     ? ?
  ? ?             ---   Enable Video For Linux API 1 compatible Layer         

only then u can select under
Video Capture Adapters  --->
           V4L USB devices  --->
                      <M> USB Philips Cameras
finally i downloaded the most recent package from
http://www.saillard.org/linux/pwc/
and extracted it in the kernel_directory under  buildroot-ng/openwrt/build_mipsel/linux where the old module was.

then i followed your advice:

"make clean" in buildroot-ng/openwrt/build_mipsel/linux
Remove .linux-compile and .modules_done, which are the "stamp files".
After you're done, go to "openwrt" directory, and start "make V=99" there.

find buildroot-ng/openwrt/build_mipsel/linux -iname "*pwc*"
then u get the pwc.ko

then upgrade the router.
install videodev and usb-stuff
wget 192.168.1.XXX/pwc.ko /lib/modules/2.6.17

insmod pwc
should work now....

no problems any more....

hope this "howto" is understandable ;-))

Greetz Martin

The discussion might have continued from here.