]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Improve tusb revision checking
authorTony Lindgren <tony@atomide.com>
Mon, 11 Jun 2007 07:25:26 +0000 (00:25 -0700)
committerTony Lindgren <tony@atomide.com>
Mon, 11 Jun 2007 07:25:26 +0000 (00:25 -0700)
Needed for hardware workarounds based on the tusb revision.

Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/usb/musb/tusb6010.c
drivers/usb/musb/tusb6010.h

index 123ad108b9f6f64e240b50fa3215c4475b18074c..23bff72bfc0b4cb6d30a2bd9fe53c5bfe630dc70 100644 (file)
 
 #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;
index df73a29d8a991b9e43bfb9546301cd2bbe99dc69..48f8b61a209a336a3475d149c3065ab7c0aafec4 100644 (file)
 #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