ARM: dts: imx6: Specify 'anatop-enable-bit' where appropriate
PATCH 1/2 ARM: dts: imx6: Specify 'anatop-enable-bit' where appropriate
ENABLE_LINREG bit is implemented by 3P0, 1P1 and 2P5 regulators on i.MX6. This property is present in similar code in Fresscale BSP and made its way upstream in imx6ul.dtsi, so this patch adds this property to the rest of i.MX6 family for completness.
--- arch/arm/boot/dts/imx6qdl.dtsi | 3 +++ arch/arm/boot/dts/imx6sl.dtsi | 3 +++ arch/arm/boot/dts/imx6sx.dtsi | 3 +++ 3 files changed, 9 insertions(+)
arch/arm/boot/dts/imx6qdl.dtsi +3 -0
@@ -635,6 +635,7 @@ anatop-min-bit-val = <4>; anatop-min-voltage = <800000>; anatop-max-voltage = <1375000>; + anatop-enable-bit = <0>; }; regulator-3p0 {
@@ -649,6 +650,7 @@ anatop-min-bit-val = <0>; anatop-min-voltage = <2625000>; anatop-max-voltage = <3400000>; + anatop-enable-bit = <0>; }; regulator-2p5 {
@@ -663,6 +665,7 @@ anatop-min-bit-val = <0>; anatop-min-voltage = <2000000>; anatop-max-voltage = <2750000>; + anatop-enable-bit = <0>; }; reg_arm: regulator-vddcore {
arch/arm/boot/dts/imx6sl.dtsi +3 -0
@@ -522,6 +522,7 @@ anatop-min-bit-val = <4>; anatop-min-voltage = <800000>; anatop-max-voltage = <1375000>; + anatop-enable-bit = <0>; }; regulator-3p0 {
@@ -536,6 +537,7 @@ anatop-min-bit-val = <0>; anatop-min-voltage = <2625000>; anatop-max-voltage = <3400000>; + anatop-enable-bit = <0>; }; regulator-2p5 {
@@ -550,6 +552,7 @@ anatop-min-bit-val = <0>; anatop-min-voltage = <2100000>; anatop-max-voltage = <2850000>; + anatop-enable-bit = <0>; }; reg_arm: regulator-vddcore {
arch/arm/boot/dts/imx6sx.dtsi +3 -0
@@ -578,6 +578,7 @@ anatop-min-bit-val = <4>; anatop-min-voltage = <800000>; anatop-max-voltage = <1375000>; + anatop-enable-bit = <0>; }; regulator-3p0 {
@@ -592,6 +593,7 @@ anatop-min-bit-val = <0>; anatop-min-voltage = <2625000>; anatop-max-voltage = <3400000>; + anatop-enable-bit = <0>; }; regulator-2p5 {
@@ -606,6 +608,7 @@ anatop-min-bit-val = <0>; anatop-min-voltage = <2100000>; anatop-max-voltage = <2875000>; + anatop-enable-bit = <0>; }; reg_arm: regulator-vddcore {
Signature · 1 line
2.9.3
PATCH 1/1 regulator: anatop: Add support for "anatop-enable-bit"
Add code to support support for "anatop-enable-bit" device-tree property. This property translates to LINREG_ENABLE bit in real hardware and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator on i.MX7.
---
Note: "anatop-enable-bit" has already found its way into upstream tree before this patch (probably not on purpose). See imx6ul.dtsi and imx7s.dtsi for concrete examples
.../devicetree/bindings/regulator/anatop-regulator.txt | 1 + drivers/regulator/anatop-regulator.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)
Documentation/devicetree/bindings/regulator/anatop-regulator.txt +1 -0
@@ -14,6 +14,7 @@ Optional properties: - anatop-delay-bit-shift: Bit shift for the step time register - anatop-delay-bit-width: Number of bits used in the step time register - vin-supply: The supply for this regulator +- anatop-enable-bit: Regulator enable bit offset Any property defined as part of the core regulator binding, defined in regulator.txt, can also be used.
drivers/regulator/anatop-regulator.c +12 -0
@@ -301,7 +301,19 @@ static int anatop_regulator_probe(struct platform_device *pdev)return -EINVAL ; } }else { +u32 enable_bit; + rdesc->ops = &anatop_rops; + +if (!of_property_read_u32 (np,"anatop-enable-bit" , + &enable_bit)) { + anatop_rops.enable = regulator_enable_regmap; + anatop_rops.disable = regulator_disable_regmap; + anatop_rops.is_enabled = regulator_is_enabled_regmap; + + rdesc->enable_reg = sreg->control_reg; + rdesc->enable_mask =BIT (enable_bit); + } }/* register regulator */
Signature · 1 line
2.9.3
PATCH 2/2 ARM: dts: imx7s: Adjust anatop-enable-bit for 'reg_1p0d'
In reply to Andrey SmirnovIn PMU_REG_1P0Dn ENABLE_LINREG is bit 0. Bit 31 is called OVERRIDE and it serves the funtion of granting permission to GPC IP block to alter various other bit-fields of the register. The reason why this property, that trickeld here from Freescale BSP, is set up like that is because in the code it came from it is used in conjunction with a notifier handler for REGULATOR_EVENT_PRE_DO_ENABLE and REGULATOR_EVENT_PRE_DO_DISABLE events (not found in upstream kernel) that triggers GPC to start manipulating aforementioned other bitfields.
Since:
a) none of the aforementioned machinery is implemented by upstream
b) using 'anatop-enable-bit' in that capacity is a bit of a semantic stretch
simplify the situation by setting the value of 'anatop-enable-bit' to point to ENABLE_LINREG (same as i.MX6).
--- arch/arm/boot/dts/imx7s.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx7s.dtsi +1 -1
@@ -509,7 +509,7 @@ anatop-min-bit-val = <8>; anatop-min-voltage = <800000>; anatop-max-voltage = <1200000>; - anatop-enable-bit = <31>; + anatop-enable-bit = <0>; }; };
Signature · 1 line
2.9.3
Fabio Estevam
reviewerQuoted 4 lines · Andrey Smirnov
ENABLE_LINREGbit is implemented by 3P0, 1P1 and 2P5 regulators on i.MX6. This property is present in similar code in Fresscale BSP and made its way upstream inimx6ul.dtsi, so this patch adds this property to the rest of i.MX6 family for completness.
Quoted 9 lines · Fabio Estevam
Quoted 4 lines · Andrey Smirnov
ENABLE_LINREGbit is implemented by 3P0, 1P1 and 2P5 regulators on i.MX6. This property is present in similar code in Fresscale BSP and made its way upstream inimx6ul.dtsi, so this patch adds this property to the rest of i.MX6 family for completness.
Fabio:
I submitted a patch implementing this property to LKML as well, see
https://www.spinics.net/lists/kernel/msg2418471.html
All of these patches are a part of a broader attempt to add PCIe support for i.MX7, and on that platform this is a part of a 1P0D regulator which supplies PCIe PHY.
I can rebase this patch set to take your commit into account, or else let's discuss the best way to allow setting ENABLE_LINREG.
Thanks,
Andrey Smirnov
Rob Herring
maintainerRe: [PATCH] regulator: anatop: Add support for "anatop-enable-bit"
In reply to Andrey SmirnovQuoted 13 lines · Andrey Smirnov
Add code to support support for "anatop-enable-bit" device-tree property. This property translates to
LINREG_ENABLEbit in real hardware and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator on i.MX7.Cc Liam Girdwood <[email protected]>Cc Mark Brown <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>
Quoted 5 lines
---
Note: "anatop-enable-bit" has already found its way into upstream tree before this patch (probably not on purpose). See
imx6ul.dtsiandimx7s.dtsifor concrete examples
But since the kernel is not using it, it doesn't really mean we have to keep it. Yes, other OSs could be, but that's unlikely.
Documentation/devicetree/bindings/regulator/anatop-regulator.txt Optional properties: · line 17
Quoted 13 lines
.../devicetree/bindings/regulator/anatop-regulator.txt | 1 + drivers/regulator/anatop-regulator.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)Documentation/devicetree/bindings/regulator/anatop-regulator.txt +1
-0@@ -14,6 +14,7 @@ Optional properties: - anatop-delay-bit-shift: Bit shift for the step time register - anatop-delay-bit-width: Number of bits used in the step time register - vin-supply: The supply for this regulator +- anatop-enable-bit: Regulator enable bit offset
Looks like we have several properties describing the register layout. IMO, we should drop all of them and use the compatible strings to determine those instead.
Rob
Re: [PATCH] regulator: anatop: Add support for "anatop-enable-bit"
Quoted 27 lines · Rob Herring
Quoted 13 lines · Andrey Smirnov
Add code to support support for "anatop-enable-bit" device-tree property. This property translates to
LINREG_ENABLEbit in real hardware and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator on i.MX7.Cc Liam Girdwood <[email protected]>Cc Mark Brown <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>Quoted 5 lines
---
Note: "anatop-enable-bit" has already found its way into upstream tree before this patch (probably not on purpose). See
imx6ul.dtsiandimx7s.dtsifor concrete examplesBut since the kernel is not using it, it doesn't really mean we have to keep it. Yes, other OSs could be, but that's unlikely.
Quoted 4 lines
.../devicetree/bindings/regulator/anatop-regulator.txt | 1 + drivers/regulator/anatop-regulator.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)
Quoted 13 lines
Documentation/devicetree/bindings/regulator/anatop-regulator.txt Optional properties: · line 17
Quoted 9 lines
Documentation/devicetree/bindings/regulator/anatop-regulator.txt +1
-0@@ -14,6 +14,7 @@ Optional properties: - anatop-delay-bit-shift: Bit shift for the step time register - anatop-delay-bit-width: Number of bits used in the step time register - vin-supply: The supply for this regulator +- anatop-enable-bit: Regulator enable bit offsetLooks like we have several properties describing the register layout. IMO, we should drop all of them and use the compatible strings to determine those instead.
NM, I see this on each regulator...
Mark Brown
maintainerApplied "regulator: anatop: Add support for "anatop-enable-bit"" to the regulator tree
In reply to Andrey SmirnovThe patch
regulator: anatop: Add support for "anatop-enable-bit"
has been applied to the regulator tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
ca7734ad77b4ffb83a03c80b8d64d40c7ef49263Mon Sep 17 00:00:00 2001
From: Andrey Smirnov <[email protected]>
Date: Tue, 10 Jan 2017 08:30:14 -0800
Subject: [PATCH] regulator: anatop: Add support for "anatop-enable-bit"
Add code to support support for "anatop-enable-bit" device-tree property. This property translates to LINREG_ENABLE bit in real hardware and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator on i.MX7.
--- .../devicetree/bindings/regulator/anatop-regulator.txt | 1 + drivers/regulator/anatop-regulator.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)
Documentation/devicetree/bindings/regulator/anatop-regulator.txt +1 -0
@@ -14,6 +14,7 @@ Optional properties: - anatop-delay-bit-shift: Bit shift for the step time register - anatop-delay-bit-width: Number of bits used in the step time register - vin-supply: The supply for this regulator +- anatop-enable-bit: Regulator enable bit offset Any property defined as part of the core regulator binding, defined in regulator.txt, can also be used.
drivers/regulator/anatop-regulator.c +12 -0
@@ -301,7 +301,19 @@ static int anatop_regulator_probe(struct platform_device *pdev)return -EINVAL ; } }else { +u32 enable_bit; + rdesc->ops = &anatop_rops; + +if (!of_property_read_u32 (np,"anatop-enable-bit" , + &enable_bit)) { + anatop_rops.enable = regulator_enable_regmap; + anatop_rops.disable = regulator_disable_regmap; + anatop_rops.is_enabled = regulator_is_enabled_regmap; + + rdesc->enable_reg = sreg->control_reg; + rdesc->enable_mask =BIT (enable_bit); + } }/* register regulator */
Signature · 1 line
2.11.0