mmc: omap_hsmmc: pbias dt and cleanup
Subsystems (6)
v7 cover mmc: omap_hsmmc: pbias dt and cleanup
Balaji T K (7):
mmc: omap_hsmmc: use devm_regulator API
mmc: omap_hsmmc: handle vcc and vcc_aux independently
regulator: add pbias regulator support
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
mmc: omap_hsmmc: remove pbias workaround
.../bindings/regulator/pbias-regulator.txt | 16 ++ arch/arm/boot/dts/dra7.dtsi | 18 ++ arch/arm/boot/dts/omap2430.dtsi | 18 ++ arch/arm/boot/dts/omap3.dtsi | 18 ++ arch/arm/boot/dts/omap4.dtsi | 18 ++ arch/arm/boot/dts/omap5.dtsi | 18 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 113 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++ 11 files changed, 443 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Signature · 1 line
1.7.5.4
PATCH v7 1/7 mmc: omap_hsmmc: use devm_regulator API
Use devm_regulator API, while at it use devm_regulator_get_optional for optional vmmc_aux supply
--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -4
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) { -regulator_put (host->vcc); -regulator_put (host->vcc_aux);mmc_slot (host).set_power =NULL ; }
Signature · 1 line
1.7.5.4
Re: [PATCH v7 1/7] mmc: omap_hsmmc: use devm_regulator API
Quoted 4 lines · Balaji T K
Use
devm_regulatorAPI, while at it usedevm_regulator_get_optionalfor optionalvmmc_auxsupplySigned-off-by Balaji T K <[email protected]>
Quoted 38 lines
--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-4@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */ @@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) { -regulator_put (host->vcc); -regulator_put (host->vcc_aux);mmc_slot (host).set_power =NULL ; }Signature · 1 line
1.7.5.4
PATCH v7 2/7 mmc: omap_hsmmc: handle vcc and vcc_aux independently
In reply to Balaji T Khandle vcc and vcc_aux independently to reduce indent.
--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +23 -27
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (host->vcc) + ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd);/* Enable interface voltage rail, if needed */ if (ret ==0 && host->vcc_aux) { ret =regulator_enable (host->vcc_aux); -if (ret <0 ) +if (ret <0 && host->vcc) ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 ); }
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,/* Shut down the rail */ if (host->vcc_aux) ret =regulator_disable (host->vcc_aux); -if (!ret) { +if (host->vcc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 );
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +PTR_ERR (reg));return PTR_ERR (reg); }else { -mmc_slot (host).set_power = omap_hsmmc_set_power; host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } +mmc_slot (host).set_power = omap_hsmmc_set_power; -/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +/* Allow an aux regulator */ + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; -/* For eMMC do not power off when not in sleep state */ -if (mmc_slot (host).no_regulator_off_init) -return 0 ; -/* -* UGLY HACK: workaround regulator framework bugs. -* When the bootloader leaves a supply active, it's -* initialized with zero usecount ... and we can't -* disable it without first enabling it. Until the -* framework is fixed, we need a workaround like this -* (which is safe for MMC, but not in general). -*/ -if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { -int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init) +return 0 ; +/* +* To disable boot_on regulator, enable regulator +* to increase usecount and then disable it. +*/ +if ((host->vcc &®ulator_is_enabled (host->vcc) >0 ) || + (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { +int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +mmc_slot (host).set_power (host->dev, host->slot_id,1 , vdd); +mmc_slot (host).set_power (host->dev, host->slot_id,0 ,0 ); }return 0 ;
Signature · 1 line
1.7.5.4
Re: [PATCH v7 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently
Quoted 3 lines · Balaji T K
handle vcc and
vcc_auxindependently to reduce indent.Signed-off-by Balaji T K <[email protected]>
PATCH v7 3/7 regulator: add pbias regulator support
In reply to Balaji T Kpbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.
--- .../bindings/regulator/pbias-regulator.txt | 16 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++ 4 files changed, 287 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +16 -0
@@ -0,0 +1,16 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7 + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
drivers/regulator/Kconfig +9 -0
@@ -369,6 +369,15 @@ config REGULATOR_PALMAS on the muxing. This is handled automatically in the driver by reading the mux info from OTP. +config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on (ARCH_OMAP || COMPILE_TEST) && MFD_SYSCON + help + Say y here to support pbias regulator for mmc1:SD card i/o + on OMAP SoCs. + This driver provides support for OMAP pbias modelled + regulators. + config REGULATOR_PCAP tristate "Motorola PCAP2 regulator driver" depends on EZX_PCAP
drivers/regulator/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o +obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
drivers/regulator/pbias-regulator.c new file +261 -0
261 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [PATCH v7 3/7] regulator: add pbias regulator support
Quoted 21 lines · Balaji T K
drivers/regulator/pbias-regulator.c new file +21
-0+static const struct pbias_reg_info pbias_mmc_omap2430 = { + .enable =BIT (1 ), + .enable_mask =BIT (1 ), + .vmode =BIT (0 ), + .enable_time =100 , + .name ="pbias_mmc_omap2430" +}; + +static const struct pbias_reg_info pbias_sim_omap3 = { + .enable =BIT (9 ), + .enable_mask =BIT (9 ), + .vmode =BIT (8 ), + .enable_time =100 , + .name ="pbias_sim_omap3" +}; + +static const struct pbias_reg_info pbias_mmc_omap4 = { + .enable =BIT (26 ) |BIT (22 ), + .enable_mask =BIT (26 ) |BIT (25 ) |BIT (22 ), + .vmode =BIT (21 ), + .enable_time =10 ,
drivers/regulator/pbias-regulator.c line 152
Quoted 10 lines
drivers/regulator/pbias-regulator.c new file +10
-0+ .name = "pbias_mmc_omap4" +}; + +static const struct pbias_reg_info pbias_mmc_omap5 = { + .enable =BIT (27 ) |BIT (26 ), + .enable_mask =BIT (27 ) |BIT (25 ) |BIT (26 ), + .vmode =BIT (21 ), + .enable_time =100 , + .name ="pbias_mmc_omap5" +};
Should the enable_time be 100 for omap4 like for the others?
Other than that:
Re: [PATCH v7 3/7] regulator: add pbias regulator support
Quoted 26 lines · Tony Lindgren
Quoted 25 lines · Balaji T K
drivers/regulator/pbias-regulator.c new file +25
-0+static const struct pbias_reg_info pbias_mmc_omap2430 = { + .enable =BIT (1 ), + .enable_mask =BIT (1 ), + .vmode =BIT (0 ), + .enable_time =100 , + .name ="pbias_mmc_omap2430" +}; + +static const struct pbias_reg_info pbias_sim_omap3 = { + .enable =BIT (9 ), + .enable_mask =BIT (9 ), + .vmode =BIT (8 ), + .enable_time =100 , + .name ="pbias_sim_omap3" +}; + +static const struct pbias_reg_info pbias_mmc_omap4 = { + .enable =BIT (26 ) |BIT (22 ), + .enable_mask =BIT (26 ) |BIT (25 ) |BIT (22 ), + .vmode =BIT (21 ), + .enable_time =10 , + .name ="pbias_mmc_omap4" +}; + +static const struct pbias_reg_info pbias_mmc_omap5 = {
Quoted 9 lines
drivers/regulator/pbias-regulator.c line 152
Quoted 6 lines
drivers/regulator/pbias-regulator.c new file +6
-0+ .enable = BIT(27) | BIT(26), + .enable_mask = BIT(27) | BIT(25) | BIT(26), + .vmode = BIT(21), + .enable_time = 100, + .name = "pbias_mmc_omap5" +};Should the
enable_timebe 100 for omap4 like for the others?
enable_time of 10 is fine for omap4
Quoted 4 lines
Other than that:
Acked-by Tony Lindgren <[email protected]>
Thanks Tony
Re: [PATCH v7 3/7] regulator: add pbias regulator support
In reply to Balaji T KQuoted 27 lines · Balaji T K
pbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.Signed-off-by Balaji T K <[email protected]>--- .../bindings/regulator/pbias-regulator.txt | 16 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++ 4 files changed, 287 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.cDocumentation/devicetree/bindings/regulator/pbias-regulator.txt new file +6
-0@@ -0,0 +1,16 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7 +
Documentation/devicetree/bindings/regulator/pbias-regulator.txt line 16
Quoted 10 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +10
-0+Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
This doesn't look like a full example. I don't see the required compatible string.
[...]
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
Quoted 6 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +6
-0+static struct of_regulator_match pbias_matches[] = { + { .name = "pbias_mmc_omap2430", .driver_data = (void *)&pbias_mmc_omap2430}, + { .name = "pbias_sim_omap3", .driver_data = (void *)&pbias_sim_omap3}, + { .name = "pbias_mmc_omap4", .driver_data = (void *)&pbias_mmc_omap4}, + { .name = "pbias_mmc_omap5", .driver_data = (void *)&pbias_mmc_omap5}, +};
These weren't documented.
[...]
Quoted 19 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +19
-0+static int pbias_regulator_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct device_node *dev_node; + struct pbias_regulator_data *drvdata; + struct resource *res; + struct regulator_config cfg = { }; + struct regmap *syscon; + const struct pbias_reg_info *info; + int ret = 0; + int count, idx, data_idx = 0; + + count = of_regulator_match(&pdev->dev, np, pbias_matches, + PBIAS_NUM_REGS); + if (count < 0) + return count; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data) + * count, GFP_KERNEL);
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
Quoted 10 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +10
-0+ if (drvdata == NULL) { + dev_err(&pdev->dev, "Failed to allocate device data\n"); + return -ENOMEM; + } + + dev_node = of_get_parent(np); + if (!dev_node) + return -ENODEV; + + syscon = syscon_node_to_regmap(dev_node);
If we're relying on a particular parent node, that _must_ be described in the binding.
Quoted 6 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +6
-0+ of_node_put(dev_node); + if (IS_ERR(syscon)) + return PTR_ERR(syscon); + + cfg.dev = &pdev->dev; +
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
Quoted 10 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +10
-0+ for (idx = 0; idx < PBIAS_NUM_REGS, data_idx < count; idx++) { + if (!pbias_matches[idx].init_data || + !pbias_matches[idx].of_node) + continue; + + info = pbias_matches[idx].driver_data; + if (!info) + return -ENODEV; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
A reg entry was not mentioned in the binding.
Why is this inside the loop? It's grabbing the reg from the parent, not each of the children it's walking over.
Thanks,
Mark.
Re: [PATCH v7 3/7] regulator: add pbias regulator support
Quoted 33 lines · Mark Rutland
Quoted 32 lines · Balaji T K
pbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.Signed-off-by Balaji T K <[email protected]>--- .../bindings/regulator/pbias-regulator.txt | 16 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++ 4 files changed, 287 insertions(+), 0 deletions(-)create mode 100644
Documentation/devicetree/bindings/regulator/pbias-regulator.txtcreate mode 100644drivers/regulator/pbias-regulator.cDocumentation/devicetree/bindings/regulator/pbias-regulator.txt new file +11
-0@@ -0,0 +1,16 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7 + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: +
Quoted 9 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt line 16
Quoted 5 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +5
-0+ pbias_regulator: pbias_regulator { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };This doesn't look like a full example. I don't see the required compatible string.
Thanks for pointing, I missed it, will add to example.
Quoted 10 lines
[...]
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
Quoted 6 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +6
-0+static struct of_regulator_match pbias_matches[] = { + { .name = "pbias_mmc_omap2430", .driver_data = (void *)&pbias_mmc_omap2430}, + { .name = "pbias_sim_omap3", .driver_data = (void *)&pbias_sim_omap3}, + { .name = "pbias_mmc_omap4", .driver_data = (void *)&pbias_mmc_omap4}, + { .name = "pbias_mmc_omap5", .driver_data = (void *)&pbias_mmc_omap5}, +};These weren't documented.
Ok, will add it
Quoted 27 lines
[...]
Quoted 24 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +24
-0+static int pbias_regulator_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct device_node *dev_node; + struct pbias_regulator_data *drvdata; + struct resource *res; + struct regulator_config cfg = { }; + struct regmap *syscon; + const struct pbias_reg_info *info; + int ret = 0; + int count, idx, data_idx = 0; + + count = of_regulator_match(&pdev->dev, np, pbias_matches, + PBIAS_NUM_REGS); + if (count < 0) + return count; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data) + * count, GFP_KERNEL); + if (drvdata == NULL) { + dev_err(&pdev->dev, "Failed to allocate device data\n"); + return -ENOMEM; + } +
Quoted 8 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
Quoted 5 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +5
-0+ dev_node = of_get_parent(np); + if (!dev_node) + return -ENODEV; + + syscon = syscon_node_to_regmap(dev_node);If we're relying on a particular parent node, that _must_ be described in the binding.
Ok
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +10
-0+ of_node_put(dev_node); + if (IS_ERR(syscon)) + return PTR_ERR(syscon); + + cfg.dev = &pdev->dev; + + for (idx = 0; idx < PBIAS_NUM_REGS, data_idx < count; idx++) { + if (!pbias_matches[idx].init_data || + !pbias_matches[idx].of_node) + continue;
Quoted 8 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt
Quoted 6 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +6
-0+ + info = pbias_matches[idx].driver_data; + if (!info) + return -ENODEV; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);A reg entry was not mentioned in the binding.
Ok, will add it
Quoted 4 lines
Why is this inside the loop? It's grabbing the reg from the parent, not each of the children it's walking over.
The reg property is same for each children and is needed for each regulator. It is for the case where a single register can control 2 regulators as in OMAP3 (mmc and sim). In other SoCs, only one regulator of "ti,pbias-omap" compatible exists in the pbias register.
Quoted 3 lines
Thanks,
Mark.
PATCH v7 4/7 mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
In reply to Balaji T KIn DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +39 -0
@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power; + } + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }
@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;
@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host);
Signature · 1 line
1.7.5.4
Re: [PATCH v7 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
Hi
Quoted 33 lines · Balaji T K
In DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)drivers/mmc/host/omap_hsmmc.c +6
-0@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known @@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 285
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c +5
-0@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ;
you should return error?
Quoted 16 lines
drivers/mmc/host/omap_hsmmc.c +9
-0+ } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to @@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 338
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10
-0+ ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power;
Is this an error condition? Do you need this flag?
Mcihael
Quoted 36 lines
drivers/mmc/host/omap_hsmmc.c +9
-1+ } + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host); --1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
Quoted 67 lines · Michael Trimarchi
Hi
Quoted 33 lines · Balaji T K
In DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)drivers/mmc/host/omap_hsmmc.c +6
-0@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known @@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 285
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c +5
-0@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ;you should return error?
Quoted 20 lines
drivers/mmc/host/omap_hsmmc.c +13
-0+ } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to @@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power;
Quoted 9 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 338
Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c +6
-0+ +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power;Is this an error condition? Do you need this flag?
Hi,
pbias_enabled flag is used to balance regulator_enable/regulator_disable, otherwise regulator might be kept enabled base on to use count.
PATCH v7 5/7 ARM: dts: add pbias dt node
In reply to Balaji T KAdd pbias regulator node as a child of system control module - syscon.
--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +18 -0
@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;
@@ -485,6 +502,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap2430.dtsi +18 -0
@@ -29,6 +29,23 @@ pinctrl-single,function-mask = <0x3f>; }; + omap2_scm_general: tisyscon@49002270 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x49002270 0x240>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x230 0x4>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +200,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap3.dtsi +18 -0
@@ -137,6 +137,23 @@ pinctrl-single,function-mask = <0xff1f>; }; + omap3_scm_general: tisyscon@48002270 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x48002270 0x2f0>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x2b0 0x4>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -351,6 +368,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap4.dtsi +18 -0
@@ -134,6 +134,23 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap4_padconf_global: tisyscon@4a1005a0 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4a1005a0 0x170>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + pbias_mmc_reg: pbias_mmc_omap4 { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -367,6 +384,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap5.dtsi +18 -0
@@ -130,6 +130,23 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap5_padconf_global: tisyscon@4a002da0 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002da0 0xec>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -409,6 +426,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 4 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>
Benoit should queue this:
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
In reply to Balaji T KQuoted 17 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 5 lines
arch/arm/boot/dts/dra7.dtsi +2
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";
Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Quoted 5 lines
arch/arm/boot/dts/dra7.dtsi +5
-0+ reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator {
arch/arm/boot/dts/dra7.dtsi line 129
Quoted 10 lines
arch/arm/boot/dts/dra7.dtsi +10
-0+ compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; +
Thanks,
Mark.
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 21 lines · Mark Rutland
Quoted 20 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; };
Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 2 lines
arch/arm/boot/dts/dra7.dtsi +2
-0+ dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Hi Mark,
Actually ti,control-syscon driver does not exist, so I can remove it, and simple-bus is needed for child creation.
Quoted 20 lines
Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi +5
-0+ reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator {arch/arm/boot/dts/dra7.dtsi line 129
Quoted 10 lines
arch/arm/boot/dts/dra7.dtsi +10
-0+ compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; +Thanks,
Mark.
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 29 lines · Balaji T K
Quoted 21 lines · Mark Rutland
Quoted 20 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; };Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 2 lines
arch/arm/boot/dts/dra7.dtsi +2
-0+ dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Quoted 4 lines
Hi Mark,
Actually ti,control-syscon driver does not exist, so I can remove it, and simple-bus is needed for child creation.
This still shows up as a syscon node, with a reg property, and syscon is not an extension of simple-bus.
There are properties in the parent node that children depend on, and that makes me wary of describing it as a simple bus. I'd expect to be able to move child nodes out of a simple-bus if ranges provided an idmap, and I can't do that here.
Thanks,
Mark.
Quoted 22 lines
Quoted 21 lines
Quoted 7 lines
arch/arm/boot/dts/dra7.dtsi +5
-0+ reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator {arch/arm/boot/dts/dra7.dtsi line 129
Quoted 10 lines
arch/arm/boot/dts/dra7.dtsi +10
-0+ compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; +Thanks,
Mark.
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 35 lines · Mark Rutland
Quoted 29 lines · Balaji T K
Quoted 21 lines · Mark Rutland
Quoted 20 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; };Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 2 lines
arch/arm/boot/dts/dra7.dtsi +2
-0+ dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Quoted 4 lines
Hi Mark,
Actually ti,control-syscon driver does not exist, so I can remove it, and simple-bus is needed for child creation.
Quoted 8 lines
This still shows up as a syscon node, with a reg property, and syscon is not an extension of simple-bus.
There are properties in the parent node that children depend on, and that makes me wary of describing it as a simple bus. I'd expect to be able to move child nodes out of a simple-bus if ranges provided an idmap, and I can't do that here.
Hi Mark,
Not sure if I am understanding here, can you please add more info.
Quoted 25 lines
Thanks,
Mark.Quoted 22 lines
Quoted 21 lines
Quoted 7 lines
arch/arm/boot/dts/dra7.dtsi +5
-0+ reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator {arch/arm/boot/dts/dra7.dtsi line 129
Quoted 10 lines
arch/arm/boot/dts/dra7.dtsi +10
-0+ compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; +Thanks,
Mark.
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 39 lines · Balaji T K
Quoted 38 lines · Mark Rutland
Quoted 29 lines · Balaji T K
Quoted 21 lines · Mark Rutland
Quoted 20 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; };Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 2 lines
arch/arm/boot/dts/dra7.dtsi +2
-0+ dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Quoted 4 lines
Hi Mark,
Actually ti,control-syscon driver does not exist, so I can remove it, and simple-bus is needed for child creation.
This still shows up as a syscon node, with a reg property, and syscon is not an extension of simple-bus.
Quoted 9 lines
Quoted 5 lines
There are properties in the parent node that children depend on, and that makes me wary of describing it as a simple bus. I'd expect to be able to move child nodes out of a simple-bus if ranges provided an idmap, and I can't do that here.
Hi Mark,
Not sure if I am understanding here, can you please add more info.
Hi Mark,
From Documentation/devicetree/bindings.. , I could get below info about simple-bus
- "simple-bus" compatible value (to ensure creation of the children)
compatible = "simple-bus";
Quoted 27 lines
Quoted 26 lines
Thanks,
Mark.Quoted 22 lines
Quoted 21 lines
Quoted 7 lines
arch/arm/boot/dts/dra7.dtsi +5
-0+ reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator {arch/arm/boot/dts/dra7.dtsi line 129
Quoted 10 lines
arch/arm/boot/dts/dra7.dtsi +10
-0+ compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; +Thanks,
Mark.
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 40 lines · Balaji T K
Quoted 39 lines · Balaji T K
Quoted 38 lines · Mark Rutland
Quoted 29 lines · Balaji T K
Quoted 21 lines · Mark Rutland
Quoted 20 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; };Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 2 lines
arch/arm/boot/dts/dra7.dtsi +2
-0+ dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Quoted 4 lines
Hi Mark,
Actually ti,control-syscon driver does not exist, so I can remove it, and simple-bus is needed for child creation.
This still shows up as a syscon node, with a reg property, and syscon is not an extension of simple-bus.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
There are properties in the parent node that children depend on, and that makes me wary of describing it as a simple bus. I'd expect to be able to move child nodes out of a simple-bus if ranges provided an idmap, and I can't do that here.
Hi Mark,
Not sure if I am understanding here, can you please add more info.
A node's compatible string list describes the set of devices (or rather descriptions of devices) with which it is compatible. The list goes from most specific to least specific. The idea is that an OS reads through the list until it finds a string it knows how to handle, then treats the node as that.
Ignoring "ti,control-syscon", the node has both "syscon" and "simple-bus". Given you expect the OS to recognise "syscon", you should _not_ expect it to also treat the node as "simple-bus". Doing so is an abuse of the property and current Linux implementation details.
The "syscon" binding is not a more specific version of "simple-bus". They imply completely different things.
Either make a ti,control-syscon driver that probes the child nodes, or move the child nodes out and give them a phandle to the dra7_ctrl_general node that they can parse. I'd prefer the latter as relies on fewer topology details, is as easy to implement as your current parent node parsing, and is easier to extend in future.
Quoted 6 lines
Quoted 1 line
Hi Mark,
From
Documentation/devicetree/bindings.. , I could get below info about simple-bus
- "simple-bus" compatible value (to ensure creation of the children)compatible = "simple-bus";
That's from the vexpress binding description of the smb node?
In that case, the smb node _is_ a simple-bus. It has no nonstandard properties, and the child nodes aren't reading arbitrary properties out of the smb node.
There the simple-bus is used to remap addresses of child nodes via ranges. It does represent a simple bus, and that's all the OS is expected to know.
Thanks,
Mark.
Re: [PATCH v7 5/7] ARM: dts: add pbias dt node
Quoted 61 lines · Mark Rutland
Quoted 40 lines · Balaji T K
Quoted 39 lines · Balaji T K
Quoted 38 lines · Mark Rutland
Quoted 29 lines · Balaji T K
Quoted 21 lines · Mark Rutland
Quoted 20 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; };Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi line 114
Quoted 2 lines
arch/arm/boot/dts/dra7.dtsi +2
-0+ dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "ti,control-syscon", "syscon", "simple-bus";Please, don't use simple-bus like that. The components below this node depend on it. It is _NOT_ a simple bus. Make the ti,control-syscon driver probe it's children.
Quoted 4 lines
Hi Mark,
Actually ti,control-syscon driver does not exist, so I can remove it, and simple-bus is needed for child creation.
This still shows up as a syscon node, with a reg property, and syscon is not an extension of simple-bus.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
There are properties in the parent node that children depend on, and that makes me wary of describing it as a simple bus. I'd expect to be able to move child nodes out of a simple-bus if ranges provided an idmap, and I can't do that here.
Hi Mark,
Not sure if I am understanding here, can you please add more info.
A node's compatible string list describes the set of devices (or rather descriptions of devices) with which it is compatible. The list goes from most specific to least specific. The idea is that an OS reads through the list until it finds a string it knows how to handle, then treats the node as that.
Ignoring "ti,control-syscon", the node has both "syscon" and "simple-bus". Given you expect the OS to recognise "syscon", you should _not_ expect it to also treat the node as "simple-bus". Doing so is an abuse of the property and current Linux implementation details.
Quoted 9 lines
The "syscon" binding is not a more specific version of "simple-bus". They imply completely different things.
Either make a ti,control-syscon driver that probes the child nodes, or move the child nodes out and give them a phandle to the
dra7_ctrl_generalnode that they can parse. I'd prefer the latter as relies on fewer topology details, is as easy to implement as your current parent node parsing, and is easier to extend in future.
Thanks Mark,
phandle to syscon is fine for me.
PATCH v7 6/7 ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
In reply to Balaji T KEnable REGULATOR_PBIAS needed for SD card on most OMAPs.
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/omap2plus_defconfig +2 -0
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v7 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
Quoted 3 lines · Balaji T K
Enable
REGULATOR_PBIASneeded for SD card on most OMAPs.Signed-off-by Balaji T K <[email protected]>
I can queue this one once the pieces are merged.
Tony
Quoted 26 lines
arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/configs/omap2plus_defconfig +2
-0@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=ySignature · 1 line
1.7.5.4
PATCH v7 7/7 mmc: omap_hsmmc: remove pbias workaround
In reply to Balaji T Kremove pbias workaround
--- drivers/mmc/host/omap_hsmmc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -19
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled; -int pbias_disable;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc)return 0 ; -/* -* With DT, never turn OFF the regulator for MMC1. This is because -* the pbias cell programming support is still missing when -* booting with Device tree -*/ -if (host->pbias_disable && !vdd) -return 0 ;if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd);
@@ -1541,13 +1533,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)* of external transceiver; but they all handle 1.8V. */ if ((OMAP_HSMMC_READ (host->base,HCTL ) &SDVSDET ) && - (ios->vdd ==DUAL_VOLT_OCR_BIT ) && -/* -* With pbias cell programming missing, this -* can't be allowed on MMC1 when booting with device -* tree. -*/ - !host->pbias_disable) { + (ios->vdd ==DUAL_VOLT_OCR_BIT )) {/* * The mmc_select_voltage fn of the core does * not seem to set the power_mode to
@@ -1880,10 +1866,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_context_save (host); -/* This can be removed once we support PBIAS with DT */ -if (host->dev->of_node && res->start ==0x4809c000 ) - host->pbias_disable =1 ; - host->dbclk =clk_get (&pdev->dev,"mmchsdb_fck" );/* * MMC can still work without debounce clock.
Signature · 1 line
1.7.5.4
Re: [PATCH v7 7/7] mmc: omap_hsmmc: remove pbias workaround
Quoted 3 lines · Balaji T K
remove pbias workaround
Signed-off-by Balaji T K <[email protected]>
v8 cover mmc: omap_hsmmc: pbias dt and cleanup
In reply to Balaji T KFew cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.
Balaji T K (7):
mmc: omap_hsmmc: use devm_regulator API
mmc: omap_hsmmc: handle vcc and vcc_aux independently
regulator: add pbias regulator support
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
mmc: omap_hsmmc: remove pbias workaround
.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 18 ++ arch/arm/boot/dts/omap2430.dtsi | 18 ++ arch/arm/boot/dts/omap3.dtsi | 18 ++ arch/arm/boot/dts/omap4.dtsi | 18 ++ arch/arm/boot/dts/omap5.dtsi | 18 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 113 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++ 11 files changed, 454 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Signature · 1 line
1.7.5.4
PATCH v8 1/7 mmc: omap_hsmmc: use devm_regulator API
Use devm_regulator API, while at it use devm_regulator_get_optional for optional vmmc_aux supply
--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -4
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) { -regulator_put (host->vcc); -regulator_put (host->vcc_aux);mmc_slot (host).set_power =NULL ; }
Signature · 1 line
1.7.5.4
Re: [PATCH v8 1/7] mmc: omap_hsmmc: use devm_regulator API
Hi,
Quoted 32 lines · Balaji T K
Use
devm_regulatorAPI, while at it usedevm_regulator_get_optionalfor optionalvmmc_auxsupplySigned-off-by Balaji T K <[email protected]>Acked-by Tony Lindgren <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-2@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 367
Quoted 2 lines
drivers/mmc/host/omap_hsmmc.c +0
-0@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host)
since this function does nothing now, you could pretty much remove it and move set_power assignment to ->remove() directly. No strong feelings though.
Signature · 1 line
balbi
Re: [PATCH v8 1/7] mmc: omap_hsmmc: use devm_regulator API
Quoted 33 lines · Felipe Balbi
Hi,
Quoted 30 lines · Balaji T K
Use
devm_regulatorAPI, while at it usedevm_regulator_get_optionalfor optionalvmmc_auxsupplySigned-off-by Balaji T K <[email protected]>Acked-by Tony Lindgren <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-2@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;
Quoted 9 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 367
Quoted 4 lines
drivers/mmc/host/omap_hsmmc.c +0
-0/* For eMMC do not power off when not in sleep state */ @@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host)since this function does nothing now, you could pretty much remove it and move
set_powerassignment to ->remove() directly. No strong feelings though.
Hi Felipe,
omap_hsmmc_reg_put is used in probe error handling path in addition to .remove(), so I would keep it for now to balance omap_hsmmc_reg_get.
Re: [PATCH v8 1/7] mmc: omap_hsmmc: use devm_regulator API
hi,
Quoted 43 lines · Balaji T K
Quoted 33 lines · Felipe Balbi
Hi,
Quoted 30 lines · Balaji T K
Use
devm_regulatorAPI, while at it usedevm_regulator_get_optionalfor optionalvmmc_auxsupplySigned-off-by Balaji T K <[email protected]>Acked-by Tony Lindgren <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-2@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;Quoted 9 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 367
Quoted 4 lines
drivers/mmc/host/omap_hsmmc.c +0
-0/* For eMMC do not power off when not in sleep state */ @@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host)since this function does nothing now, you could pretty much remove it and move
set_powerassignment to ->remove() directly. No strong feelings though.
Quoted 4 lines
Hi Felipe,
omap_hsmmc_reg_putis used in probe error handling path in addition to .remove(), so I would keep it for now to balanceomap_hsmmc_reg_get.
right, but it does nothing but setting set_power to NULL ;-)
Signature · 1 line
balbi
PATCH v8 2/7 mmc: omap_hsmmc: handle vcc and vcc_aux independently
In reply to Balaji T Khandle vcc and vcc_aux independently to reduce indent.
--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +23 -27
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (host->vcc) + ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd);/* Enable interface voltage rail, if needed */ if (ret ==0 && host->vcc_aux) { ret =regulator_enable (host->vcc_aux); -if (ret <0 ) +if (ret <0 && host->vcc) ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 ); }
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,/* Shut down the rail */ if (host->vcc_aux) ret =regulator_disable (host->vcc_aux); -if (!ret) { +if (host->vcc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 );
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +PTR_ERR (reg));return PTR_ERR (reg); }else { -mmc_slot (host).set_power = omap_hsmmc_set_power; host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } +mmc_slot (host).set_power = omap_hsmmc_set_power; -/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +/* Allow an aux regulator */ + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; -/* For eMMC do not power off when not in sleep state */ -if (mmc_slot (host).no_regulator_off_init) -return 0 ; -/* -* UGLY HACK: workaround regulator framework bugs. -* When the bootloader leaves a supply active, it's -* initialized with zero usecount ... and we can't -* disable it without first enabling it. Until the -* framework is fixed, we need a workaround like this -* (which is safe for MMC, but not in general). -*/ -if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { -int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init) +return 0 ; +/* +* To disable boot_on regulator, enable regulator +* to increase usecount and then disable it. +*/ +if ((host->vcc &®ulator_is_enabled (host->vcc) >0 ) || + (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { +int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +mmc_slot (host).set_power (host->dev, host->slot_id,1 , vdd); +mmc_slot (host).set_power (host->dev, host->slot_id,0 ,0 ); }return 0 ;
Signature · 1 line
1.7.5.4
PATCH v8 3/7 regulator: add pbias regulator support
In reply to Balaji T Kpbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.
--- .../bindings/regulator/pbias-regulator.txt | 27 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 261 ++++++++++++++++++++ 4 files changed, 298 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +27 -0
@@ -0,0 +1,27 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7. +- reg: pbias register offset from syscon base and size of pbias register. +- regulator-name : should be + pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs + pbias_sim_omap3 for OMAP3 SoCs + pbias_mmc_omap4 for OMAP4 SoCs + pbias_mmc_omap5 for OMAP5 and DRA7 SoC + +pbias_regulator node should be a child of syscon node (system control module) + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
drivers/regulator/Kconfig +9 -0
@@ -369,6 +369,15 @@ config REGULATOR_PALMAS on the muxing. This is handled automatically in the driver by reading the mux info from OTP. +config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on (ARCH_OMAP || COMPILE_TEST) && MFD_SYSCON + help + Say y here to support pbias regulator for mmc1:SD card i/o + on OMAP SoCs. + This driver provides support for OMAP pbias modelled + regulators. + config REGULATOR_PCAP tristate "Motorola PCAP2 regulator driver" depends on EZX_PCAP
drivers/regulator/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o +obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
drivers/regulator/pbias-regulator.c new file +261 -0
261 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [PATCH v8 3/7] regulator: add pbias regulator support
Quoted 4 lines · Balaji T K
pbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.
PATCH v8 4/7 mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
In reply to Balaji T KIn DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +39 -0
@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power; + } + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }
@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;
@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host);
Signature · 1 line
1.7.5.4
PATCH v8 5/7 ARM: dts: add pbias dt node
In reply to Balaji T KAdd pbias regulator node as a child of system control module - syscon.
--- arch/arm/boot/dts/dra7.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 18 ++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +18 -0
@@ -110,6 +110,23 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "syscon", "simple-bus"; + reg = <0x4a002e00 0x7c>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;
@@ -485,6 +502,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap2430.dtsi +18 -0
@@ -29,6 +29,23 @@ pinctrl-single,function-mask = <0x3f>; }; + omap2_scm_general: tisyscon@49002270 { + compatible = "syscon", "simple-bus"; + reg = <0x49002270 0x240>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x230 0x4>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +200,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap3.dtsi +18 -0
@@ -137,6 +137,23 @@ pinctrl-single,function-mask = <0xff1f>; }; + omap3_scm_general: tisyscon@48002270 { + compatible = "syscon", "simple-bus"; + reg = <0x48002270 0x2f0>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x2b0 0x4>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -351,6 +368,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap4.dtsi +18 -0
@@ -134,6 +134,23 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap4_padconf_global: tisyscon@4a1005a0 { + compatible = "syscon", "simple-bus"; + reg = <0x4a1005a0 0x170>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + pbias_mmc_reg: pbias_mmc_omap4 { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -367,6 +384,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap5.dtsi +18 -0
@@ -130,6 +130,23 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap5_padconf_global: tisyscon@4a002da0 { + compatible = "syscon", "simple-bus"; + reg = <0x4A002da0 0xec>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -409,6 +426,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
PATCH v8 6/7 ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
In reply to Balaji T KEnable REGULATOR_PBIAS needed for SD card on most OMAPs.
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/omap2plus_defconfig +2 -0
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y
Signature · 1 line
1.7.5.4
PATCH v8 7/7 mmc: omap_hsmmc: remove pbias workaround
In reply to Balaji T Kremove pbias workaround
--- drivers/mmc/host/omap_hsmmc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -19
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled; -int pbias_disable;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc)return 0 ; -/* -* With DT, never turn OFF the regulator for MMC1. This is because -* the pbias cell programming support is still missing when -* booting with Device tree -*/ -if (host->pbias_disable && !vdd) -return 0 ;if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd);
@@ -1541,13 +1533,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)* of external transceiver; but they all handle 1.8V. */ if ((OMAP_HSMMC_READ (host->base,HCTL ) &SDVSDET ) && - (ios->vdd ==DUAL_VOLT_OCR_BIT ) && -/* -* With pbias cell programming missing, this -* can't be allowed on MMC1 when booting with device -* tree. -*/ - !host->pbias_disable) { + (ios->vdd ==DUAL_VOLT_OCR_BIT )) {/* * The mmc_select_voltage fn of the core does * not seem to set the power_mode to
@@ -1880,10 +1866,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_context_save (host); -/* This can be removed once we support PBIAS with DT */ -if (host->dev->of_node && res->start ==0x4809c000 ) - host->pbias_disable =1 ; - host->dbclk =clk_get (&pdev->dev,"mmchsdb_fck" );/* * MMC can still work without debounce clock.
Signature · 1 line
1.7.5.4
v9 cover mmc: omap_hsmmc: pbias dt and cleanup
In reply to Balaji T KFew cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.
v9 changes:
remove simple-bus, add phandle for syscon in dt node
Balaji T K (7):
mmc: omap_hsmmc: use devm_regulator API
mmc: omap_hsmmc: handle vcc and vcc_aux independently
regulator: add pbias regulator support
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
mmc: omap_hsmmc: remove pbias workaround
.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 17 ++ arch/arm/boot/dts/omap2430.dtsi | 17 ++ arch/arm/boot/dts/omap3.dtsi | 17 ++ arch/arm/boot/dts/omap4.dtsi | 17 ++ arch/arm/boot/dts/omap5.dtsi | 17 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 113 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 11 files changed, 443 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Signature · 1 line
1.7.5.4
PATCH v9 1/7 mmc: omap_hsmmc: use devm_regulator API
Use devm_regulator API, while at it use devm_regulator_get_optional for optional vmmc_aux supply
--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -4
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) { -regulator_put (host->vcc); -regulator_put (host->vcc_aux);mmc_slot (host).set_power =NULL ; }
Signature · 1 line
1.7.5.4
PATCH v9 2/7 mmc: omap_hsmmc: handle vcc and vcc_aux independently
In reply to Balaji T Khandle vcc and vcc_aux independently to reduce indent.
--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +23 -27
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (host->vcc) + ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd);/* Enable interface voltage rail, if needed */ if (ret ==0 && host->vcc_aux) { ret =regulator_enable (host->vcc_aux); -if (ret <0 ) +if (ret <0 && host->vcc) ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 ); }
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,/* Shut down the rail */ if (host->vcc_aux) ret =regulator_disable (host->vcc_aux); -if (!ret) { +if (host->vcc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 );
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +PTR_ERR (reg));return PTR_ERR (reg); }else { -mmc_slot (host).set_power = omap_hsmmc_set_power; host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } +mmc_slot (host).set_power = omap_hsmmc_set_power; -/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +/* Allow an aux regulator */ + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; -/* For eMMC do not power off when not in sleep state */ -if (mmc_slot (host).no_regulator_off_init) -return 0 ; -/* -* UGLY HACK: workaround regulator framework bugs. -* When the bootloader leaves a supply active, it's -* initialized with zero usecount ... and we can't -* disable it without first enabling it. Until the -* framework is fixed, we need a workaround like this -* (which is safe for MMC, but not in general). -*/ -if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { -int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init) +return 0 ; +/* +* To disable boot_on regulator, enable regulator +* to increase usecount and then disable it. +*/ +if ((host->vcc &®ulator_is_enabled (host->vcc) >0 ) || + (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { +int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +mmc_slot (host).set_power (host->dev, host->slot_id,1 , vdd); +mmc_slot (host).set_power (host->dev, host->slot_id,0 ,0 ); }return 0 ;
Signature · 1 line
1.7.5.4
PATCH v9 3/7 regulator: add pbias regulator support
In reply to Balaji T Kpbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.
---
v9:
use syscon phandle lookup method
.../bindings/regulator/pbias-regulator.txt | 27 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 4 files changed, 292 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +27 -0
@@ -0,0 +1,27 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7. +- reg: pbias register offset from syscon base and size of pbias register. +- syscon : phandle of the system control module +- regulator-name : should be + pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs + pbias_sim_omap3 for OMAP3 SoCs + pbias_mmc_omap4 for OMAP4 SoCs + pbias_mmc_omap5 for OMAP5 and DRA7 SoC + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
drivers/regulator/Kconfig +9 -0
@@ -369,6 +369,15 @@ config REGULATOR_PALMAS on the muxing. This is handled automatically in the driver by reading the mux info from OTP. +config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on (ARCH_OMAP || COMPILE_TEST) && MFD_SYSCON + help + Say y here to support pbias regulator for mmc1:SD card i/o + on OMAP SoCs. + This driver provides support for OMAP pbias modelled + regulators. + config REGULATOR_PCAP tristate "Motorola PCAP2 regulator driver" depends on EZX_PCAP
drivers/regulator/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o +obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
drivers/regulator/pbias-regulator.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v9 4/7 mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
In reply to Balaji T KIn DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +39 -0
@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power; + } + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }
@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;
@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host);
Signature · 1 line
1.7.5.4
Re: [PATCH v9 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
Hi
Quoted 57 lines · Balaji T K
In DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)drivers/mmc/host/omap_hsmmc.c +20
-0@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known @@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to @@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 338
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10
-0+ ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power;
why you a goto to error_set_power if the regulator enable was a succes? and if pbias_enabled is used for verify if is already enabled. Is the same to useregulator_is_enabled?
Michael
Quoted 36 lines
drivers/mmc/host/omap_hsmmc.c +9
-1+ } + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host); --1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
Quoted 64 lines · Michael Trimarchi
Hi
Quoted 61 lines · Balaji T K
In DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)drivers/mmc/host/omap_hsmmc.c +24
-0@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known @@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to @@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power;
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 338
Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c +6
-0+ +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) { + host->pbias_enabled =1 ; + goto error_set_power;why you a goto to
error_set_powerif the regulator enable was a succes?
Hi,
My bad
yes, goto error_set_power is not needed when regulator got enabled. will remove it.
Quoted 4 lines
and if
pbias_enabledis used for verify if is already enabled. Is the same to useregulator_is_enabled?
pbias_enabled is used to verify if it already enabled or not and it is used to balance regulator_enable/disable.
Quoted 38 lines
Michael
Quoted 36 lines
drivers/mmc/host/omap_hsmmc.c +9
-1+ } + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }@@ -342,6 +377,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;@@ -1808,6 +1846,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host); --1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v9 5/7 ARM: dts: add pbias dt node
In reply to Balaji T KAdd pbias regulator node as a child of system control module - syscon.
--- arch/arm/boot/dts/dra7.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 17 +++++++++++++++++ 5 files changed, 85 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +17 -0
@@ -110,6 +110,22 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "syscon", "simple-bus"; + reg = <0x4a002e00 0x7c>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&dra7_ctrl_general>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;
@@ -485,6 +501,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap2430.dtsi +17 -0
@@ -29,6 +29,22 @@ pinctrl-single,function-mask = <0x3f>; }; + omap2_scm_general: tisyscon@49002270 { + compatible = "syscon", "simple-bus"; + reg = <0x49002270 0x240>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x230 0x4>; + syscon = <&omap2_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +199,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap3.dtsi +17 -0
@@ -137,6 +137,22 @@ pinctrl-single,function-mask = <0xff1f>; }; + omap3_scm_general: tisyscon@48002270 { + compatible = "syscon", "simple-bus"; + reg = <0x48002270 0x2f0>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x2b0 0x4>; + syscon = <&omap3_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -351,6 +367,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap4.dtsi +17 -0
@@ -134,6 +134,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap4_padconf_global: tisyscon@4a1005a0 { + compatible = "syscon", "simple-bus"; + reg = <0x4a1005a0 0x170>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap4_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap4 { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -367,6 +383,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap5.dtsi +17 -0
@@ -130,6 +130,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap5_padconf_global: tisyscon@4a002da0 { + compatible = "syscon"; + reg = <0x4A002da0 0xec>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -409,6 +425,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
PATCH v9 6/7 ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
In reply to Balaji T KEnable REGULATOR_PBIAS needed for SD card on most OMAPs.
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/omap2plus_defconfig +2 -0
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y
Signature · 1 line
1.7.5.4
PATCH v9 7/7 mmc: omap_hsmmc: remove pbias workaround
In reply to Balaji T Kremove pbias workaround
--- drivers/mmc/host/omap_hsmmc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -19
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled; -int pbias_disable;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc)return 0 ; -/* -* With DT, never turn OFF the regulator for MMC1. This is because -* the pbias cell programming support is still missing when -* booting with Device tree -*/ -if (host->pbias_disable && !vdd) -return 0 ;if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd);
@@ -1541,13 +1533,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)* of external transceiver; but they all handle 1.8V. */ if ((OMAP_HSMMC_READ (host->base,HCTL ) &SDVSDET ) && - (ios->vdd ==DUAL_VOLT_OCR_BIT ) && -/* -* With pbias cell programming missing, this -* can't be allowed on MMC1 when booting with device -* tree. -*/ - !host->pbias_disable) { + (ios->vdd ==DUAL_VOLT_OCR_BIT )) {/* * The mmc_select_voltage fn of the core does * not seem to set the power_mode to
@@ -1880,10 +1866,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_context_save (host); -/* This can be removed once we support PBIAS with DT */ -if (host->dev->of_node && res->start ==0x4809c000 ) - host->pbias_disable =1 ; - host->dbclk =clk_get (&pdev->dev,"mmchsdb_fck" );/* * MMC can still work without debounce clock.
Signature · 1 line
1.7.5.4
v10 cover mmc: omap_hsmmc: pbias dt and cleanup
In reply to Balaji T KFew cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.
Balaji T K (7):
mmc: omap_hsmmc: use devm_regulator API
mmc: omap_hsmmc: handle vcc and vcc_aux independently
regulator: add pbias regulator support
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
mmc: omap_hsmmc: remove pbias workaround
.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 17 ++ arch/arm/boot/dts/omap2430.dtsi | 17 ++ arch/arm/boot/dts/omap3.dtsi | 17 ++ arch/arm/boot/dts/omap4.dtsi | 17 ++ arch/arm/boot/dts/omap5.dtsi | 17 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 111 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 11 files changed, 441 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Signature · 1 line
1.7.5.4
PATCH v10 1/7 mmc: omap_hsmmc: use devm_regulator API
Use devm_regulator API, while at it use devm_regulator_get_optional for optional vmmc_aux supply
--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -4
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) { -regulator_put (host->vcc); -regulator_put (host->vcc_aux);mmc_slot (host).set_power =NULL ; }
Signature · 1 line
1.7.5.4
PATCH v10 2/7 mmc: omap_hsmmc: handle vcc and vcc_aux independently
In reply to Balaji T Khandle vcc and vcc_aux independently to reduce indent.
--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +23 -27
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (host->vcc) + ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd);/* Enable interface voltage rail, if needed */ if (ret ==0 && host->vcc_aux) { ret =regulator_enable (host->vcc_aux); -if (ret <0 ) +if (ret <0 && host->vcc) ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 ); }
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,/* Shut down the rail */ if (host->vcc_aux) ret =regulator_disable (host->vcc_aux); -if (!ret) { +if (host->vcc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 );
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +PTR_ERR (reg));return PTR_ERR (reg); }else { -mmc_slot (host).set_power = omap_hsmmc_set_power; host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } +mmc_slot (host).set_power = omap_hsmmc_set_power; -/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +/* Allow an aux regulator */ + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; -/* For eMMC do not power off when not in sleep state */ -if (mmc_slot (host).no_regulator_off_init) -return 0 ; -/* -* UGLY HACK: workaround regulator framework bugs. -* When the bootloader leaves a supply active, it's -* initialized with zero usecount ... and we can't -* disable it without first enabling it. Until the -* framework is fixed, we need a workaround like this -* (which is safe for MMC, but not in general). -*/ -if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { -int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init) +return 0 ; +/* +* To disable boot_on regulator, enable regulator +* to increase usecount and then disable it. +*/ +if ((host->vcc &®ulator_is_enabled (host->vcc) >0 ) || + (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { +int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +mmc_slot (host).set_power (host->dev, host->slot_id,1 , vdd); +mmc_slot (host).set_power (host->dev, host->slot_id,0 ,0 ); }return 0 ;
Signature · 1 line
1.7.5.4
PATCH v10 3/7 regulator: add pbias regulator support
In reply to Balaji T Kpbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.
--- .../bindings/regulator/pbias-regulator.txt | 27 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 4 files changed, 292 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +27 -0
@@ -0,0 +1,27 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7. +- reg: pbias register offset from syscon base and size of pbias register. +- syscon : phandle of the system control module +- regulator-name : should be + pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs + pbias_sim_omap3 for OMAP3 SoCs + pbias_mmc_omap4 for OMAP4 SoCs + pbias_mmc_omap5 for OMAP5 and DRA7 SoC + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
drivers/regulator/Kconfig +9 -0
@@ -369,6 +369,15 @@ config REGULATOR_PALMAS on the muxing. This is handled automatically in the driver by reading the mux info from OTP. +config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on (ARCH_OMAP || COMPILE_TEST) && MFD_SYSCON + help + Say y here to support pbias regulator for mmc1:SD card i/o + on OMAP SoCs. + This driver provides support for OMAP pbias modelled + regulators. + config REGULATOR_PCAP tristate "Motorola PCAP2 regulator driver" depends on EZX_PCAP
drivers/regulator/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o +obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
drivers/regulator/pbias-regulator.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v10 4/7 mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
In reply to Balaji T KIn DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
--- drivers/mmc/host/omap_hsmmc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +37 -0
@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,27 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) + host->pbias_enabled =1 ; + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }
@@ -342,6 +375,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;
@@ -1808,6 +1844,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host);
Signature · 1 line
1.7.5.4
PATCH v10 5/7 ARM: dts: add pbias dt node
In reply to Balaji T KAdd pbias regulator node as a child of system control module - syscon.
--- arch/arm/boot/dts/dra7.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 17 +++++++++++++++++ 5 files changed, 85 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +17 -0
@@ -110,6 +110,22 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "syscon", "simple-bus"; + reg = <0x4a002e00 0x7c>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&dra7_ctrl_general>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;
@@ -485,6 +501,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap2430.dtsi +17 -0
@@ -29,6 +29,22 @@ pinctrl-single,function-mask = <0x3f>; }; + omap2_scm_general: tisyscon@49002270 { + compatible = "syscon", "simple-bus"; + reg = <0x49002270 0x240>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x230 0x4>; + syscon = <&omap2_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +199,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap3.dtsi +17 -0
@@ -137,6 +137,22 @@ pinctrl-single,function-mask = <0xff1f>; }; + omap3_scm_general: tisyscon@48002270 { + compatible = "syscon", "simple-bus"; + reg = <0x48002270 0x2f0>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x2b0 0x4>; + syscon = <&omap3_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -351,6 +367,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap4.dtsi +17 -0
@@ -134,6 +134,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap4_padconf_global: tisyscon@4a1005a0 { + compatible = "syscon", "simple-bus"; + reg = <0x4a1005a0 0x170>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap4_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap4 { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -367,6 +383,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap5.dtsi +17 -0
@@ -130,6 +130,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap5_padconf_global: tisyscon@4a002da0 { + compatible = "syscon"; + reg = <0x4A002da0 0xec>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -409,6 +425,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
Re: [PATCH v10 5/7] ARM: dts: add pbias dt node
Quoted 5 lines · Balaji T K
Add pbias regulator node as a child of system control module - syscon.
Signed-off-by Balaji T K <[email protected]>Acked-by Tony Lindgren <[email protected]>
Hi Benoit,
Gentle Ping, Let me know if you have any comments.
Quoted 184 lines
--- arch/arm/boot/dts/dra7.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 17 +++++++++++++++++ 5 files changed, 85 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +17
-0@@ -110,6 +110,22 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "syscon", "simple-bus"; + reg = <0x4a002e00 0x7c>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&dra7_ctrl_general>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;@@ -485,6 +501,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {arch/arm/boot/dts/omap2430.dtsi +17
-0@@ -29,6 +29,22 @@ pinctrl-single,function-mask = <0x3f>; }; + omap2_scm_general: tisyscon@49002270 { + compatible = "syscon", "simple-bus"; + reg = <0x49002270 0x240>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x230 0x4>; + syscon = <&omap2_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;@@ -183,6 +199,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {arch/arm/boot/dts/omap3.dtsi +17
-0@@ -137,6 +137,22 @@ pinctrl-single,function-mask = <0xff1f>; }; + omap3_scm_general: tisyscon@48002270 { + compatible = "syscon", "simple-bus"; + reg = <0x48002270 0x2f0>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x2b0 0x4>; + syscon = <&omap3_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;@@ -351,6 +367,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {arch/arm/boot/dts/omap4.dtsi +17
-0@@ -134,6 +134,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap4_padconf_global: tisyscon@4a1005a0 { + compatible = "syscon", "simple-bus"; + reg = <0x4a1005a0 0x170>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap4_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap4 { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;@@ -367,6 +383,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {arch/arm/boot/dts/omap5.dtsi +17
-0@@ -130,6 +130,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap5_padconf_global: tisyscon@4a002da0 { + compatible = "syscon"; + reg = <0x4A002da0 0xec>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;@@ -409,6 +425,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
PATCH v10 6/7 ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
In reply to Balaji T KEnable REGULATOR_PBIAS needed for SD card on most OMAPs.
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/omap2plus_defconfig +2 -0
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y
Signature · 1 line
1.7.5.4
PATCH v10 7/7 mmc: omap_hsmmc: remove pbias workaround
In reply to Balaji T Kremove pbias workaround
--- drivers/mmc/host/omap_hsmmc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -19
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled; -int pbias_disable;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc)return 0 ; -/* -* With DT, never turn OFF the regulator for MMC1. This is because -* the pbias cell programming support is still missing when -* booting with Device tree -*/ -if (host->pbias_disable && !vdd) -return 0 ;if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd);
@@ -1539,13 +1531,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)* of external transceiver; but they all handle 1.8V. */ if ((OMAP_HSMMC_READ (host->base,HCTL ) &SDVSDET ) && - (ios->vdd ==DUAL_VOLT_OCR_BIT ) && -/* -* With pbias cell programming missing, this -* can't be allowed on MMC1 when booting with device -* tree. -*/ - !host->pbias_disable) { + (ios->vdd ==DUAL_VOLT_OCR_BIT )) {/* * The mmc_select_voltage fn of the core does * not seem to set the power_mode to
@@ -1878,10 +1864,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_context_save (host); -/* This can be removed once we support PBIAS with DT */ -if (host->dev->of_node && res->start ==0x4809c000 ) - host->pbias_disable =1 ; - host->dbclk =clk_get (&pdev->dev,"mmchsdb_fck" );/* * MMC can still work without debounce clock.
Signature · 1 line
1.7.5.4
Quoted 4 lines · Balaji T K
Few cleanups to reduce code indent,
Addpbias_regulatorsupport and adaptomap_hsmmcto use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.
Hi Tony,
Considering the dependencies with regulator, defconfig, mmc and device tree, Is it possible for you to pick this series.
Thanks and Regards,
Balaji T K
Quoted 24 lines
Balaji T K (7):
mmc:omap_hsmmc: usedevm_regulatorAPI
mmc:omap_hsmmc: handle vcc andvcc_auxindependently
regulator: add pbias regulator support
mmc:omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON andREGULATOR_PBIASinomap2plus_defconfig
mmc:omap_hsmmc: remove pbias workaround.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 17 ++ arch/arm/boot/dts/omap2430.dtsi | 17 ++ arch/arm/boot/dts/omap3.dtsi | 17 ++ arch/arm/boot/dts/omap4.dtsi | 17 ++ arch/arm/boot/dts/omap5.dtsi | 17 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 111 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 11 files changed, 441 insertions(+), 49 deletions(-)create mode 100644
Documentation/devicetree/bindings/regulator/pbias-regulator.txtcreate mode 100644drivers/regulator/pbias-regulator.c
v10 cover mmc: omap_hsmmc: pbias dt and cleanup
In reply to Balaji T KFew cleanups to reduce code indent,
Add pbias_regulator support and adapt omap_hsmmc to use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.
Balaji T K (7):
mmc: omap_hsmmc: use devm_regulator API
mmc: omap_hsmmc: handle vcc and vcc_aux independently
regulator: add pbias regulator support
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
mmc: omap_hsmmc: remove pbias workaround
.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 17 ++ arch/arm/boot/dts/omap2430.dtsi | 17 ++ arch/arm/boot/dts/omap3.dtsi | 17 ++ arch/arm/boot/dts/omap4.dtsi | 17 ++ arch/arm/boot/dts/omap5.dtsi | 17 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 111 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 11 files changed, 441 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Signature · 1 line
1.7.5.4
PATCH RESEND v11 1/7 mmc: omap_hsmmc: use devm_regulator API
Use devm_regulator API, while at it use devm_regulator_get_optional for optional vmmc_aux supply
--- drivers/mmc/host/omap_hsmmc.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -4
@@ -316,7 +316,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_err (host->dev,"vmmc regulator missing\n" );return PTR_ERR (reg);
@@ -336,7 +336,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =regulator_get (host->dev,"vmmc_aux" ); + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg;/* For eMMC do not power off when not in sleep state */
@@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) { -regulator_put (host->vcc); -regulator_put (host->vcc_aux);mmc_slot (host).set_power =NULL ; }
Signature · 1 line
1.7.5.4
PATCH RESEND v11 2/7 mmc: omap_hsmmc: handle vcc and vcc_aux independently
In reply to Balaji T Khandle vcc and vcc_aux independently to reduce indent.
--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +23 -27
@@ -286,11 +286,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (host->vcc) + ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd);/* Enable interface voltage rail, if needed */ if (ret ==0 && host->vcc_aux) { ret =regulator_enable (host->vcc_aux); -if (ret <0 ) +if (ret <0 && host->vcc) ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 ); }
@@ -298,7 +299,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,/* Shut down the rail */ if (host->vcc_aux) ret =regulator_disable (host->vcc_aux); -if (!ret) { +if (host->vcc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 );
@@ -318,10 +319,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +PTR_ERR (reg));return PTR_ERR (reg); }else { -mmc_slot (host).set_power = omap_hsmmc_set_power; host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -334,31 +335,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } +mmc_slot (host).set_power = omap_hsmmc_set_power; -/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +/* Allow an aux regulator */ + reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; -/* For eMMC do not power off when not in sleep state */ -if (mmc_slot (host).no_regulator_off_init) -return 0 ; -/* -* UGLY HACK: workaround regulator framework bugs. -* When the bootloader leaves a supply active, it's -* initialized with zero usecount ... and we can't -* disable it without first enabling it. Until the -* framework is fixed, we need a workaround like this -* (which is safe for MMC, but not in general). -*/ -if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { -int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init) +return 0 ; +/* +* To disable boot_on regulator, enable regulator +* to increase usecount and then disable it. +*/ +if ((host->vcc &®ulator_is_enabled (host->vcc) >0 ) || + (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { +int vdd =ffs (mmc_slot (host).ocr_mask) -1 ; -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +mmc_slot (host).set_power (host->dev, host->slot_id,1 , vdd); +mmc_slot (host).set_power (host->dev, host->slot_id,0 ,0 ); }return 0 ;
Signature · 1 line
1.7.5.4
PATCH RESEND v11 3/7 regulator: add pbias regulator support
In reply to Balaji T Kpbias register controls internal power supply to sd card i/o pads in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and enabling/disabling are in the same PBIAS register.
--- .../bindings/regulator/pbias-regulator.txt | 27 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 4 files changed, 292 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +27 -0
@@ -0,0 +1,27 @@ +PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7. +- reg: pbias register offset from syscon base and size of pbias register. +- syscon : phandle of the system control module +- regulator-name : should be + pbias_mmc_omap2430 for OMAP2430, OMAP3 SoCs + pbias_sim_omap3 for OMAP3 SoCs + pbias_mmc_omap4 for OMAP4 SoCs + pbias_mmc_omap5 for OMAP5 and DRA7 SoC + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
drivers/regulator/Kconfig +9 -0
@@ -384,6 +384,15 @@ config REGULATOR_PALMAS on the muxing. This is handled automatically in the driver by reading the mux info from OTP. +config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on (ARCH_OMAP || COMPILE_TEST) && MFD_SYSCON + help + Say y here to support pbias regulator for mmc1:SD card i/o + on OMAP SoCs. + This driver provides support for OMAP pbias modelled + regulators. + config REGULATOR_PCAP tristate "Motorola PCAP2 regulator driver" depends on EZX_PCAP
drivers/regulator/Makefile +1 -0
@@ -54,6 +54,7 @@ obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o +obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
drivers/regulator/pbias-regulator.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH RESEND v11 4/7 mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
In reply to Balaji T KIn DT case, PBAIS registers are programmed via regulator, use regulator APIs to control PBIAS.
--- drivers/mmc/host/omap_hsmmc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +37 -0
@@ -126,6 +126,10 @@#define OMAP_MMC_MAX_CLOCK 52000000#define DRIVER_NAME "omap_hsmmc" +#define VDD_1V8 1800000/* 180000 uV */ +#define VDD_3V0 3000000/* 300000 uV */ +#define VDD_165_195 (ffs(MMC_VDD_165_195) - 1) +/* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known
@@ -164,6 +168,8 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; +struct regulator *pbias; +bool pbias_enabled;int pbias_disable;void __iomem *base;resource_size_t mapbase;
@@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); +if (host->pbias) { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (!ret) + host->pbias_enabled =0 ; + } +regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
@@ -306,9 +321,27 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, } } +if (host->pbias) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) + goto error_set_power; + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (!ret) + host->pbias_enabled =1 ; + } + } +if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +error_set_power:return ret; }
@@ -342,6 +375,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); host->vcc_aux =IS_ERR (reg) ?NULL : reg; + reg =devm_regulator_get_optional (host->dev,"pbias" ); + host->pbias =IS_ERR (reg) ?NULL : reg; +/* For eMMC do not power off when not in sleep state */ if (mmc_slot (host).no_regulator_off_init)return 0 ;
@@ -1808,6 +1844,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; + host->pbias_enabled =0 ;platform_set_drvdata (pdev, host);
Signature · 1 line
1.7.5.4
PATCH RESEND v11 5/7 ARM: dts: add pbias dt node
In reply to Balaji T KAdd pbias regulator node as a child of system control module - syscon.
--- arch/arm/boot/dts/dra7.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 17 +++++++++++++++++ 5 files changed, 85 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +17 -0
@@ -149,6 +149,22 @@ ti,hwmods = "counter_32k"; }; + dra7_ctrl_general: tisyscon@4a002e00 { + compatible = "syscon", "simple-bus"; + reg = <0x4a002e00 0x7c>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0 0x4>; + syscon = <&dra7_ctrl_general>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;
@@ -524,6 +540,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap2430.dtsi +17 -0
@@ -29,6 +29,22 @@ pinctrl-single,function-mask = <0x3f>; }; + omap2_scm_general: tisyscon@49002270 { + compatible = "syscon", "simple-bus"; + reg = <0x49002270 0x240>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x230 0x4>; + syscon = <&omap2_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +199,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap3.dtsi +17 -0
@@ -176,6 +176,22 @@ pinctrl-single,function-mask = <0xff1f>; }; + omap3_scm_general: tisyscon@48002270 { + compatible = "syscon", "simple-bus"; + reg = <0x48002270 0x2f0>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x2b0 0x4>; + syscon = <&omap3_scm_general>; + pbias_mmc_reg: pbias_mmc_omap2430 { + regulator-name = "pbias_mmc_omap2430"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -390,6 +406,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap4.dtsi +17 -0
@@ -186,6 +186,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap4_padconf_global: tisyscon@4a1005a0 { + compatible = "syscon", "simple-bus"; + reg = <0x4a1005a0 0x170>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap4_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap4 { + regulator-name = "pbias_mmc_omap4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -419,6 +435,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap5.dtsi +17 -0
@@ -192,6 +192,22 @@ pinctrl-single,function-mask = <0x7fff>; }; + omap5_padconf_global: tisyscon@4a002da0 { + compatible = "syscon"; + reg = <0x4A002da0 0xec>; + }; + + pbias_regulator: pbias_regulator { + compatible = "ti,pbias-omap"; + reg = <0x60 0x4>; + syscon = <&omap5_padconf_global>; + pbias_mmc_reg: pbias_mmc_omap5 { + regulator-name = "pbias_mmc_omap5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -471,6 +487,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_mmc_reg>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
PATCH RESEND v11 6/7 ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
In reply to Balaji T KEnable REGULATOR_PBIAS needed for SD card on most OMAPs.
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/omap2plus_defconfig +2 -0
@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y
@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y
Signature · 1 line
1.7.5.4
Re: [PATCH RESEND v11 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
Quoted 3 lines · Balaji T K
Enable
REGULATOR_PBIASneeded for SD card on most OMAPs.Signed-off-by Balaji T K <[email protected]>
I belive this is the only one missing my ack:
Probably best that this all gets queued along with other MMC related patches by Balaji and Chris.
Quoted 31 lines
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/configs/omap2plus_defconfig +2
-0@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=ySignature · 6 lines
1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND v11 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Balaji T K
Enable
REGULATOR_PBIASneeded for SD card on most OMAPs.Signed-off-by Balaji T K <[email protected]>I belive this is the only one missing my ack:
Acked-by Tony Lindgren <[email protected]>
Thanks Tony
Quoted 2 lines
Probably best that this all gets queued along with other MMC related patches by Balaji and Chris.
Hi Chris,
Can you please pull this patch series for 3.15?
Thanks and Regards,
Balaji T K
Quoted 32 lines
Quoted 32 lines
--- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/configs/omap2plus_defconfig +2
-1@@ -169,6 +169,7 @@ CONFIG_DRA752_THERMAL=y CONFIG_WATCHDOG=y CONFIG_OMAP_WATCHDOG=y CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_SYSCON=y CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65910=y@@ -180,6 +181,7 @@ CONFIG_REGULATOR_TPS6507X=y CONFIG_REGULATOR_TPS65217=y CONFIG_REGULATOR_TPS65910=y CONFIG_REGULATOR_TWL4030=y +CONFIG_REGULATOR_PBIAS=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y --1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH RESEND v11 7/7 mmc: omap_hsmmc: remove pbias workaround
In reply to Balaji T Kremove pbias workaround
--- drivers/mmc/host/omap_hsmmc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -19
@@ -170,7 +170,6 @@ struct omap_hsmmc_host {struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled; -int pbias_disable;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -267,13 +266,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc)return 0 ; -/* -* With DT, never turn OFF the regulator for MMC1. This is because -* the pbias cell programming support is still missing when -* booting with Device tree -*/ -if (host->pbias_disable && !vdd) -return 0 ;if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd);
@@ -1539,13 +1531,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)* of external transceiver; but they all handle 1.8V. */ if ((OMAP_HSMMC_READ (host->base,HCTL ) &SDVSDET ) && - (ios->vdd ==DUAL_VOLT_OCR_BIT ) && -/* -* With pbias cell programming missing, this -* can't be allowed on MMC1 when booting with device -* tree. -*/ - !host->pbias_disable) { + (ios->vdd ==DUAL_VOLT_OCR_BIT )) {/* * The mmc_select_voltage fn of the core does * not seem to set the power_mode to
@@ -1878,10 +1864,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_context_save (host); -/* This can be removed once we support PBIAS with DT */ -if (host->dev->of_node && res->start ==0x4809c000 ) - host->pbias_disable =1 ; - host->dbclk =clk_get (&pdev->dev,"mmchsdb_fck" );/* * MMC can still work without debounce clock.
Signature · 1 line
1.7.5.4
Quoted 25 lines · Balaji T K
Few cleanups to reduce code indent,
Addpbias_regulatorsupport and adaptomap_hsmmcto use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.Balaji T K (7):
mmc:omap_hsmmc: usedevm_regulatorAPI
mmc:omap_hsmmc: handle vcc andvcc_auxindependently
regulator: add pbias regulator support
mmc:omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON andREGULATOR_PBIASinomap2plus_defconfig
mmc:omap_hsmmc: remove pbias workaround.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 17 ++ arch/arm/boot/dts/omap2430.dtsi | 17 ++ arch/arm/boot/dts/omap3.dtsi | 17 ++ arch/arm/boot/dts/omap4.dtsi | 17 ++ arch/arm/boot/dts/omap5.dtsi | 17 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 111 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 11 files changed, 441 insertions(+), 49 deletions(-)
Quoted 2 lines
create mode 100644
Documentation/devicetree/bindings/regulator/pbias-regulator.txtcreate mode 100644drivers/regulator/pbias-regulator.c
This patch series (its v11 even though this mail has the subject v10) fixes problems I'm experiencing with MMC detection on some OMAP3 based boards. So:
Thanks,
Stefan
Hi,
Quoted 4 lines · Balaji T K
Few cleanups to reduce code indent,
Addpbias_regulatorsupport and adaptomap_hsmmcto use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.
I tested on both OMAP3630 (Overo Storm) and OMAP4430 (DuoVero). The rootfs is mounted on mmc1 and works as usual. Here is what I can see:
- pbias-supply is parsed from DT
- VMMC1 is set to 3V
- According to the debugfs entry, we are working at 3V signaling
- By dumping CONTROL_PBIASLITE, bit MMC1_PBIASLITE_VMODE (PBIASLITEVMODE0 on OMAP3) is set to 1 (-> 3V)
Do you see any other tests that I could run to validate your patches? Otherwise:
Quoted 24 lines
Balaji T K (7):
mmc:omap_hsmmc: usedevm_regulatorAPI
mmc:omap_hsmmc: handle vcc andvcc_auxindependently
regulator: add pbias regulator support
mmc:omap_hsmmc: adapt hsmmc to use pbias regulator
ARM: dts: add pbias dt node
ARM: OMAP: enable SYSCON andREGULATOR_PBIASinomap2plus_defconfig
mmc:omap_hsmmc: remove pbias workaround.../bindings/regulator/pbias-regulator.txt | 27 ++ arch/arm/boot/dts/dra7.dtsi | 17 ++ arch/arm/boot/dts/omap2430.dtsi | 17 ++ arch/arm/boot/dts/omap3.dtsi | 17 ++ arch/arm/boot/dts/omap4.dtsi | 17 ++ arch/arm/boot/dts/omap5.dtsi | 17 ++ arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 111 +++++---- drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 11 files changed, 441 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/pbias-regulator.txt create mode 100644 drivers/regulator/pbias-regulator.c
Quoted 11 lines · Florian Vaussard
Hi,
Quoted 4 lines · Balaji T K
Few cleanups to reduce code indent,
Addpbias_regulatorsupport and adaptomap_hsmmcto use pbias regulator to configure required voltage on mmc1 pad(SD card) i/o rails on OMAP SoCs.I tested on both OMAP3630 (Overo Storm) and OMAP4430 (DuoVero). The rootfs is mounted on mmc1 and works as usual. Here is what I can see:
Quoted 7 lines
- pbias-supply is parsed from DT
- VMMC1 is set to 3V
- According to the debugfs entry, we are working at 3V signaling
- By dumpingCONTROL_PBIASLITE, bitMMC1_PBIASLITE_VMODE(PBIASLITEVMODE0 on OMAP3) is set to 1 (-> 3V)Do you see any other tests that I could run to validate your patches?
Nope, Stefan has tested the other use case of detecting sd card at kernel without any sd card/pbias activity at u-boot.
Quoted 4 lines
Otherwise:
Tested-by Florian Vaussard <[email protected]>
Thanks Florian, Stefan for Testing.