Hi Andy,

andy_purc...@keysight.com writes:
> Hello,
>
> I am starting work on a board that has the Intel Skylake chipset,
> which has hardware for doing USB-device.

Not all SKLs have dwc3 enabled. Can you provide the output of lspci?

> The Intel chipset USB-device hardware is the Synopsys DesignWare
> Controller 3, aka "dwc3".
>
> The Linux source tree has code for dwc3, so I thought to try running
> Linux on this board.
>
> The USB-device function is hard-wired on my board to be USB-device.
> Cannot be OTG. Cannot be USB-host.

fair enough

> I boot Ubuntu Desktop 16.04, kernel = 4.4.0-59, to test the USB-device 
> function.

I need to ask you to try a newer kernel. Can you try v4.9.6 or v4.10-rc6?

> Using a script, I set up the USB-device to be RNDIS, using functionfs.

functionfs needs a userspace component, do you have that? Can you try
any other gadget driver like mass storage, for instance? Here's a quick
script for mass storage:

#!/bin/sh

dd if=/dev/zero of=/dev/shm/file bs=1M count=1024

mount -t configfs none /c
mkdir /c/usb_gadget/g1
echo 0x18d1 > /c/usb_gadget/g1/idVendor
echo 0xbeef > /c/usb_gadget/g1/idProduct
mkdir /c/usb_gadget/g1/strings/0x409
echo 123456789012 > /c/usb_gadget/g1/strings/0x409/serialnumber
echo "Intel Corporation" > /c/usb_gadget/g1/strings/0x409/manufacturer
echo "Joule" > /c/usb_gadget/g1/strings/0x409/product
mkdir /c/usb_gadget/g1/functions/mass_storage.1
mkdir /c/usb_gadget/g1/configs/b.1
mkdir /c/usb_gadget/g1/configs/b.1/strings/0x409
echo 500 > /c/usb_gadget/g1/configs/b.1/MaxPower
echo /dev/shm/file > /c/usb_gadget/g1/functions/mass_storage.1/lun.0/file
ln -s /c/usb_gadget/g1/functions/mass_storage.1  /c/usb_gadget/g1/configs/b.1/f1
echo dwc3.0.auto > /c/usb_gadget/g1/UDC

> I connect a USB cable from my board to a USB-host. 
> My USB analyzer shows nothing happens. No connection, no SETUP
> packets, nothing.

right, I'm assuming you don't have userspace component for functionfs,
so ->pullup() is never called.

> To troubleshoot, I try turning on some test modes, using the Linux debugfs 
> interface.
> The debugfs interface is in this directory: 
>       /sys/kernel/debug/dwc3.0.auto 
> I see link_state, mode, regdump, testmode files. 

Can you also get the output of:

grep DCTL regdump

> * echo "test_j" > testmode
>       I see D+ go high, D- stays low. 
> * echo "test_k" > testmode
>       No change on D+
>       No change on D- 
>       This is not correct. 
> * echo "test_se0_nak" > testmode
>       No changes. 
> * echo "test_packet" 
>       D+ goes low, D- remains low. 
>
> OK, so here are my questions. 
>
> 1)    Should I expect Ubuntu 16.04 dwc3 code to work? 
>       (uname -a shows kernel level is 4.4.0-59)  
>       I ask, because kernel.org shows recent changes in dwc3 code. 

if you enabled the driver, it should work, yes. Now we just need to make
you have all the other pieces.

> 2)    The Linux dwc3 code appears to be written to work with several 
> different USB phy's. 
>       I see dwc3-exynos.c, dwc3-keystone.c, dwc3-omap.c, dwc3-pci.c, 
> dwc3-of-simple.c, etc. 
>       The schematic for my board shows there is no external USB2 phy and no 
> external USB3 phy.

you don't need to worry about that AFAICT :-)

>       For my board, the phy's are internal to the Skylake chipset.
>       a.      Should the Linux dwc3 code work without an external phy?
>       b.      Is there some configuration I need to do for my board?

most likely, no. BIOS is likely handling that for you.

-- 
balbi

Attachment: signature.asc
Description: PGP signature

Reply via email to