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.
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)),
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 \
#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
/*----------------------------------------------------------------------------*/