Commit fd310267 authored by Tony Lindgren's avatar Tony Lindgren

musb_hdrc: Fix revision check for tusb3.1

In order to detect between tusb3.0 and 3.1, die id register
must be checked.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 98a008d9
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
static void tusb_source_power(struct musb *musb, int is_on); 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 * 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. * 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); ...@@ -34,18 +37,27 @@ static void tusb_source_power(struct musb *musb, int is_on);
static u8 tusb_get_revision(struct musb *musb) static u8 tusb_get_revision(struct musb *musb)
{ {
void __iomem *base = musb->ctrl_base; 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) static int __init tusb_print_revision(struct musb *musb)
{ {
void __iomem *base = musb->ctrl_base; 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", "prcm",
TUSB_REV_MAJOR(musb_readl(base, TUSB_PRCM_REV)), 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_PRCM_REV)),
...@@ -57,9 +69,13 @@ static int __init tusb_print_revision(struct musb *musb) ...@@ -57,9 +69,13 @@ static int __init tusb_print_revision(struct musb *musb)
TUSB_REV_MINOR(musb_readl(base, TUSB_GPIO_REV)), TUSB_REV_MINOR(musb_readl(base, TUSB_GPIO_REV)),
"dma", "dma",
TUSB_REV_MAJOR(musb_readl(base, TUSB_DMA_CTRL_REV)), 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 WBUS_QUIRK_MASK (TUSB_PHY_OTG_CTRL_TESTM2 | TUSB_PHY_OTG_CTRL_TESTM1 \
......
...@@ -216,9 +216,17 @@ ...@@ -216,9 +216,17 @@
#define TUSB_PROD_TEST_RESET_VAL 0xa596 #define TUSB_PROD_TEST_RESET_VAL 0xa596
#define TUSB_EP_FIFO(ep) (TUSB_FIFO_BASE + (ep) * 0x20) #define TUSB_EP_FIFO(ep) (TUSB_FIFO_BASE + (ep) * 0x20)
#define TUSB_REV_1 0x10 #define TUSB_DIDR1_LO 0x1f8
#define TUSB_REV_2 0x20 #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_30 0x30
#define TUSB_REV_31 0x31
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment