This patch add varius fix to the ehci. - fix ehci_readl, ehci_writel - introduce new define in ehci.h - introduce the handshake function for waiting on a register - fix usb_ehci_fsl with the new HC_LENGTH macro
PATCH 1/1 This patch add varius fix to the ehci. - fix ehci_readl, ehci_writel - introduce new define in ehci.h - introduce the handshake function for waiting on a register - fix usb_ehci_fsl with the new HC_LENGTH macro
Signed-off-by Michael Trimarchi <[email protected]>
--- drivers/usb/usb_ehci.h | 27 +++++++-- drivers/usb/usb_ehci_core.c | 147 ++++++++++++++++++++++++++++++++----------- drivers/usb/usb_ehci_fsl.c | 3 +- include/usb.h | 2 +- 4 files changed, 134 insertions(+), 45 deletions(-)
drivers/usb/usb_ehci.h +22 -5
@@ -45,15 +45,24 @@ struct ehci_hccr {#define HC_LENGTH (p) (((p) >> 0) & 0x00ff)#define HC_VERSION (p) (((p) >> 16) & 0xffff)uint32_t cr_hcsparams; +#define HCS_N_PORTS (p) (((p) >> 0) & 0xf)uint32_t cr_hccparams;uint8_t cr_hcsp_portrt[8 ]; };struct ehci_hcor {uint32_t or_usbcmd; -#define CMD_ASE (1 << 5) +#define CMD_PARK (1 << 11)/* enable "park" */ +#define CMD_PARK_CNT (c) (((c) >> 8) & 3)/* how many transfers to park */ +#define CMD_ASE (1 << 5)/* async schedule enable */ +#define CMD_LRESET (1 << 7)/* partial reset */ +#define CMD_IAAD (1 << 5)/* "doorbell" interrupt */ +#define CMD_PSE (1 << 4)/* periodic schedule enable */ +#define CMD_RESET (1 << 1)/* reset HC not bus */ +#define CMD_RUN (1 << 0)/* start/stop HC */ uint32_t or_usbsts;#define STD_ASS (1 << 15) +#define STS_HALT (1 << 12)uint32_t or_usbintr;uint32_t or_frindex;uint32_t or_ctrldssegment;
@@ -61,10 +70,17 @@ struct ehci_hcor {uint32_t or_asynclistaddr;uint32_t _reserved_[9 ];uint32_t or_configflag; +#define FLAG_CF (1 << 0)/* true: we'll support "high speed" */ uint32_t or_portsc[2 ];uint32_t or_systune; }; +#define USBMODE 0x68/* USB Device mode */ +#define USBMODE_SDIS (1 << 3)/* Stream disable */ +#define USBMODE_BE (1 << 2)/* BE/LE endiannes select */ +#define USBMODE_CM_HC (3 << 0)/* host controller mode */ +#define USBMODE_CM_IDLE (0 << 0)/* idle state */ +/* Interface descriptor */ struct usb_linux_interface_descriptor {unsigned char bLength;
@@ -91,11 +107,12 @@ struct usb_linux_config_descriptor { } __attribute__ ((packed));#if definedCONFIG_EHCI_DESC_BIG_ENDIAN -#define ehci_readl (x) (x) -#define ehci_writel (a, b) (a) = (b) +#define ehci_readl (x) (*((volatile u32 *)(x))) +#define ehci_writel (a, b) (*((volatile u32 *)(a)) = ((volatile u32)b))#else -#define ehci_readl (x) cpu_to_le32((x)) -#define ehci_writel (a, b) (a) = cpu_to_le32((b)) +#define ehci_readl (x) cpu_to_le32((*((volatile u32 *)(x)))) +#define ehci_writel (a, b) (*((volatile u32 *)(a)) = \ + cpu_to_le32(((volatile u32)b)))#endif #if definedCONFIG_EHCI_MMIO_BIG_ENDIAN
drivers/usb/usb_ehci_core.c +109 -38
251 lines not on this page · raw message
drivers/usb/usb_ehci_fsl.c +2 -1
@@ -43,7 +43,8 @@ int ehci_hcd_init(void) addr = (uint32_t )&(im->usb[0 ]); hccr = (struct ehci_hccr *)(addr +FSL_SKIP_PCI ); - hcor = (struct ehci_hcor *)((uint32_t ) hccr + hccr->cr_caplength); + hcor = (struct ehci_hcor *)((uint32_t ) hccr + +HC_LENGTH (ehci_readl (&hccr->cr_capbase)));/* Configure clock */ clrsetbits_be32(&(im->clk.sccr), MPC83XX_SCCR_USB_MASK,
include/usb.h +1 -1
@@ -181,7 +181,7 @@ struct usb_device {*/ #if defined(CONFIG_USB_UHCI ) || defined(CONFIG_USB_OHCI ) || \ - defined(CONFI_USB_EHCI ) || defined(CONFIG_USB_OHCI_NEW ) || \ + defined(CONFIG_USB_EHCI ) || defined(CONFIG_USB_OHCI_NEW ) || \ defined(CONFIG_USB_SL811HS ) || defined(CONFIG_USB_ISP116X_HCD ) || \ defined(CONFIG_USB_R8A66597_HCD )
Signature · 1 line
1.5.6.5