[PATCH 3/7] ARM: mx53-qsrb: fix USB

Eric Bénard eric at eukrea.com
Sat Feb 8 09:16:08 EST 2014


- configure the MC34708 properly so that USB can work
(the sequence is taken from u-boot)
- add the required defines to the mc13xxx include file

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 arch/arm/boards/freescale-mx53-qsb/board.c | 45 ++++++++++++++++++++++++++++++
 include/mfd/mc13xxx.h                      | 11 ++++++++
 2 files changed, 56 insertions(+)

diff --git a/arch/arm/boards/freescale-mx53-qsb/board.c b/arch/arm/boards/freescale-mx53-qsb/board.c
index 69036da..74826e4 100644
--- a/arch/arm/boards/freescale-mx53-qsb/board.c
+++ b/arch/arm/boards/freescale-mx53-qsb/board.c
@@ -93,11 +93,56 @@ static int loco_late_init(void)
 
 	mc34708 = mc13xxx_get();
 	if (mc34708) {
+		unsigned int val;
+		int ret;
 		/* get the board revision from fuse */
 		rev = readl(MX53_IIM_BASE_ADDR + 0x878);
 		set_board_rev(rev);
 		printf("MCIMX53-START-R board 1.0 rev %c\n", (rev == 1) ? 'A' : 'B' );
 		armlinux_set_revision(loco_system_rev);
+		/* Set VDDGP to 1.25V for 1GHz on SW1 */
+		mc13xxx_reg_read(mc34708, MC13892_REG_SW_0, &val);
+		val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_250V_MC34708;
+		ret = mc13xxx_reg_write(mc34708, MC13892_REG_SW_0, val);
+		if (ret) {
+			printf("Writing to REG_SW_0 failed: %d\n", ret);
+			return ret;
+		}
+
+		/* Set VCC as 1.30V on SW2 */
+		mc13xxx_reg_read(mc34708, MC13892_REG_SW_1, &val);
+		val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_300V_MC34708;
+		ret = mc13xxx_reg_write(mc34708, MC13892_REG_SW_1, val);
+		if (ret) {
+			printf("Writing to REG_SW_1 failed: %d\n", ret);
+			return ret;
+		}
+
+		/* Set global reset timer to 4s */
+		mc13xxx_reg_read(mc34708, MC13892_REG_POWER_CTL2, &val);
+		val = (val & ~TIMER_MASK_MC34708) | TIMER_4S_MC34708;
+		ret = mc13xxx_reg_write(mc34708, MC13892_REG_POWER_CTL2, val);
+		if (ret) {
+			printf("Writing to REG_POWER_CTL2 failed: %d\n", ret);
+			return ret;
+		}
+
+		/* Set VUSBSEL and VUSBEN for USB PHY supply*/
+		mc13xxx_reg_read(mc34708, MC13892_REG_MODE_0, &val);
+		val |= (VUSBSEL_MC34708 | VUSBEN_MC34708);
+		ret = mc13xxx_reg_write(mc34708, MC13892_REG_MODE_0, val);
+		if (ret) {
+			printf("Writing to REG_MODE_0 failed: %d\n", ret);
+			return ret;
+		}
+
+		/* Set SWBST to 5V in auto mode */
+		val = SWBST_AUTO;
+		ret = mc13xxx_reg_write(mc34708, SWBST_CTRL, val);
+		if (ret) {
+			printf("Writing to SWBST_CTRL failed: %d\n", ret);
+			return ret;
+		}
 	} else {
 		/* so we have a DA9053 based board */
 		printf("MCIMX53-START board 1.0\n");
diff --git a/include/mfd/mc13xxx.h b/include/mfd/mc13xxx.h
index cba8589..1946b1a 100644
--- a/include/mfd/mc13xxx.h
+++ b/include/mfd/mc13xxx.h
@@ -152,6 +152,17 @@
 #define MC13783_SW1B_SOFTSTART		(1 << 17)
 #define MC13783_SW_PLL_FACTOR(x)	(((x) - 28) << 19)
 
+/* MC34708 Definitions */
+#define SWx_VOLT_MASK_MC34708	0x3F
+#define SWx_1_250V_MC34708	0x30
+#define SWx_1_300V_MC34708	0x34
+#define TIMER_MASK_MC34708	0x300
+#define TIMER_4S_MC34708	0x100
+#define VUSBSEL_MC34708		(1 << 2)
+#define VUSBEN_MC34708		(1 << 3)
+#define SWBST_CTRL		31
+#define SWBST_AUTO		0x8
+
 struct mc13xxx;
 
 #ifdef CONFIG_MFD_MC13XXX
-- 
1.8.3.1




More information about the barebox mailing list