
On Fri, 29 Aug 2008 11:53:45 -0400 "mike zheng" mail4mz@gmail.com wrote:
Hi Bryan,
The USB/RS232 cable is a USB device, it shall has firmware in it, which works as a USB slave. What I need to do is have some code talk to this device via the Host controller - ISP1561. So, I need some code as usb-storage.c, maybe called usb-serial.c.
Almost certainly.
I am not sure how "usbtty" being used. Is it used when there is a USB/USB cable connected between the target and PC?
Yes. Think of usbtty being equivalent to the firmware that runs inside of that USB/RS232 cable you have.
It allows u-boot to be a USB slave and provide a console interface over the USB, to a USB host somewhere.
Both ends of the cable are USB port, the PC end is a master, the target end is the slave. So usbtty running on the target is acting as the USB device. However it is not my case. The cable I have has one USB end, and one RS232 end.
Understood.
The USB end is connected to the target. I assume there is something in the chip within the cable acts as a USB slave device already.
A bit of firmware implementing either some FDTI-specific USB protocol stuff to emulate UART over the USB, or just simply following the USB standard for this => cdc-acm.
And again you're right - you'll need to be implementing a host side USB serial driver for u-boot.
Alternatively if the ISP1561 can do device mode - you could have your PC be master and just implement the usbdcore_isp1561.c for u-boot and then use either the usbserial or cdc-acm USB protocol to talk to the USB host. In this case you could use the code in usbtty to plug into the u-boot console system - and just implement whatever is required to make the isp1561 be a well behaved u-boot USB slave.
Most embedded USB transceivers these days to both host and slave - so it'd probably be worth looking into this option ?
In either case it might be interesting to plug your host-side stuff into usbtty.c in u-boot - though it's unclear to me if there'd be more or less pain for you in the long run !
-- Bryan