omap_hsmmc: regulator usage cleanup and fixes
Subsystems (3)
cover omap_hsmmc: regulator usage cleanup and fixes
This patch series does the following
*) Uses devm_regulator_get_optional() for vmmc and then removes the
CONFIG_REGULATOR check altogether.
*) return on -EPROBE_DEFER
*) enable/disable vmmc_aux regulator based on prior state
This series is in preparation for implementing the voltage switch sequence so that UHS cards can be supported.
Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM, Beaglebone black, OMAP5 uEVM and OMAP4 PANDA.
Kishon Vijay Abraham I (16):
mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
mmc: host: omap_hsmmc: return error from omap_hsmmc_reg_get on
-EPROBE_DEFER
mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
mmc: host: omap_hsmmc: add separate functions for enable/disable
supply
mmc: host: omap_hsmmc: add separate function to set pbias
mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator
state
ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on
prior state
mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
Roger Quadros (1):
mmc: host: omap_hsmmc: use "mmc_of_parse_voltage" to get ocr_avail
.../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 2 + arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - drivers/mmc/host/omap_hsmmc.c | 333 +++++++++++++------- 3 files changed, 216 insertions(+), 120 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/17 mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
Since vmmc can be optional for some platforms, use devm_regulator_get_optional() for vmmc. Now return error only in the case of -EPROBE_DEFER and for all other cases set host->vcc to NULL.
--- drivers/mmc/host/omap_hsmmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/host/omap_hsmmc.c +5 -3
@@ -344,11 +344,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ; - reg =devm_regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get_optional (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +if (PTR_ERR (reg) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + host->vcc =NULL ; +dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" ,PTR_ERR (reg)); -return PTR_ERR (reg); }else { host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);
Signature · 1 line
1.7.9.5
PATCH 2/17 mmc: host: omap_hsmmc: return error from omap_hsmmc_reg_get on -EPROBE_DEFER
In reply to Kishon Vijay Abraham IEPROBE_DEFER is not fatal and it means the regulator can still be obtained. Hence return error if devm_regulator_get_optional for vmmc_aux and pbias returns -EPROBE_DEFER. This gives omap_hsmmc driver another chance to get these regulators.
--- drivers/mmc/host/omap_hsmmc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +18 -2
@@ -369,10 +369,26 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)/* Allow an aux regulator */ reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +if (IS_ERR (reg)) { +if (PTR_ERR (reg) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + host->vcc_aux =NULL ; +dev_dbg (host->dev,"unable to get vmmc_aux regulator %ld\n" , +PTR_ERR (reg)); + }else { + host->vcc_aux = reg; + } reg =devm_regulator_get_optional (host->dev,"pbias" ); - host->pbias =IS_ERR (reg) ?NULL : reg; +if (IS_ERR (reg)) { +if (PTR_ERR (reg) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + host->pbias =NULL ; +dev_dbg (host->dev,"unable to get pbias regulator %ld\n" , +PTR_ERR (reg)); + }else { + host->pbias = reg; + }/* For eMMC do not power off when not in sleep state */ if (mmc_pdata (host)->no_regulator_off_init)
Signature · 1 line
1.7.9.5
PATCH 3/17 mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
In reply to Kishon Vijay Abraham INo functional change. Instead of using a local regulator variable in omap_hsmmc_reg_get() for holding the return value of devm_regulator_get_optional() and then assigning to omap_hsmmc_host regulator members: vcc, vcc_aux and pbias, directly use the omap_hsmmc_host regulator members.
--- drivers/mmc/host/omap_hsmmc.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-)
drivers/mmc/host/omap_hsmmc.c +16 -22
@@ -341,19 +341,17 @@ error_set_power:static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) { -struct regulator *reg;int ocr_value =0 ; - reg =devm_regulator_get_optional (host->dev,"vmmc" ); -if (IS_ERR (reg)) { -if (PTR_ERR (reg) == -EPROBE_DEFER ) + host->vcc =devm_regulator_get_optional (host->dev,"vmmc" ); +if (IS_ERR (host->vcc)) { +if (PTR_ERR (host->vcc) == -EPROBE_DEFER )return -EPROBE_DEFER ; - host->vcc =NULL ;dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" , -PTR_ERR (reg)); +PTR_ERR (host->vcc)); + host->vcc =NULL ; }else { - host->vcc = reg; - ocr_value =mmc_regulator_get_ocrmask (reg); + ocr_value =mmc_regulator_get_ocrmask (host->vcc);if (!mmc_pdata (host)->ocr_mask) {mmc_pdata (host)->ocr_mask = ocr_value; }else {
@@ -368,26 +366,22 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)mmc_pdata (host)->set_power = omap_hsmmc_set_power;/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); -if (IS_ERR (reg)) { -if (PTR_ERR (reg) == -EPROBE_DEFER ) + host->vcc_aux =devm_regulator_get_optional (host->dev,"vmmc_aux" ); +if (IS_ERR (host->vcc_aux)) { +if (PTR_ERR (host->vcc_aux) == -EPROBE_DEFER )return -EPROBE_DEFER ; - host->vcc_aux =NULL ;dev_dbg (host->dev,"unable to get vmmc_aux regulator %ld\n" , -PTR_ERR (reg)); - }else { - host->vcc_aux = reg; +PTR_ERR (host->vcc_aux)); + host->vcc_aux =NULL ; } - reg =devm_regulator_get_optional (host->dev,"pbias" ); -if (IS_ERR (reg)) { -if (PTR_ERR (reg) == -EPROBE_DEFER ) + host->pbias =devm_regulator_get_optional (host->dev,"pbias" ); +if (IS_ERR (host->pbias)) { +if (PTR_ERR (host->pbias) == -EPROBE_DEFER )return -EPROBE_DEFER ; - host->pbias =NULL ;dev_dbg (host->dev,"unable to get pbias regulator %ld\n" , -PTR_ERR (reg)); - }else { - host->pbias = reg; +PTR_ERR (host->pbias)); + host->pbias =NULL ; }/* For eMMC do not power off when not in sleep state */
Signature · 1 line
1.7.9.5
PATCH 4/17 mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
In reply to Kishon Vijay Abraham IIf the vmmc regulator provides a valid ocrmask, use it. By this even if the pdata has a valid ocrmask, it will be overwritten with the ocrmask of the vmmc regulator.
Also remove the unnecessary compatibility check between the ocrmask in the pdata and the ocrmask from the vmmc regulator.
--- drivers/mmc/host/omap_hsmmc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -9
@@ -352,16 +352,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) host->vcc =NULL ; }else { ocr_value =mmc_regulator_get_ocrmask (host->vcc); -if (!mmc_pdata (host)->ocr_mask) { +if (ocr_value >0 )mmc_pdata (host)->ocr_mask = ocr_value; - }else { -if (!(mmc_pdata (host)->ocr_mask & ocr_value)) { -dev_err (host->dev,"ocrmask %x is not supported\n" , -mmc_pdata (host)->ocr_mask); -mmc_pdata (host)->ocr_mask =0 ; -return -EINVAL ; - } - } }mmc_pdata (host)->set_power = omap_hsmmc_set_power;
Signature · 1 line
1.7.9.5
PATCH 5/17 mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
In reply to Kishon Vijay Abraham INo functional change. Instead of using our own vcc and vcc_aux members, use vmmc and vqmmc present in mmc_host which is present for the same purpose.
--- drivers/mmc/host/omap_hsmmc.c | 63 ++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 35 deletions(-)
drivers/mmc/host/omap_hsmmc.c +28 -35
@@ -181,15 +181,6 @@ struct omap_hsmmc_host {struct mmc_data *data;struct clk *fclk;struct clk *dbclk; -/* -* vcc == configured supply -* vcc_aux == optional -* - MMC1, supply for DAT4..DAT7 -* - MMC2/MMC2, external level shifter voltage supply, for -* chip (SDIO, eMMC, etc) or transceiver (MMC2 only) -*/ -struct regulator *vcc; -struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled;void __iomem *base;
@@ -260,13 +251,14 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) {struct omap_hsmmc_host *host =platform_get_drvdata (to_platform_device (dev)); +struct mmc_host *mmc = host->mmc;int ret =0 ;/* * If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!mmc->supply.vmmc)return 0 ;if (mmc_pdata (host)->before_set_reg)
@@ -295,23 +287,23 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { -if (host->vcc) - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (mmc->supply.vmmc) + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd);/* Enable interface voltage rail, if needed */ -if (ret ==0 && host->vcc_aux) { - ret =regulator_enable (host->vcc_aux); -if (ret <0 && host->vcc) - ret =mmc_regulator_set_ocr (host->mmc, - host->vcc,0 ); +if (ret ==0 && mmc->supply.vqmmc) { + ret =regulator_enable (mmc->supply.vqmmc); +if (ret <0 && mmc->supply.vmmc) + ret =mmc_regulator_set_ocr (mmc, + mmc->supply.vmmc, +0 ); } }else {/* Shut down the rail */ -if (host->vcc_aux) - ret =regulator_disable (host->vcc_aux); -if (host->vcc) { +if (mmc->supply.vqmmc) + ret =regulator_disable (mmc->supply.vqmmc); +if (mmc->supply.vmmc) {/* Then proceed to shut down the local regulator */ - ret =mmc_regulator_set_ocr (host->mmc, - host->vcc,0 ); + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); } }
@@ -342,29 +334,30 @@ error_set_power:static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) {int ocr_value =0 ; +struct mmc_host *mmc = host->mmc; - host->vcc =devm_regulator_get_optional (host->dev,"vmmc" ); -if (IS_ERR (host->vcc)) { -if (PTR_ERR (host->vcc) == -EPROBE_DEFER ) + mmc->supply.vmmc =devm_regulator_get_optional (host->dev,"vmmc" ); +if (IS_ERR (mmc->supply.vmmc)) { +if (PTR_ERR (mmc->supply.vmmc) == -EPROBE_DEFER )return -EPROBE_DEFER ;dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" , -PTR_ERR (host->vcc)); - host->vcc =NULL ; +PTR_ERR (mmc->supply.vmmc)); + mmc->supply.vmmc =NULL ; }else { - ocr_value =mmc_regulator_get_ocrmask (host->vcc); + ocr_value =mmc_regulator_get_ocrmask (mmc->supply.vmmc);if (ocr_value >0 )mmc_pdata (host)->ocr_mask = ocr_value; }mmc_pdata (host)->set_power = omap_hsmmc_set_power;/* Allow an aux regulator */ - host->vcc_aux =devm_regulator_get_optional (host->dev,"vmmc_aux" ); -if (IS_ERR (host->vcc_aux)) { -if (PTR_ERR (host->vcc_aux) == -EPROBE_DEFER ) + mmc->supply.vqmmc =devm_regulator_get_optional (host->dev,"vmmc_aux" ); +if (IS_ERR (mmc->supply.vqmmc)) { +if (PTR_ERR (mmc->supply.vqmmc) == -EPROBE_DEFER )return -EPROBE_DEFER ;dev_dbg (host->dev,"unable to get vmmc_aux regulator %ld\n" , -PTR_ERR (host->vcc_aux)); - host->vcc_aux =NULL ; +PTR_ERR (mmc->supply.vqmmc)); + mmc->supply.vqmmc =NULL ; } host->pbias =devm_regulator_get_optional (host->dev,"pbias" );
@@ -383,8 +376,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)* 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))) { +if ((mmc->supply.vmmc &®ulator_is_enabled (mmc->supply.vmmc) >0 ) || + (mmc->supply.vqmmc &®ulator_is_enabled (mmc->supply.vqmmc))) {int vdd =ffs (mmc_pdata (host)->ocr_mask) -1 ;mmc_pdata (host)->set_power (host->dev,1 , vdd);
Signature · 1 line
1.7.9.5
PATCH 6/17 mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
In reply to Kishon Vijay Abraham IRemove the unnecessary pbias regulator_set_voltage done after pbias regulator_disable in omap_hsmmc_set_power.
--- drivers/mmc/host/omap_hsmmc.c | 1 - 1 file changed, 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +0 -1
@@ -270,7 +270,6 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)if (!ret) host->pbias_enabled =0 ; } -regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); }/*
Signature · 1 line
1.7.9.5
PATCH 7/17 mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
In reply to Kishon Vijay Abraham IReturn error if any of the regulator APIs (regulator_enable, regulator_disable, regulator_set_voltage) fails in omap_hsmmc_set_power to avoid undefined behavior.
--- drivers/mmc/host/omap_hsmmc.c | 52 +++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-)
drivers/mmc/host/omap_hsmmc.c +40 -12
@@ -267,8 +267,11 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)if (host->pbias) {if (host->pbias_enabled ==1 ) { ret =regulator_disable (host->pbias); -if (!ret) - host->pbias_enabled =0 ; +if (ret) { +dev_err (dev,"pbias reg disable failed\n" ); +return ret; + } + host->pbias_enabled =0 ; } }
@@ -286,23 +289,35 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { -if (mmc->supply.vmmc) +if (mmc->supply.vmmc) { ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); +if (ret) +return ret; + } +/* Enable interface voltage rail, if needed */ -if (ret ==0 && mmc->supply.vqmmc) { +if (mmc->supply.vqmmc) { ret =regulator_enable (mmc->supply.vqmmc); -if (ret <0 && mmc->supply.vmmc) - ret =mmc_regulator_set_ocr (mmc, - mmc->supply.vmmc, -0 ); +if (ret) { +dev_err (dev,"vmmc_aux reg enable failed\n" ); + goto err_set_vqmmc; + } } }else {/* Shut down the rail */ -if (mmc->supply.vqmmc) +if (mmc->supply.vqmmc) { ret =regulator_disable (mmc->supply.vqmmc); +if (ret) { +dev_err (dev,"vmmc_aux reg disable failed\n" ); +return ret; + } + } +if (mmc->supply.vmmc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +if (ret) +return ret; } }
@@ -314,19 +329,32 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) ret =regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 );if (ret <0 ) - goto error_set_power; + goto err_set_voltage;if (host->pbias_enabled ==0 ) { ret =regulator_enable (host->pbias); -if (!ret) +if (ret) { +dev_err (dev,"pbias reg enable failed\n" ); + goto err_set_voltage; + }else { host->pbias_enabled =1 ; + } } }if (mmc_pdata (host)->after_set_reg)mmc_pdata (host)->after_set_reg (dev, power_on, vdd); -error_set_power: +return 0 ; + +err_set_voltage: +if (mmc->supply.vqmmc) +regulator_disable (mmc->supply.vqmmc); + +err_set_vqmmc: +if (mmc->supply.vmmc) +mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +return ret; }
Signature · 1 line
1.7.9.5
PATCH 8/17 mmc: host: omap_hsmmc: add separate functions for enable/disable supply
In reply to Kishon Vijay Abraham INo functional change. Cleanup omap_hsmmc_set_power by adding separate functions for enable/disable supply and invoke it from omap_hsmmc_set_power.
--- drivers/mmc/host/omap_hsmmc.c | 101 +++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 35 deletions(-)
drivers/mmc/host/omap_hsmmc.c +66 -35
@@ -247,6 +247,65 @@ static int omap_hsmmc_get_cover_state(struct device *dev)#ifdef CONFIG_REGULATOR +static int omap_hsmmc_enable_supply (struct mmc_host *mmc,int vdd) +{ +int ret; + +if (mmc->supply.vmmc) { + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); +if (ret) +return ret; + } + +/* Enable interface voltage rail, if needed */ +if (mmc->supply.vqmmc) { + ret =regulator_enable (mmc->supply.vqmmc); +if (ret) { +dev_err (mmc_dev (mmc),"vmmc_aux reg enable failed\n" ); + goto err_vqmmc; + } + } + +return 0 ; + +err_vqmmc: +if (mmc->supply.vmmc) +mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); + +return ret; +} + +static int omap_hsmmc_disable_supply (struct mmc_host *mmc) +{ +int ret; +int status; + +if (mmc->supply.vqmmc) { + ret =regulator_disable (mmc->supply.vqmmc); +if (ret) { +dev_err (mmc_dev (mmc),"vmmc_aux reg disable failed\n" ); +return ret; + } + } + +if (mmc->supply.vmmc) { + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +if (ret) + goto err_set_ocr; + } + +return 0 ; + +err_set_ocr: +if (mmc->supply.vqmmc) { + status =regulator_enable (mmc->supply.vqmmc); +if (status) +dev_err (mmc_dev (mmc),"vmmc_aux re-enable failed\n" ); + } + +return ret; +} +static int omap_hsmmc_set_power (struct device *dev,int power_on,int vdd) { struct omap_hsmmc_host *host =
@@ -289,36 +348,13 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { -if (mmc->supply.vmmc) { - ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); -if (ret) -return ret; - } - -/* Enable interface voltage rail, if needed */ -if (mmc->supply.vqmmc) { - ret =regulator_enable (mmc->supply.vqmmc); -if (ret) { -dev_err (dev,"vmmc_aux reg enable failed\n" ); - goto err_set_vqmmc; - } - } + ret =omap_hsmmc_enable_supply (mmc, vdd); +if (ret) +return ret; }else { -/* Shut down the rail */ -if (mmc->supply.vqmmc) { - ret =regulator_disable (mmc->supply.vqmmc); -if (ret) { -dev_err (dev,"vmmc_aux reg disable failed\n" ); -return ret; - } - } - -if (mmc->supply.vmmc) { -/* Then proceed to shut down the local regulator */ - ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); -if (ret) -return ret; - } + ret =omap_hsmmc_disable_supply (mmc); +if (ret) +return ret; }if (host->pbias) {
@@ -348,12 +384,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)return 0 ; err_set_voltage: -if (mmc->supply.vqmmc) -regulator_disable (mmc->supply.vqmmc); - -err_set_vqmmc: -if (mmc->supply.vmmc) -mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +omap_hsmmc_disable_supply (mmc);return ret; }
Signature · 1 line
1.7.9.5
PATCH 9/17 mmc: host: omap_hsmmc: add separate function to set pbias
In reply to Kishon Vijay Abraham INo functional change. Cleanup omap_hsmmc_set_power by adding separate functions to set pbias and invoke it from omap_hsmmc_set_power.
--- drivers/mmc/host/omap_hsmmc.c | 78 +++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 30 deletions(-)
drivers/mmc/host/omap_hsmmc.c +48 -30
@@ -306,6 +306,48 @@ err_set_ocr:return ret; } +static int omap_hsmmc_set_pbias (struct omap_hsmmc_host *host,bool power_on, +int vdd) +{ +int ret; + +if (!host->pbias) +return 0 ; + +if (power_on) { +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 ) { +dev_err (host->dev,"pbias set voltage fail\n" ); +return ret; + } + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (ret) { +dev_err (host->dev,"pbias reg enable fail\n" ); +return ret; + } + host->pbias_enabled =1 ; + } + }else { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (ret) { +dev_err (host->dev,"pbias reg disable fail\n" ); +return ret; + } + host->pbias_enabled =0 ; + } + } + +return 0 ; +} +static int omap_hsmmc_set_power (struct device *dev,int power_on,int vdd) { struct omap_hsmmc_host *host =
@@ -323,16 +365,9 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)if (mmc_pdata (host)->before_set_reg)mmc_pdata (host)->before_set_reg (dev, power_on, vdd); -if (host->pbias) { -if (host->pbias_enabled ==1 ) { - ret =regulator_disable (host->pbias); -if (ret) { -dev_err (dev,"pbias reg disable failed\n" ); -return ret; - } - host->pbias_enabled =0 ; - } - } + ret =omap_hsmmc_set_pbias (host, false,0 ); +if (ret) +return ret;/* * Assume Vcc regulator is used only to power the card ... OMAP
@@ -357,26 +392,9 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)return ret; } -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 err_set_voltage; - -if (host->pbias_enabled ==0 ) { - ret =regulator_enable (host->pbias); -if (ret) { -dev_err (dev,"pbias reg enable failed\n" ); - goto err_set_voltage; - }else { - host->pbias_enabled =1 ; - } - } - } + ret =omap_hsmmc_set_pbias (host, true, vdd); +if (ret) + goto err_set_voltage;if (mmc_pdata (host)->after_set_reg)mmc_pdata (host)->after_set_reg (dev, power_on, vdd);
Signature · 1 line
1.7.9.5
PATCH 10/17 mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
In reply to Kishon Vijay Abraham IFix omap_hsmmc_set_power so that pbias regulator is not enabled during power off.
--- drivers/mmc/host/omap_hsmmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +4 -4
@@ -386,16 +386,16 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) ret =omap_hsmmc_enable_supply (mmc, vdd);if (ret)return ret; + + ret =omap_hsmmc_set_pbias (host, true, vdd); +if (ret) + goto err_set_voltage; }else { ret =omap_hsmmc_disable_supply (mmc);if (ret)return ret; } - ret =omap_hsmmc_set_pbias (host, true, vdd); -if (ret) - goto err_set_voltage; -if (mmc_pdata (host)->after_set_reg)mmc_pdata (host)->after_set_reg (dev, power_on, vdd);
Signature · 1 line
1.7.9.5
PATCH 11/17 mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state
In reply to Kishon Vijay Abraham IIf the regulator is enabled on boot (checked using regulator_is_enabled), invoke regulator_enable() so that the usecount reflects the correct state of the regulator and then disable the regulator so that the initial state of the regulator is disabled. Avoid using ->set_power, since set_power also takes care of setting the voltages which is not needed at this point.
--- drivers/mmc/host/omap_hsmmc.c | 67 +++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 10 deletions(-)
drivers/mmc/host/omap_hsmmc.c +57 -10
@@ -407,9 +407,63 @@ err_set_voltage:return ret; } +static int omap_hsmmc_disable_boot_regulator (struct regulator *reg) +{ +int ret; + +if (!reg) +return 0 ; + +if (regulator_is_enabled (reg)) { + ret =regulator_enable (reg); +if (ret) +return ret; + + ret =regulator_disable (reg); +if (ret) +return ret; + } + +return 0 ; +} + +static int omap_hsmmc_disable_boot_regulators (struct omap_hsmmc_host *host) +{ +struct mmc_host *mmc = host->mmc; +int ret; + +/* +* disable regulators enabled during boot and get the usecount +* right so that regulators can be enabled/disabled by checking +* the return value of regulator_is_enabled +*/ + ret =omap_hsmmc_disable_boot_regulator (mmc->supply.vmmc); +if (ret) { +dev_err (host->dev,"fail to disable boot enabled vmmc reg\n" ); +return ret; + } + + ret =omap_hsmmc_disable_boot_regulator (mmc->supply.vqmmc); +if (ret) { +dev_err (host->dev, +"fail to disable boot enabled vmmc_aux reg\n" ); +return ret; + } + + ret =omap_hsmmc_disable_boot_regulator (host->pbias); +if (ret) { +dev_err (host->dev, +"failed to disable boot enabled pbias reg\n" ); +return ret; + } + +return 0 ; +} +static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) {int ocr_value =0 ; +int ret;struct mmc_host *mmc = host->mmc; mmc->supply.vmmc =devm_regulator_get_optional (host->dev,"vmmc" );
@@ -448,17 +502,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)/* For eMMC do not power off when not in sleep state */ if (mmc_pdata (host)->no_regulator_off_init)return 0 ; -/* -* To disable boot_on regulator, enable regulator -* to increase usecount and then disable it. -*/ -if ((mmc->supply.vmmc &®ulator_is_enabled (mmc->supply.vmmc) >0 ) || - (mmc->supply.vqmmc &®ulator_is_enabled (mmc->supply.vqmmc))) { -int vdd =ffs (mmc_pdata (host)->ocr_mask) -1 ; -mmc_pdata (host)->set_power (host->dev,1 , vdd); -mmc_pdata (host)->set_power (host->dev,0 ,0 ); - } + ret =omap_hsmmc_disable_boot_regulators (host); +if (ret) +return ret;return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 12/17 ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
In reply to Kishon Vijay Abraham IFor beagle x15, both the vdd and io lines are connected to the same regulator (ldo1_reg). However vmmc_aux is populated to vdd_3v3. Remove it.
--- arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/am57xx-beagle-x15.dts +0 -1
@@ -579,7 +579,6 @@ pinctrl-0 = <&mmc1_pins_default>; vmmc-supply = <&ldo1_reg>; - vmmc_aux-supply = <&vdd_3v3>; pbias-supply = <&pbias_mmc_reg>; bus-width = <4>; cd-gpios = <&gpio6 27 0>; /* gpio 219 */
Signature · 1 line
1.7.9.5
PATCH 13/17 mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on prior state
In reply to Kishon Vijay Abraham Ienable vmmc_aux regulator only if it is in disabled state and disable vmmc_aux regulator only if it is in enabled state.
--- drivers/mmc/host/omap_hsmmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -2
@@ -258,7 +258,7 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd) }/* Enable interface voltage rail, if needed */ -if (mmc->supply.vqmmc) { +if (mmc->supply.vqmmc && !regulator_is_enabled (mmc->supply.vqmmc)) { ret =regulator_enable (mmc->supply.vqmmc);if (ret) {dev_err (mmc_dev (mmc),"vmmc_aux reg enable failed\n" );
@@ -280,7 +280,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc)int ret;int status; -if (mmc->supply.vqmmc) { +if (mmc->supply.vqmmc &®ulator_is_enabled (mmc->supply.vqmmc)) { ret =regulator_disable (mmc->supply.vqmmc);if (ret) {dev_err (mmc_dev (mmc),"vmmc_aux reg disable failed\n" );
Signature · 1 line
1.7.9.5
PATCH 14/17 mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
In reply to Kishon Vijay Abraham IUse regulator_is_enabled of pbias regulator to find pbias regulator status instead of maintaining a custom bookkeeping pbias_enabled variable.
--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -6
@@ -182,7 +182,6 @@ struct omap_hsmmc_host {struct clk *fclk;struct clk *dbclk;struct regulator *pbias; -bool pbias_enabled;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -326,22 +325,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,return ret; } -if (host->pbias_enabled ==0 ) { +if (!regulator_is_enabled (host->pbias)) { ret =regulator_enable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg enable fail\n" );return ret; } - host->pbias_enabled =1 ; } }else { -if (host->pbias_enabled ==1 ) { +if (regulator_is_enabled (host->pbias)) { ret =regulator_disable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg disable fail\n" );return ret; } - host->pbias_enabled =0 ; } }
@@ -2073,7 +2070,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base = base + pdata->reg_offset; host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; - host->pbias_enabled =0 ; ret =omap_hsmmc_gpio_init (mmc, host, pdata);if (ret)
Signature · 1 line
1.7.9.5
PATCH 15/17 mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
In reply to Kishon Vijay Abraham Ivdd voltage is set in mmc core to ios->vdd and vmmc should actually be set to this voltage. Modify omap_hsmmc_enable_supply to not take vdd as argument since now it's directly set to the voltage in ios->vdd.
--- drivers/mmc/host/omap_hsmmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/host/omap_hsmmc.c +4 -3
@@ -246,12 +246,13 @@ static int omap_hsmmc_get_cover_state(struct device *dev)#ifdef CONFIG_REGULATOR -static int omap_hsmmc_enable_supply (struct mmc_host *mmc,int vdd) +static int omap_hsmmc_enable_supply (struct mmc_host *mmc) {int ret; +struct mmc_ios *ios = &mmc->ios;if (mmc->supply.vmmc) { - ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, ios->vdd);if (ret)return ret; }
@@ -380,7 +381,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =omap_hsmmc_enable_supply (mmc, vdd); + ret =omap_hsmmc_enable_supply (mmc);if (ret)return ret;
Signature · 1 line
1.7.9.5
PATCH 16/17 mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
In reply to Kishon Vijay Abraham INow that support for platforms which have optional regulator is added, remove CONFIG_REGULATOR check in omap_hsmmc.
--- drivers/mmc/host/omap_hsmmc.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-)
drivers/mmc/host/omap_hsmmc.c +3 -32
@@ -203,7 +203,6 @@ struct omap_hsmmc_host {int context_loss;int protect_card;int reqs_blocked; -int use_reg;int req_in_progress;unsigned long clk_rate;unsigned int flags;
@@ -244,8 +243,6 @@ static int omap_hsmmc_get_cover_state(struct device *dev)return mmc_gpio_get_cd (host->mmc); } -#ifdef CONFIG_REGULATOR -static int omap_hsmmc_enable_supply (struct mmc_host *mmc) {int ret;
@@ -513,29 +510,6 @@ static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)mmc_pdata (host)->set_power =NULL ; } -static inline int omap_hsmmc_have_reg (void ) -{ -return 1 ; -} - -#else - -static inline int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) -{ -return -EINVAL ; -} - -static inline void omap_hsmmc_reg_put (struct omap_hsmmc_host *host) -{ -} - -static inline int omap_hsmmc_have_reg (void ) -{ -return 0 ; -} - -#endif -static irqreturn_t omap_hsmmc_cover_irq (int irq,void *dev_id); static int omap_hsmmc_gpio_init(struct mmc_host *mmc,
@@ -2195,11 +2169,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev) goto err_irq; } -if (omap_hsmmc_have_reg () && !mmc_pdata (host)->set_power) { +if (!mmc_pdata (host)->set_power) { ret =omap_hsmmc_reg_get (host);if (ret) goto err_irq; - host->use_reg =1 ; } mmc->ocr_avail =mmc_pdata (host)->ocr_mask;
@@ -2242,8 +2215,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) err_slot_name:mmc_remove_host (mmc); -if (host->use_reg) -omap_hsmmc_reg_put (host); +omap_hsmmc_reg_put (host); err_irq:device_init_wakeup (&pdev->dev, false);if (host->tx_chan)
@@ -2267,8 +2239,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev)pm_runtime_get_sync (host->dev);mmc_remove_host (host->mmc); -if (host->use_reg) -omap_hsmmc_reg_put (host); +omap_hsmmc_reg_put (host);if (host->tx_chan)dma_release_channel (host->tx_chan);
Signature · 1 line
1.7.9.5
PATCH 17/17 mmc: host: omap_hsmmc: use "mmc_of_parse_voltage" to get ocr_avail
In reply to Kishon Vijay Abraham IFrom: Roger Quadros <[email protected]>
For platforms that doesn't have explicit regulator control in MMC, populate voltage-ranges in MMC device tree node and use mmc_of_parse_voltage to get ocr_avail
--- .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 2 ++ drivers/mmc/host/omap_hsmmc.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +2 -0
@@ -22,6 +22,8 @@ ti,dual-volt: boolean, supports dual voltage cards ti,non-removable: non-removable slot (like eMMC) ti,needs-special-reset: Requires a special softreset sequence ti,needs-special-hs-handling: HSMMC IP needs special setting for handling High Speed +voltage-ranges: Specify the voltage range supported if regulator framework +isn't enabled. dmas: List of DMA specifiers with the controller specific format as described in the generic DMA client binding. A tx and rx specifier is required.
drivers/mmc/host/omap_hsmmc.c +8 -1
@@ -2175,7 +2175,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev) goto err_irq; } - mmc->ocr_avail =mmc_pdata (host)->ocr_mask; +if (!mmc_pdata (host)->ocr_mask) { + ret =mmc_of_parse_voltage (pdev->dev.of_node, &mmc->ocr_avail); +if (ret) + goto err_parse_voltage; + }else { + mmc->ocr_avail =mmc_pdata (host)->ocr_mask; + }omap_hsmmc_disable_irq (host);
@@ -2215,6 +2221,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) err_slot_name:mmc_remove_host (mmc); +err_parse_voltage:omap_hsmmc_reg_put (host); err_irq:device_init_wakeup (&pdev->dev, false);
Signature · 1 line
1.7.9.5
Re: [PATCH 01/17] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
In reply to Kishon Vijay Abraham IQuoted 18 lines · Kishon Vijay Abraham I
Since vmmc can be optional for some platforms, use
devm_regulator_get_optional()for vmmc. Now return error only in the case of -EPROBE_DEFER and for all other cases sethost->vccto NULL.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-0@@ -344,11 +344,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ;
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 351
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +5
-3- reg =devm_regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get_optional (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +if (PTR_ERR (reg) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + host->vcc =NULL ; +dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" ,PTR_ERR (reg)); -return PTR_ERR (reg);
I think, It could be unsafe to just drop this return.regulator_get_optional may return:
1 valid pointer on regulator : success;
2 ERR_PTR(-ENODEV) : regulator is not assigned, can proceed.
3 ERR_PTR(-EPROBE_DEFER) : regulator is assigned, but not ready yet, retry.
4 ERR_PTR(<other error codes>: regulator is assigned, but can't be retrieved, failure, can't proceed
So, It's allowed to continue with host->vcc = NULL; only in case [2], while in case [4] probe should fail.
Quoted 4 lines
drivers/mmc/host/omap_hsmmc.c +0
-0}else { host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);
Signature · 2 lines
regards, -grygorii
Re: [PATCH 12/17] ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
In reply to Kishon Vijay Abraham IQuoted 15 lines · Kishon Vijay Abraham I
For beagle x15, both the vdd and io lines are connected to the same regulator (
ldo1_reg). Howevervmmc_auxis populated tovdd_3v3. Remove it.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - 1 file changed, 1 deletion(-)arch/arm/boot/dts/am57xx-beagle-x15.dts +0
-0
arch/arm/boot/dts/am57xx-beagle-x15.dts line 584
Quoted 7 lines
arch/arm/boot/dts/am57xx-beagle-x15.dts +0
-1@@ -579,7 +579,6 @@ pinctrl-0 = <&mmc1_pins_default>; vmmc-supply = <&ldo1_reg>; - vmmc_aux-supply = <&vdd_3v3>; pbias-supply = <&pbias_mmc_reg>; bus-width = <4>; cd-gpios = <&gpio6 27 0>; /* gpio 219 */
Signature · 2 lines
Regards, Nishanth Menon
Re: [PATCH 01/17] mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
In reply to Grygorii StrashkoHi Grygorii,
Quoted 37 lines · Grygorii Strashko
Quoted 18 lines · Kishon Vijay Abraham I
Since vmmc can be optional for some platforms, use
devm_regulator_get_optional()for vmmc. Now return error only in the case of -EPROBE_DEFER and for all other cases sethost->vccto NULL.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-0@@ -344,11 +344,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)struct regulator *reg;int ocr_value =0 ;drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 351
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +5
-3- reg =devm_regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get_optional (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"unable to get vmmc regulator %ld\n" , +if (PTR_ERR (reg) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + host->vcc =NULL ; +dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" ,PTR_ERR (reg)); -return PTR_ERR (reg);I think, It could be unsafe to just drop this return.
regulator_get_optionalmay return:
1 valid pointer on regulator : success;
2ERR_PTR(-ENODEV): regulator is not assigned, can proceed.
3ERR_PTR(-EPROBE_DEFER): regulator is assigned, but not ready yet, retry.
4 ERR_PTR(<other error codes>: regulator is assigned, but can't be retrieved, failure, can't proceed
Quoted 2 lines
So, It's allowed to continue with
host->vcc= NULL; only in case [2], while in case [4] probe should fail.
You are right. Will fix it and resend the patch.
Thanks
Kishon
Hi Kishon,
Thanks for taking a look at the regulator code. Do you have a public git repository so I can pull your patches instead of cherry picking 1-by-1?
/Andi
2015-07-29 13:09 GMT+02:00 Kishon Vijay Abraham I <[email protected]>:
Quoted 45 lines
This patch series does the following
*) Usesdevm_regulator_get_optional()for vmmc and then removes the
CONFIG_REGULATORcheck altogether.
*) return on -EPROBE_DEFER
*) enable/disablevmmc_auxregulator based on prior stateThis series is in preparation for implementing the voltage switch sequence so that UHS cards can be supported.
Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM, Beaglebone black, OMAP5 uEVM and OMAP4 PANDA.
Kishon Vijay Abraham I (16):
mmc: host:omap_hsmmc: usedevm_regulator_get_optional()for vmmc
mmc: host:omap_hsmmc: return error fromomap_hsmmc_reg_geton
-EPROBE_DEFER
mmc: host:omap_hsmmc: cleanupomap_hsmmc_reg_get()
mmc: host:omap_hsmmc: use the ocrmask provided by the vmmc regulator
mmc: host:omap_hsmmc: use mmc_host's vmmc and vqmmc
mmc: host:omap_hsmmc: remove unnecessary pbiasset_voltage
mmc: host:omap_hsmmc: return error if any of the regulator APIs fail
mmc: host:omap_hsmmc: add separate functions for enable/disable
supply
mmc: host:omap_hsmmc: add separate function to set pbias
mmc: host:omap_hsmmc: avoid pbias regulator enable on power off
mmc: host:omap_hsmmc: don't use ->set_power to set initial regulator
state
ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
mmc: host:omap_hsmmc: enable/disablevmmc_auxregulator based on
prior state
mmc: host:omap_hsmmc: useregulator_is_enabledto find pbias status
mmc: host:omap_hsmmc: useios->vddfor setting vmmc voltage
mmc: host:omap_hsmmc: removeCONFIG_REGULATORcheckRoger Quadros (1):
mmc: host:omap_hsmmc: use "mmc_of_parse_voltage" to getocr_avail.../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 2 + arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - drivers/mmc/host/omap_hsmmc.c | 333 +++++++++++++------- 3 files changed, 216 insertions(+), 120 deletions(-)--
1.7.9.5
Hi,
Quoted 5 lines · Andreas Fenkart
Hi Kishon,
Thanks for taking a look at the regulator code. Do you have a public git repository so I can pull your patches instead of cherry picking 1-by-1?
I'll post v2 shortly. With that I'll have the patches in a git tree.
Thanks
Kishon
Quoted 49 lines
/Andi
2015-07-29 13:09 GMT+02:00 Kishon Vijay Abraham I <[email protected]>:
Quoted 45 lines
This patch series does the following
*) Usesdevm_regulator_get_optional()for vmmc and then removes the
CONFIG_REGULATORcheck altogether.
*) return on -EPROBE_DEFER
*) enable/disablevmmc_auxregulator based on prior stateThis series is in preparation for implementing the voltage switch sequence so that UHS cards can be supported.
Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM, Beaglebone black, OMAP5 uEVM and OMAP4 PANDA.
Kishon Vijay Abraham I (16):
mmc: host:omap_hsmmc: usedevm_regulator_get_optional()for vmmc
mmc: host:omap_hsmmc: return error fromomap_hsmmc_reg_geton
-EPROBE_DEFER
mmc: host:omap_hsmmc: cleanupomap_hsmmc_reg_get()
mmc: host:omap_hsmmc: use the ocrmask provided by the vmmc regulator
mmc: host:omap_hsmmc: use mmc_host's vmmc and vqmmc
mmc: host:omap_hsmmc: remove unnecessary pbiasset_voltage
mmc: host:omap_hsmmc: return error if any of the regulator APIs fail
mmc: host:omap_hsmmc: add separate functions for enable/disable
supply
mmc: host:omap_hsmmc: add separate function to set pbias
mmc: host:omap_hsmmc: avoid pbias regulator enable on power off
mmc: host:omap_hsmmc: don't use ->set_power to set initial regulator
state
ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
mmc: host:omap_hsmmc: enable/disablevmmc_auxregulator based on
prior state
mmc: host:omap_hsmmc: useregulator_is_enabledto find pbias status
mmc: host:omap_hsmmc: useios->vddfor setting vmmc voltage
mmc: host:omap_hsmmc: removeCONFIG_REGULATORcheckRoger Quadros (1):
mmc: host:omap_hsmmc: use "mmc_of_parse_voltage" to getocr_avail.../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 2 + arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - drivers/mmc/host/omap_hsmmc.c | 333 +++++++++++++------- 3 files changed, 216 insertions(+), 120 deletions(-)--
1.7.9.5
Re: [PATCH 12/17] ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
In reply to Nishanth MenonHi Tony,
Quoted 17 lines · Nishanth Menon
Quoted 16 lines · Kishon Vijay Abraham I
For beagle x15, both the vdd and io lines are connected to the same regulator (
ldo1_reg). Howevervmmc_auxis populated tovdd_3v3. Remove it.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - 1 file changed, 1 deletion(-)arch/arm/boot/dts/am57xx-beagle-x15.dts +0
-0@@ -579,7 +579,6 @@ pinctrl-0 = <&mmc1_pins_default>;
Quoted 7 lines
arch/arm/boot/dts/am57xx-beagle-x15.dts line 584
Quoted 6 lines
arch/arm/boot/dts/am57xx-beagle-x15.dts +0
-1vmmc-supply = <&ldo1_reg>; - vmmc_aux-supply = <&vdd_3v3>; pbias-supply = <&pbias_mmc_reg>; bus-width = <4>; cd-gpios = <&gpio6 27 0>; /* gpio 219 */Acked-by Nishanth Menon <[email protected]>
Can you pick this one or you want me to resend it?
Thanks
Kishon
Re: [PATCH 12/17] ARM: dts: am57xx-beagle-x15: Fix regulator populated in MMC1 dt node
Quoted 28 lines · Kishon Vijay Abraham I
Hi Tony,
Quoted 17 lines · Nishanth Menon
Quoted 16 lines · Kishon Vijay Abraham I
For beagle x15, both the vdd and io lines are connected to the same regulator (
ldo1_reg). Howevervmmc_auxis populated tovdd_3v3. Remove it.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/boot/dts/am57xx-beagle-x15.dts | 1 - 1 file changed, 1 deletion(-)arch/arm/boot/dts/am57xx-beagle-x15.dts +0
-0@@ -579,7 +579,6 @@ pinctrl-0 = <&mmc1_pins_default>;Quoted 7 lines
arch/arm/boot/dts/am57xx-beagle-x15.dts line 584
Quoted 6 lines
arch/arm/boot/dts/am57xx-beagle-x15.dts +0
-1vmmc-supply = <&ldo1_reg>; - vmmc_aux-supply = <&vdd_3v3>; pbias-supply = <&pbias_mmc_reg>; bus-width = <4>; cd-gpios = <&gpio6 27 0>; /* gpio 219 */Acked-by Nishanth Menon <[email protected]>
Quoted 1 line
Can you pick this one or you want me to resend it?
Picking into omap-for-v4.3/fixes thanks.
Tony