Commit 8b1d3ce1 authored by Tony Lindgren's avatar Tony Lindgren

musb_hdrc: Improve tusb revision checking

Needed for hardware workarounds based on the tusb revision.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 0e13579c
......@@ -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;
......
......@@ -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
......
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