usb/serial/io_ti.c broken on BE systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm trying to use Edgeport sensors on my Openwrt router (Atheros MIPS CPU
with 3.3.8 kernel). It does not work and I have enabled debug output below:

Feb 11 20:28:42 10.0.0.254 kernel: [5650055.170000] usb 1-1: new full-speed
USB device number 10 using ehci-platform
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.460000] io_ti 1-1:1.0:
Edgeport TI 1 port adapter converter detected
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.470000]
drivers/usb/serial/io_ti.c: choose_config - Number of Interfaces = 1
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.480000]
drivers/usb/serial/io_ti.c: choose_config - MAX Power            = 80
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.490000]
drivers/usb/serial/io_ti.c: download_fw - RUNNING IN DOWNLOAD MODE
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.490000]
drivers/usb/serial/io_ti.c: read_download_mem - @ 0 for 1
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.510000]
drivers/usb/serial/io_ti.c: read_download_mem - @ 2 for 4
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.510000]
drivers/usb/serial/io_ti.c: read_download_mem - @ 2 for 4
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.530000] usb 1-1:
read_download_mem - length = 4, data = 06 e4 c9 fb
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.530000]
drivers/usb/serial/io_ti.c: check_i2c_image - structure too big,
erroring out.
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.540000]
drivers/usb/serial/io_ti.c: download_fw - DOWNLOAD MODE -- BAD I2C
Feb 11 20:28:42 10.0.0.254 kernel: [5650055.550000] io_ti: probe of
1-1:1.0 failed with error -5

When I plug the sensor on my x86 server, it works:

...
Feb 11 20:13:35 red kernel: [801958.038659]
/build/linux-vnts0_/linux-3.2.54/drivers/usb/serial/io_ti.c:
download_fw - RUNNING IN DOWNLOAD MODE
Feb 11 20:13:35 red kernel: [801958.038664]
/build/linux-vnts0_/linux-3.2.54/drivers/usb/serial/io_ti.c:
read_download_mem - @ 0 for 1
 Feb 11 20:13:35 red kernel: [801958.043284]
/build/linux-vnts0_/linux-3.2.54/drivers/usb/serial/io_ti.c:
read_download_mem - @ 2 for 4
 Feb 11 20:13:35 red kernel: [801958.043292]
/build/linux-vnts0_/linux-3.2.54/drivers/usb/serial/io_ti.c:
read_download_mem - @ 2 for 4
 Feb 11 20:13:35 red kernel: [801958.047275] usb 3-1:
read_download_mem - length = 4, data = 01 09 00 b0
Feb 11 20:13:35 red kernel: [801958.047288]
/build/linux-vnts0_/linux-3.2.54/drivers/usb/serial/io_ti.c:
check_i2c_image Type =0x1
Feb 11 20:13:35 red kernel: [801958.047294]
/build/linux-vnts0_/linux-3.2.54/drivers/usb/serial/io_ti.c:
read_download_mem - @ 6 for 9
...
...

And the rest of the init continues properly.

I've created a little libusb perl script to debug the device, and found that
I could simulate the MIPS bug if I would send a read_download_mem address in
LE format instead of BE, e.g.:

  $dev->control_msg((64 + 0 + 128), 0x92 , 0x82, 0x200, $bytes, 4, 1000);
  => OK returns 01 09 00 b0
  
  $dev->control_msg((64 + 0 + 128), 0x92 , 0x82, 0x0002, $bytes, 4, 1000);
  => BAD returns 06 e4 c9 fb

In the io_ti driver, in read_download_mem(), we have:

      be_start_address = cpu_to_be16(start_address);
      status = ti_vread_sync(dev, UMPC_MEMORY_READ,
                               (__u16)address_type,
                               (__force __u16)be_start_address,
                         buffer, read_length);
      
      
Of course cpu_to_be16() has no effect on MIPS BE, and that's the cause of
the bug.
I don't know if it should be replaced with a swab16() or something else, I'm
not a kernel expert :) and there are a few other lines to fix.

Would could fix this bug, or would give me some advice on how to fix it?

Best regards,

-- 
L.Drolez.

http://www.aopensource.com             - The Android Open Source Portal


--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux