]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Fix revision check for tusb3.1
authorTony Lindgren <tony@atomide.com>
Tue, 14 Aug 2007 09:19:04 +0000 (02:19 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 14 Aug 2007 09:19:04 +0000 (02:19 -0700)
In order to detect between tusb3.0 and 3.1, die id register
must be checked.

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

index ddeca4a3a612e469a5d999bf5655754c02b48608..7625187e89b7e5d40e3424cbb62b4093c795e4d5 100644 (file)
@@ -27,6 +27,9 @@
 
 static void tusb_source_power(struct musb *musb, int is_on);
 
+#define TUSB_REV_MAJOR(reg_val)                ((reg_val >> 4) & 0xf)
+#define TUSB_REV_MINOR(reg_val)                (reg_val & 0xf)
+
 /*
  * 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.
@@ -34,18 +37,27 @@ static void tusb_source_power(struct musb *musb, int is_on);
 static u8 tusb_get_revision(struct musb *musb)
 {
        void __iomem    *base = musb->ctrl_base;
+       u32             die_id;
+       u8              rev;
+
+       rev = musb_readl(base, TUSB_DMA_CTRL_REV) & 0xff;
+       if (TUSB_REV_MAJOR(rev) == 3) {
+               die_id = TUSB_DIDR1_HI_CHIP_REV(musb_readl(base, TUSB_DIDR1_HI));
+               if (die_id == TUSB_DIDR1_HI_REV_31)
+                       rev |= 1;
+       }
 
-       return musb_readl(base, TUSB_DMA_CTRL_REV) & 0xff;
+       return rev;
 }
 
-#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;
+       u8              rev;
+
+       rev = tusb_get_revision(musb);
 
-       pr_info("tusb: Revisions: %s%i.%i %s%i.%i %s%i.%i %s%i.%i\n",
+       pr_info("tusb: %s%i.%i %s%i.%i %s%i.%i %s%i.%i %s%i %s%i.%i\n",
                "prcm",
                TUSB_REV_MAJOR(musb_readl(base, TUSB_PRCM_REV)),
                TUSB_REV_MINOR(musb_readl(base, TUSB_PRCM_REV)),
@@ -57,9 +69,13 @@ static int __init tusb_print_revision(struct musb *musb)
                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)));
+               TUSB_REV_MINOR(musb_readl(base, TUSB_DMA_CTRL_REV)),
+               "dieid",
+               TUSB_DIDR1_HI_CHIP_REV(musb_readl(base, TUSB_DIDR1_HI)),
+               "rev",
+               TUSB_REV_MAJOR(rev), TUSB_REV_MINOR(rev));
 
-       return TUSB_REV_MAJOR(musb_readl(base, TUSB_INT_CTRL_REV));
+       return tusb_get_revision(musb);
 }
 
 #define WBUS_QUIRK_MASK        (TUSB_PHY_OTG_CTRL_TESTM2 | TUSB_PHY_OTG_CTRL_TESTM1    \
index 48f8b61a209a336a3475d149c3065ab7c0aafec4..2fc9f5a5f7ac32e2a1792ab103b81f34cc499757 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_DIDR1_LO                          0x1f8
+#define TUSB_DIDR1_HI                          0x1fc
+#define                TUSB_DIDR1_HI_CHIP_REV(v)               (((v) >> 17) & 0x3)
+#define                        TUSB_DIDR1_HI_REV_20            0
+#define                        TUSB_DIDR1_HI_REV_30            1
+#define                        TUSB_DIDR1_HI_REV_31            2
+
+#define TUSB_REV_10    0x10
+#define TUSB_REV_20    0x20
 #define TUSB_REV_30    0x30
+#define TUSB_REV_31    0x31
 
 /*----------------------------------------------------------------------------*/