XHCI DbC (debug port) problems

2018-12-05 Thread Tj
I'm assisting in debugging what appears to be a race condition in I2C
code [0] on Intel ComputeStick STK1A32SC [1] devices. As part of that
effort we were originally using an external USB<>RS232 adapter and
"console=ttyUSB0,115200n8" but that can be extremely slow (connected to
a real UART port) and the debug messages seem to prevent the issue occuring.

We decided to switch to use the XHCI debug port and ordered a set of
USB3 A<>A debug crossover cables [2].

We are following the kernel admin guide's USB3 debug port document [3]

We've hit problems in getting the DbC port to work correctly and need
some advice as to whether there is a kernel issue here?

The target is using custom-built 4.20-rc4 kernels with all required
modules built in. The original issue was first detected in Debian
kernels v4.18.*, but didn't occur in v4.9.

The ComputeStick devices have 2 USB ports, 1 is USB3, which the cable
connects to. The host is using v4.18.18 (Fedora) and has usb_debug
module loaded.

Initially the host reported:

usb 2-6: new SuperSpeed Gen 1 USB device number 9 using xhci_hcd
usb 2-6: LPM exit latency is zeroed, disabling LPM.
usb 2-6: language id specifier not provided by device, defaulting to English
usb 2-6: New USB device found, idVendor=1d6b, idProduct=0011, bcdDevice=
0.10
usb 2-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-6: rejected 1 configuration due to insufficient available bus power
usb 2-6: no configuration chosen from 1 choice
mtp-probe[32428]: checking bus 2, device 9:
"/sys/devices/pci:00/:00:14.0/usb2/2-6"
mtp-probe[32428]: bus: 2, device: 9 was not an MTP device
fwupd[2590]: failed to add USB device 1d6b:0011: 1d6b:0011 is not
supported: USB error on device 1d6b:0011 : Entity not found [-5]

Due to "rejected 1 configuration due to insufficient available bus
power" we then enabled the workaround:

# echo 1 > /sys/bus/usb/devices/.../bConfigurationValue

That got us further but then hits repeated -EPROTO errors:

usb 2-6: no configuration chosen from 1 choice
usb 2-6: new config #1 exceeds power limit by 660mA
usb_debug 2-6:1.0: xhci_dbc converter detected
usb 2-6: xhci_dbc converter now attached to ttyUSB0
xhci_dbc ttyUSB0: usb_serial_generic_write_bulk_callback - nonzero urb
status: -71

The last line is repeated constantly several times each second.

The first thing that has confused us is where is the host getting the
"idProduct=0011" from? Looking at the xhci-dbgcap.h the only USB ID is

#define DBC_PRODUCT_ID  0x0010  /* device 0010 */

and xhci-dbgcap.c seems to write it without change:

dev_info = cpu_to_le32((DBC_DEVICE_REV << 16) | DBC_PRODUCT_ID);

usb_serial does declare both 0x0010 and 0x0011 as aliases but that
doesn't explain why the target is reported as 0x0011.

We're wondering if the warning:

"usb_serial_generic_write_bulk_callback - nonzero urb status: -71"

is a regression or bug, rather than us missing something, since we've
tried to do the same operation between two Fedora 4.18.18 PCs and got
exactly the same results.


Secondly, the "new config #1 exceeds power limit by 660mA" report, if we
calculate correctly, suggests that bMaxPower being sent by the target is
900mA + 660mA = 1560mA, but cannot find in the code where bMaxPower is
being set, if any. How is this set by the target?


Any advice or experience as to what we might be missing?

[0] https://bugs.freedesktop.org/show_bug.cgi?id=108714
[1] https://ark.intel.com/products/91064/Intel-Compute-Stick-STK1A32SC
[2]
https://www.datapro.net/products/usb-3-0-super-speed-a-a-debugging-cable.html
[3]
https://www.kernel.org/doc/html/v4.14/driver-api/usb/usb3-debug-port.html


Re: XHCI DbC (debug port) problems

2018-12-21 Thread Tj
On 11/12/2018 14:00, Mathias Nyman wrote:
>> Any advice or experience as to what we might be missing?
>
> What does sudo lsusb -v on the host say about the target device?
> What's the dbc status on the target? you did enable it right?
> (on target,  cat /sys/bus/pci/devices/:00:14.0/dbc) 

Is this documentation incomplete?

