From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peng Fan Date: Fri, 9 Jan 2015 16:59:43 +0800 Subject: [U-Boot] [PATCH 08/12] imx:mx6slevk add ldo mode set function In-Reply-To: <1420793987-7621-1-git-send-email-Peng.Fan@freescale.com> References: <1420793987-7621-1-git-send-email-Peng.Fan@freescale.com> Message-ID: <1420793987-7621-9-git-send-email-Peng.Fan@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add ldo_mode_set function. If ldo_bypass is true, it will adjust voltage. If not, do nothing. This function is board specific, so implement it in board file. Signed-off-by: Peng Fan Signed-off-by: Robin Gong --- board/freescale/mx6slevk/mx6slevk.c | 61 ++++++++++++++++++++++++++++++++++--- include/configs/mx6slevk.h | 2 ++ 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c index f74b237..fdb6672 100644 --- a/board/freescale/mx6slevk/mx6slevk.c +++ b/board/freescale/mx6slevk/mx6slevk.c @@ -247,16 +247,69 @@ struct i2c_pads_info i2c_pad_info1 = { }, }; +static struct pmic *pfuze; + +#ifdef CONFIG_LDO_BYPASS_CHECK +void ldo_mode_set(int ldo_bypass) +{ + u32 value; + int is_400M; + struct pmic *p = pfuze; + + if (!p) + return; + + /* swith to ldo_bypass mode */ + if (ldo_bypass) { + prep_anatop_bypass(); + + /* decrease VDDARM to 1.1V */ + pmic_reg_read(p, PFUZE100_SW1ABVOL, &value); + value &= ~0x3f; + value |= PFUZE100_SW1ABC_SETP(11000); + pmic_reg_write(p, PFUZE100_SW1ABVOL, value); + + /* increase VDDSOC to 1.3V */ + pmic_reg_read(p, PFUZE100_SW1CVOL, &value); + value &= ~0x3f; + value |= PFUZE100_SW1ABC_SETP(13000); + pmic_reg_write(p, PFUZE100_SW1CVOL, value); + + is_400M = set_anatop_bypass(0); + + /* + * MX6SL: VDDARM:1.175V at 800M; VDDSOC:1.175V at 800M + * VDDARM:0.975V at 400M; VDDSOC:1.175V at 400M + */ + pmic_reg_read(p, PFUZE100_SW1ABVOL, &value); + value &= ~0x3f; + if (is_400M) + value |= PFUZE100_SW1ABC_SETP(9750); + else + value |= PFUZE100_SW1ABC_SETP(11750); + pmic_reg_write(p, PFUZE100_SW1ABVOL, value); + + /* decrease VDDSOC to 1.175V */ + pmic_reg_read(p, PFUZE100_SW1CVOL, &value); + value &= ~0x3f; + value |= PFUZE100_SW1ABC_SETP(11750); + pmic_reg_write(p, PFUZE100_SW1CVOL, value); + + finish_anatop_bypass(); + printf("switch to ldo_bypass mode!\n"); + } +} +#endif + int power_init_board(void) { - struct pmic *p; unsigned int ret; - p = pfuze_common_init(I2C_PMIC); - if (!p) + pfuze = pfuze_common_init(I2C_PMIC); + if (!pfuze) return -ENODEV; - ret = pfuze_mode_init(p, APS_PFM); + ret = pfuze_mode_init(pfuze, APS_PFM); if (ret < 0) return -EIO; diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h index 9fd7619..56c2faf 100644 --- a/include/configs/mx6slevk.h +++ b/include/configs/mx6slevk.h @@ -60,6 +60,8 @@ #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 +#define CONFIG_LDO_BYPASS_CHECK + #define CONFIG_CMD_PING #define CONFIG_CMD_DHCP #define CONFIG_CMD_MII -- 1.8.4