From: Tony Lindgren Date: Tue, 14 Aug 2007 09:19:04 +0000 (-0700) Subject: musb_hdrc: Fix revision check for tusb3.1 X-Git-Tag: v2.6.23-omap1~229 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=fd310267d683a063c5e1df868481f34bdba03cdd;p=linux-2.6-omap-h63xx.git 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: Tony Lindgren --- diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index ddeca4a3a61..7625187e89b 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -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 \ diff --git a/drivers/usb/musb/tusb6010.h b/drivers/usb/musb/tusb6010.h index 48f8b61a209..2fc9f5a5f7a 100644 --- a/drivers/usb/musb/tusb6010.h +++ b/drivers/usb/musb/tusb6010.h @@ -216,9 +216,17 @@ #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 /*----------------------------------------------------------------------------*/