https://www.kernel.org/doc/html/v4.14/driver-api/usb/usb3-debug-port.html

There's no mention of needing to manipulate the 'dbc' node on either the
host or the target.

In fact, it wouldn't make sense to manipulate it on the target since
we're trying to capture the kernel earlyprintk using "earlyprintk=xdbc"
and the target doesn't necessarily reach userspace.



Re: XHCI DbC (debug port) problems

2018-12-21 Thread Tj
On 21/12/2018 16:37, Mathias Nyman wrote:
> On 21.12.2018 17:53, Tj wrote:
>> On 11/12/2018 14:00, Mathias Nyman wrote:
>>>> Any advice or experience as to what we might be missing?
>>>
>>> What does sudo lsusb -v on the host say about the target device?
>>> What's the dbc status on the target? you did enable it right?
>>> (on target,  cat /sys/bus/pci/devices/:00:14.0/dbc)
>>
>> Is this documentation incomplete?
>>
>> https://www.kernel.org/doc/html/v4.14/driver-api/usb/usb3-debug-port.html
>>
>
>
> That's the documentation for a old 4.14 kernel.
>
> see this instead:
> https://www.kernel.org/doc/html/v4.19/driver-api/usb/usb3-debug-port.html
>
Thanks; hadn't realised we'd been looking at the older docs but it
doesn't help. That specifically shows that writing to the 'dbc' node is
a userspace procedure on the target - we're dealing with kernel earlyprintk.

We have a custom kernel with all built-ins for testing with:

$ egrep 'DBC|XHCI' .config
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DBGCAP=y
CONFIG_USB_XHCI_PCI=y
CONFIG_EARLY_PRINTK_USB_XDBC=y

and a command-line including "earlyprintk=xdbc"

>From what you've said, and looking at our host dmesg reports, it looks
like we're only getting confirmation that the host is detecting the
debug cable and the target XHCI hardware *but not* the target OS's debug
function (which might explain the unexpected idProduct) that should be
enabled by CONFIG_EARLY_PRINTK_USB_XDBC.

I've just reviewed the kernel config options and cannot see anything
else that would appear to affect this.

Thanks for helping out on this; we'd given up on making sense of it and
not having a working example to compare against we're working blind.



Huawei Wireless data modem in Freescale i.MX6 Board

2013-09-30 Thread Thomas TJ
I'm trying to connect Huawei wireless data modem in Freescale i.MX6 Board.
It's detected as a usb device and the result of lsusb is
"Bus 002 Device 007: ID 12d1:140b Huawei Technologies Co., Ltd. EC1260
Wireless Data Modem HSD USB Card"

But it's not mounted in /dev/disk/bu-id

kindly help me to get it mounted and get the internet access in the
Freescale i.MX6 Board through the USB Modem



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Huawei Wireless data modem in Freescale i.MX6 Board

2013-09-30 Thread Thomas Tj

Dear Dan

Thanks for the reply.

* PF the output(log.txt) of the below command.

lsusb -v -d 12d1:140b

* USB_Modeswitch operation also i've done.
* Please let me know how to get the WWAN (I thing it's WLAN) connection 
manager in the ARM Board.
(while connecting the USB broadband modem in x86, it's detecting as 
WLAN0 (in ifconfig)

but the same is not shown in the ARM device for ifconfig
Do we need to insmod any specific ko file for Wlan. please let me know. 
Thanks


Regards,
Thomas TJ.


On Monday 30 September 2013 08:25 PM, Dan Williams wrote:

On Mon, 2013-09-30 at 08:37 +, Thomas TJ wrote:

I'm trying to connect Huawei wireless data modem in Freescale i.MX6 Board.
It's detected as a usb device and the result of lsusb is
"Bus 002 Device 007: ID 12d1:140b Huawei Technologies Co., Ltd. EC1260
Wireless Data Modem HSD USB Card"

But it's not mounted in /dev/disk/bu-id

kindly help me to get it mounted and get the internet access in the
Freescale i.MX6 Board through the USB Modem

What is the full lsusb output?  Run "lsusb -v -d 12d1:140b".  Many
Huawei devices need to be "modeswitched" because by default their
firmware presents itself not as a modem, but as a fake CD that contains
the connection manager and driver.  That is done by the usb_modeswitch
program, and we need to first figure out whether that's necessary on
your system and whether it's done.

After that, you need a WWAN connection manager to make the actual data
connection for your device.

Dan




--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html