From 8b1d3ce128e4a40d610e87c0d3091c418a95c5a0 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Mon, 11 Jun 2007 00:25:26 -0700 Subject: [PATCH] musb_hdrc: Improve tusb revision checking Needed for hardware workarounds based on the tusb revision. Signed-off-by: Tony Lindgren --- drivers/usb/musb/tusb6010.c | 58 ++++++++++++++++++++++--------------- drivers/usb/musb/tusb6010.h | 4 +++ 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 123ad108b9f..23bff72bfc0 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -25,6 +25,40 @@ #include "musbdefs.h" +/* + * Checks the revision. We need to use the DMA register as 3.0 does not + * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. + */ +static u8 tusb_get_revision(struct musb *musb) +{ + void __iomem *base = musb->ctrl_base; + + return musb_readl(base, TUSB_DMA_CTRL_REV) & 0xff; +} + +#define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) +#define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) + +static int __init tusb_print_revision(struct musb *musb) +{ + void __iomem *base = musb->ctrl_base; + + pr_info("tusb: Revisions: %s%i.%i %s%i.%i %s%i.%i %s%i.%i\n", + "prcm", + TUSB_REV_MAJOR(musb_readl(base, TUSB_PRCM_REV)), + TUSB_REV_MINOR(musb_readl(base, TUSB_PRCM_REV)), + "int", + TUSB_REV_MAJOR(musb_readl(base, TUSB_INT_CTRL_REV)), + TUSB_REV_MINOR(musb_readl(base, TUSB_INT_CTRL_REV)), + "gpio", + TUSB_REV_MAJOR(musb_readl(base, TUSB_GPIO_REV)), + TUSB_REV_MINOR(musb_readl(base, TUSB_GPIO_REV)), + "dma", + TUSB_REV_MAJOR(musb_readl(base, TUSB_DMA_CTRL_REV)), + TUSB_REV_MINOR(musb_readl(base, TUSB_DMA_CTRL_REV))); + + return TUSB_REV_MAJOR(musb_readl(base, TUSB_INT_CTRL_REV)); +} /* * TUSB 6010 may use a parallel bus that doesn't support byte ops; @@ -833,30 +867,6 @@ static void __init tusb_setup_cpu_interface(struct musb *musb) musb_writel(base, TUSB_WAIT_COUNT, 1); } -#define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) -#define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) - -static int __init tusb_print_revision(struct musb *musb) -{ - void __iomem *base = musb->ctrl_base; - - pr_info("tusb: Revisions: %s%i.%i %s%i.%i %s%i.%i %s%i.%i\n", - "prcm", - TUSB_REV_MAJOR(musb_readl(base, TUSB_PRCM_REV)), - TUSB_REV_MINOR(musb_readl(base, TUSB_PRCM_REV)), - "int", - TUSB_REV_MAJOR(musb_readl(base, TUSB_INT_CTRL_REV)), - TUSB_REV_MINOR(musb_readl(base, TUSB_INT_CTRL_REV)), - "gpio", - TUSB_REV_MAJOR(musb_readl(base, TUSB_GPIO_REV)), - TUSB_REV_MINOR(musb_readl(base, TUSB_GPIO_REV)), - "dma", - TUSB_REV_MAJOR(musb_readl(base, TUSB_DMA_CTRL_REV)), - TUSB_REV_MINOR(musb_readl(base, TUSB_DMA_CTRL_REV))); - - return TUSB_REV_MAJOR(musb_readl(base, TUSB_INT_CTRL_REV)); -} - static int __init tusb_start(struct musb *musb) { void __iomem *base = musb->ctrl_base; diff --git a/drivers/usb/musb/tusb6010.h b/drivers/usb/musb/tusb6010.h index df73a29d8a9..48f8b61a209 100644 --- a/drivers/usb/musb/tusb6010.h +++ b/drivers/usb/musb/tusb6010.h @@ -216,6 +216,10 @@ #define TUSB_PROD_TEST_RESET_VAL 0xa596 #define TUSB_EP_FIFO(ep) (TUSB_FIFO_BASE + (ep) * 0x20) +#define TUSB_REV_1 0x10 +#define TUSB_REV_2 0x20 +#define TUSB_REV_30 0x30 + /*----------------------------------------------------------------------------*/ #ifdef CONFIG_USB_TUSB6010 -- 2.41.1