Hello there, I'm programming a hardware driver module and use a Cypress EzUsb controller for which I should upload firmware first. Firmware uploading would normally be done by 'fxload' but I want to get rid of all external dependencies and include all functionality in the driver itself.
The firmware is divided into short bursts of data that have to be written to endpoint 0, into the internal ram. I use the following method for handling the firmware in the source code of the module: The datatype: ----------------------------------- #define MAX_INTEL_HEX_RECORD_LENGTH 16 typedef struct _INTEL_HEX_RECORD { __u8 Length; __u16 Address; __u8 Type; __u8 Data[MAX_INTEL_HEX_RECORD_LENGTH]; } INTEL_HEX_RECORD, *INTEL_HEX_RECORD; ----------------------------------- The firmware itself: ----------------------------------- const INTEL_HEX_RECORD CypressCode[] = { { 8, // Length 0x1546, // Address 0, // Type {0xAE, 0x40, 0xAF, 0x41, 0x7C, 0x00, 0x7D, 0x02} }, ... <etc.etc.> ... } }; ----------------------------------- And then in the probe function of the driver I call the following function: ----------------------------------- ret = usb_control_msg( udev, usb_sndctrlpipe(udev, 0), INTERNAL_RAM_ADDR, USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, firmware->Address, 0, firmware->Data, firmware->Length, 10*HZ ); ----------------------------------- I use the usb_control_msg in this fashion in other spots without any trouble so there should be no syntax error. The error that is thrown upon insertion of the usb-device (I turned on extra debugging information of the usb host controller): ----------------------------------- Jul 19 10:09:38 virtualinux kernel: uhci_hcd 0000:00:07.2: wakeup_rh (auto-start) Jul 19 10:09:38 virtualinux kernel: hub 1-0:1.0: state 7 ports 2 chg 0000 evt 0002 Jul 19 10:09:38 virtualinux kernel: uhci_hcd 0000:00:07.2: port 1 portsc 0083,00 Jul 19 10:09:38 virtualinux kernel: hub 1-0:1.0: port 1, status 0101, change 0001, 12 Mb/s Jul 19 10:09:38 virtualinux kernel: hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101 Jul 19 10:09:38 virtualinux kernel: usb 1-1: new full speed USB device using uhci_hcd and address 2 Jul 19 10:09:39 virtualinux kernel: usb 1-1: new device found, idVendor=XXXX, idProduct=XXXX Jul 19 10:09:39 virtualinux kernel: usb 1-1: new device strings: Mfr=0, Product=0, SerialNumber=0 Jul 19 10:09:39 virtualinux kernel: usb 1-1: uevent Jul 19 10:09:39 virtualinux kernel: usb 1-1: device is bus-powered Jul 19 10:09:39 virtualinux kernel: usb 1-1: configuration #1 chosen from 1 choice Jul 19 10:09:39 virtualinux kernel: usb 1-1: adding 1-1:1.0 (config #1, interface 0) Jul 19 10:09:39 virtualinux kernel: usb 1-1:1.0: uevent Jul 19 10:09:39 virtualinux kernel: drivers/usb/core/inode.c: creating file '002' Jul 19 10:09:39 virtualinux kernel: hDriver 1-1:1.0: usb_probe_interface Jul 19 10:09:39 virtualinux kernel: hDriver 1-1:1.0: usb_probe_interface - got id Jul 19 10:09:39 virtualinux kernel: hDriver: hDriver_probe is called Jul 19 10:09:39 virtualinux kernel: hDriver: Found extDevice without EZUSB firmware Jul 19 10:09:39 virtualinux kernel: hDriver: Uploading EZUSB firmware for extDevice... Jul 19 10:09:39 virtualinux kernel: hDriver: Check: 1 Jul 19 10:09:39 virtualinux kernel: hDriver: Check: 2 Jul 19 10:09:39 virtualinux kernel: uhci_hcd 0000:00:07.2: host controller process error, something bad happened! Jul 19 10:09:39 virtualinux kernel: uhci_hcd 0000:00:07.2: host controller halted, very bad! Jul 19 10:09:39 virtualinux kernel: uhci_hcd 0000:00:07.2: HC died; cleaning up Jul 19 10:09:39 virtualinux kernel: hub 1-0:1.0: state 0 ports 2 chg 0000 evt 0000 Jul 19 10:09:39 virtualinux kernel: usb 1-1: USB disconnect, address 2 Jul 19 10:09:41 virtualinux kernel: usb 1-1: modprobe timed out on ep0out len=0/16 Jul 19 10:09:41 virtualinux kernel: hDriver: Check: 3 Jul 19 10:09:41 virtualinux kernel: hDriver: Status value: -110 Jul 19 10:09:41 virtualinux kernel: hDriver: probe of 1-1:1.0 failed with error -1 Jul 19 10:09:41 virtualinux kernel: usb 1-1: usb_disable_device nuking all URBs Jul 19 10:09:41 virtualinux kernel: usb 1-1: unregistering interface 1-1:1.0 Jul 19 10:09:41 virtualinux kernel: usb 1-1:1.0: uevent Jul 19 10:09:41 virtualinux kernel: usb 1-1: unregistering device Jul 19 10:09:41 virtualinux kernel: usb 1-1: uevent Jul 19 10:09:41 virtualinux kernel: usbcore: registered new driver hDriver ------------------------------------- This error log was grabbed from a Suse 10.1 system with kernel-2.6.16.13-4-default but I also tested it on kernel-2.6.8 (Debian) and kernel-2.6.17.6 (Debian, Gentoo). The tests were carried out on both virtual machines and a Native Linux machine but all resulted in the same error. I build in some printk-checkpoints to find out where exactly the error occurs, between checkpoint 2 and 3 so it seems; which is the usb_control_msg statement. The driver name is 'hDriver' and the device is called 'extDevice', hotplugging and such works fine; it's just this 'host controller process error'. Is there a way to get even more debugging information from the uhci controller than this? 'Very bad' doesn't really help me here. Does somebody have any idea of what has gone/is wrong? Thanks in advance! -Kris ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Linux-usb-users@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users