Prepare USB layer for ehci

Prepare USB layer for ehci support

Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it>
Signed-off-by: Remy Böhmer <linux@bohmer.net>
This commit is contained in:
Michael Trimarchi 2008-11-28 13:19:19 +01:00 committed by Remy Bohmer
parent a0cb3fc31e
commit 3e126484df
4 changed files with 23 additions and 10 deletions

View File

@ -310,7 +310,7 @@ void usb_show_tree_graph(struct usb_device *dev, char *pre)
pre[index] = 0; pre[index] = 0;
printf(" %s (%s, %dmA)\n", usb_get_class_desc( printf(" %s (%s, %dmA)\n", usb_get_class_desc(
dev->config.if_desc[0].bInterfaceClass), dev->config.if_desc[0].bInterfaceClass),
dev->slow ? "1.5MBit/s" : "12MBit/s", dev->speed ? "1.5MBit/s" : "12MBit/s",
dev->config.MaxPower * 2); dev->config.MaxPower * 2);
if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial)) 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 %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);

View File

@ -1136,7 +1136,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
/* Allocate a new device struct for it */ /* Allocate a new device struct for it */
usb = usb_alloc_new_device(); 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; dev->children[port] = usb;
usb->parent = dev; usb->parent = dev;

View File

@ -138,7 +138,7 @@ enum {
struct usb_device { struct usb_device {
int devnum; /* Device number on USB bus */ int devnum; /* Device number on USB bus */
int slow; /* Slow device? */ int speed; /* full/low/high */
char mf[32]; /* manufacturer */ char mf[32]; /* manufacturer */
char prod[32]; /* product */ char prod[32]; /* product */
char serial[32]; /* serial number */ char serial[32]; /* serial number */
@ -171,6 +171,7 @@ struct usb_device {
unsigned long status; unsigned long status;
int act_len; /* transfered bytes */ int act_len; /* transfered bytes */
int maxchild; /* Number of ports if hub */ int maxchild; /* Number of ports if hub */
int portnr;
struct usb_device *parent; struct usb_device *parent;
struct usb_device *children[USB_MAXCHILDREN]; struct usb_device *children[USB_MAXCHILDREN];
}; };
@ -180,8 +181,9 @@ struct usb_device {
*/ */
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \ #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_SL811HS) || \ defined(CONFI_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
defined(CONFIG_USB_ISP116X_HCD) || defined(CONFIG_USB_R8A66597_HCD) defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
defined(CONFIG_USB_R8A66597_HCD)
int usb_lowlevel_init(void); int usb_lowlevel_init(void);
int usb_lowlevel_stop(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) * - endpoint number (4 bits)
* - current Data0/1 state (1 bit) * - current Data0/1 state (1 bit)
* - direction (1 bit) * - direction (1 bit)
* - speed (1 bit) * - speed (2 bits)
* - max packet size (2 bits: 8, 16, 32 or 64) * - max packet size (2 bits: 8, 16, 32 or 64)
* - pipe type (2 bits: control, interrupt, bulk, isochronous) * - 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 * - device: bits 8-14
* - endpoint: bits 15-18 * - endpoint: bits 15-18
* - Data0/1: bit 19 * - 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, * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
* 10 = control, 11 = bulk) * 10 = control, 11 = bulk)
* *
@ -308,8 +310,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
/* Create various pipes... */ /* Create various pipes... */
#define create_pipe(dev,endpoint) \ #define create_pipe(dev,endpoint) \
(((dev)->devnum << 8) | (endpoint << 15) | \ (((dev)->devnum << 8) | (endpoint << 15) | \
((dev)->slow << 26) | (dev)->maxpacketsize) ((dev)->speed << 26) | (dev)->maxpacketsize)
#define default_pipe(dev) ((dev)->slow << 26) #define default_pipe(dev) ((dev)->speed << 26)
#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \ #define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
create_pipe(dev, endpoint)) 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_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf) #define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
#define usb_pipedata(pipe) (((pipe) >> 19) & 1) #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_pipetype(pipe) (((pipe) >> 30) & 3)
#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS) #define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT) #define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)

View File

@ -80,6 +80,12 @@
#define USB_DIR_OUT 0 #define USB_DIR_OUT 0
#define USB_DIR_IN 0x80 #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 */ /* Descriptor types */
#define USB_DT_DEVICE 0x01 #define USB_DT_DEVICE 0x01
#define USB_DT_CONFIG 0x02 #define USB_DT_CONFIG 0x02
@ -202,6 +208,7 @@
#define USB_PORT_FEAT_RESET 4 #define USB_PORT_FEAT_RESET 4
#define USB_PORT_FEAT_POWER 8 #define USB_PORT_FEAT_POWER 8
#define USB_PORT_FEAT_LOWSPEED 9 #define USB_PORT_FEAT_LOWSPEED 9
#define USB_PORT_FEAT_HIGHSPEED 10
#define USB_PORT_FEAT_C_CONNECTION 16 #define USB_PORT_FEAT_C_CONNECTION 16
#define USB_PORT_FEAT_C_ENABLE 17 #define USB_PORT_FEAT_C_ENABLE 17
#define USB_PORT_FEAT_C_SUSPEND 18 #define USB_PORT_FEAT_C_SUSPEND 18
@ -216,6 +223,9 @@
#define USB_PORT_STAT_RESET 0x0010 #define USB_PORT_STAT_RESET 0x0010
#define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_POWER 0x0100
#define USB_PORT_STAT_LOW_SPEED 0x0200 #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 */ /* wPortChange bits */
#define USB_PORT_STAT_C_CONNECTION 0x0001 #define USB_PORT_STAT_C_CONNECTION 0x0001