* [PATCH 0/3] regulator: twl6030: Fix the VMMC reset behavior @ 2019-07-25 9:45 Gregory CLEMENT 2019-07-25 9:45 ` [PATCH 1/3] dt-bindings: regulator: twl6030: Add retain-on-reset property Gregory CLEMENT ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Gregory CLEMENT @ 2019-07-25 9:45 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, linux-kernel Cc: Rob Herring, devicetree, Tony Lindgren, linux-omap, Thomas Petazzoni, Gregory CLEMENT Hello, With the TWL6030 PMIC, during reset the VMMC regulator doesn't reach 0V and only drops to 1.8V, furthermore the pulse width is under 200us whereas the SD specification expect 1ms. Fortunately, the WR_S bit allows the TWL6030 to no reset at all the VMMC during warm reset and keep the current voltage. Thanks to this workaround the SD card doesn't reach a undefined reset stage. The first patch describes the new property needed for this "feature". The second one is just a small cleanup done while I wrote the last patch, but as it was not really related to the feature itself, I made a separate patch for it. The last patch adds the feature in the driver. Gregory Gregory CLEMENT (3): dt-bindings: regulator: twl6030: Add retain-on-reset property regulator: twl6030: use variable for device node regulator: twl6030: workaround the VMMC reset behavior .../bindings/regulator/twl-regulator.txt | 7 +++++++ drivers/regulator/twl6030-regulator.c | 21 +++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] dt-bindings: regulator: twl6030: Add retain-on-reset property 2019-07-25 9:45 [PATCH 0/3] regulator: twl6030: Fix the VMMC reset behavior Gregory CLEMENT @ 2019-07-25 9:45 ` Gregory CLEMENT 2019-08-12 13:10 ` Applied "dt-bindings: regulator: twl6030: Add retain-on-reset property" to the regulator tree Mark Brown 2019-07-25 9:45 ` [PATCH 2/3] regulator: twl6030: use variable for device node Gregory CLEMENT 2019-07-25 9:45 ` [PATCH 3/3] regulator: twl6030: workaround the VMMC reset behavior Gregory CLEMENT 2 siblings, 1 reply; 7+ messages in thread From: Gregory CLEMENT @ 2019-07-25 9:45 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, linux-kernel Cc: Rob Herring, devicetree, Tony Lindgren, linux-omap, Thomas Petazzoni, Gregory CLEMENT During reset the VMMC regulator doesn't reach 0V and only drops to 1.8V, furthermore the pulse width is under 200us whereas the SD specification expect 1ms. For this 2 reasons being able to no reset at all the VMMC during warm reset and keep the current voltage is a good workaround. The TWL6030 allows this but needs to be aware of it and this configuration should also be shared with the bootloader. This is the purpose of this new property: ti,retain-on-reset Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- .../devicetree/bindings/regulator/twl-regulator.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/twl-regulator.txt b/Documentation/devicetree/bindings/regulator/twl-regulator.txt index 74a91c4f8530..549f80436deb 100644 --- a/Documentation/devicetree/bindings/regulator/twl-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/twl-regulator.txt @@ -71,3 +71,10 @@ Example: regulator-min-microvolt = <1000000>; regulator-max-microvolt = <3000000>; }; + +For twl6030 regulators/LDOs: + + - ti,retain-on-reset: Does not turn off the supplies during warm + reset. Could be needed for VMMC, as TWL6030 + reset sequence for this signal does not comply + with the SD specification. -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Applied "dt-bindings: regulator: twl6030: Add retain-on-reset property" to the regulator tree 2019-07-25 9:45 ` [PATCH 1/3] dt-bindings: regulator: twl6030: Add retain-on-reset property Gregory CLEMENT @ 2019-08-12 13:10 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2019-08-12 13:10 UTC (permalink / raw) To: Gregory CLEMENT Cc: devicetree, Liam Girdwood, linux-kernel, linux-omap, Mark Brown, Rob Herring, Thomas Petazzoni, Tony Lindgren The patch dt-bindings: regulator: twl6030: Add retain-on-reset property has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.4 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 From 906c4d5c939b4d8ebe7be357121271df7b8c9582 Mon Sep 17 00:00:00 2001 From: Gregory CLEMENT <gregory.clement@bootlin.com> Date: Thu, 25 Jul 2019 11:45:40 +0200 Subject: [PATCH] dt-bindings: regulator: twl6030: Add retain-on-reset property During reset the VMMC regulator doesn't reach 0V and only drops to 1.8V, furthermore the pulse width is under 200us whereas the SD specification expect 1ms. For this 2 reasons being able to no reset at all the VMMC during warm reset and keep the current voltage is a good workaround. The TWL6030 allows this but needs to be aware of it and this configuration should also be shared with the bootloader. This is the purpose of this new property: ti,retain-on-reset Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Link: https://lore.kernel.org/r/20190725094542.16547-2-gregory.clement@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org> --- .../devicetree/bindings/regulator/twl-regulator.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/twl-regulator.txt b/Documentation/devicetree/bindings/regulator/twl-regulator.txt index 74a91c4f8530..549f80436deb 100644 --- a/Documentation/devicetree/bindings/regulator/twl-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/twl-regulator.txt @@ -71,3 +71,10 @@ Example: regulator-min-microvolt = <1000000>; regulator-max-microvolt = <3000000>; }; + +For twl6030 regulators/LDOs: + + - ti,retain-on-reset: Does not turn off the supplies during warm + reset. Could be needed for VMMC, as TWL6030 + reset sequence for this signal does not comply + with the SD specification. -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] regulator: twl6030: use variable for device node 2019-07-25 9:45 [PATCH 0/3] regulator: twl6030: Fix the VMMC reset behavior Gregory CLEMENT 2019-07-25 9:45 ` [PATCH 1/3] dt-bindings: regulator: twl6030: Add retain-on-reset property Gregory CLEMENT @ 2019-07-25 9:45 ` Gregory CLEMENT 2019-08-12 13:10 ` Applied "regulator: twl6030: use variable for device node" to the regulator tree Mark Brown 2019-07-25 9:45 ` [PATCH 3/3] regulator: twl6030: workaround the VMMC reset behavior Gregory CLEMENT 2 siblings, 1 reply; 7+ messages in thread From: Gregory CLEMENT @ 2019-07-25 9:45 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, linux-kernel Cc: Rob Herring, devicetree, Tony Lindgren, linux-omap, Thomas Petazzoni, Gregory CLEMENT Instead of refering the full pdev->dev.of_node use a local variable. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- drivers/regulator/twl6030-regulator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c index 5fe208b381eb..d73c81542ceb 100644 --- a/drivers/regulator/twl6030-regulator.c +++ b/drivers/regulator/twl6030-regulator.c @@ -665,14 +665,14 @@ static int twlreg_probe(struct platform_device *pdev) struct regulation_constraints *c; struct regulator_dev *rdev; struct regulator_config config = { }; + struct device_node *np = pdev->dev.of_node; template = of_device_get_match_data(&pdev->dev); if (!template) return -ENODEV; id = template->desc.id; - initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node, - &template->desc); + initdata = of_get_regulator_init_data(&pdev->dev, np, &template->desc); if (!initdata) return -EINVAL; @@ -713,7 +713,7 @@ static int twlreg_probe(struct platform_device *pdev) config.dev = &pdev->dev; config.init_data = initdata; config.driver_data = info; - config.of_node = pdev->dev.of_node; + config.of_node = np; rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); if (IS_ERR(rdev)) { -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Applied "regulator: twl6030: use variable for device node" to the regulator tree 2019-07-25 9:45 ` [PATCH 2/3] regulator: twl6030: use variable for device node Gregory CLEMENT @ 2019-08-12 13:10 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2019-08-12 13:10 UTC (permalink / raw) To: Gregory CLEMENT Cc: devicetree, Liam Girdwood, linux-kernel, linux-omap, Mark Brown, Rob Herring, Thomas Petazzoni, Tony Lindgren The patch regulator: twl6030: use variable for device node has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.4 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 From 621d3ce830649d56ef1c9611e370d05ceaffd7fc Mon Sep 17 00:00:00 2001 From: Gregory CLEMENT <gregory.clement@bootlin.com> Date: Thu, 25 Jul 2019 11:45:41 +0200 Subject: [PATCH] regulator: twl6030: use variable for device node Instead of refering the full pdev->dev.of_node use a local variable. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Link: https://lore.kernel.org/r/20190725094542.16547-3-gregory.clement@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/regulator/twl6030-regulator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c index 5fe208b381eb..d73c81542ceb 100644 --- a/drivers/regulator/twl6030-regulator.c +++ b/drivers/regulator/twl6030-regulator.c @@ -665,14 +665,14 @@ static int twlreg_probe(struct platform_device *pdev) struct regulation_constraints *c; struct regulator_dev *rdev; struct regulator_config config = { }; + struct device_node *np = pdev->dev.of_node; template = of_device_get_match_data(&pdev->dev); if (!template) return -ENODEV; id = template->desc.id; - initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node, - &template->desc); + initdata = of_get_regulator_init_data(&pdev->dev, np, &template->desc); if (!initdata) return -EINVAL; @@ -713,7 +713,7 @@ static int twlreg_probe(struct platform_device *pdev) config.dev = &pdev->dev; config.init_data = initdata; config.driver_data = info; - config.of_node = pdev->dev.of_node; + config.of_node = np; rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); if (IS_ERR(rdev)) { -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] regulator: twl6030: workaround the VMMC reset behavior 2019-07-25 9:45 [PATCH 0/3] regulator: twl6030: Fix the VMMC reset behavior Gregory CLEMENT 2019-07-25 9:45 ` [PATCH 1/3] dt-bindings: regulator: twl6030: Add retain-on-reset property Gregory CLEMENT 2019-07-25 9:45 ` [PATCH 2/3] regulator: twl6030: use variable for device node Gregory CLEMENT @ 2019-07-25 9:45 ` Gregory CLEMENT 2019-08-12 13:10 ` Applied "regulator: twl6030: workaround the VMMC reset behavior" to the regulator tree Mark Brown 2 siblings, 1 reply; 7+ messages in thread From: Gregory CLEMENT @ 2019-07-25 9:45 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, linux-kernel Cc: Rob Herring, devicetree, Tony Lindgren, linux-omap, Thomas Petazzoni, Gregory CLEMENT During reset the VMMC regulator doesn't reach 0V and only drops to 1.8V, furthermore the pulse width is under 200us whereas the SD specification expect 1ms. The WR_S bit allows the TWL6030 to no reset at all the VMMC during warm reset and keep the current voltage. Thanks to this workaround the SD card doesn't reach a undefined reset stage. Actually this behavior is available for all the LDO regulator, so the driver will also allow to use it with any of these regulator. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- drivers/regulator/twl6030-regulator.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c index d73c81542ceb..b8100c3cedad 100644 --- a/drivers/regulator/twl6030-regulator.c +++ b/drivers/regulator/twl6030-regulator.c @@ -57,6 +57,9 @@ struct twlreg_info { #define VREG_BC_PROC 3 #define VREG_BC_CLK_RST 4 +/* TWL6030 LDO register values for VREG_VOLTAGE */ +#define TWL6030_VREG_VOLTAGE_WR_S BIT(7) + /* TWL6030 LDO register values for CFG_STATE */ #define TWL6030_CFG_STATE_OFF 0x00 #define TWL6030_CFG_STATE_ON 0x01 @@ -68,9 +71,10 @@ struct twlreg_info { #define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\ TWL6030_CFG_STATE_APP_SHIFT) -/* Flags for SMPS Voltage reading */ +/* Flags for SMPS Voltage reading and LDO reading*/ #define SMPS_OFFSET_EN BIT(0) #define SMPS_EXTENDED_EN BIT(1) +#define TWL_6030_WARM_RESET BIT(3) /* twl6032 SMPS EPROM values */ #define TWL6030_SMPS_OFFSET 0xB0 @@ -250,6 +254,9 @@ twl6030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector) { struct twlreg_info *info = rdev_get_drvdata(rdev); + if (info->flags & TWL_6030_WARM_RESET) + selector |= TWL6030_VREG_VOLTAGE_WR_S; + return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE, selector); } @@ -259,6 +266,9 @@ static int twl6030ldo_get_voltage_sel(struct regulator_dev *rdev) struct twlreg_info *info = rdev_get_drvdata(rdev); int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE); + if (info->flags & TWL_6030_WARM_RESET) + vsel &= ~TWL6030_VREG_VOLTAGE_WR_S; + return vsel; } @@ -710,6 +720,9 @@ static int twlreg_probe(struct platform_device *pdev) break; } + if (of_get_property(np, "ti,retain-on-reset", NULL)) + info->flags |= TWL_6030_WARM_RESET; + config.dev = &pdev->dev; config.init_data = initdata; config.driver_data = info; -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Applied "regulator: twl6030: workaround the VMMC reset behavior" to the regulator tree 2019-07-25 9:45 ` [PATCH 3/3] regulator: twl6030: workaround the VMMC reset behavior Gregory CLEMENT @ 2019-08-12 13:10 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2019-08-12 13:10 UTC (permalink / raw) To: Gregory CLEMENT Cc: devicetree, Liam Girdwood, linux-kernel, linux-omap, Mark Brown, Rob Herring, Thomas Petazzoni, Tony Lindgren The patch regulator: twl6030: workaround the VMMC reset behavior has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.4 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 From d9df0187b6edd5871255cee29128c63f134e599c Mon Sep 17 00:00:00 2001 From: Gregory CLEMENT <gregory.clement@bootlin.com> Date: Thu, 25 Jul 2019 11:45:42 +0200 Subject: [PATCH] regulator: twl6030: workaround the VMMC reset behavior During reset the VMMC regulator doesn't reach 0V and only drops to 1.8V, furthermore the pulse width is under 200us whereas the SD specification expect 1ms. The WR_S bit allows the TWL6030 to no reset at all the VMMC during warm reset and keep the current voltage. Thanks to this workaround the SD card doesn't reach a undefined reset stage. Actually this behavior is available for all the LDO regulator, so the driver will also allow to use it with any of these regulator. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Link: https://lore.kernel.org/r/20190725094542.16547-4-gregory.clement@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/regulator/twl6030-regulator.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c index d73c81542ceb..b8100c3cedad 100644 --- a/drivers/regulator/twl6030-regulator.c +++ b/drivers/regulator/twl6030-regulator.c @@ -57,6 +57,9 @@ struct twlreg_info { #define VREG_BC_PROC 3 #define VREG_BC_CLK_RST 4 +/* TWL6030 LDO register values for VREG_VOLTAGE */ +#define TWL6030_VREG_VOLTAGE_WR_S BIT(7) + /* TWL6030 LDO register values for CFG_STATE */ #define TWL6030_CFG_STATE_OFF 0x00 #define TWL6030_CFG_STATE_ON 0x01 @@ -68,9 +71,10 @@ struct twlreg_info { #define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\ TWL6030_CFG_STATE_APP_SHIFT) -/* Flags for SMPS Voltage reading */ +/* Flags for SMPS Voltage reading and LDO reading*/ #define SMPS_OFFSET_EN BIT(0) #define SMPS_EXTENDED_EN BIT(1) +#define TWL_6030_WARM_RESET BIT(3) /* twl6032 SMPS EPROM values */ #define TWL6030_SMPS_OFFSET 0xB0 @@ -250,6 +254,9 @@ twl6030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector) { struct twlreg_info *info = rdev_get_drvdata(rdev); + if (info->flags & TWL_6030_WARM_RESET) + selector |= TWL6030_VREG_VOLTAGE_WR_S; + return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE, selector); } @@ -259,6 +266,9 @@ static int twl6030ldo_get_voltage_sel(struct regulator_dev *rdev) struct twlreg_info *info = rdev_get_drvdata(rdev); int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE); + if (info->flags & TWL_6030_WARM_RESET) + vsel &= ~TWL6030_VREG_VOLTAGE_WR_S; + return vsel; } @@ -710,6 +720,9 @@ static int twlreg_probe(struct platform_device *pdev) break; } + if (of_get_property(np, "ti,retain-on-reset", NULL)) + info->flags |= TWL_6030_WARM_RESET; + config.dev = &pdev->dev; config.init_data = initdata; config.driver_data = info; -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-08-12 13:10 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-07-25 9:45 [PATCH 0/3] regulator: twl6030: Fix the VMMC reset behavior Gregory CLEMENT 2019-07-25 9:45 ` [PATCH 1/3] dt-bindings: regulator: twl6030: Add retain-on-reset property Gregory CLEMENT 2019-08-12 13:10 ` Applied "dt-bindings: regulator: twl6030: Add retain-on-reset property" to the regulator tree Mark Brown 2019-07-25 9:45 ` [PATCH 2/3] regulator: twl6030: use variable for device node Gregory CLEMENT 2019-08-12 13:10 ` Applied "regulator: twl6030: use variable for device node" to the regulator tree Mark Brown 2019-07-25 9:45 ` [PATCH 3/3] regulator: twl6030: workaround the VMMC reset behavior Gregory CLEMENT 2019-08-12 13:10 ` Applied "regulator: twl6030: workaround the VMMC reset behavior" to the regulator tree Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).