diff options
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-regulators.c | 63 | ||||
-rw-r--r-- | drivers/regulator/ab8500-debug.c | 56 | ||||
-rw-r--r-- | drivers/regulator/ab8500-ext.c | 18 | ||||
-rw-r--r-- | include/linux/regulator/ab8500.h | 1 |
4 files changed, 81 insertions, 57 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c index be90ea6c486..62e92e89bdd 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.c +++ b/arch/arm/mach-ux500/board-mop500-regulators.c @@ -339,12 +339,12 @@ static struct ab8500_regulator_reg_init ab8500_reg_init[] = { INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), /* * VextSupply1Regu = force LP - * VextSupply2Regu = HW control + * VextSupply2Regu = force OFF * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 */ - INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x1b), + INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), /* * Vaux1Regu = force HP * Vaux2Regu = force off @@ -546,6 +546,11 @@ static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), }; +/* extended configuration for VextSupply2, only used for HREFP_V20 boards */ +static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = { + .hwreq = true, +}; + /* * AB8500 external regulators */ @@ -561,6 +566,14 @@ static struct regulator_init_data ab8500_ext_regulators[] = { .always_on = 1, }, }, + /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ + [AB8500_EXT_SUPPLY2] = { + .constraints = { + .name = "ab8500-ext-supply2", + .min_uV = 1360000, + .max_uV = 1360000, + }, + }, /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ [AB8500_EXT_SUPPLY3] = { .constraints = { @@ -585,6 +598,24 @@ struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), }; +static void ab8500_modify_reg_init(int id, u8 mask, u8 value) +{ + int i; + + for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) { + if (ab8500_reg_init[i].id == id) { + u8 initval = ab8500_reg_init[i].value; + initval = (initval & ~mask) | (value & mask); + ab8500_reg_init[i].value = initval; + + BUG_ON(mask & ~ab8500_reg_init[i].mask); + return; + } + } + + BUG_ON(1); +} + void mop500_regulator_init(void) { struct regulator_init_data *regulator; @@ -599,4 +630,32 @@ void mop500_regulator_init(void) regulator->constraints.state_mem.disabled = 1; regulator->constraints.state_standby.disabled = 1; } + + /* + * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for + * all HREFP_V20 boards) + */ + if (cpu_is_u8500v20()) { + /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */ + ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01); + + /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */ + ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2, + 0x20, 0x20); + + /* VextSupply2 = force HP at initialization */ + ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04); + + /* enable VextSupply2 during platform active */ + regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; + regulator->constraints.always_on = 1; + + /* disable VextSupply2 in suspend */ + regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; + regulator->constraints.state_mem.disabled = 1; + regulator->constraints.state_standby.disabled = 1; + + /* enable VextSupply2 HW control (used in suspend) */ + regulator->driver_data = (void *)&ab8500_ext_supply2; + } } diff --git a/drivers/regulator/ab8500-debug.c b/drivers/regulator/ab8500-debug.c index 50789258654..b2e1628e52d 100644 --- a/drivers/regulator/ab8500-debug.c +++ b/drivers/regulator/ab8500-debug.c @@ -1465,30 +1465,6 @@ static struct ab8500_force_reg ab8500_force_reg[] = { }, { /* - * ReguSysClkReq1HPValid2 - * OTP: 0x03, HSI: 0x40, suspend: 0x60/0x70 (value/mask) - * [ 5] VextSupply2SysClkReq1HPValid = Vext2 set by SysClkReq1 - */ - .name = "ReguSysClkReq1HPValid2", - .bank = 0x03, - .addr = 0x08, - .mask = 0x20, /* test and compare with 0x7f */ - .val = 0x20, - }, - { - /* - * ReguRequestCtrl3 - * OTP: 0x00, HSI: 0x00, suspend: 0x05/0x0f (value/mask) - * [1:0] VExtSupply2RequestCtrl[1:0] = VExt2 set in HP/OFF mode - */ - .name = "ReguRequestCtrl3", - .bank = 0x03, - .addr = 0x05, - .mask = 0x03, /* test and compare with 0xff */ - .val = 0x01, - }, - { - /* * VsimSysClkCtrl * OTP: 0x01, HSI: 0x21, suspend: 0x01/0xff (value/mask) * [ 7] VsimSysClkReq8Valid = no connection @@ -1523,18 +1499,6 @@ static struct ab8500_force_reg ab8500_force_reg[] = { }, { /* - * ExtSupplyRegu (HSI: 0x2a on v2-v40?) - * OTP: 0x15, HSI: 0x28, suspend: 0x28/0x3f (value/mask) - * [3:2] VExtSupply2Regu[1:0] = 10 = Vext2 in HW control - */ - .name = "ExtSupplyRegu", - .bank = 0x04, - .addr = 0x08, - .mask = 0x0c, - .val = 0x08, - }, - { - /* * TVoutCtrl * OTP: N/A, HSI: N/A, suspend: 0x00/0x03 (value/mask) * [ 2] PlugTvOn = plug/unplug detection disabled @@ -1720,7 +1684,7 @@ static struct dentry *ab8500_regulator_suspend_force_file; static int __devinit ab8500_regulator_debug_probe(struct platform_device *plf) { void __iomem *boot_info_backupram; - int ret, i; + int ret; /* setup dev pointers */ dev = &plf->dev; @@ -1731,24 +1695,6 @@ static int __devinit ab8500_regulator_debug_probe(struct platform_device *plf) if (ret < 0) dev_err(&plf->dev, "Failed to record init state.\n"); - /* remove force of external regulators if AB8500 3.0 and DB8500 v2.2 */ - if ((abx500_get_chip_id(&pdev->dev) >= 0x30) && cpu_is_u8500v22()) { - /* - * find ExtSupplyRegu register (bank 0x04, addr 0x08) - * and update value (Vext2 off). - */ - for (i = 0; i < ARRAY_SIZE(ab8500_force_reg); i++) { - if (ab8500_force_reg[i].bank == 0x04 && - ab8500_force_reg[i].addr == 0x08) { - u8 val, val_mask = 0x0c; - - val = ab8500_force_reg[i].val; - val = (val & ~val_mask) | (0x00 & val_mask); - ab8500_force_reg[i].val = val; - } - } - } - /* make suspend-force default if board profile is v5x-power */ boot_info_backupram = ioremap(BOOT_INFO_BACKUPRAM1, 0x4); diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c index f6ce6623460..f5971de1dc5 100644 --- a/drivers/regulator/ab8500-ext.c +++ b/drivers/regulator/ab8500-ext.c @@ -318,6 +318,24 @@ static struct ab8500_ext_regulator_info .update_val_lp = 0x03, .update_val_hw = 0x02, }, + [AB8500_EXT_SUPPLY2] = { + .desc = { + .name = "VEXTSUPPLY2", + .ops = &ab8500_ext_regulator_ops, + .type = REGULATOR_VOLTAGE, + .id = AB8500_EXT_SUPPLY2, + .owner = THIS_MODULE, + .n_voltages = 1, + }, + .fixed_uV = 1360000, + .update_bank = 0x04, + .update_reg = 0x08, + .update_mask = 0x0c, + .update_val = 0x04, + .update_val_hp = 0x04, + .update_val_lp = 0x0c, + .update_val_hw = 0x08, + }, [AB8500_EXT_SUPPLY3] = { .desc = { .name = "VEXTSUPPLY3", diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 49d5df43d22..112677fdb0a 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h @@ -163,6 +163,7 @@ struct ab8500_ext_regulator_cfg { enum ab8500_ext_regulator_id { AB8500_EXT_SUPPLY1, + AB8500_EXT_SUPPLY2, AB8500_EXT_SUPPLY3, AB8500_NUM_EXT_REGULATORS, }; |