Skip to content
Snippets Groups Projects
Commit db63299b authored by michael's avatar michael Committed by Remy Bohmer
Browse files

[PATCH] Fix EHCI usb. I start to test on a

IXP465 board and I find some errors in the code. This
patch fix:
- descriptor initizialization (config, interface and endpoint
  must be one next-to the other when the USB_DT_CONFIG message
  is send.
- FIX little/endian bigendian (introduce the CONFIG_EHCI_DESC_BIG_ENDIAN
  and the CONFIG_EHCI_MMIO_BIG_ENDIAN)
- Introduce the linux version of the usb_config_descriptor and
  usb_interface descriptor. This descriptor does't contains
  u-boot extension.

Signed-off-by: default avatarMichael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: default avatarRemy Böhmer <linux@bohmer.net>
parent 6b92487d
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */ /* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
#define DeviceRequest \ #define DeviceRequest \
((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
#define DeviceOutRequest \ #define DeviceOutRequest \
((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
#define EndpointRequest \ #define EndpointRequest \
((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
#define EndpointOutRequest \ #define EndpointOutRequest \
((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
...@@ -39,8 +41,9 @@ ...@@ -39,8 +41,9 @@
* Register Space. * Register Space.
*/ */
struct ehci_hccr { struct ehci_hccr {
uint8_t cr_caplength; uint32_t cr_capbase;
uint16_t cr_hciversion; #define HC_LENGTH(p) (((p) >> 0) & 0x00ff)
#define HC_VERSION(p) (((p) >> 16) & 0xffff)
uint32_t cr_hcsparams; uint32_t cr_hcsparams;
uint32_t cr_hccparams; uint32_t cr_hccparams;
uint8_t cr_hcsp_portrt[8]; uint8_t cr_hcsp_portrt[8];
...@@ -48,7 +51,9 @@ struct ehci_hccr { ...@@ -48,7 +51,9 @@ struct ehci_hccr {
struct ehci_hcor { struct ehci_hcor {
uint32_t or_usbcmd; uint32_t or_usbcmd;
#define CMD_ASE (1 << 5)
uint32_t or_usbsts; uint32_t or_usbsts;
#define STD_ASS (1 << 15)
uint32_t or_usbintr; uint32_t or_usbintr;
uint32_t or_frindex; uint32_t or_frindex;
uint32_t or_ctrldssegment; uint32_t or_ctrldssegment;
...@@ -60,6 +65,47 @@ struct ehci_hcor { ...@@ -60,6 +65,47 @@ struct ehci_hcor {
uint32_t or_systune; uint32_t or_systune;
}; };
/* Interface descriptor */
struct usb_linux_interface_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bInterfaceNumber;
unsigned char bAlternateSetting;
unsigned char bNumEndpoints;
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
} __attribute__ ((packed));
/* Configuration descriptor information.. */
struct usb_linux_config_descriptor {
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wTotalLength;
unsigned char bNumInterfaces;
unsigned char bConfigurationValue;
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char MaxPower;
} __attribute__ ((packed));
#if defined CONFIG_EHCI_DESC_BIG_ENDIAN
#define ehci_readl(x) (x)
#define ehci_writel(a, b) (a) = (b)
#else
#define ehci_readl(x) cpu_to_le32((x))
#define ehci_writel(a, b) (a) = cpu_to_le32((b))
#endif
#if defined CONFIG_EHCI_MMIO_BIG_ENDIAN
#define hc32_to_cpu(x) be32_to_cpu((x))
#define cpu_to_hc32(x) cpu_to_be32((x))
#else
#define hc32_to_cpu(x) le32_to_cpu((x))
#define cpu_to_hc32(x) cpu_to_le32((x))
#endif
#define EHCI_PS_WKOC_E 0x00400000 /* RW wake on over current */ #define EHCI_PS_WKOC_E 0x00400000 /* RW wake on over current */
#define EHCI_PS_WKDSCNNT_E 0x00200000 /* RW wake on disconnect */ #define EHCI_PS_WKDSCNNT_E 0x00200000 /* RW wake on disconnect */
#define EHCI_PS_WKCNNT_E 0x00100000 /* RW wake on connect */ #define EHCI_PS_WKCNNT_E 0x00100000 /* RW wake on connect */
......
This diff is collapsed.
/*- /*-
* Copyright (c) 2007-2008, Juniper Networks, Inc. * Copyright (c) 2007-2008, Juniper Networks, Inc.
* Copyright (c) 2008, Excito Elektronik i Skåne AB * Copyright (c) 2008, Excito Elektronik i Skåne AB
* All rights reserved. * All rights reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment