Patchwork [U-Boot] omap4_panda: Initialize the USB phy

login
register
mail settings
Submitter clalancette@gmail.com
Date Dec. 13, 2011, 1:04 p.m.
Message ID <1323781459-9585-1-git-send-email-clalancette@gmail.com>
Download mbox | patch
Permalink /patch/131076/
State Changes Requested
Delegated to: Tom Rini
Headers show

Comments

clalancette@gmail.com - Dec. 13, 2011, 1:04 p.m.
From: Chris Lalancette <clalancette@gmail.com>

During misc_init_r, make sure to setup the clocks
properly for the USB hub on the pandaboard.  With
this in place, the USB hub and the ethernet works
on the pandaboard.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
---
 arch/arm/include/asm/arch-omap4/omap.h |   42 ++++++++++++++++++++++++++++++++
 board/ti/panda/panda.c                 |   16 ++++++++++++
 2 files changed, 58 insertions(+), 0 deletions(-)

Patch

diff --git a/arch/arm/include/asm/arch-omap4/omap.h b/arch/arm/include/asm/arch-omap4/omap.h
index 4d8c89f..bdda199 100644
--- a/arch/arm/include/asm/arch-omap4/omap.h
+++ b/arch/arm/include/asm/arch-omap4/omap.h
@@ -165,6 +165,48 @@  struct control_lpddr2io_regs {
 	unsigned int control_lpddr2io2_2;
 	unsigned int control_lpddr2io2_3;
 };
+
+struct omap4_scrm_regs {
+	u32 revision;		/* 0x0000 */
+	u32 pad00[63];
+	u32 clksetuptime;	/* 0x0100 */
+	u32 pmicsetuptime;	/* 0x0104 */
+	u32 pad01[2];
+	u32 altclksrc;		/* 0x0110 */
+	u32 pad02[2];
+	u32 c2cclkm;		/* 0x011c */
+	u32 pad03[56];
+	u32 extclkreq;		/* 0x0200 */
+	u32 accclkreq;		/* 0x0204 */
+	u32 pwrreq;		/* 0x0208 */
+	u32 pad04[1];
+	u32 auxclkreq0;		/* 0x0210 */
+	u32 auxclkreq1;		/* 0x0214 */
+	u32 auxclkreq2;		/* 0x0218 */
+	u32 auxclkreq3;		/* 0x021c */
+	u32 auxclkreq4;		/* 0x0220 */
+	u32 auxclkreq5;		/* 0x0224 */
+	u32 pad05[3];
+	u32 c2cclkreq;		/* 0x0234 */
+	u32 pad06[54];
+	u32 auxclk0;		/* 0x0310 */
+	u32 auxclk1;		/* 0x0314 */
+	u32 auxclk2;		/* 0x0318 */
+	u32 auxclk3;		/* 0x031c */
+	u32 auxclk4;		/* 0x0320 */
+	u32 auxclk5;		/* 0x0324 */
+	u32 pad07[54];
+	u32 rsttime_reg;	/* 0x0400 */
+	u32 pad08[6];
+	u32 c2crstctrl;		/* 0x041c */
+	u32 extpwronrstctrl;	/* 0x0420 */
+	u32 pad09[59];
+	u32 extwarmrstst_reg;	/* 0x0510 */
+	u32 apewarmrstst_reg;	/* 0x0514 */
+	u32 pad10[1];
+	u32 c2cwarmrstst_reg;	/* 0x051C */
+};
+
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index b4271fb..6f847c4 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -33,6 +33,8 @@  const struct omap_sysinfo sysinfo = {
 	"Board: OMAP4 Panda\n"
 };
 
+struct omap4_scrm_regs *const scrm = (struct omap4_scrm_regs *)0x4a30a000;
+
 /**
  * @brief board_init
  *
@@ -62,6 +64,20 @@  int board_eth_init(bd_t *bis)
  */
 int misc_init_r(void)
 {
+	if (omap_revision() != OMAP4430_ES1_0) {
+		/* Enable the USB phy */
+		/* enable software ioreq */
+		sr32(&scrm->auxclk3, 8, 1, 0x1);
+		/* set for sys_clk (38.4MHz) */
+		sr32(&scrm->auxclk3, 1, 2, 0x0);
+		/* set divisor to 2 */
+		sr32(&scrm->auxclk3, 16, 4, 0x1);
+		/* set the clock source to active */
+		sr32(&scrm->altclksrc, 0, 1, 0x1);
+		/* enable clocks */
+		sr32(&scrm->altclksrc, 2, 2, 0x3);
+	}
+
 	return 0;
 }