Commit 3e126484df7868e341545cce740b24b62b0cd3b7

Authored by Michael Trimarchi
Committed by Remy Bohmer
1 parent a0cb3fc31e

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>

Showing 4 changed files with 23 additions and 10 deletions Side-by-side Diff

... ... @@ -310,7 +310,7 @@
310 310 pre[index] = 0;
311 311 printf(" %s (%s, %dmA)\n", usb_get_class_desc(
312 312 dev->config.if_desc[0].bInterfaceClass),
313   - dev->slow ? "1.5MBit/s" : "12MBit/s",
  313 + dev->speed ? "1.5MBit/s" : "12MBit/s",
314 314 dev->config.MaxPower * 2);
315 315 if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
316 316 printf(" %s %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
... ... @@ -1136,7 +1136,7 @@
1136 1136  
1137 1137 /* Allocate a new device struct for it */
1138 1138 usb = usb_alloc_new_device();
1139   - usb->slow = (portstatus & USB_PORT_STAT_LOW_SPEED) ? 1 : 0;
  1139 + usb->speed = (portstatus & USB_PORT_STAT_LOW_SPEED) ? 1 : 0;
1140 1140  
1141 1141 dev->children[port] = usb;
1142 1142 usb->parent = dev;
... ... @@ -138,7 +138,7 @@
138 138  
139 139 struct usb_device {
140 140 int devnum; /* Device number on USB bus */
141   - int slow; /* Slow device? */
  141 + int speed; /* full/low/high */
142 142 char mf[32]; /* manufacturer */
143 143 char prod[32]; /* product */
144 144 char serial[32]; /* serial number */
... ... @@ -171,6 +171,7 @@
171 171 unsigned long status;
172 172 int act_len; /* transfered bytes */
173 173 int maxchild; /* Number of ports if hub */
  174 + int portnr;
174 175 struct usb_device *parent;
175 176 struct usb_device *children[USB_MAXCHILDREN];
176 177 };
... ... @@ -180,8 +181,9 @@
180 181 */
181 182  
182 183 #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
183   - defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_SL811HS) || \
184   - defined(CONFIG_USB_ISP116X_HCD) || defined(CONFIG_USB_R8A66597_HCD)
  184 + defined(CONFI_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
  185 + defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
  186 + defined(CONFIG_USB_R8A66597_HCD)
185 187  
186 188 int usb_lowlevel_init(void);
187 189 int usb_lowlevel_stop(void);
... ... @@ -279,7 +281,7 @@
279 281 * - endpoint number (4 bits)
280 282 * - current Data0/1 state (1 bit)
281 283 * - direction (1 bit)
282   - * - speed (1 bit)
  284 + * - speed (2 bits)
283 285 * - max packet size (2 bits: 8, 16, 32 or 64)
284 286 * - pipe type (2 bits: control, interrupt, bulk, isochronous)
285 287 *
... ... @@ -296,7 +298,7 @@
296 298 * - device: bits 8-14
297 299 * - endpoint: bits 15-18
298 300 * - Data0/1: bit 19
299   - * - speed: bit 26 (0 = Full, 1 = Low Speed)
  301 + * - speed: bit 26 (0 = Full, 1 = Low Speed, 2 = High)
300 302 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
301 303 * 10 = control, 11 = bulk)
302 304 *
... ... @@ -308,8 +310,8 @@
308 310 /* Create various pipes... */
309 311 #define create_pipe(dev,endpoint) \
310 312 (((dev)->devnum << 8) | (endpoint << 15) | \
311   - ((dev)->slow << 26) | (dev)->maxpacketsize)
312   -#define default_pipe(dev) ((dev)->slow << 26)
  313 + ((dev)->speed << 26) | (dev)->maxpacketsize)
  314 +#define default_pipe(dev) ((dev)->speed << 26)
313 315  
314 316 #define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
315 317 create_pipe(dev, endpoint))
... ... @@ -359,7 +361,8 @@
359 361 #define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
360 362 #define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
361 363 #define usb_pipedata(pipe) (((pipe) >> 19) & 1)
362   -#define usb_pipeslow(pipe) (((pipe) >> 26) & 1)
  364 +#define usb_pipespeed(pipe) (((pipe) >> 26) & 3)
  365 +#define usb_pipeslow(pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW)
363 366 #define usb_pipetype(pipe) (((pipe) >> 30) & 3)
364 367 #define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
365 368 #define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
... ... @@ -80,6 +80,12 @@
80 80 #define USB_DIR_OUT 0
81 81 #define USB_DIR_IN 0x80
82 82  
  83 +/* USB device speeds */
  84 +#define USB_SPEED_FULL 0x0 /* 12Mbps */
  85 +#define USB_SPEED_LOW 0x1 /* 1.5Mbps */
  86 +#define USB_SPEED_HIGH 0x2 /* 480Mbps */
  87 +#define USB_SPEED_RESERVED 0x3
  88 +
83 89 /* Descriptor types */
84 90 #define USB_DT_DEVICE 0x01
85 91 #define USB_DT_CONFIG 0x02
... ... @@ -202,6 +208,7 @@
202 208 #define USB_PORT_FEAT_RESET 4
203 209 #define USB_PORT_FEAT_POWER 8
204 210 #define USB_PORT_FEAT_LOWSPEED 9
  211 +#define USB_PORT_FEAT_HIGHSPEED 10
205 212 #define USB_PORT_FEAT_C_CONNECTION 16
206 213 #define USB_PORT_FEAT_C_ENABLE 17
207 214 #define USB_PORT_FEAT_C_SUSPEND 18
... ... @@ -216,6 +223,9 @@
216 223 #define USB_PORT_STAT_RESET 0x0010
217 224 #define USB_PORT_STAT_POWER 0x0100
218 225 #define USB_PORT_STAT_LOW_SPEED 0x0200
  226 +#define USB_PORT_STAT_HIGH_SPEED 0x0400 /* support for EHCI */
  227 +#define USB_PORT_STAT_SPEED \
  228 + (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)
219 229  
220 230 /* wPortChange bits */
221 231 #define USB_PORT_STAT_C_CONNECTION 0x0001