RE: [PATCH 1/2] Documentation: usb: dwc3: add power down clock scale property

2019-03-10 Thread Jun Li

> -Original Message-
> From: Rob Herring 
> Sent: 2019年2月23日 8:33
> To: Jun Li 
> Cc: mark.rutl...@arm.com; ba...@kernel.org; linux-usb@vger.kernel.org;
> devicet...@vger.kernel.org; dl-linux-imx 
> Subject: Re: [PATCH 1/2] Documentation: usb: dwc3: add power down clock scale
> property
> 
> On Tue, Jan 22, 2019 at 10:37:17AM +, Jun Li wrote:
> > The USB3 suspend_clk input replaces pipe3_rx_pclk as a clock source to
> > a small part of the USB3 core that operates when the SS PHY is in its
> > lowest power(P3) state, and therefore does not provide a clock. The
> > power down scale specifies how many suspend_clk periods fit into a 16
> > KHz clock period, details can see DWC3 databook register
> > GCTL.PWRDNSCALE.
> >
> > Signed-off-by: Li Jun 
> > ---
> >  Documentation/devicetree/bindings/usb/dwc3.txt | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt
> > b/Documentation/devicetree/bindings/usb/dwc3.txt
> > index 3e4c38b..d1c8b62 100644
> > --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> > +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> > @@ -102,6 +102,12 @@ Optional properties:
> > more than one value, which means undefined length INCR 
> > burst type
> > enabled. The values can be 1, 4, 8, 16, 32, 64, 128 and 
> > 256.
> >
> > + - snps,power-down-scale: Power down scale field specifies how many
> suspend_clk
> > +   periods fit into a 16 Khz clock period. When performing
> > +   the division, round up the remainder. Suspend clock is
> > +   from 32kHz to 125MHz, means the value range is 2~8000.
> > +   (details see DWC_usb3 databook register 
> > GCTL.PWRDNSCALE).
> > +
> 
> Sounds like the suspend_clk should be provided as a clock input so you can
> calculate this value.

Yes, I will go this approach by update dts with suspend_clk of dwc3

Thanks
Li Jun 
> 
> >   - in addition all properties from usb-xhci.txt from the current directory 
> > are
> > supported as well
> >
> > --
> > 2.7.4
> >


Re: Using EHSET module

2019-03-10 Thread Peter Chen
BR,Peter Chen
On Thu, Mar 7, 2019 at 11:26 PM Greg KH  wrote:
>
> On Thu, Mar 07, 2019 at 03:24:29PM +0100, rchmielarz wrote:
> > Hi,
> >
> > I'm trying to certify USB on our device that is running Linux 4.14.
> > For windows systems we were using https://www.usb.org/usb2tools. For
> > linux the only option I have found is a kernel module called EHSET.
> > Unfortunately I can't manage to get it working, can You please help?
> >
> > I have added the following configuration:
> > CONFIG_USB_HCD_TEST_MODE=y
> > USB_EHSET_TEST_FIXTURE=m
> >
> > Then on the system I type in modprobe ehset. After this looking at the
> > source code of ehset.c I assumed that inserting USB stick with
> > VendorID: 0x1a0a and ProductID: 0x0104 would start the Packet command,
> > but it doesn't do anything (not output visible on the oscilloscope).
> > The device is loaded as a regular USB stick.
> >
> > The output I see is:
> > [ 1059.904034] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus 
> > number 1
> > [ 1059.935515] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
> > [ 1059.941700] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
> > [ 1059.948523] usb usb1: New USB device strings: Mfr=3, Product=2,
> > SerialNumber=1
> > [ 1059.955776] usb usb1: Product: EHCI Host Controller
> > [ 1059.960680] usb usb1: Manufacturer: Linux 4.14.87-rt50 ehci_hcd
> > [ 1059.966627] usb usb1: SerialNumber: ci_hdrc.0
> > [ 1059.974486] usb usb1: usb_probe_device
> > [ 1059.982387] hub 1-0:1.0: usb_probe_interface
> > [ 1059.986735] hub 1-0:1.0: USB hub found
> > [ 1059.990614] hub 1-0:1.0: 1 port detected
> > [ 1060.475521] usb 1-1: new high-speed USB device number 2 using ci_hdrc
> > [ 1060.677970] usb 1-1: New USB device found, idVendor=1a0a, idProduct=0104
> > [ 1060.684709] usb 1-1: New USB device strings: Mfr=1, Product=2, 
> > SerialNumber=3
> > [ 1060.691877] usb 1-1: Product: USB DISK 3.0
> > [ 1060.696005] usb 1-1: Manufacturer:
> > [ 1060.700215] usb 1-1: SerialNumber: 190073AE389B2300
> > [ 1060.708279] usb 1-1: usb_probe_device
> > [ 1060.716351] usb-storage 1-1:1.0: usb_probe_interface
> > [ 1060.724692] usb-storage 1-1:1.0: USB Mass Storage device detected
> > [ 1060.745330] scsi host1: usb-storage 1-1:1.0
>

You need to have a device with the below vid and pid, that device can let your
ehci host enter test mode, eg, sending test packet for eye diagram.

122 static const struct usb_device_id ehset_id_table[] = {
123 { USB_DEVICE(0x1a0a, TEST_SE0_NAK_PID) },
124 { USB_DEVICE(0x1a0a, TEST_J_PID) },
125 { USB_DEVICE(0x1a0a, TEST_K_PID) },
126 { USB_DEVICE(0x1a0a, TEST_PACKET_PID) },
127 { USB_DEVICE(0x1a0a, TEST_HS_HOST_PORT_SUSPEND_RESUME) },
128 { USB_DEVICE(0x1a0a, TEST_SINGLE_STEP_GET_DEV_DESC) },
129 { USB_DEVICE(0x1a0a, TEST_SINGLE_STEP_SET_FEATURE) },
130 { } /* Terminating entry */
131 };
132 MODULE_DEVICE_TABLE(usb, ehset_id_table);

Peter

> The usb-storage driver bound to your device first.  Try building a
> kernel without that driver and then it shoudl bind to the other driver.
>
> Or manually bind the ehset driver to your device through sysfs.  Read up
> on the documentation for the "new_id" and "bind" and "unbind" sysfs
> files for how to do that.
>
> thanks,
>
> greg k-h