v3 OMAP USB
Subsystems (5)
The is version 3 of the patchset to enable usb device support on OMAP.
The changes from the last revision are.
Per Remy's request
Quoted 6 lines
Quoted 2 lines
USB_CONFIG_DESCRIPTOR_DEFINITIONUSB_INTERFACE_DESCRIPTOR_DEFINITIONPersonally I do not like the macros for these kind of definitions, I would prefer a solution by nesting the structures.
What do you think?
I have exchanged the first patch to an earlier version that used a nested structure 'desc' instead of the macros.
At the other end of the patch set I have added Ajay's changes to condition initialization of twl4030 and enabling in omap3_evm.
I have runtested this on Beagle.
Tom
PATCH 1/10 USB Consolidate descriptor definitions
The header files usb.h and usbdescriptors.h have the same nameed structure definitions for
usb_config_descriptorusb_interface_descriptorusb_endpoint_descriptorusb_device_descriptorusb_string_descriptor
These are out right duplicates in usb.h
usb_device_descriptorusb_string_descriptor
This one has extra unused elements
usb_endpoint_descriptor
unsigned char bRefresh unsigned char bSynchAddress;
These in usb.h have extra elements at the end of the usb 2.0 specified descriptor and are used.
usb_config_descriptorusb_interface_descriptor
The change is to consolidate the definition of the descriptors to usbdescriptors.h. The dublicates in usb.h are removed. The extra element structure will have their name shorted by removing the '_descriptor' suffix.
So
usb_config_descriptor -> usb_configusb_interface_descriptor -> usb_interface
For these, the common descriptor elements are accessed now by an element 'desc'.
As an example
- if (iface->bInterfaceClass != USB_CLASS_HUB)
+ if (iface->desc.bInterfaceClass != USB_CLASS_HUB)
This has been compile tested on MAKEALL arm, ppc and mips.
--- common/cmd_usb.c | 20 ++++++------ common/usb.c | 35 ++++++++++----------- common/usb_kbd.c | 22 ++++++++----- common/usb_storage.c | 16 +++++----- cpu/ppc4xx/usbdev.c | 4 +- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/musb/musb_hcd.c | 2 +- include/usb.h | 70 +++++------------------------------------- 8 files changed, 61 insertions(+), 110 deletions(-)
common/cmd_usb.c +10 -10
@@ -157,7 +157,7 @@ void usb_display_desc(struct usb_device *dev) {if (dev->descriptor.bDescriptorType ==USB_DT_DEVICE ) {printf ("%d: %s, USB Revision %x.%x\n" , dev->devnum, -usb_get_class_desc (dev->config.if_desc[0 ].bInterfaceClass), +usb_get_class_desc (dev->config.if_desc[0 ].desc.bInterfaceClass), (dev->descriptor.bcdUSB>>8 ) &0xff , dev->descriptor.bcdUSB &0xff );
@@ -174,7 +174,7 @@ void usb_display_desc(struct usb_device *dev) }else {printf (" - Class: (from Interface) %s\n" ,usb_get_class_desc ( - dev->config.if_desc[0 ].bInterfaceClass)); + dev->config.if_desc[0 ].desc.bInterfaceClass)); } printf(" - PacketSize: %d Configurations: %d\n", dev->descriptor.bMaxPacketSize0,
@@ -187,14 +187,14 @@ void usb_display_desc(struct usb_device *dev) } -void usb_display_conf_desc (struct usb_config_descriptor *config, +void usb_display_conf_desc (struct usb_configuration_descriptor *config,struct usb_device *dev) {printf (" Configuration: %d\n" , config->bConfigurationValue);printf (" - Interfaces: %d %s%s%dmA\n" , config->bNumInterfaces, (config->bmAttributes &0x40 ) ?"Self Powered " :"Bus Powered " , (config->bmAttributes &0x20 ) ?"Remote Wakeup " :"" , - config->MaxPower*2 ); + config->bMaxPower*2 );if (config->iConfiguration) {printf (" - " );usb_display_string (dev, config->iConfiguration);
@@ -246,16 +246,16 @@ void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)/* main routine to diasplay the configs, interfaces and endpoints */ void usb_display_config (struct usb_device *dev) { -struct usb_config_descriptor *config; -struct usb_interface_descriptor *ifdesc; +struct usb_config *config; +struct usb_interface *ifdesc;struct usb_endpoint_descriptor *epdesc;int i, ii; config = &dev->config; -usb_display_conf_desc (config, dev); +usb_display_conf_desc (&config->desc, dev);for (i =0 ; i < config->no_of_if; i++) { ifdesc = &config->if_desc[i]; -usb_display_if_desc (ifdesc, dev); +usb_display_if_desc (&ifdesc->desc, dev);for (ii =0 ; ii < ifdesc->no_of_ep; ii++) { epdesc = &ifdesc->ep_desc[ii];usb_display_ep_desc (epdesc);
@@ -319,9 +319,9 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre) pre[index++] = has_child ?'|' :' ' ; pre[index] =0 ;printf (" %s (%s, %dmA)\n" ,usb_get_class_desc ( - dev->config.if_desc[0 ].bInterfaceClass), + dev->config.if_desc[0 ].desc.bInterfaceClass),portspeed (dev->speed), - dev->config.MaxPower *2 ); + dev->config.desc.bMaxPower *2 );if (strlen (dev->mf) ||strlen (dev->prod) ||strlen (dev->serial))printf (" %s %s %s %s\n" , pre, dev->mf, dev->prod, dev->serial);printf (" %s\n" , pre);
common/usb.c +17 -18
@@ -299,8 +299,8 @@ int usb_set_maxpacket(struct usb_device *dev) {int i, ii; -for (i =0 ; i < dev->config.bNumInterfaces; i++) -for (ii =0 ; ii < dev->config.if_desc[i].bNumEndpoints; ii++) +for (i =0 ; i < dev->config.desc.bNumInterfaces; i++) +for (ii =0 ; ii < dev->config.if_desc[i].desc.bNumEndpoints; ii++)usb_set_maxpacket_ep (dev, &dev->config.if_desc[i].ep_desc[ii]);
@@ -330,14 +330,14 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno)return -1 ; }memcpy (&dev->config, buffer, buffer[0 ]); -le16_to_cpus (&(dev->config.wTotalLength)); +le16_to_cpus (&(dev->config.desc.wTotalLength)); dev->config.no_of_if =0 ; - index = dev->config.bLength; + index = dev->config.desc.bLength;/* Ok the first entry must be a configuration entry, * now process the others */ head = (struct usb_descriptor_header *) &buffer[index]; -while (index +1 < dev->config.wTotalLength) { +while (index +1 < dev->config.desc.wTotalLength) {switch (head->bDescriptorType) {case USB_DT_INTERFACE : if (((struct usb_interface_descriptor *) \
@@ -350,7 +350,7 @@ int usb_parse_config(struct usb_device *dev, unsigned char *buffer, int cfgno) dev->config.if_desc[ifno].no_of_ep =0 ; dev->config.if_desc[ifno].num_altsetting =1 ; curr_if_num = - dev->config.if_desc[ifno].bInterfaceNumber; + dev->config.if_desc[ifno].desc.bInterfaceNumber; }else {/* found alternate setting for the interface */ dev->config.if_desc[ifno].num_altsetting++;
@@ -440,10 +440,9 @@ int usb_get_configuration_no(struct usb_device *dev, {int result;unsigned int tmp; -struct usb_config_descriptor *config; +struct usb_configuration_descriptor *config; - - config = (struct usb_config_descriptor *)&buffer[0 ]; + config = (struct usb_configuration_descriptor *)&buffer[0 ]; result =usb_get_descriptor (dev,USB_DT_CONFIG , cfgno, buffer,9 );if (result <9 ) {if (result <0 )
@@ -489,11 +488,11 @@ int usb_set_address(struct usb_device *dev)*/ int usb_set_interface (struct usb_device *dev,int interface,int alternate) { -struct usb_interface_descriptor *if_face =NULL ; +struct usb_interface *if_face =NULL ;int ret, i; -for (i =0 ; i < dev->config.bNumInterfaces; i++) { -if (dev->config.if_desc[i].bInterfaceNumber == interface) { +for (i =0 ; i < dev->config.desc.bNumInterfaces; i++) { +if (dev->config.if_desc[i].desc.bInterfaceNumber == interface) { if_face = &dev->config.if_desc[i];break ; }
@@ -897,7 +896,7 @@ int usb_new_device(struct usb_device *dev)usb_parse_config (dev, &tmpbuf[0 ],0 );usb_set_maxpacket (dev);/* we set the default configuration here */ -if (usb_set_configuration (dev, dev->config.bConfigurationValue)) { +if (usb_set_configuration (dev, dev->config.desc.bConfigurationValue)) {printf ("failed to set default configuration " \"len %d, status %lX\n" , dev->act_len, dev->status);return -1 ;
@@ -1347,21 +1346,21 @@ int usb_hub_configure(struct usb_device *dev)int usb_hub_probe (struct usb_device *dev,int ifnum) { -struct usb_interface_descriptor *iface; +struct usb_interface *iface;struct usb_endpoint_descriptor *ep;int ret; iface = &dev->config.if_desc[ifnum];/* Is it a hub? */ -if (iface->bInterfaceClass !=USB_CLASS_HUB ) +if (iface->desc.bInterfaceClass !=USB_CLASS_HUB )return 0 ;/* Some hubs have a subclass of 1, which AFAICT according to the */ /* specs is not defined, but it works */ -if ((iface->bInterfaceSubClass !=0 ) && - (iface->bInterfaceSubClass !=1 )) +if ((iface->desc.bInterfaceSubClass !=0 ) && + (iface->desc.bInterfaceSubClass !=1 ))return 0 ;/* Multiple endpoints? What kind of mutant ninja-hub is this? */ -if (iface->bNumEndpoints !=1 ) +if (iface->desc.bNumEndpoints !=1 )return 0 ; ep = &iface->ep_desc[0 ];/* Output endpoint? Curiousier and curiousier.. */
common/usb_kbd.c +13 -9
@@ -229,7 +229,7 @@ int usb_kbd_deregister(void)static void usb_kbd_setled (struct usb_device *dev) { -struct usb_interface_descriptor *iface; +struct usb_interface *iface; iface = &dev->config.if_desc[0 ]; leds=0 ;if (scroll_lock!=0 )
@@ -242,7 +242,7 @@ static void usb_kbd_setled(struct usb_device *dev) leds|=1 ;usb_control_msg (dev,usb_sndctrlpipe (dev,0 ),USB_REQ_SET_REPORT ,USB_TYPE_CLASS |USB_RECIP_INTERFACE , -0x200 , iface->bInterfaceNumber,(void *)&leds,1 ,0 ); +0x200 , iface->desc.bInterfaceNumber, (void *)&leds,1 ,0 ); }
@@ -348,17 +348,21 @@ static int usb_kbd_irq(struct usb_device *dev)/* probes the USB device dev for keyboard type */ static int usb_kbd_probe (struct usb_device *dev,unsigned int ifnum) { -struct usb_interface_descriptor *iface; +struct usb_interface *iface;struct usb_endpoint_descriptor *ep;int pipe,maxp;if (dev->descriptor.bNumConfigurations !=1 )return 0 ; iface = &dev->config.if_desc[ifnum]; -if (iface->bInterfaceClass !=3 )return 0 ; -if (iface->bInterfaceSubClass !=1 )return 0 ; -if (iface->bInterfaceProtocol !=1 )return 0 ; -if (iface->bNumEndpoints !=1 )return 0 ; +if (iface->desc.bInterfaceClass !=3 ) +return 0 ; +if (iface->desc.bInterfaceSubClass !=1 ) +return 0 ; +if (iface->desc.bInterfaceProtocol !=1 ) +return 0 ; +if (iface->desc.bNumEndpoints !=1 ) +return 0 ; ep = &iface->ep_desc[0 ];
@@ -367,9 +371,9 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)USB_KBD_PRINTF ("USB KBD found set protocol...\n" );/* ok, we found a USB Keyboard, install it */ /* usb_kbd_get_hid_desc(dev); */ -usb_set_protocol (dev, iface->bInterfaceNumber,0 ); +usb_set_protocol (dev, iface->desc.bInterfaceNumber,0 );USB_KBD_PRINTF ("USB KBD found set idle...\n" ); -usb_set_idle (dev, iface->bInterfaceNumber,REPEAT_RATE ,0 ); +usb_set_idle (dev, iface->desc.bInterfaceNumber,REPEAT_RATE ,0 );memset (&new[0 ],0 ,8 );memset (&old[0 ],0 ,8 ); repeat_delay=0 ;
common/usb_storage.c +8 -8
@@ -1070,7 +1070,7 @@ retry_it:int usb_storage_probe (struct usb_device *dev,unsigned int ifnum,struct us_data *ss) { -struct usb_interface_descriptor *iface; +struct usb_interface *iface;int i;unsigned int flags =0 ;
@@ -1094,9 +1094,9 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,#endif if (dev->descriptor.bDeviceClass !=0 || - iface->bInterfaceClass !=USB_CLASS_MASS_STORAGE || - iface->bInterfaceSubClass <US_SC_MIN || - iface->bInterfaceSubClass >US_SC_MAX ) { + iface->desc.bInterfaceClass !=USB_CLASS_MASS_STORAGE || + iface->desc.bInterfaceSubClass <US_SC_MIN || + iface->desc.bInterfaceSubClass >US_SC_MAX ) {/* if it's not a mass storage, we go no further */ return 0 ; }
@@ -1119,8 +1119,8 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, ss->subclass = subclass; ss->protocol = protocol; }else { - ss->subclass = iface->bInterfaceSubClass; - ss->protocol = iface->bInterfaceProtocol; + ss->subclass = iface->desc.bInterfaceSubClass; + ss->protocol = iface->desc.bInterfaceProtocol; }/* set the handler pointers based on the protocol */
@@ -1153,7 +1153,7 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,* An optional interrupt is OK (necessary for CBI protocol). * We will ignore any others. */ -for (i =0 ; i < iface->bNumEndpoints; i++) { +for (i =0 ; i < iface->desc.bNumEndpoints; i++) {/* is it an BULK endpoint? */ if ((iface->ep_desc[i].bmAttributes &USB_ENDPOINT_XFERTYPE_MASK ) ==USB_ENDPOINT_XFER_BULK ) {
@@ -1178,7 +1178,7 @@ int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, ss->ep_in, ss->ep_out, ss->ep_int);/* Do some basic sanity checks, and bail if we find a problem */ -if (usb_set_interface (dev, iface->bInterfaceNumber,0 ) || +if (usb_set_interface (dev, iface->desc.bInterfaceNumber,0 ) || !ss->ep_in || !ss->ep_out || (ss->protocol ==US_PR_CBI && ss->ep_int ==0 )) {USB_STOR_PRINTF ("Problems with device\n" );
cpu/ppc4xx/usbdev.c +2 -2
@@ -21,7 +21,7 @@ void process_endpoints(unsigned short usb2d0_intrin) {/*will hold the packet received */ struct usb_device_descriptor usb_device_packet; -struct usb_config_descriptor usb_config_packet; +struct usb_configuration_descriptor usb_config_packet;struct usb_string_descriptor usb_string_packet;struct devrequest setup_packet;unsigned int *setup_packet_pt;
@@ -99,7 +99,7 @@ void process_endpoints(unsigned short usb2d0_intrin) usb_config_packet.bConfigurationValue =1 ; usb_config_packet.iConfiguration =0 ; usb_config_packet.bmAttributes =0x40 ; - usb_config_packet.MaxPower =0 ; + usb_config_packet.bMaxPower =0 ;/*put packet in fifo */ packet_pt = (unsigned char *)&usb_config_packet;
drivers/usb/host/ehci-hcd.c +1 -1
@@ -96,7 +96,7 @@ static struct descriptor {* UE_DIR_IN | EHCI_INTR_ENDPT */ 3, /* bmAttributes: UE_INTERRUPT */ - 8, 0, /* wMaxPacketSize */ + 8, /* wMaxPacketSize */255 /* bInterval */ }, };
drivers/usb/musb/musb_hcd.c +1 -1
@@ -803,7 +803,7 @@ void usb_event_poll() {struct stdio_dev *dev;struct usb_device *usb_kbd_dev; -struct usb_interface_descriptor *iface; +struct usb_interface *iface;struct usb_endpoint_descriptor *ep;int pipe;int maxp;
include/usb.h +9 -61
102 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 2/10 USB add macros for debugging usb device setup.
When developing usb device features, it is useful to print out common usb structures.
--- include/usbdescriptors.h | 26 ++++++++++++ include/usbdevice.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 0 deletions(-)
include/usbdescriptors.h +26 -0
@@ -504,4 +504,30 @@ struct usb_class_descriptor { } __attribute__ ((packed)); +#ifdef DEBUG +static inline void print_device_descriptor (struct usb_device_descriptor *d) +{ +serial_printf ("usb device descriptor \n" ); +serial_printf ("\tbLength %2.2x\n" , d->bLength); +serial_printf ("\tbDescriptorType %2.2x\n" , d->bDescriptorType); +serial_printf ("\tbcdUSB %4.4x\n" , d->bcdUSB); +serial_printf ("\tbDeviceClass %2.2x\n" , d->bDeviceClass); +serial_printf ("\tbDeviceSubClass %2.2x\n" , d->bDeviceSubClass); +serial_printf ("\tbDeviceProtocol %2.2x\n" , d->bDeviceProtocol); +serial_printf ("\tbMaxPacketSize0 %2.2x\n" , d->bMaxPacketSize0); +serial_printf ("\tidVendor %4.4x\n" , d->idVendor); +serial_printf ("\tidProduct %4.4x\n" , d->idProduct); +serial_printf ("\tbcdDevice %4.4x\n" , d->bcdDevice); +serial_printf ("\tiManufacturer %2.2x\n" , d->iManufacturer); +serial_printf ("\tiProduct %2.2x\n" , d->iProduct); +serial_printf ("\tiSerialNumber %2.2x\n" , d->iSerialNumber); +serial_printf ("\tbNumConfigurations %2.2x\n" , d->bNumConfigurations); +} + +#else + +/* stubs */ +#define print_device_descriptor (d) + +#endif /* DEBUG */ #endif
include/usbdevice.h +103 -0
107 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 3/10 TWL4030 Add usb PHY support
The twl4030 provides a PHY device for connecting a link device, like musb, to physical connection.
This change adds the twl4030 usb registers and functions for initializing the PHY as required by omap3.
--- Makefile | 1 + drivers/usb/phy/Makefile | 44 +++++++++++ drivers/usb/phy/twl4030.c | 189 +++++++++++++++++++++++++++++++++++++++++++++ include/twl4030.h | 143 ++++++++++++++++++++++++++++++---- 4 files changed, 362 insertions(+), 15 deletions(-) create mode 100644 drivers/usb/phy/Makefile create mode 100644 drivers/usb/phy/twl4030.c
Makefile +1 -0
@@ -243,6 +243,7 @@ LIBS += drivers/twserial/libtws.a LIBS += drivers/usb/gadget/libusb_gadget.a LIBS += drivers/usb/host/libusb_host.a LIBS += drivers/usb/musb/libusb_musb.a +LIBS += drivers/usb/phy/libusb_phy.a LIBS += drivers/video/libvideo.a LIBS += drivers/watchdog/libwatchdog.a LIBS += common/libcommon.a
drivers/usb/phy/Makefile new file +44 -0
44 lines not on this page · raw message
drivers/usb/phy/twl4030.c new file +189 -0
189 lines not on this page · raw message
include/twl4030.h +128 -15
153 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 4/10 OMAP3 Add usb device support
This change adds the usb device support for musb.
Omap3 platform support added at the same level as davinci.
The interface for usbtty to use the musb device support was added.
Verified on omap3 beagle, zoom1 and zoom2.
--- drivers/serial/usbtty.h | 2 + drivers/usb/musb/Makefile | 2 + drivers/usb/musb/musb_core.c | 8 +- drivers/usb/musb/musb_core.h | 40 ++ drivers/usb/musb/musb_debug.h | 205 +++++++++ drivers/usb/musb/musb_udc.c | 963 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/musb/omap3.c | 129 ++++++ drivers/usb/musb/omap3.h | 48 ++ include/usb.h | 3 +- include/usb/musb_udc.h | 54 +++ 10 files changed, 1451 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/musb/musb_debug.h create mode 100644 drivers/usb/musb/musb_udc.c create mode 100644 drivers/usb/musb/omap3.c create mode 100644 drivers/usb/musb/omap3.h create mode 100644 include/usb/musb_udc.h
drivers/serial/usbtty.h +2 -0
@@ -29,6 +29,8 @@#include <usb/mpc8xx_udc.h> #elif defined(CONFIG_OMAP1510 )#include <usb/omap1510_udc.h> +#elif defined(CONFIG_MUSB_UDC ) +#include <usb/musb_udc.h> #elif defined(CONFIG_PXA27X )#include <usb/pxa27x_udc.h> #endif
drivers/usb/musb/Makefile +2 -0
@@ -26,7 +26,9 @@ include $(TOPDIR)/config.mk LIB := $(obj)libusb_musb.a COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o +COBJS-$(CONFIG_MUSB_UDC) += musb_udc.o musb_core.o COBJS-$(CONFIG_USB_DAVINCI) += davinci.o +COBJS-$(CONFIG_USB_OMAP3) += omap3.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/usb/musb/musb_core.c +6 -2
@@ -32,7 +32,9 @@ struct musb_regs *musbr;*/ void musb_start (void ) { +#if defined(CONFIG_MUSB_HCD )u8 devctl; +#endif /* disable all interrupts */ writew (0 , &musbr->intrtxe);
@@ -74,9 +76,10 @@ void musb_configure_ep(struct musb_epinfo *epinfo, u8 cnt)/* Configure fifo size and fifo base address */ writeb (idx, &musbr->txfifosz);writew (fifoaddr >>3 , &musbr->txfifoadd); + + csr =readw (&musbr->txcsr);#if defined(CONFIG_MUSB_HCD )/* clear the data toggle bit */ - csr =readw (&musbr->txcsr);writew (csr |MUSB_TXCSR_CLRDATATOG , &musbr->txcsr);#endif /* Flush fifo if required */
@@ -87,9 +90,10 @@ void musb_configure_ep(struct musb_epinfo *epinfo, u8 cnt)/* Configure fifo size and fifo base address */ writeb (idx, &musbr->rxfifosz);writew (fifoaddr >>3 , &musbr->rxfifoadd); + + csr =readw (&musbr->rxcsr);#if defined(CONFIG_MUSB_HCD )/* clear the data toggle bit */ - csr =readw (&musbr->rxcsr);writew (csr |MUSB_RXCSR_CLRDATATOG , &musbr->rxcsr);#endif /* Flush fifo if required */
drivers/usb/musb/musb_core.h +40 -0
@@ -40,6 +40,36 @@#define MUSB_EP0_FIFOSIZE 64/* This is non-configurable */ +/* EP0 */ +struct musb_ep0_regs { +u16 reserved4; +u16 csr0; +u16 reserved5; +u16 reserved6; +u16 count0; +u8 host_type0; +u8 host_naklimit0; +u8 reserved7; +u8 reserved8; +u8 reserved9; +u8 configdata; +}; + +/* EP 1-15 */ +struct musb_epN_regs { +u16 txmaxp; +u16 txcsr; +u16 rxmaxp; +u16 rxcsr; +u16 rxcount; +u8 txtype; +u8 txinterval; +u8 rxtype; +u8 rxinterval; +u8 reserved0; +u8 fifosize; +}; +/* Mentor USB core register overlay structure */ struct musb_regs {/* common registers */
@@ -97,6 +127,16 @@ struct musb_regs {u8 rxhubaddr;u8 rxhubport; } tar[16 ]; +/* +* end point registers +* ep0 elements are valid when array index is 0 +* otherwise epN is valid +*/ +union musb_ep_regs { +struct musb_ep0_regs ep0; +struct musb_epN_regs epN; + } ep[16 ]; + } __attribute__((aligned(32)));/*
drivers/usb/musb/musb_debug.h new file +205 -0
205 lines not on this page · raw message
drivers/usb/musb/musb_udc.c new file +963 -0
963 lines not on this page · raw message
drivers/usb/musb/omap3.c new file +129 -0
129 lines not on this page · raw message
drivers/usb/musb/omap3.h new file +48 -0
48 lines not on this page · raw message
include/usb.h +2 -1
@@ -131,7 +131,8 @@ struct usb_device {#if defined(CONFIG_USB_UHCI ) || defined(CONFIG_USB_OHCI ) || \ defined(CONFIG_USB_EHCI ) || defined(CONFIG_USB_OHCI_NEW ) || \ defined(CONFIG_USB_SL811HS ) || defined(CONFIG_USB_ISP116X_HCD ) || \ - defined(CONFIG_USB_R8A66597_HCD ) || defined(CONFIG_USB_DAVINCI ) + defined(CONFIG_USB_R8A66597_HCD ) || defined(CONFIG_USB_DAVINCI ) || \ + defined(CONFIG_USB_OMAP3 )int usb_lowlevel_init (void );int usb_lowlevel_stop (void );
include/usb/musb_udc.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 5/10 OMAP3 zoom1 Add usbtty configuration
The primary console of zoom1 is the serial out from the jumpers accessed by removing the back panel.
A secondary console is to use the usbtty. The user can set this manually by doing
setenv stdout usbtty; setenv stdin usbtty; setenv stderr usbtty saveenv
usbtty will be usable by accessing the /dev/ttyACM0 on a linux host.
--- include/configs/omap3_zoom1.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
include/configs/omap3_zoom1.h +16 -0
@@ -98,6 +98,21 @@#define CONFIG_OMAP3_MMC 1#define CONFIG_DOS_PARTITION 1 +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 +#define CONFIG_TWL4030_USB 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "Zoom1" +/* commands to include */ #include <config_cmd_default.h>
@@ -160,6 +175,7 @@#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ + "usbtty=cdc_acm\0" \ "console=ttyS2,115200n8\0" \ "videomode=1024x768 at 60,vxres=1024,vyres=768\0" \ "videospec=omapfb:vram:2M,vram:4M\0" \
Signature · 1 line
1.6.0.6
PATCH 6/10 OMAP3 beagle Add usbtty configuration
The primary console of beagle is the serial header.
A secondary console is to use the usbtty. The user can set this manually by doing
setenv stdout usbtty; setenv stdin usbtty; setenv stderr usbtty saveenv
usbtty will be usable by accessing the /dev/ttyACM0 on a linux host.
--- include/configs/omap3_beagle.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
include/configs/omap3_beagle.h +16 -0
@@ -97,6 +97,21 @@#define CONFIG_OMAP3_MMC 1#define CONFIG_DOS_PARTITION 1 +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 +#define CONFIG_TWL4030_USB 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "Beagle" +/* commands to include */ #include <config_cmd_default.h>
@@ -163,6 +178,7 @@#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ + "usbtty=cdc_acm\0" \ "console=ttyS2,115200n8\0" \ "vram=12M\0" \ "dvimode=1024x768MR-16 at 60\0" \
Signature · 1 line
1.6.0.6
PATCH 7/10 USBTTY make some function declarations easier to use.
Zoom2 needs to use these declarations and the include directory is a better place from them than in the middle of the driver directory. It did not make sense to create a new file for just a couple of lines so they were appended to the serial.h
--- include/serial.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
include/serial.h +6 -0
@@ -66,4 +66,10 @@ extern void serial_stdio_init(void);extern int serial_assign (char * name);extern void serial_reinit_all (void ); +/* For usbtty */ +extern int usbtty_getc (void ); +extern void usbtty_putc (const char c); +extern void usbtty_puts (const char *str); +extern int usbtty_tstc (void ); +#endif
Signature · 1 line
1.6.0.6
PATCH 8/10 OMAP3 zoom2 Use usbtty if the debug board is not connected.
The preferred serial output comes from the debug board. When the debug board is disconnected, fall back on using usbtty from the usb connector on the Zoom2 board.
This shows up as /dev/ttyACM0 in a linux host.
--- board/logicpd/zoom2/zoom2_serial.c | 12 ++++++++---- include/configs/omap3_zoom2.h | 17 +++++++++++++++++ include/serial.h | 12 ++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-)
board/logicpd/zoom2/zoom2_serial.c +8 -4
@@ -86,6 +86,8 @@ void quad_putc_dev (unsigned long base, const char c)quad_putc_dev (base,'\r' );NS16550_putc ((NS16550_t ) base, c); + }else { +usbtty_putc (c); } }
@@ -94,6 +96,8 @@ void quad_puts_dev (unsigned long base, const char *s)if (zoom2_debug_board_connected ()) {while ((s !=NULL ) && (*s !='\0' ))quad_putc_dev (base, *s++); + }else { +usbtty_puts (s); } }
@@ -101,16 +105,16 @@ int quad_getc_dev (unsigned long base) {if (zoom2_debug_board_connected ())return NS16550_getc ((NS16550_t ) base); -else -return 0 ; + +return usbtty_getc (); }int quad_tstc_dev (unsigned long base) {if (zoom2_debug_board_connected ())return NS16550_tstc ((NS16550_t ) base); -else -return 0 ; + +return usbtty_tstc (); }void quad_setbrg_dev (unsigned long base)
include/configs/omap3_zoom2.h +17 -0
@@ -122,6 +122,20 @@#define CONFIG_OMAP3_GPIO_3 /* board revision */ #define CONFIG_OMAP3_GPIO_5 /* debug board detection, ZOOM2_LED_BLUE */ +/* USB */ +#define CONFIG_MUSB_UDC 1 +#define CONFIG_USB_OMAP3 1 +#define CONFIG_TWL4030_USB 1 + +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "Zoom2" +/* commands to include */ #include <config_cmd_default.h>
@@ -169,6 +183,9 @@/* Environment information */ #define CONFIG_BOOTDELAY 10 +#define CONFIG_EXTRA_ENV_SETTINGS \ + "usbtty=cdc_acm\0" \ +/* * Miscellaneous configurable options */
include/serial.h +12 -0
@@ -67,9 +67,21 @@ extern int serial_assign(char * name);extern void serial_reinit_all (void );/* For usbtty */ +#ifdef CONFIG_USB_TTY +extern int usbtty_getc (void );extern void usbtty_putc (const char c);extern void usbtty_puts (const char *str);extern int usbtty_tstc (void ); +#else + +/* stubs */ +#define usbtty_getc () 0 +#define usbtty_putc (a) +#define usbtty_puts (a) +#define usbtty_tstc () 0 + +#endif /* CONFIG_USB_TTY */ +#endif
Signature · 1 line
1.6.0.6
PATCH 9/10 OMAP3 USB Initialize twl4030 only if required
OMAP3EVM uses ISP1504 phy and so twl4030 related init is not required.
--- drivers/usb/musb/omap3.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/usb/musb/omap3.c +6 -1
@@ -94,12 +94,17 @@ int musb_platform_init(void)if (platform_needs_initialization) {u32 stdby; +/* +* OMAP3EVM uses ISP1504 phy and so +* twl4030 related init is not required. +*/ +#ifdef CONFIG_TWL4030_USB if (twl4030_usb_ulpi_init ()) {serial_printf ("ERROR: %s Could not initialize PHY\n" , __PRETTY_FUNCTION__); goto end; } - +#endif otg = (struct omap3_otg_regs *)OMAP3_OTG_BASE ;/* Set OTG to always be on */
Signature · 1 line
1.6.0.6
PATCH 10/10 omap3evm: musb: add USB config
From: Ajay Kumar Gupta <[email protected]>
Added USB host and device config for host (MSC, Keyboard) and device (ACM) functionalities.
--- include/configs/omap3_evm.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)
include/configs/omap3_evm.h +39 -0
@@ -101,6 +101,44 @@#define CONFIG_OMAP3_MMC 1#define CONFIG_DOS_PARTITION 1 +/* USB +* Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard +* Enable CONFIG_MUSB_UDD for Device functionalities. +*/ +#define CONFIG_USB_OMAP3 1 +#define CONFIG_MUSB_HCD 1 +/* #define CONFIG_MUSB_UDC 1 */ + +#ifdef CONFIG_USB_OMAP3 + +#ifdef CONFIG_MUSB_HCD +#define CONFIG_CMD_USB + +#define CONFIG_USB_STORAGE +#define CONGIG_CMD_STORAGE +#define CONFIG_CMD_FAT + +#ifdef CONFIG_USB_KEYBOARD +#define CONFIG_SYS_USB_EVENT_POLL +#define CONFIG_PREBOOT "usb start" +#endif /* CONFIG_USB_KEYBOARD */ + +#endif /* CONFIG_MUSB_HCD */ + +#ifdef CONFIG_MUSB_UDC +/* USB device configuration */ +#define CONFIG_USB_DEVICE 1 +#define CONFIG_USB_TTY 1 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1 +/* Change these to suit your needs */ +#define CONFIG_USBD_VENDORID 0x0451 +#define CONFIG_USBD_PRODUCTID 0x5678 +#define CONFIG_USBD_MANUFACTURER "Texas Instruments" +#define CONFIG_USBD_PRODUCT_NAME "EVM" +#endif /* CONFIG_MUSB_UDC */ + +#endif /* CONFIG_USB_OMAP3 */ +/* commands to include */ #include <config_cmd_default.h>
@@ -159,6 +197,7 @@#define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x82000000\0" \ + "usbtty=cdc_acm\0" \ "console=ttyS2,115200n8\0" \ "mmcargs=setenv bootargs console=${console} " \ "root=/dev/mmcblk0p2 rw " \
Signature · 1 line
1.6.0.6
PATCH 9/10 OMAP3 USB Initialize twl4030 only if required
In reply to Tom RixQuoted 10 lines · On Saturday 31 October 2009 13:37:46 Tom Rix wrote:
OMAP3EVM uses ISP1504 phy and so twl4030 related init is not required.
drivers/usb/musb/omap3.c +2
-0@@ -94,12 +94,17 @@ int musb_platform_init(void)if (platform_needs_initialization) {u32 stdby; +/* +* OMAP3EVM uses ISP1504 phy and so
drivers/usb/musb/omap3.c int musb_platform_init(void) · line 107
Quoted 10 lines
drivers/usb/musb/omap3.c +4
-1+* twl4030 related init is not required. +*/ +#ifdef CONFIG_TWL4030_USB if (twl4030_usb_ulpi_init ()) {serial_printf ("ERROR: %s Could not initialize PHY\n" , __PRETTY_FUNCTION__); goto end; } - +#endif
shouldnt this be abstracted away (weaks/phy-common name/etc...) instead of sprinkling ifdef's everywhere ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091031/11d4eb60/attachment.pgp
PATCH 9/10 OMAP3 USB Initialize twl4030 only if required
Quoted 9 lines · Mike Frysinger
Quoted 8 lines · On Saturday 31 October 2009 13:37:46 Tom Rix wrote:
OMAP3EVM uses ISP1504 phy and so twl4030 related init is not required.
drivers/usb/musb/omap3.c +0
-0@@ -94,12 +94,17 @@ int musb_platform_init(void)if (platform_needs_initialization) {u32 stdby;
Quoted 16 lines
drivers/usb/musb/omap3.c int musb_platform_init(void) · line 107
Quoted 12 lines
drivers/usb/musb/omap3.c +6
-1+/* +* OMAP3EVM uses ISP1504 phy and so +* twl4030 related init is not required. +*/ +#ifdef CONFIG_TWL4030_USB if (twl4030_usb_ulpi_init ()) {serial_printf ("ERROR: %s Could not initialize PHY\n" , __PRETTY_FUNCTION__); goto end; } - +#endif shouldnt this be abstracted away (weaks/phy-common name/etc...) instead of sprinkling ifdef's everywhere ?
-mike
I do not think this change has spinkled if-defs' everywhere
As far as I know only the omap3_evm does not use a twl4030. There is no sense making this more complicated than an if-def.
Tom
PATCH 9/10 OMAP3 USB Initialize twl4030 only if required
Quoted 26 lines · On Saturday 31 October 2009 22:09:05 Tom wrote:
Quoted 9 lines · Mike Frysinger
Quoted 8 lines · On Saturday 31 October 2009 13:37:46 Tom Rix wrote:
OMAP3EVM uses ISP1504 phy and so twl4030 related init is not required.
drivers/usb/musb/omap3.c +0
-0@@ -94,12 +94,17 @@ int musb_platform_init(void)if (platform_needs_initialization) {u32 stdby;Quoted 15 lines
drivers/usb/musb/omap3.c int musb_platform_init(void) · line 107
Quoted 12 lines
drivers/usb/musb/omap3.c +6
-1+/* +* OMAP3EVM uses ISP1504 phy and so +* twl4030 related init is not required. +*/ +#ifdef CONFIG_TWL4030_USB if (twl4030_usb_ulpi_init ()) {serial_printf ("ERROR: %s Could not initialize PHY\n" , __PRETTY_FUNCTION__); goto end; } - +#endif shouldnt this be abstracted away (weaks/phy-common name/etc...) instead of sprinkling ifdef's everywhere ?
Quoted 1 line
I do not think this change has spinkled if-defs' everywhere
it always starts out as "just one" :P
Quoted 2 lines
As far as I know only the
omap3_evmdoes not use a twl4030. There is no sense making this more complicated than an if-def.
this isnt common musb code, so i wont complain about proper architecture here as it doesnt affect me.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/b99da44c/attachment.pgp
PATCH 8/10 OMAP3 zoom2 Use usbtty if the debug board is not connected.
In reply to Tom Rixboard/logicpd/zoom2/zoom2_serial.c void quad_putc_dev (unsigned long base, const char c) · line 91
Quoted 3 lines · On Saturday 31 October 2009 13:37:45 Tom Rix wrote:
board/logicpd/zoom2/zoom2_serial.c +2
-0+ }else { +usbtty_putc (c); }
dont need those braces (same goes for a few other hunks here)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091031/7d6dc6f6/attachment.pgp
PATCH 8/10 OMAP3 zoom2 Use usbtty if the debug board is not connected.
Quoted 7 lines · Mike Frysinger
board/logicpd/zoom2/zoom2_serial.c void quad_putc_dev (unsigned long base, const char c) · line 91
Quoted 3 lines · On Saturday 31 October 2009 13:37:45 Tom Rix wrote:
board/logicpd/zoom2/zoom2_serial.c +2
-0+ }else { +usbtty_putc (c); }dont need those braces (same goes for a few other hunks here) -mike
This is done because if-statement above use braces. If this was a simple
if (foo)
smt_1 else smt_2
I would have not use braces.
Tom
PATCH 8/10 OMAP3 zoom2 Use usbtty if the debug board is not connected.
Quoted 9 lines · On Saturday 31 October 2009 22:03:45 Tom wrote:
Quoted 7 lines · Mike Frysinger
board/logicpd/zoom2/zoom2_serial.c void quad_putc_dev (unsigned long base, const char c) · line 91
Quoted 3 lines · On Saturday 31 October 2009 13:37:45 Tom Rix wrote:
board/logicpd/zoom2/zoom2_serial.c +2
-0+ }else { +usbtty_putc (c); }dont need those braces (same goes for a few other hunks here) -mike
Quoted 8 lines
This is done because if-statement above use braces. If this was a simple
if (foo)smt_1 else smt_2I would have not use braces.
the trailing "else" clause is one statement. the relationship to the previous if section doesnt matter. common style convention is:
if (foo) {
statement_1;
statement_2;
} else
statement_3;-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/ed54e9f0/attachment.pgp
PATCH 8/10 OMAP3 zoom2 Use usbtty if the debug board is not connected.
Quoted 17 lines · Mike Frysinger
Quoted 7 lines · On Saturday 31 October 2009 22:03:45 Tom wrote:
Quoted 6 lines · Mike Frysinger
board/logicpd/zoom2/zoom2_serial.c void quad_putc_dev (unsigned long base, const char c) · line 91
Quoted 3 lines · On Saturday 31 October 2009 13:37:45 Tom Rix wrote:
board/logicpd/zoom2/zoom2_serial.c +2
-0+ }else { +usbtty_putc (c); }dont need those braces (same goes for a few other hunks here) -mike
Quoted 8 lines
This is done because if-statement above use braces. If this was a simple
if (foo)smt_1 else smt_2I would have not use braces.
Quoted 8 lines
the trailing "else" clause is one statement. the relationship to the previous if section doesnt matter. common style convention is:
if (foo) { statement_1; statement_2; } else statement_3;-mike
Please see
http://www.kernel.org/doc/Documentation/CodingStyle
Do not unnecessarily use braces where a single statement will do.
if (condition)
action();
This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches.
if (condition) {
do_this();
do_that();
} else {
otherwise();
}Tom
PATCH 8/10 OMAP3 zoom2 Use usbtty if the debug board is not connected.
Quoted 39 lines · On Sunday 01 November 2009 09:14:48 Tom wrote:
Quoted 18 lines · Mike Frysinger
Quoted 8 lines · On Saturday 31 October 2009 22:03:45 Tom wrote:
Quoted 6 lines · Mike Frysinger
board/logicpd/zoom2/zoom2_serial.c void quad_putc_dev (unsigned long base, const char c) · line 91
Quoted 3 lines · On Saturday 31 October 2009 13:37:45 Tom Rix wrote:
board/logicpd/zoom2/zoom2_serial.c +2
-0+ }else { +usbtty_putc (c); }dont need those braces (same goes for a few other hunks here)
Quoted 8 lines
This is done because if-statement above use braces. If this was a simple
if (foo)smt_1 else smt_2I would have not use braces.
Quoted 7 lines
the trailing "else" clause is one statement. the relationship to the previous if section doesnt matter. common style convention is:
if (foo) { statement_1; statement_2; } else statement_3;Please see
http://www.kernel.org/doc/Documentation/CodingStyle
Do not unnecessarily use braces where a single statement will do.
if (condition)
action();This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches.
Quoted 6 lines
if (condition) {
do_this();
do_that();
} else {
otherwise();
}i guess i go by what people are actually accepting at LKML. braces get stripped from single if statements all the time. i dont really care the much since it isnt my code, so if you want to include the cruft anyways, that's your choice.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/1d9124e8/attachment.pgp
PATCH 2/10 USB add macros for debugging usb device setup.
In reply to Tom Rixinclude/usbdescriptors.h struct usb_class_descriptor { · line 510
Quoted 4 lines · On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
include/usbdescriptors.h +3
-0+#ifdef DEBUG +static inline void print_device_descriptor (struct usb_device_descriptor *d) +{ +serial_printf ("usb device descriptor \n" );
do you really need serial_printf() ? what's wrong with debug() ? then you dont even really need "#ifdef DEBUG" around all the functions ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091031/c16c6cfc/attachment.pgp
PATCH 2/10 USB add macros for debugging usb device setup.
Quoted 9 lines · Mike Frysinger
include/usbdescriptors.h struct usb_class_descriptor { · line 510
Quoted 4 lines · On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
include/usbdescriptors.h +3
-0+#ifdef DEBUG +static inline void print_device_descriptor (struct usb_device_descriptor *d) +{ +serial_printf ("usb device descriptor \n" );do you really need
serial_printf()? what's wrong withdebug()? then you dont even really need "#ifdef DEBUG" around all the functions ... -mike
The explicit serial_printf is done because this patch set changes the stdin and stdout for serial to usbtty.
When you use printf to debug printf, you regress into a bad state.
Tom
PATCH 2/10 USB add macros for debugging usb device setup.
Quoted 10 lines · On Saturday 31 October 2009 22:00:09 Tom wrote:
Quoted 8 lines · Mike Frysinger
include/usbdescriptors.h struct usb_class_descriptor { · line 510
Quoted 4 lines · On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
include/usbdescriptors.h +3
-0+#ifdef DEBUG +static inline void print_device_descriptor (struct usb_device_descriptor *d) +{ +serial_printf ("usb device descriptor \n" );do you really need
serial_printf()? what's wrong withdebug()? then you dont even really need "#ifdef DEBUG" around all the functions ...
Quoted 4 lines
The explicit
serial_printfis done because this patch set changes the stdin and stdout for serial to usbtty.When you use printf to debug printf, you regress into a bad state.
so in your specific use case it makes sense *some* of the time (usbtty is enabled and the console has been changed to it), but in the general use case (usb debugging), it does not. why not make it intelligent instead of penalizing everyone to use their serial console:
- default to debug()
- if usbtty support is enabled, check the current stdout console to see if
it's set to a usbtty, and only then fall back to forcing serial_printf() -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/a05a2879/attachment.pgp
PATCH 2/10 USB add macros for debugging usb device setup.
Quoted 14 lines · Mike Frysinger
Quoted 8 lines · On Saturday 31 October 2009 22:00:09 Tom wrote:
Quoted 7 lines · Mike Frysinger
include/usbdescriptors.h struct usb_class_descriptor { · line 510
Quoted 4 lines · On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
include/usbdescriptors.h +3
-0+#ifdef DEBUG +static inline void print_device_descriptor (struct usb_device_descriptor *d) +{ +serial_printf ("usb device descriptor \n" );do you really need
serial_printf()? what's wrong withdebug()? then you dont even really need "#ifdef DEBUG" around all the functions ...Quoted 4 lines
The explicit
serial_printfis done because this patch set changes the stdin and stdout for serial to usbtty.When you use printf to debug printf, you regress into a bad state.
Quoted 8 lines
so in your specific use case it makes sense *some* of the time (usbtty is enabled and the console has been changed to it), but in the general use case (usb debugging), it does not. why not make it intelligent instead of penalizing everyone to use their serial console:
- default todebug()
- if usbtty support is enabled, check the current stdout console to see if
it's set to a usbtty, and only then fall back to forcingserial_printf()-mike
A better solution would be to combine this logic into debug().
Tom
PATCH 2/10 USB add macros for debugging usb device setup.
Quoted 26 lines · On Sunday 01 November 2009 09:02:22 Tom wrote:
Quoted 16 lines · Mike Frysinger
Quoted 10 lines · On Saturday 31 October 2009 22:00:09 Tom wrote:
Quoted 8 lines · Mike Frysinger
include/usbdescriptors.h struct usb_class_descriptor { · line 510
Quoted 4 lines · On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
(quoted diff) +2
-0+#ifdef DEBUG +static inline void print_device_descriptor(struct
usb_device_descriptor*d) +{include/usbdescriptors.h +1
-0+serial_printf ("usb device descriptor \n" );do you really need
serial_printf()? what's wrong withdebug()? then you dont even really need "#ifdef DEBUG" around all the functions ...Quoted 4 lines
The explicit
serial_printfis done because this patch set changes the stdin and stdout for serial to usbtty.When you use printf to debug printf, you regress into a bad state.
Quoted 8 lines
so in your specific use case it makes sense *some* of the time (usbtty is enabled and the console has been changed to it), but in the general use case (usb debugging), it does not. why not make it intelligent instead of penalizing everyone to use their serial console:
- default todebug()
- if usbtty support is enabled, check the current stdout console to see
if it's set to a usbtty, and only then fall back to forcingserial_printf()
Quoted 1 line
A better solution would be to combine this logic into
debug().
yes and no. debug() should not change, but a new debug function would probably make sense. debug_stdio() where the first argument would be the device name you're debugging ("usbtty" here) and would handle sending directly to the serial functions if current stdio is set to that.
i look forward to your proposed code ;)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091101/edd48f0e/attachment.pgp
PATCH 2/10 USB add macros for debugging usb device setup.
Quoted 23 lines · Mike Frysinger
Quoted 22 lines · On Sunday 01 November 2009 09:02:22 Tom wrote:
Quoted 21 lines · Mike Frysinger
Quoted 8 lines · On Saturday 31 October 2009 22:00:09 Tom wrote:
Quoted 7 lines · Mike Frysinger
include/usbdescriptors.h struct usb_class_descriptor { · line 510
Quoted 4 lines · On Saturday 31 October 2009 13:37:39 Tom Rix wrote:
(quoted diff) +2
-0+#ifdef DEBUG +static inline void print_device_descriptor(struct
usb_device_descriptor*d) +{include/usbdescriptors.h +1
-0+serial_printf ("usb device descriptor \n" );do you really need
serial_printf()? what's wrong withdebug()? then you dont even really need "#ifdef DEBUG" around all the functions ...Quoted 4 lines
The explicit
serial_printfis done because this patch set changes the stdin and stdout for serial to usbtty.When you use printf to debug printf, you regress into a bad state.
so in your specific use case it makes sense *some* of the time (usbtty is enabled and the console has been changed to it), but in the general use case (usb debugging), it does not. why not make it intelligent instead of penalizing everyone to use their serial console:
- default todebug()
- if usbtty support is enabled, check the current stdout console to see
if it's set to a usbtty, and only then fall back to forcingserial_printf()
Quoted 8 lines
Quoted 1 line
A better solution would be to combine this logic into
debug().yes and no.
debug()should not change, but a new debug function would probably make sense.debug_stdio()where the first argument would be the device name you're debugging ("usbtty" here) and would handle sending directly to the serial functions if current stdio is set to that.i look forward to your proposed code ;)
This patch is not critical to the patchset.
It would be easier for me to remove it.
Tom
Quoted 16 lines · Tom Rix
The is version 3 of the patchset to enable usb device support on OMAP.
The changes from the last revision are.
Per Remy's request
Quoted 6 lines
Quoted 2 lines
USB_CONFIG_DESCRIPTOR_DEFINITIONUSB_INTERFACE_DESCRIPTOR_DEFINITIONPersonally I do not like the macros for these kind of definitions, I would prefer a solution by nesting the structures.
What do you think?I have exchanged the first patch to an earlier version that used a nested structure 'desc' instead of the macros.
Quoted 6 lines
At the other end of the patch set I have added Ajay's changes to condition initialization of twl4030 and enabling in
omap3_evm.I have runtested this on Beagle.
Tom
Any comments?
I will push this set otherwise.
Tom
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Quoted 2 lines · On Wednesday 04 November 2009 10:06:20 Tom wrote:
Any comments?
I will push this set otherwise.
i dont know what you mean by "push", but changes to code that have a maintainer (i.e. usb tree) go through that maintainers tree. so unless Remy has specifically OK-ed it, changes to drivers/usb/ (regardless of the exact device they're for) go through him.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091104/6716ea4b/attachment.pgp
Hi Tom,
2009/11/4 Tom <[email protected]>:
Quoted 21 lines
Quoted 20 lines · Tom Rix
The is version 3 of the patchset to enable usb device support on OMAP.
The changes from the last revision are.
Per Remy's request
Quoted 7 lines
Quoted 3 lines
USB_CONFIG_DESCRIPTOR_DEFINITIONUSB_INTERFACE_DESCRIPTOR_DEFINITIONPersonally I do not like the macros for these kind of definitions, I would prefer a solution by nesting the structures.
What do you think?I have exchanged the first patch to an earlier version that used a nested structure 'desc' instead of the macros.
At the other end of the patch set I have added Ajay's changes to condition initialization of twl4030 and enabling in
omap3_evm.
Quoted 6 lines
Quoted 3 lines
I have runtested this on Beagle.
Tom
Any comments?
I will push this set otherwise.
I have pulled it in u-boot-usb next.
But I have to mention that there are a few OMAP specific patches in the series. I guess it is okay to pull those in as well to keep the series together.
If not, please let me know how to deal with those. Further, the subject mentioned a series of 10 patches, but I seem to have missed the 10/10 patch, since I can only find 9...
Kind regards,
Remy
Gupta
Quoted 26 lines
2009/11/4 Tom <[email protected]>:
Quoted 25 lines
Quoted 23 lines · Tom Rix
The is version 3 of the patchset to enable usb device support on OMAP.
The changes from the last revision are.
Per Remy's request
Quoted 7 lines
Quoted 3 lines
USB_CONFIG_DESCRIPTOR_DEFINITIONUSB_INTERFACE_DESCRIPTOR_DEFINITIONPersonally I do not like the macros for these kind of definitions, I would prefer a solution by nesting the structures.
What do you think?I have exchanged the first patch to an earlier version that used a nested structure 'desc' instead of the macros.
At the other end of the patch set I have added Ajay's changes to condition initialization of twl4030 and enabling in
omap3_evm.I have runtested this on Beagle.
Tom
Quoted 8 lines
Quoted 2 lines
Any comments?
I will push this set otherwise.I have pulled it in u-boot-usb next.
But I have to mention that there are a few OMAP specific patches in the series. I guess it is okay to pull those in as well to keep the series together.
If not, please let me know how to deal with those.
Remy,
OMAP specific patches are making the change only in omap3.c and omap3_xxx.h files so they are separated from generic files.
-Ajay
Quoted 6 lines
Further, the subject mentioned a series of 10 patches, but I seem to have missed the 10/10 patch, since I can only find 9...
Kind regards,
Remy
Hi Ajay,
Quoted 11 lines
Quoted 5 lines
I have pulled it in u-boot-usb next.
But I have to mention that there are a few OMAP specific patches in the series. I guess it is okay to pull those in as well to keep the series together.
If not, please let me know how to deal with those.Remy,
OMAP specific patches are making the change only in
omap3.candomap3_xxx.hfiles so they are separated from generic files.-Ajay
This is exactly what I was pointing at.
The complete series contains changes for generic code and changes for board-specific code.
Since it is 1 series with patches dependant on each other, the question appeared if it was smarter to split it up over separate custodian trees, or keep it together in the USB tree.(since the bulk of the changes affect USB)
My proposal was to merge it in the USB tree and push it forward from there, if we all agree about that.
Otherwise the series need to be split up to make it independent...
Remy
Quoted 25 lines · Remy Bohmer
Hi Ajay,
Quoted 11 lines
Quoted 5 lines
I have pulled it in u-boot-usb next.
But I have to mention that there are a few OMAP specific patches in the series. I guess it is okay to pull those in as well to keep the series together.
If not, please let me know how to deal with those.Remy,
OMAP specific patches are making the change only in
omap3.candomap3_xxx.hfiles so they are separated from generic files.-Ajay
This is exactly what I was pointing at.
The complete series contains changes for generic code and changes for board-specific code.
Since it is 1 series with patches dependant on each other, the question appeared if it was smarter to split it up over separate custodian trees, or keep it together in the USB tree.(since the bulk of the changes affect USB)
My proposal was to merge it in the USB tree and push it forward from there, if we all agree about that.
Otherwise the series need to be split up to make it independent...
Quoted 1 line
Remy
I would rather keep the patch set together.
My current work depends on it.
I am working with the usb/cdc branch to added gadget support for omap and ultimately help mainline the usb/cdc branch.
Since these patches are already in your usb/next, it seems that is a good place.
What is the path forward?
I think a pull request to the TI branch, else a pull to ARM, else a pull to master. If there is more interest, sooner.
Tom
Hi Tom,
Quoted 1 line
I would rather keep the patch set together.
OK.
Quoted 10 lines
My current work depends on it.
I am working with the usb/cdc branch to added gadget support for omap and ultimately help mainline the usb/cdc branch.Since these patches are already in your usb/next, it seems that is a good place.
What is the path forward?
I think a pull request to the TI branch, else a pull to ARM, else a pull to master. ?If there is more interest, sooner.
I have no problem pulling it in the u-boot-next branch. It should not be pulled in the current release.
Kind regards,
Remy
[U-Boot] AT91 runnable out of RAM ?
Quoted 9 lines · Remy Bohmer
Hi Tom,
Quoted 1 line
I would rather keep the patch set together.
OK.
Quoted 3 lines
My current work depends on it.
I am working with the usb/cdc branch to added gadget support for omap and ultimately help mainline the usb/cdc branch.
I am trying to connect a at91sam9g20 the gadget code so I can have a working example of a driver to compare against the omap side that I am writing.
The problem I am having is trying to the at91 out of ram doing something like
# d
.. downloads the u-boot.bin image
# g 22000000
... seems to load the flash image
... gets stuck somewhere after flash enumeration
Tom
[U-Boot] AT91 runnable out of RAM ?
Hi Tom,
2009/11/6 Tom Rix <[email protected]>:
Quoted 19 lines
Quoted 10 lines · Remy Bohmer
Hi Tom,
Quoted 1 line
I would rather keep the patch set together.
OK.
Quoted 3 lines
My current work depends on it.
I am working with the usb/cdc branch to added gadget support for omap and ultimately help mainline the usb/cdc branch.I am trying to connect a at91sam9g20 the gadget code so I can have a working example of a driver to compare against the omap side that I am writing.
The problem I am having is trying to the at91 out of ram doing something like
Quoted 8 lines
# d.. downloads the u-boot.bin image
# g 22000000... seems to load the flash image
... gets stuck somewhere after flash enumeration
It would help if you would post at least the terminal logging. Otherwise I have no idea what happens...
Kind regards,
Remy
[U-Boot] AT91 runnable out of RAM ?
Quoted 28 lines · Remy Bohmer
Hi Tom,
2009/11/6 Tom Rix <[email protected]>:
Quoted 16 lines
Quoted 8 lines · Remy Bohmer
Hi Tom,
Quoted 1 line
I would rather keep the patch set together.
OK.
Quoted 3 lines
My current work depends on it.
I am working with the usb/cdc branch to added gadget support for omap and ultimately help mainline the usb/cdc branch.I am trying to connect a at91sam9g20 the gadget code so I can have a working example of a driver to compare against the omap side that I am writing.
The problem I am having is trying to the at91 out of ram doing something like
Quoted 8 lines
# d.. downloads the u-boot.bin image
# g 22000000... seems to load the flash image
... gets stuck somewhere after flash enumeration
Quoted 8 lines
It would help if you would post at least the terminal logging. Otherwise I have no idea what happens...
Kind regards,
Remy
This is NOT an issue with the cdc branch.
All I am trying to do is download via dhcp/tftp the new u-boot image and run it without flashing it first.
Likely a bone headed thing that I am doing or general limitation with at91. For now I am going with bone-headed.
Tom