From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bryan O'Donoghue Date: Sun, 31 Aug 2008 00:24:30 +0100 Subject: [U-Boot] how to support usbtty In-Reply-To: <5c9cd53b0808290853s62f2b51cg5e3e7659cbd5e2d2@mail.gmail.com> References: <50c9a225050922202647e885fe@mail.gmail.com> <20050923061150.E88EE353A4F@atlas.denx.de> <19167791.post@talk.nabble.com> <20080826185621.E7642248C3@gemini.denx.de> <5c9cd53b0808270720t795e1586r91d47a1fa917bebb@mail.gmail.com> <20080827181155.664a5a0f@neuromancer.mindspace> <5c9cd53b0808290853s62f2b51cg5e3e7659cbd5e2d2@mail.gmail.com> Message-ID: <20080831002430.052de407@neuromancer.mindspace> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 29 Aug 2008 11:53:45 -0400 "mike zheng" 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