Merge NXP branch 'lf-5.4.y' into 5.4-1.0.0-imx

Following commits are merged from NXP kernel tree:
  40fe6bd542 MLK-23844-2 ARM64: dts: freescale: imx8mm: correct VDDARM@1.6GHz
  aec0c14ae6 MLK-23844-1: ARM64: dts: freescale: imx8mn-ddr4-evk: cleanup Rhom pmic
  e8e35fd0e7 MLK-23275-2: ARM64: dts: freescale: imx8mn-ddr4-evk: correct ldo1/ldo2 voltage
  975d8ab072 MLK-23275-1: ARM64: dts: freescale: fsl-imx8mm-evk: correct ldo1/ldo2 voltage
  4711466d53 MLK-23562: regulator: core: adjust supply voltage in bypass
  bbbc26a40a MLK-13793-6 regulator: anatop: fix min dropout for bypass mode

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
This commit is contained in:
Andrey Zhizhikin 2020-05-06 22:14:53 +00:00
commit 1ec1631331
5 changed files with 50 additions and 26 deletions

View File

@ -450,15 +450,15 @@
ldo1_reg: LDO1 {
regulator-name = "LDO1";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3300000>;
regulator-min-microvolt = <1600000>;
regulator-max-microvolt = <1900000>;
regulator-boot-on;
regulator-always-on;
};
ldo2_reg: LDO2 {
regulator-name = "LDO2";
regulator-min-microvolt = <900000>;
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <900000>;
regulator-boot-on;
regulator-always-on;

View File

@ -132,7 +132,7 @@
opp-1600000000 {
opp-hz = /bits/ 64 <1600000000>;
opp-microvolt = <900000>;
opp-microvolt = <950000>;
opp-supported-hw = <0xc>, <0x7>;
clock-latency-ns = <150000>;
opp-suspend;

View File

@ -631,13 +631,8 @@
regulator-boot-on;
regulator-always-on;
regulator-ramp-delay = <1250>;
};
buck3_reg: BUCK3 {
// BUCK5 in datasheet
regulator-name = "BUCK3";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1350000>;
rohm,dvs-run-voltage = <1000000>;
rohm,dvs-idle-voltage = <900000>;
};
buck4_reg: BUCK4 {
@ -669,15 +664,15 @@
ldo1_reg: LDO1 {
regulator-name = "LDO1";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3300000>;
regulator-min-microvolt = <1600000>;
regulator-max-microvolt = <1900000>;
regulator-boot-on;
regulator-always-on;
};
ldo2_reg: LDO2 {
regulator-name = "LDO2";
regulator-min-microvolt = <900000>;
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <900000>;
regulator-boot-on;
regulator-always-on;
@ -691,14 +686,6 @@
regulator-always-on;
};
ldo4_reg: LDO4 {
regulator-name = "LDO4";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};
ldo6_reg: LDO6 {
regulator-name = "LDO6";
regulator-min-microvolt = <900000>;

View File

@ -22,6 +22,8 @@
#define LDO_POWER_GATE 0x00
#define LDO_FET_FULL_ON 0x1f
#define LDO_MIN_DROPOUT_UV 125000
struct anatop_regulator {
u32 delay_reg;
int delay_bit_shift;
@ -31,6 +33,9 @@ struct anatop_regulator {
int sel;
};
static struct anatop_regulator *vddpu;
static struct anatop_regulator *vddsoc;
static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg,
unsigned int old_sel,
unsigned int new_sel)
@ -62,6 +67,17 @@ static int anatop_regmap_enable(struct regulator_dev *reg)
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
int sel;
/*
* The vddpu has to stay at the same voltage level as vddsoc
* whenever it's about to be enabled.
*/
if (anatop_reg == vddpu && vddsoc) {
anatop_reg->sel = vddsoc->sel;
anatop_reg->bypass = vddsoc->bypass;
if (anatop_reg->bypass)
anatop_reg->rdesc.min_dropout_uV = 0;
}
sel = anatop_reg->bypass ? LDO_FET_FULL_ON : anatop_reg->sel;
return regulator_set_voltage_sel_regmap(reg, sel);
}
@ -128,6 +144,10 @@ static int anatop_regmap_set_bypass(struct regulator_dev *reg, bool enable)
sel = enable ? LDO_FET_FULL_ON : anatop_reg->sel;
anatop_reg->bypass = enable;
if (anatop_reg->bypass)
anatop_reg->rdesc.min_dropout_uV = 0;
else
anatop_reg->rdesc.min_dropout_uV = LDO_MIN_DROPOUT_UV;
return regulator_set_voltage_sel_regmap(reg, sel);
}
@ -246,7 +266,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
rdesc->linear_min_sel = min_bit_val;
rdesc->vsel_reg = control_reg;
rdesc->vsel_mask = ((1 << vol_bit_width) - 1) << vol_bit_shift;
rdesc->min_dropout_uV = 125000;
rdesc->min_dropout_uV = LDO_MIN_DROPOUT_UV;
config.dev = &pdev->dev;
config.init_data = initdata;
@ -268,6 +288,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
if (sreg->sel == LDO_FET_FULL_ON) {
sreg->sel = 0;
sreg->bypass = true;
rdesc->min_dropout_uV = 0;
}
/*
@ -275,13 +296,18 @@ static int anatop_regulator_probe(struct platform_device *pdev)
* a sane default until imx6-cpufreq was probed and changes the
* voltage to the correct value. In this case we set 1.25V.
*/
if (!sreg->sel && !strcmp(rdesc->name, "vddpu"))
if (!sreg->sel && !strcmp(rdesc->name, "vddpu")) {
sreg->sel = 22;
vddpu = sreg;
}
/* set the default voltage of the pcie phy to be 1.100v */
if (!sreg->sel && !strcmp(rdesc->name, "vddpcie"))
sreg->sel = 0x10;
if (!strcmp(rdesc->name, "vddsoc"))
vddsoc = sreg;
if (!sreg->bypass && !sreg->sel) {
dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
return -EINVAL;

View File

@ -3334,6 +3334,16 @@ static int _regulator_do_set_suspend_voltage(struct regulator_dev *rdev,
return 0;
}
static bool _regulator_is_bypass(struct regulator_dev *rdev)
{
bool bypassed = false;
if (rdev->desc->ops->get_bypass)
rdev->desc->ops->get_bypass(rdev, &bypassed);
return bypassed;
}
static int regulator_set_voltage_unlocked(struct regulator *regulator,
int min_uV, int max_uV,
suspend_state_t state)
@ -3403,8 +3413,9 @@ int regulator_set_voltage_rdev(struct regulator_dev *rdev, int min_uV,
if (rdev->supply &&
regulator_ops_is_valid(rdev->supply->rdev,
REGULATOR_CHANGE_VOLTAGE) &&
(rdev->desc->min_dropout_uV || !(rdev->desc->ops->get_voltage ||
rdev->desc->ops->get_voltage_sel))) {
(_regulator_is_bypass(rdev) || rdev->desc->min_dropout_uV ||
!(rdev->desc->ops->get_voltage ||
rdev->desc->ops->get_voltage_sel))) {
int current_supply_uV;
int selector;