From efc587fb24a5246f5a436a057320687a1b7847c6 Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Wed, 10 Feb 2010 15:23:19 -0800 Subject: [PATCH 04/37] OMAP3: Set VAUX2 to 1.8V for EHCI PHY on Beagle Rev C4 boards --- board/ti/beagle/beagle.c | 5 +++++ drivers/power/twl4030.c | 45 +++++++++++++++++++++++++-------------------- include/twl4030.h | 15 +++++++++++++++ 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ba16dd7..b4ea7e6 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -120,6 +120,11 @@ int misc_init_r(void) case REVISION_C4: printf("C4\n"); MUX_BEAGLE_C(); + /* Set VAUX2 to 1.8V for EHCI PHY */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED, + TWL4030_PM_RECEIVER_VAUX2_VSEL_18, + TWL4030_PM_RECEIVER_VAUX2_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); break; case REVISION_D: printf("D\n"); diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index eb066cb..f354834 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -59,57 +59,62 @@ void twl4030_power_reset_init(void) } } - -/* - * Power Init - */ -#define DEV_GRP_P1 0x20 -#define VAUX3_VSEL_28 0x03 -#define DEV_GRP_ALL 0xE0 -#define VPLL2_VSEL_18 0x05 -#define VDAC_VSEL_18 0x03 - void twl4030_power_init(void) { unsigned char byte; /* set VAUX3 to 2.8V */ - byte = DEV_GRP_P1; + byte = TWL4030_PM_RECEIVER_DEV_GRP_P1; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VAUX3_DEV_GRP); - byte = VAUX3_VSEL_28; + byte = TWL4030_PM_RECEIVER_VAUX3_VSEL_28; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VAUX3_DEDICATED); /* set VPLL2 to 1.8V */ - byte = DEV_GRP_ALL; + byte = TWL4030_PM_RECEIVER_DEV_GRP_ALL; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VPLL2_DEV_GRP); - byte = VPLL2_VSEL_18; + byte = TWL4030_PM_RECEIVER_VPLL2_VSEL_18; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VPLL2_DEDICATED); /* set VDAC to 1.8V */ - byte = DEV_GRP_P1; + byte = TWL4030_PM_RECEIVER_DEV_GRP_P1; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VDAC_DEV_GRP); - byte = VDAC_VSEL_18; + byte = TWL4030_PM_RECEIVER_VDAC_VSEL_18; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VDAC_DEDICATED); } -#define VMMC1_VSEL_30 0x02 - void twl4030_power_mmc_init(void) { unsigned char byte; - byte = DEV_GRP_P1; + byte = TWL4030_PM_RECEIVER_DEV_GRP_P1; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VMMC1_DEV_GRP); /* 3 Volts */ - byte = VMMC1_VSEL_30; + byte = TWL4030_PM_RECEIVER_VMMC1_VSEL_30; twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, TWL4030_PM_RECEIVER_VMMC1_DEDICATED); } + +/* + * Generic function to select Device Group and Voltage + */ +void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val, + u8 dev_grp, u8 dev_grp_sel) +{ + /* Select the Device Group */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, dev_grp_sel, + dev_grp); + + /* Select the Voltage */ + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, vsel_val, + vsel_reg); +} + + diff --git a/include/twl4030.h b/include/twl4030.h index 2b2f5ae..cc99403 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -471,6 +471,21 @@ #define TWL4030_USB_PHY_CLK_CTRL_STS 0xFF /* + * Voltage Selection in PM Receiver Module + */ +#define TWL4030_PM_RECEIVER_VAUX2_VSEL_18 0x05 +#define TWL4030_PM_RECEIVER_VAUX3_VSEL_28 0x03 +#define TWL4030_PM_RECEIVER_VPLL2_VSEL_18 0x05 +#define TWL4030_PM_RECEIVER_VDAC_VSEL_18 0x03 +#define TWL4030_PM_RECEIVER_VMMC1_VSEL_30 0x02 + +/* + * Device Selection in PM Receiver Module + */ +#define TWL4030_PM_RECEIVER_DEV_GRP_P1 0x20 +#define TWL4030_PM_RECEIVER_DEV_GRP_ALL 0xE0 + +/* * Convience functions to read and write from TWL4030 * * chip_no is the i2c address, it must be one of the chip addresses -- 1.6.6.1