Prepare USB layer for ehci support
RFC PATCH v3 1/3 Prepare USB layer for ehci support
Prepare USB layer for support ehci
--- common/cmd_usb.c | 2 +- common/usb.c | 2 +- include/usb.h | 19 +++++++++++-------- include/usb_defs.h | 10 ++++++++++ 4 files changed, 23 insertions(+), 10 deletions(-)
common/cmd_usb.c +1 -1
@@ -310,7 +310,7 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre) pre[index] =0 ;printf (" %s (%s, %dmA)\n" ,usb_get_class_desc ( dev->config.if_desc[0 ].bInterfaceClass), - dev->slow ?"1.5MBit/s" :"12MBit/s" , + dev->speed ?"1.5MBit/s" :"12MBit/s" , dev->config.MaxPower *2 );if (strlen (dev->mf) ||strlen (dev->prod) ||strlen (dev->serial))printf (" %s %s %s %s\n" , pre, dev->mf, dev->prod, dev->serial);
common/usb.c +1 -1
@@ -1136,7 +1136,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)/* Allocate a new device struct for it */ usb =usb_alloc_new_device (); - usb->slow = (portstatus &USB_PORT_STAT_LOW_SPEED ) ?1 :0 ; + usb->speed = (portstatus &USB_PORT_STAT_LOW_SPEED ) ?1 :0 ; dev->children[port] = usb; usb->parent = dev;
include/usb.h +11 -8
@@ -138,7 +138,7 @@ enum {struct usb_device {int devnum;/* Device number on USB bus */ -int slow;/* Slow device? */ +int speed;/* full/low/high */ char mf[32 ];/* manufacturer */ char prod[32 ];/* product */ char serial[32 ];/* serial number */
@@ -171,6 +171,7 @@ struct usb_device {unsigned long status;int act_len;/* transfered bytes */ int maxchild;/* Number of ports if hub */ +int portnr;struct usb_device *parent;struct usb_device *children[USB_MAXCHILDREN ]; };
@@ -180,8 +181,9 @@ struct usb_device {*/ #if defined(CONFIG_USB_UHCI ) || defined(CONFIG_USB_OHCI ) || \ - defined(CONFIG_USB_OHCI_NEW ) || defined(CONFIG_USB_SL811HS ) || \ - defined(CONFIG_USB_ISP116X_HCD ) || defined(CONFIG_USB_R8A66597_HCD ) + defined(CONFIG_USB_EHCI ) || defined(CONFIG_USB_OHCI_NEW ) || \ + defined(CONFIG_USB_SL811HS ) || defined(CONFIG_USB_ISP116X_HCD ) || \ + defined(CONFIG_USB_R8A66597_HCD )int usb_lowlevel_init (void );int usb_lowlevel_stop (void );
@@ -279,7 +281,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);* - endpoint number (4 bits) * - current Data0/1 state (1 bit) * - direction (1 bit) -* - speed (1 bit) +* - speed (2 bits) * - max packet size (2 bits: 8, 16, 32 or 64) * - pipe type (2 bits: control, interrupt, bulk, isochronous) *
@@ -296,7 +298,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);* - device: bits 8-14 * - endpoint: bits 15-18 * - Data0/1: bit 19 -* - speed: bit 26 (0 = Full, 1 = Low Speed) +* - speed: bit 26 (0 = Full, 1 = Low Speed, 2 = High) * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt, * 10 = control, 11 = bulk) *
@@ -308,8 +310,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);/* Create various pipes... */ #define create_pipe (dev,endpoint) \ (((dev)->devnum << 8) | (endpoint << 15) | \ - ((dev)->slow << 26) | (dev)->maxpacketsize) -#define default_pipe (dev) ((dev)->slow << 26) + ((dev)->speed << 26) | (dev)->maxpacketsize) +#define default_pipe (dev) ((dev)->speed << 26)#define usb_sndctrlpipe (dev, endpoint) ((PIPE_CONTROL << 30) | \ create_pipe(dev, endpoint))
@@ -359,7 +361,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);#define usb_pipe_endpdev (pipe) (((pipe) >> 8) & 0x7ff)#define usb_pipeendpoint (pipe) (((pipe) >> 15) & 0xf)#define usb_pipedata (pipe) (((pipe) >> 19) & 1) -#define usb_pipeslow (pipe) (((pipe) >> 26) & 1) +#define usb_pipespeed (pipe) (((pipe) >> 26) & 3) +#define usb_pipeslow (pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW)#define usb_pipetype (pipe) (((pipe) >> 30) & 3)#define usb_pipeisoc (pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)#define usb_pipeint (pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
include/usb_defs.h +10 -0
@@ -80,6 +80,12 @@#define USB_DIR_OUT 0#define USB_DIR_IN 0x80 +/* USB device speeds */ +#define USB_SPEED_FULL 0x0/* 12Mbps */ +#define USB_SPEED_LOW 0x1/* 1.5Mbps */ +#define USB_SPEED_HIGH 0x2/* 480Mbps */ +#define USB_SPEED_RESERVED 0x3 +/* Descriptor types */ #define USB_DT_DEVICE 0x01#define USB_DT_CONFIG 0x02
@@ -202,6 +208,7 @@#define USB_PORT_FEAT_RESET 4#define USB_PORT_FEAT_POWER 8#define USB_PORT_FEAT_LOWSPEED 9 +#define USB_PORT_FEAT_HIGHSPEED 10#define USB_PORT_FEAT_C_CONNECTION 16#define USB_PORT_FEAT_C_ENABLE 17#define USB_PORT_FEAT_C_SUSPEND 18
@@ -216,6 +223,9 @@#define USB_PORT_STAT_RESET 0x0010#define USB_PORT_STAT_POWER 0x0100#define USB_PORT_STAT_LOW_SPEED 0x0200 +#define USB_PORT_STAT_HIGH_SPEED 0x0400/* support for EHCI */ +#define USB_PORT_STAT_SPEED \ + (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)/* wPortChange bits */ #define USB_PORT_STAT_C_CONNECTION 0x0001
Signature · 1 line
1.5.6.5
RFC PATCH v3 1/3 Prepare USB layer for ehci support
Hello Michael,
I already have those patches (V2) in the u-boot-usb tree, next branch. Can you please rebase these patches on top of that tree, or at least describe what you changed?
Kind Regards,
Remy
2008/12/10 Michael Trimarchi <[email protected]>:
Quoted 148 lines
Prepare USB layer for support ehci
Signed-off-by Michael Trimarchi <[email protected]>--- common/cmd_usb.c | 2 +- common/usb.c | 2 +- include/usb.h | 19 +++++++++++-------- include/usb_defs.h | 10 ++++++++++ 4 files changed, 23 insertions(+), 10 deletions(-)common/cmd_usb.c +1
-1@@ -310,7 +310,7 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre) pre[index] =0 ;printf (" %s (%s, %dmA)\n" ,usb_get_class_desc ( dev->config.if_desc[0 ].bInterfaceClass), - dev->slow ?"1.5MBit/s" :"12MBit/s" , + dev->speed ?"1.5MBit/s" :"12MBit/s" , dev->config.MaxPower *2 );if (strlen (dev->mf) ||strlen (dev->prod) ||strlen (dev->serial))printf (" %s %s %s %s\n" , pre, dev->mf, dev->prod, dev->serial);common/usb.c +1
-1@@ -1136,7 +1136,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)/* Allocate a new device struct for it */ usb =usb_alloc_new_device (); - usb->slow = (portstatus &USB_PORT_STAT_LOW_SPEED ) ?1 :0 ; + usb->speed = (portstatus &USB_PORT_STAT_LOW_SPEED ) ?1 :0 ; dev->children[port] = usb; usb->parent = dev;include/usb.h +11
-8@@ -138,7 +138,7 @@ enum {struct usb_device {int devnum;/* Device number on USB bus */ -int slow;/* Slow device? */ +int speed;/* full/low/high */ char mf[32 ];/* manufacturer */ char prod[32 ];/* product */ char serial[32 ];/* serial number */ @@ -171,6 +171,7 @@ struct usb_device {unsigned long status;int act_len;/* transfered bytes */ int maxchild;/* Number of ports if hub */ +int portnr;struct usb_device *parent;struct usb_device *children[USB_MAXCHILDREN ]; };@@ -180,8 +181,9 @@ struct usb_device {*/ #if defined(CONFIG_USB_UHCI ) || defined(CONFIG_USB_OHCI ) || \ - defined(CONFIG_USB_OHCI_NEW ) || defined(CONFIG_USB_SL811HS ) || \ - defined(CONFIG_USB_ISP116X_HCD ) || defined(CONFIG_USB_R8A66597_HCD ) + defined(CONFIG_USB_EHCI ) || defined(CONFIG_USB_OHCI_NEW ) || \ + defined(CONFIG_USB_SL811HS ) || defined(CONFIG_USB_ISP116X_HCD ) || \ + defined(CONFIG_USB_R8A66597_HCD )int usb_lowlevel_init (void );int usb_lowlevel_stop (void );@@ -279,7 +281,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);* - endpoint number (4 bits) * - current Data0/1 state (1 bit) * - direction (1 bit) -* - speed (1 bit) +* - speed (2 bits) * - max packet size (2 bits: 8, 16, 32 or 64) * - pipe type (2 bits: control, interrupt, bulk, isochronous) * @@ -296,7 +298,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);* - device: bits 8-14 * - endpoint: bits 15-18 * - Data0/1: bit 19 -* - speed: bit 26 (0 = Full, 1 = Low Speed) +* - speed: bit 26 (0 = Full, 1 = Low Speed, 2 = High) * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt, * 10 = control, 11 = bulk) * @@ -308,8 +310,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);/* Create various pipes... */ #define create_pipe (dev,endpoint) \ (((dev)->devnum << 8) | (endpoint << 15) | \ - ((dev)->slow << 26) | (dev)->maxpacketsize) -#define default_pipe (dev) ((dev)->slow << 26) + ((dev)->speed << 26) | (dev)->maxpacketsize) +#define default_pipe (dev) ((dev)->speed << 26)#define usb_sndctrlpipe (dev, endpoint) ((PIPE_CONTROL << 30) | \ create_pipe(dev, endpoint))@@ -359,7 +361,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);#define usb_pipe_endpdev (pipe) (((pipe) >> 8) & 0x7ff)#define usb_pipeendpoint (pipe) (((pipe) >> 15) & 0xf)#define usb_pipedata (pipe) (((pipe) >> 19) & 1) -#define usb_pipeslow (pipe) (((pipe) >> 26) & 1) +#define usb_pipespeed (pipe) (((pipe) >> 26) & 3) +#define usb_pipeslow (pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW)#define usb_pipetype (pipe) (((pipe) >> 30) & 3)#define usb_pipeisoc (pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)#define usb_pipeint (pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)include/usb_defs.h +10
-1@@ -80,6 +80,12 @@#define USB_DIR_OUT 0#define USB_DIR_IN 0x80 +/* USB device speeds */ +#define USB_SPEED_FULL 0x0/* 12Mbps */ +#define USB_SPEED_LOW 0x1/* 1.5Mbps */ +#define USB_SPEED_HIGH 0x2/* 480Mbps */ +#define USB_SPEED_RESERVED 0x3 +/* Descriptor types */ #define USB_DT_DEVICE 0x01#define USB_DT_CONFIG 0x02@@ -202,6 +208,7 @@#define USB_PORT_FEAT_RESET 4#define USB_PORT_FEAT_POWER 8#define USB_PORT_FEAT_LOWSPEED 9 +#define USB_PORT_FEAT_HIGHSPEED 10#define USB_PORT_FEAT_C_CONNECTION 16#define USB_PORT_FEAT_C_ENABLE 17#define USB_PORT_FEAT_C_SUSPEND 18@@ -216,6 +223,9 @@#define USB_PORT_STAT_RESET 0x0010#define USB_PORT_STAT_POWER 0x0100#define USB_PORT_STAT_LOW_SPEED 0x0200 +#define USB_PORT_STAT_HIGH_SPEED 0x0400/* support for EHCI */ +#define USB_PORT_STAT_SPEED \ + (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)/* wPortChange bits */ #define USB_PORT_STAT_C_CONNECTION 0x0001 --1.5.6.5
RFC PATCH v3 1/3 Prepare USB layer for ehci support
Hi,
Quoted 10 lines · Remy Bohmer
Hello Michael,
I already have those patches (V2) in the u-boot-usb tree, next branch. Can you please rebase these patches on top of that tree, or at least describe what you changed?
Kind Regards,
Remy
I'll prepare another patch with various fixes. I will continue on the usb-next branch
Regards Michael