[U-Boot] [usb] dwc3 -- phy -- hub: a hint/help/an idea needed.

Yuri Frolov kernel.crashing at gmail.com
Fri Sep 7 09:10:54 UTC 2018


Hi,

Any ideas/hints needed with regard to dwc3 -- phy -- hub support on a custom board.

I've been struggling with u-boot implementation of usb support on a mips32-based
development board (a SoC with DWC3 integrated).
SoC has the ULPI interface, and by means of it, it's connected to USB 2.0 phy (Microchip USB3315),
and down the stream, the phy is connected to USB hub chip (smsc usb2422) using of usb 2.0 interface.
I've been able to verify, that USB hub chip has proper power and, when dwc3 generates proper USB commands,
the hub is kinda activated and on the pad XTALIN/CLKIN (pad #22) I can see a proper-shaped 24 mhz clock
(an oscilloscope was hooked up). But the hub is not configured properly, since the LED indicator
(connected to the pad #17 of the hub) never blinks (it's the indication that the hub has been configured properly).
USB protocol hangs up after xhci_queue_command (TRB_ENABLE_SLOT): the host never receives indication from the hub
(event->event_cmd.flags never changes from 0) => xhci stack issues BUG() ==> Reset CPU by CPC.

I presume, that hardware is ok, since after linux kernel has been loaded, the hub works just properly.

We don't have any gpios involved, any ULPI viewport windows, indeed nothing which would allow me to
configure the phy or the hub itselves. In fact, as far as I understand, the phy and the hub
shouldn't be configured by software and (in our setup at least) intended to be software-transparent.

The code in linux which activates the usb, in essence just updates the clocks infrastructure:

dwc->clk = devm_clk_get(dwc->dev, "usb");
if (IS_ERR(dwc->clk)) {
	dev_err(dev, "no interface clk specified\n");
	return -EINVAL;
}

ret = clk_prepare_enable(dwc->clk);

and I verified, that the necessary clocks are all enabled in u-boot (the necessary bits are on in proper addresses).


# usb start
(Re)start USB...
USB0:   baikal-xhci: init hccr bf100000 and hcor bf100020 hc_length 32
// Halt the HC: bf100020
// Reset the HC
Register 1000140 NbrPorts 1
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... New Device 0
common/usb.c:938 TMPBUF: a7e30a00
--- usb_set_address(dev) ---
set address 1
usb_control_msg: request: 0x5, requesttype: 0x0, value 0x1 index 0x0 length 0x0
USB_REQ_SET_ADDRESS
scrlen = 0
  req->length = 0
Len is 0
--- usb_get_descriptor(USB_DT_DEVICE) ---
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 length 0x12
USB_DT_DEVICE request
scrlen = 18
  req->length = 18
  -- returned from usb_get_descriptor.
bcdUSB:    0x300
idVendor:  0x0
idProduct: 0x0
bcdDevice: 0x100
--- usb_get_configuration_no(dev, tmpbuf, 0) ---
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 length 0x9
USB_DT_CONFIG config
scrlen = 25
  req->length = 9
00000000: 09 02 1f 00 01 01 00 40 00                         ....... at .
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 length 0x1F
USB_DT_CONFIG config
scrlen = 25
  req->length = 31
00000000: 09 02 1f 00 01 01 00 40 00 09 04 00 00 01 09 00    ....... at ........
00000010: 00 00 07 05 81 03 08 00 ff 77 6d 61 63 2e 62       .........wmac.b
get_conf_no 0 Result 25, wLength 31
--- usb_parse_config(dev, tmpbuf, 0) ---
if 0, ep 0
unknown Description Type : 6d
77 6D 61 63 2E 62 66 30 36 30 30 30 30 00 A7 0C 00 00 00 28 4F F6 A7 58 0A E3 A7 58 0A E3 A7 C8 B9 FA A7 28 4F


--- usb_set_maxpacket(dev) ---
##EP epmaxpacketin[1] = 8
new device strings: Mfr=1, Product=2, SerialNumber=0
--- usb_string iProduct ---
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x300 index 0x0 length 0xFF
USB_DT_STRING config
scrlen = 4
  req->length = 255
USB device number 1 default language ID 0x409
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x302 index 0x409 length 0xFF
USB_DT_STRING config
scrlen = 42
  req->length = 255
--- usb_string iManufacturer ---
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x301 index 0x409 length 0xFF
USB_DT_STRING config
scrlen = 14
  req->length = 255
--- usb_string iSerialNumber ---
Manufacturer U-Boot
Product      XHCI Host Controller
SerialNumber
--- usb_set_configuration ---
set configuration 1
usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 length 0x0
scrlen = 0
  req->length = 0
Len is 0
USB hub found
HUB IS SUPERSPEED, dtype 0x2a, dtype << 8 0x2a00
USB_DT_HUB: 0x29, USB_DT_SS_HUB: 0x2a
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2A00 index 0x0 length 0x4
USB_DT_HUB config
scrlen = 8
  req->length = 4
00000000: 0c 2a 01 08 ff ff ff ff ff ff ff ff                .*..........
HUB IS SUPERSPEED, dtype 0x2a, dtype << 8 0x2a00
USB_DT_HUB: 0x29, USB_DT_SS_HUB: 0x2a
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2A00 index 0x0 length 0xC
USB_DT_HUB config
scrlen = 8
  req->length = 12
00000000: 0c 2a 01 08 00 0a 00 00 ff ff ff ff                .*..........
1 ports detected
hubCharacteristics: 0x8
ganged power switching
standalone hub
individual port over-current protection
TT requires at most 8 FS bit times (666 ns)
power on to power good time: 20ms
hub controller current requirement: 0mA
port 1 is removable
usb_control_msg: request: 0x0, requesttype: 0x80, value 0x0 index 0x0 length 0x2
scrlen = 2
  req->length = 2
usb_get_status, status: 0x1
usb_get_status, ret: 0x0
usb_control_msg: request: 0x0, requesttype: 0xA0, value 0x0 index 0x0 length 0x4
scrlen = 2
  req->length = 4
get_hub_status returned status 1, change 801
local power source is lost (inactive)
no over-current condition exists
enabling power on all ports
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x1 length 0x0
scrlen = 0
  req->length = 0
Len is 0
port 1 returns 0
devnum=1 poweron: query_delay=200 connect_timeout=1200
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4
SPEED = FULLSPEED
scrlen = 4
  req->length = 4
Port 1 Status 101 Change 1
devnum=1 port=1: USB dev found
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4
SPEED = FULLSPEED
scrlen = 4
  req->length = 4
portstatus 101, change 1, 12 Mb/s
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x10 index 0x1 length 0x0
clear port connect change, actual port 1 status  = 0x6e1
scrlen = 0
  req->length = 0
Len is 0
usb_hub_port_reset: resetting port 1...
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x1 length 0x0
scrlen = 0
  req->length = 0
Len is 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4
SPEED = FULLSPEED
scrlen = 4
  req->length = 4
portstatus 111, change 0, 12 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 0
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x1 length 0x0
scrlen = 0
  req->length = 0
Len is 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4
SPEED = HIGHSPEED
scrlen = 4
  req->length = 4
portstatus 503, change 10, 480 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x14 index 0x1 length 0x0
clear port reset change, actual port 1 status  = 0xe03
scrlen = 0
  req->length = 0
Len is 0
New Device 1
common/usb.c:938 TMPBUF: a7e30400
&ctrl->dba->doorbell[0]: bf100480
_xhci_alloc_device: after xhci_queue_command (TRB_ENABLE_SLOT)...
XHCI timeout on event type 33... cannot recover.
BUG: failure at drivers/usb/host/xhci-ring.c:484/xhci_wait_for_event()!
BUG!
Reset CPU by CPC


More information about the U-Boot mailing list