On Mon, 16 Dec 2013, Rafał Miłecki wrote: > I've problem with one of my Broadcom based no-name China router. > > This is a pretty standard/common BCM47186 SoC (chip id 0x5357, rev > 0x02, package 0x0A). It can be found in some routers having USB > port(s), however my PCB doesn't have any USB port. It seems SoC is > capable of handling USB, but my PCB doesn't have USB soldered to it > (or maybe it also misses some required internal hub? I didn't try > soldering). > > This makes "bcma" driver detect USB device on the SoC: > [ 0.096000] bcma: bus0: Core 4 found: USB 2.0 Host (manuf 0x4BF, id > 0x819, rev 0x05, class 0x0) > and register it without noticing it's not connected. In fact, there's no way to know that it's not connected. > This results in the following: > [ 6.540000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver > [ 6.548000] ehci-platform: EHCI generic platform driver > [ 6.556000] ehci-platform ehci-platform.0: EHCI Host Controller > [ 6.560000] ehci-platform ehci-platform.0: new USB bus registered, > assigned bus number 1 > [ 7.156000] irq 5: nobody cared (try booting with the "irqpoll" option) > [ 7.156000] CPU: 0 PID: 154 Comm: kmodloader Not tainted 3.10.18 #14 > [ 7.156000] Stack : 00000006 00000000 00000000 00000000 00000000 > 00000000 804ed0a6 00000038 > 838b52e0 8028f2dc 804cd018 802dd23b 0000009a 802e0000 > 00000000 802e0000 > 80293268 8001f0f0 802e0000 8001ca30 00000000 00000000 > 80290bbc 82d43a04 > 82d43a00 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 82d43990 > ... > [ 7.156000] Call Trace: > [ 7.156000] [<80011d3c>] show_stack+0x48/0x70 > [ 7.156000] [<8005a114>] __report_bad_irq+0x44/0xec > [ 7.156000] [<8005a6e8>] note_interrupt+0x25c/0x314 > [ 7.156000] [<800587d4>] handle_irq_event_percpu+0x224/0x268 > [ 7.156000] [<8005b4c0>] handle_percpu_irq+0x54/0x88 > [ 7.156000] [<80057f58>] generic_handle_irq+0x3c/0x4c > [ 7.156000] [<8000ea38>] do_IRQ+0x1c/0x2c > [ 7.156000] [<8000a9e8>] plat_irq_dispatch+0x90/0xb8 > [ 7.156000] [<80001444>] ret_from_irq+0x0/0x4 > [ 7.156000] [<80130934>] arch_local_irq_restore+0x24/0x30 > [ 7.156000] [<80059c18>] __setup_irq+0x494/0x5c4 > [ 7.156000] [<80059e48>] request_threaded_irq+0x100/0x15c > [ 7.156000] [<82e475f8>] usb_add_hcd+0x334/0x7dc [usbcore] > [ 7.156000] [<82e221f8>] 0x82e221f8 > [ 7.156000] > [ 7.156000] handlers: > [ 7.156000] [<82e466e8>] usb_hcd_irq [usbcore] > [ 7.156000] Disabling IRQ #5 > > As you can see, there is usb_hcd_irq handler, but it doesn't return IRQ_HANDLED. > > Why is that? Because ehci_irq reads: > status = ehci_readl(ehci, &ehci->regs->status); > which is always 0x00001000. That means STS_HALT. This bit is ignored > by ehci_irq and it returns IRQ_NONE. This also means that the controller is generating an interrupt request when it has no reason to do so. In other words, the hardware is broken. > By adding simple printk in ehci_irq: > pr_info("[DBG] status:0x%08X masked_status:0x%08X\n", status, masked_status); > I've noticed this function is called ~140 times per second. > Funny thing, with the above printk I was spammed until device > rebooted, but I didn't see any "irq N: nobody cared". Your pr_info must have slowed things down so much that the IRQ-storm detector wasn't triggered. > On another machine with exactly the same chipset I get a nice USB support: > [ 4.068000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver > [ 4.076000] ehci-platform: EHCI generic platform driver > [ 4.112000] ehci-platform ehci-platform.0: EHCI Host Controller > [ 4.128000] ehci-platform ehci-platform.0: new USB bus registered, > assigned bus number 1 > [ 4.188000] ehci-platform ehci-platform.0: irq 6, io mem 0x18004000 > [ 4.212000] ehci-platform ehci-platform.0: USB 2.0 started, EHCI 1.00 > [ 4.216000] hub 1-0:1.0: USB hub found > [ 4.220000] hub 1-0:1.0: 2 ports detected > [ 4.228000] [DBG] [ehci_irq:706] status:0x00000004 masked_status:0x00000004 > [ 4.544000] usb 1-1: new high-speed USB device number 2 using ehci-platform > [ 4.548000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.564000] [DBG] [ehci_irq:706] status:0x00008020 masked_status:0x00000020 > [ 4.572000] [DBG] [ehci_irq:706] status:0x00008020 masked_status:0x00000020 > [ 4.668000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.672000] [DBG] [ehci_irq:706] status:0x00008020 masked_status:0x00000020 > [ 4.680000] [DBG] [ehci_irq:706] status:0x00008020 masked_status:0x00000020 > [ 4.704000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.708000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.716000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.724000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.732000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.740000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.748000] hub 1-1:1.0: USB hub found > [ 4.756000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.760000] hub 1-1:1.0: 4 ports detected > [ 4.764000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.772000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.780000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.788000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.796000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.804000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.820000] [DBG] [ehci_irq:706] status:0x00008020 masked_status:0x00000020 > [ 4.824000] [DBG] [ehci_irq:706] status:0x00008020 masked_status:0x00000020 > [ 4.912000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.916000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.924000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.932000] [DBG] [ehci_irq:706] status:0x00008001 masked_status:0x00000001 > [ 4.948000] [DBG] [ehci_irq:706] status:0x0000C020 masked_status:0x00000020 > [ 4.956000] [DBG] [ehci_irq:706] status:0x0000C020 masked_status:0x00000020 > > Is there any way this could be fixed? No, not that I know of. But since the USB controller isn't connected to anything, you could simply avoid configuring the ehci-hcd driver in the kernel. > Can we somehow early-check USB > state? We do. On the other hand, the driver doesn't bother to check that the controller really does start running when the CMD_RUN bit is turned on. > Could we somehow disable USB after getting STS_HALT interrupt? You can also disable the driver manually. But why go to the trouble of building it in the first place if you're only going to disable it later? > Any other ideas? Replace the hardware. :-) Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html