mmc: omap_hsmmc: dt pbias and regulator voltage switch
Subsystems (7)
cover mmc: omap_hsmmc: dt pbias and regulator voltage switch
This patch series adds omap-hsmmc-control driver to handle omap control module mmc registers for devicetree boot.
These control module registers are needed for mmc pbias i/o, speed mode configuration of mmc1 and loopback clock configuration of mmc2.
With voltage switch support (pbias i/o) added for dt, enhance regulator deferred probe handling by adding needs_vmmc and needs_vmmc_aux to indicate whether regulator is applicable so that omap_hsmmc can handle regulator deferred probe error properly.
Remove the assumption that vmmc_aux regulator to be present only if vmmc is available. Platforms can have fixed-always-ON regulator for vmmc and/or vmmc_aux in such cases vmmc regulator needed not be specified in board file.
Add omap-hsmmc-control data to omap dts files.
Balaji T K (13):
ARM: OMAP2+: add needs_vmmc to hsmmc_info
mmc: omap_hsmmc: make vcc and vcc_aux independent
mmc: omap_hsmmc: use needs_vmmc
mmc: omap_hsmmc: update needs_vmmc for dt
mmc: omap_hsmmc: remove use_reg
mmc: omap_hsmmc: add dt pbias and control mmc support
mmc: omap_hsmmc: remove dt pbias workaround
Documentation: dt: mmc: omap hsmmc
ARM: dts: omap3: Add omap control mmc data
ARM: dts: omap36xx: Add omap control mmc data
ARM: dts: omap4: Add omap control mmc data
ARM: dts: omap5: Add omap control mmc data
ARM: dts: am3517: add omap_control_mmc
.../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 34 ++ arch/arm/boot/dts/am3517-evm.dts | 20 + arch/arm/boot/dts/am3517_mt_ventoux.dts | 20 + arch/arm/boot/dts/omap3.dtsi | 17 + arch/arm/boot/dts/omap36xx.dtsi | 7 + arch/arm/boot/dts/omap4.dtsi | 9 + arch/arm/boot/dts/omap5.dtsi | 8 + arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 + arch/arm/mach-omap2/board-4430sdp.c | 3 + arch/arm/mach-omap2/board-cm-t35.c | 2 + arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 3 + arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-omap3beagle.c | 2 + arch/arm/mach-omap2/board-omap3evm.c | 3 + arch/arm/mach-omap2/board-omap3logic.c | 1 + arch/arm/mach-omap2/board-omap3pandora.c | 3 + arch/arm/mach-omap2/board-omap3stalker.c | 2 + arch/arm/mach-omap2/board-omap3touchbook.c | 2 + arch/arm/mach-omap2/board-omap4panda.c | 2 + arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rm680.c | 1 + arch/arm/mach-omap2/board-rx51-peripherals.c | 3 + arch/arm/mach-omap2/board-zoom-peripherals.c | 4 + arch/arm/mach-omap2/hsmmc.c | 2 + arch/arm/mach-omap2/hsmmc.h | 2 + drivers/mmc/host/Makefile | 2 +- drivers/mmc/host/omap_hsmmc.c | 138 ++++--- drivers/mmc/host/omap_hsmmc_control.c | 466 ++++++++++++++++++++ include/linux/platform_data/mmc-omap.h | 20 + 31 files changed, 729 insertions(+), 54 deletions(-) create mode 100644 drivers/mmc/host/omap_hsmmc_control.c
Signature · 1 line
1.7.5.4
PATCH 1/13 ARM: OMAP2+: add needs_vmmc to hsmmc_info
Add needs_vmmc and needs_vmmc_aux to indicate whether regulator is applicable so that omap_hsmmc can handle regulator deferred probe error properly.
Remove the assumption that vmmc_aux regulator to be available only if vmmc is present. Platforms can have fixed-always-ON regulator for vmmc and/or vmmc_aux in such cases regulator needed not be specified in board file.
--- arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 +++ arch/arm/mach-omap2/board-4430sdp.c | 3 +++ arch/arm/mach-omap2/board-cm-t35.c | 2 ++ arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 3 +++ arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-omap3beagle.c | 2 ++ arch/arm/mach-omap2/board-omap3evm.c | 3 +++ arch/arm/mach-omap2/board-omap3logic.c | 1 + arch/arm/mach-omap2/board-omap3pandora.c | 3 +++ arch/arm/mach-omap2/board-omap3stalker.c | 2 ++ arch/arm/mach-omap2/board-omap3touchbook.c | 2 ++ arch/arm/mach-omap2/board-omap4panda.c | 2 ++ arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rm680.c | 1 + arch/arm/mach-omap2/board-rx51-peripherals.c | 3 +++ arch/arm/mach-omap2/board-zoom-peripherals.c | 4 ++++ arch/arm/mach-omap2/hsmmc.c | 2 ++ arch/arm/mach-omap2/hsmmc.h | 2 ++ include/linux/platform_data/mmc-omap.h | 2 ++ 21 files changed, 44 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -0
@@ -242,6 +242,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .ext_clock = 1, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-3430sdp.c +3 -0
@@ -201,12 +201,15 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 4, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .mmc = 2, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 7, .deferred = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-4430sdp.c +3 -0
@@ -461,12 +461,14 @@ static struct omap2_hsmmc_info mmc[] = { .nonremovable = true, .ocr_mask = MMC_VDD_29_30, .no_off_init = true, + .needs_vmmc = 1, }, { .mmc = 1, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, { .mmc = 5,
@@ -476,6 +478,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .ocr_mask = MMC_VDD_165_195, .nonremovable = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-cm-t35.c +2 -0
@@ -407,6 +407,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .mmc = 2,
arch/arm/mach-omap2/board-devkit8000.c +1 -0
@@ -100,6 +100,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, .deferred = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-igep0020.c +3 -0
@@ -284,6 +284,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, },#if defined(CONFIG_LIBERTAS_SDIO ) || defined(CONFIG_LIBERTAS_SDIO_MODULE ) {
@@ -291,6 +292,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, },#endif {}/* Terminator */
arch/arm/mach-omap2/board-ldp.c +1 -0
@@ -358,6 +358,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3beagle.c +2 -0
@@ -263,6 +263,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3evm.c +3 -0
@@ -309,6 +309,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = 63, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, },#ifdef CONFIG_WILINK_PLATFORM_DATA {
@@ -318,6 +320,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, .nonremovable = true, + .needs_vmmc = 1, },#endif {}/* Terminator */
arch/arm/mach-omap2/board-omap3logic.c +1 -0
@@ -104,6 +104,7 @@ static struct omap2_hsmmc_info __initdata board_mmc_info[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3pandora.c +3 -0
@@ -278,6 +278,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .gpio_wp = 126, .ext_clock = 0, .deferred = true, + .needs_vmmc = 1, }, { .mmc = 2,
@@ -287,6 +288,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .ext_clock = 1, .transceiver = true, .deferred = true, + .needs_vmmc = 1, }, { .mmc = 3,
@@ -294,6 +296,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .init_card = pandora_wl1251_init_card, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3stalker.c +2 -0
@@ -184,6 +184,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = 23, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3touchbook.c +2 -0
@@ -103,6 +103,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap4panda.c +2 -0
@@ -199,6 +199,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, + .needs_vmmc = 1, }, { .name = "wl1271",
@@ -208,6 +209,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .ocr_mask = MMC_VDD_165_195, .nonremovable = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-overo.c +1 -0
@@ -285,6 +285,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, { .mmc = 2,
arch/arm/mach-omap2/board-rm680.c +1 -0
@@ -106,6 +106,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {/* Terminator */ } };
arch/arm/mach-omap2/board-rx51-peripherals.c +3 -0
@@ -496,6 +496,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .gpio_cd = 160, .gpio_wp = -EINVAL, .power_saving = true, + .needs_vmmc = 1, }, { .name = "internal",
@@ -507,6 +508,8 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .nonremovable = true, .power_saving = true, .remux = rx51_mmc2_remux, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-zoom-peripherals.c +4 -0
@@ -205,6 +205,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .power_saving = true, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .name = "internal",
@@ -214,6 +216,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .nonremovable = true, .power_saving = true, + .needs_vmmc = 1, }, { .name = "wl1271",
@@ -222,6 +225,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, .nonremovable = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/hsmmc.c +2 -0
@@ -313,6 +313,8 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, c->mmc, 1); mmc->slots[0 ].name = hc_name; mmc->nr_slots =1 ; + mmc->needs_vmmc = c->needs_vmmc; + mmc->needs_vmmc_aux = c->needs_vmmc_aux; mmc->slots[0 ].caps = c->caps; mmc->slots[0 ].pm_caps = c->pm_caps; mmc->slots[0 ].internal_clock = !c->ext_clock;
arch/arm/mach-omap2/hsmmc.h +2 -0
@@ -33,6 +33,8 @@ struct omap2_hsmmc_info {void (*remux)(struct device *dev,int slot,int power_on);/* init some special card */ void (*init_card)(struct mmc_card *card); + unsigned needs_vmmc:1; + unsigned needs_vmmc_aux:1; };#if defined(CONFIG_MMC_OMAP_HS ) || defined(CONFIG_MMC_OMAP_HS_MODULE )
include/linux/platform_data/mmc-omap.h +2 -0
@@ -66,6 +66,8 @@ struct omap_mmc_platform_data {/* Register offset deviation */ u16 reg_offset; + unsigned needs_vmmc:1; + unsigned needs_vmmc_aux:1;struct omap_mmc_slot_data {
Signature · 1 line
1.7.5.4
PATCH 2/13 mmc: omap_hsmmc: make vcc and vcc_aux independent
In reply to Balaji T Khandle vcc and vcc_aux independently
--- drivers/mmc/host/omap_hsmmc.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +5 -4
@@ -252,7 +252,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!host->vcc && !host->vcc_aux)return 0 ;/* * With DT, never turn OFF the regulator. This is because
@@ -279,11 +279,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 ); }
@@ -291,7 +292,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 );
Signature · 1 line
1.7.5.4
PATCH 3/13 mmc: omap_hsmmc: use needs_vmmc
In reply to Balaji T KUse needs_vmmc/needs_vmmc_aux to check whether regulator is mandatory and handle regulator errors like EPROBE_DEFER properly
--- drivers/mmc/host/omap_hsmmc.c | 65 ++++++++++++++++++++++------------------ 1 files changed, 36 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +36 -29
@@ -183,6 +183,8 @@ struct omap_hsmmc_host {struct omap_hsmmc_next next_data;struct omap_mmc_platform_data *pdata; + int needs_vmmc:1; + int needs_vmmc_aux:1; };static int omap_hsmmc_card_detect (struct device *dev,int slot)
@@ -311,11 +313,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)int ocr_value =0 ; reg =regulator_get (host->dev,"vmmc" ); -if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +if (IS_ERR (reg) && host->needs_vmmc) { +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; + } +mmc_slot (host).set_power = omap_hsmmc_set_power; +if (!IS_ERR (reg)) { host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -328,31 +332,33 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } -/* Allow an aux regulator */ - reg =regulator_get (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 ; +/* Allow an aux regulator */ + reg =regulator_get (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; +if (IS_ERR (reg) && host->needs_vmmc_aux) { +dev_err (host->dev,"unable to get vmmc_aux regulator %ld\n" , +PTR_ERR (reg)); +return PTR_ERR (reg); + } -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init || + (!host->needs_vmmc && !host->needs_vmmc_aux)) +return 0 ; +/* +* To disable boot_on regulator, enable regulator +* to increase usecount and then disable it. +*/ +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 ; + +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 ;
@@ -1822,6 +1828,8 @@ 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->needs_vmmc = pdata->needs_vmmc; + host->needs_vmmc_aux = pdata->needs_vmmc_aux;platform_set_drvdata (pdev, host);
@@ -1949,7 +1957,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)if (omap_hsmmc_have_reg () && !mmc_slot (host).set_power) { ret =omap_hsmmc_reg_get (host);if (ret) - goto err_reg; + goto err_irq_cd; host->use_reg =1 ; }
@@ -2006,7 +2014,6 @@ err_slot_name: err_irq_cd:if (host->use_reg)omap_hsmmc_reg_put (host); -err_reg:if (host->pdata->cleanup) host->pdata->cleanup (&pdev->dev); err_irq_cd_init:
Signature · 1 line
1.7.5.4
PATCH 4/13 mmc: omap_hsmmc: update needs_vmmc for dt
In reply to Balaji T Kupdate needs_vmmc, needs_vmmc_aux for dt boot
--- drivers/mmc/host/omap_hsmmc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +3 -0
@@ -1756,6 +1756,9 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)if (of_find_property (np,"ti,needs-special-hs-handling" ,NULL )) pdata->slots[0 ].features |=HSMMC_HAS_HSPE_SUPPORT ; + pdata->needs_vmmc =of_property_read_bool (np,"vmmc-supply" ); + pdata->needs_vmmc_aux =of_property_read_bool (np,"vmmc_aux-supply" ); + return pdata; }#else
Signature · 1 line
1.7.5.4
PATCH 5/13 mmc: omap_hsmmc: remove use_reg
In reply to Balaji T KSince regulator_put can handle NULL / IS_ERR(regulator) use_reg can be removed, so that regulator_put in omap_hsmmc_reg_put can be reused for vmmc_aux regulator error scenario.
--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -6
@@ -178,7 +178,6 @@ struct omap_hsmmc_host {int context_loss;int protect_card;int reqs_blocked; -int use_reg;int req_in_progress;struct omap_hsmmc_next next_data;
@@ -1961,7 +1960,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) ret =omap_hsmmc_reg_get (host);if (ret) goto err_irq_cd; - host->use_reg =1 ; } mmc->ocr_avail =mmc_slot (host).ocr_mask;
@@ -2015,8 +2013,7 @@ err_slot_name:mmc_remove_host (mmc);free_irq (mmc_slot (host).card_detect_irq, host); err_irq_cd: -if (host->use_reg) -omap_hsmmc_reg_put (host); +omap_hsmmc_reg_put (host);if (host->pdata->cleanup) host->pdata->cleanup (&pdev->dev); err_irq_cd_init:
@@ -2053,8 +2050,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->pdata->cleanup) host->pdata->cleanup (&pdev->dev);free_irq (host->irq, host);
Signature · 1 line
1.7.5.4
PATCH 6/13 mmc: omap_hsmmc: add dt pbias and control mmc support
In reply to Balaji T KAdd omap_hsmmc_control to support pbias, high speed mode configuration for mmc1, loopback clock configuration (when external transceiver is used) for mmc2
--- drivers/mmc/host/Makefile | 2 +- drivers/mmc/host/omap_hsmmc.c | 38 +++ drivers/mmc/host/omap_hsmmc_control.c | 466 ++++++++++++++++++++++++++++++++ include/linux/platform_data/mmc-omap.h | 18 ++ 4 files changed, 523 insertions(+), 1 deletions(-) create mode 100644 drivers/mmc/host/omap_hsmmc_control.c
drivers/mmc/host/Makefile +1 -1
@@ -17,7 +17,7 @@ obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o obj-$(CONFIG_MMC_WBSD) += wbsd.o obj-$(CONFIG_MMC_AU1X) += au1xmmc.o obj-$(CONFIG_MMC_OMAP) += omap.o -obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o +obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o omap_hsmmc_control.o obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o obj-$(CONFIG_MMC_MSM) += msm_sdcc.o
drivers/mmc/host/omap_hsmmc.c +38 -0
@@ -182,6 +182,7 @@ struct omap_hsmmc_host {struct omap_hsmmc_next next_data;struct omap_mmc_platform_data *pdata; +struct omap_hsmmc_control *ctrl_mmc; int needs_vmmc:1; int needs_vmmc_aux:1; };
@@ -265,6 +266,8 @@ 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->ctrl_mmc && host->ctrl_mmc->before) + host->ctrl_mmc->before (host->ctrl_mmc->dev, power_on, vdd);/* * Assume Vcc regulator is used only to power the card ... OMAP
@@ -302,6 +305,8 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +if (host->ctrl_mmc && host->ctrl_mmc->after) + host->ctrl_mmc->after (host->ctrl_mmc->dev, power_on, vdd);return ret; }
@@ -1760,6 +1765,33 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)return pdata; } + +static int omap_hsmmc_get_ctrl_mmc (struct omap_hsmmc_host *host) +{ +struct device_node *np = host->dev->of_node; +struct device_node *ctrl_np; +struct platform_device *ctrl_mmc_pdev; +struct omap_hsmmc_control *ctl_mmc; + + ctrl_np =of_parse_phandle (np,"ctrl-module" ,0 ); +if (!ctrl_np) +return 0 ; + + ctrl_mmc_pdev =of_find_device_by_node (ctrl_np); +if (ctrl_mmc_pdev) { + ctl_mmc =platform_get_drvdata (ctrl_mmc_pdev); +if (ctl_mmc && +try_module_get (ctrl_mmc_pdev->dev.driver->owner)) { + host->ctrl_mmc = ctl_mmc; + }else { +dev_err (mmc_dev (host->mmc), +"defer probe for omap-hsmmc-control\n" ); +return -EPROBE_DEFER ; + } + } + +return 0 ; +}#else static inline struct omap_mmc_platform_data *of_get_hsmmc_pdata (struct device *dev)
@@ -1834,6 +1866,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->needs_vmmc_aux = pdata->needs_vmmc_aux;platform_set_drvdata (pdev, host); + ret =omap_hsmmc_get_ctrl_mmc (host); +if (ret) + goto err_alloc; mmc->ops = &omap_hsmmc_ops;
@@ -1956,6 +1991,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev) } } +if (host->ctrl_mmc && host->ctrl_mmc->init) + host->ctrl_mmc->init (host->ctrl_mmc->dev); +if (omap_hsmmc_have_reg () && !mmc_slot (host).set_power) { ret =omap_hsmmc_reg_get (host);if (ret)
drivers/mmc/host/omap_hsmmc_control.c new file +466 -0
466 lines not on this page · raw message
include/linux/platform_data/mmc-omap.h +18 -0
@@ -35,6 +35,24 @@ struct omap_mmc_dev_attr {u8 flags; }; +struct omap_hsmmc_control { +struct device *dev; + +u32 __iomem *pbias; +u32 __iomem *prog_io1; +u32 __iomem *devconf0; +u32 __iomem *devconf1; +u32 __iomem *ctrl_mmc1; + +unsigned external_clock:1 ; +u32 ctrl_type; + +void (*before)(struct device *dev,int power_on,int vdd); +void (*after) (struct device *dev,int power_on,int vdd); +void (*init) (struct device *dev); +void (*exit) (struct device *dev); +}; +struct omap_mmc_platform_data {/* back-link to device */ struct device *dev;
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH 06/13] mmc: omap_hsmmc: add dt pbias and control mmc support
Hi,
Quoted 2 lines · Balaji T K
Add
omap_hsmmc_controlto support pbias, high speed mode configuration for mmc1, loopback clock configuration (when external transceiver is used) for mmc2
Thanks for working on this, few suggestions inlined below.
Quoted 20 lines
drivers/mmc/host/omap_hsmmc.c +3
-0@@ -182,6 +182,7 @@ struct omap_hsmmc_host {struct omap_hsmmc_next next_data;struct omap_mmc_platform_data *pdata; +struct omap_hsmmc_control *ctrl_mmc; int needs_vmmc:1; int needs_vmmc_aux:1; };@@ -265,6 +266,8 @@ 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->ctrl_mmc && host->ctrl_mmc->before) + host->ctrl_mmc->before (host->ctrl_mmc->dev, power_on, vdd);/* * Assume Vcc regulator is used only to power the card ... OMAP
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 312
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c +2
-0@@ -302,6 +305,8 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +if (host->ctrl_mmc && host->ctrl_mmc->after) + host->ctrl_mmc->after (host->ctrl_mmc->dev, power_on, vdd);return ret; }
These before and after functions should be first converted to just usual regulator_set_voltage() eventually. In the PBIAS case it's really a mux plus a comparator, but we can set it up as a regulator. And on some boards it can be an external regulator like we have the legacy callbacks for in mach-omap2/hsmmc.c.
Quoted 58 lines
+++
b/drivers/mmc/host/omap_hsmmc_control.cdrivers/mmc/host/omap_hsmmc.c +56
-0@@ -0,0 +1,466 @@ +static void omap_control_mmc_writel (u32 reg,u32 *base2) +{ +if (base2) +__raw_writel (reg, base2); +return ; +} + +static u32 omap_control_mmc_readl (u32 *base2) +{ +u32 pbias_reg =0 ; + +if (base2) + pbias_reg =__raw_readl (base2); +return pbias_reg; +} + +static void omap2430_mmc1_active_overwrite (u32 __iomem *devconf1,int vdd) +{ +u32 reg; + + reg =omap_control_mmc_readl (devconf1); +if ((1 << vdd) >=MMC_VDD_30_31 ) + reg |=OMAP243X_MMC1_ACTIVE_OVERWRITE ; +else + reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE ; +omap_control_mmc_writel (reg, devconf1); +} +/* pbias configuration for omap2430, omap3 */ +static void omap_hsmmc1_before_set_reg (struct device *dev, +int power_on,int vdd) +{ +u32 reg; +struct omap_hsmmc_control *ctl_mmc =dev_get_drvdata (dev); + +if (ctl_mmc->devconf1) +omap2430_mmc1_active_overwrite (ctl_mmc->devconf1, vdd); + + reg =omap_control_mmc_readl (ctl_mmc->pbias); + reg &= ~OMAP2_PBIASLITEPWRDNZ0 ; +omap_control_mmc_writel (reg, ctl_mmc->pbias); +} + +static void omap_hsmmc1_after_set_reg (struct device *dev, +int power_on,int vdd) +{ +u32 reg; +struct omap_hsmmc_control *ctl_mmc =dev_get_drvdata (dev); + +/* 100ms delay required for PBIAS configuration */ +msleep (100 ); + +if (power_on) { + reg =omap_control_mmc_readl (ctl_mmc->pbias); + reg |=OMAP2_PBIASLITEPWRDNZ0 ; +if ((1 << vdd) <=MMC_VDD_165_195 ) + reg &= ~OMAP2_PBIASLITEVMODE0 ;
drivers/mmc/host/omap_hsmmc.c line 66
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10
-0+else + reg |=OMAP2_PBIASLITEVMODE0 ; +omap_control_mmc_writel (reg, ctl_mmc->pbias); + }else { + reg =omap_control_mmc_readl (ctl_mmc->pbias); + reg |= (OMAP2_PBIASLITEPWRDNZ0 | +OMAP2_PBIASLITEVMODE0 ); +omap_control_mmc_writel (reg, ctl_mmc->pbias); + } +}
...
This all we can simplify quite a bit by defining the PBIAS register as pinctrl-single,bits with two different named modes. One for 1.8V and for 3.3V. This way the PBIAS register is abstracted for various omaps in the .dts file as the register is different.
Then this file should just define a new regulator that requests the defined pinctrl named mode with pinctrl_select_state().
Now the only thing missing AFAIK is getting the comparator value for checks with the generic pinconf framework. But you can already get the raw register value with pin_config_get() and add the checking to this driver until pinconf allows us to do that.
BTW, the same can then be done for the USB transceivers if we figure out a way to properly deal with comparators with generic pinconf.
Regards,
Tony
Re: [PATCH 06/13] mmc: omap_hsmmc: add dt pbias and control mmc support
Quoted 7 lines · Tony Lindgren
Hi,
Quoted 2 lines · Balaji T K
Add
omap_hsmmc_controlto support pbias, high speed mode configuration for mmc1, loopback clock configuration (when external transceiver is used) for mmc2Thanks for working on this, few suggestions inlined below.
Thanks again for reviewing
Quoted 27 lines
Quoted 27 lines
drivers/mmc/host/omap_hsmmc.c +5
-0@@ -182,6 +182,7 @@ struct omap_hsmmc_host {struct omap_hsmmc_next next_data;struct omap_mmc_platform_data *pdata; +struct omap_hsmmc_control *ctrl_mmc; int needs_vmmc:1; int needs_vmmc_aux:1; };@@ -265,6 +266,8 @@ 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->ctrl_mmc && host->ctrl_mmc->before) + host->ctrl_mmc->before (host->ctrl_mmc->dev, power_on, vdd);/* * Assume Vcc regulator is used only to power the card ... OMAP @@ -302,6 +305,8 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +if (host->ctrl_mmc && host->ctrl_mmc->after) + host->ctrl_mmc->after (host->ctrl_mmc->dev, power_on, vdd);
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 312
Quoted 2 lines
drivers/mmc/host/omap_hsmmc.c +0
-0return ret; }These before and after functions should be first converted to just usual
regulator_set_voltage()eventually. In the PBIAS case it's really a mux plus a comparator, but we can set it up as a regulator. And on some boards it can be an external regulator like we have the legacy callbacks for inmach-omap2/hsmmc.c.
Agree these .before, .after functions are for dual volt pbias i/o cell programming based on regulator voltage, but modeling pbias register programming via regulator might be overdo
Quoted 71 lines
Quoted 69 lines
+++
b/drivers/mmc/host/omap_hsmmc_control.cdrivers/mmc/host/omap_hsmmc.c +66
-0@@ -0,0 +1,466 @@ +static void omap_control_mmc_writel (u32 reg,u32 *base2) +{ +if (base2) +__raw_writel (reg, base2); +return ; +} + +static u32 omap_control_mmc_readl (u32 *base2) +{ +u32 pbias_reg =0 ; + +if (base2) + pbias_reg =__raw_readl (base2); +return pbias_reg; +} + +static void omap2430_mmc1_active_overwrite (u32 __iomem *devconf1,int vdd) +{ +u32 reg; + + reg =omap_control_mmc_readl (devconf1); +if ((1 << vdd) >=MMC_VDD_30_31 ) + reg |=OMAP243X_MMC1_ACTIVE_OVERWRITE ; +else + reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE ; +omap_control_mmc_writel (reg, devconf1); +} +/* pbias configuration for omap2430, omap3 */ +static void omap_hsmmc1_before_set_reg (struct device *dev, +int power_on,int vdd) +{ +u32 reg; +struct omap_hsmmc_control *ctl_mmc =dev_get_drvdata (dev); + +if (ctl_mmc->devconf1) +omap2430_mmc1_active_overwrite (ctl_mmc->devconf1, vdd); + + reg =omap_control_mmc_readl (ctl_mmc->pbias); + reg &= ~OMAP2_PBIASLITEPWRDNZ0 ; +omap_control_mmc_writel (reg, ctl_mmc->pbias); +} + +static void omap_hsmmc1_after_set_reg (struct device *dev, +int power_on,int vdd) +{ +u32 reg; +struct omap_hsmmc_control *ctl_mmc =dev_get_drvdata (dev); + +/* 100ms delay required for PBIAS configuration */ +msleep (100 ); + +if (power_on) { + reg =omap_control_mmc_readl (ctl_mmc->pbias); + reg |=OMAP2_PBIASLITEPWRDNZ0 ; +if ((1 << vdd) <=MMC_VDD_165_195 ) + reg &= ~OMAP2_PBIASLITEVMODE0 ; +else + reg |=OMAP2_PBIASLITEVMODE0 ; +omap_control_mmc_writel (reg, ctl_mmc->pbias); + }else { + reg =omap_control_mmc_readl (ctl_mmc->pbias); + reg |= (OMAP2_PBIASLITEPWRDNZ0 | +OMAP2_PBIASLITEVMODE0 ); +omap_control_mmc_writel (reg, ctl_mmc->pbias); + } +}...
Quoted 5 lines
This all we can simplify quite a bit by defining the PBIAS register as pinctrl-single,bits with two different named modes. One for 1.8V and for 3.3V. This way the PBIAS register is abstracted for various omaps in the .dts file as the register is different.
Sometimes pbias register (like in omap3) has bits fields other than mmc1 pbias bits, in which case it will be difficult to abstract via pinctrl-single
with mask bits for non-mmc1 pbias bits.
Quoted 16 lines
Then this file should just define a new regulator that requests the defined pinctrl named mode with
pinctrl_select_state().Now the only thing missing AFAIK is getting the comparator value for checks with the generic pinconf framework. But you can already get the raw register value with
pin_config_get()and add the checking to this driver until pinconf allows us to do that.BTW, the same can then be done for the USB transceivers if we figure out a way to properly deal with comparators with generic pinconf.
Regards,
Tony
Tony Lindgren
maintainerRe: [PATCH 06/13] mmc: omap_hsmmc: add dt pbias and control mmc support
Quoted 11 lines · Balaji T K
Quoted 6 lines · Tony Lindgren
These before and after functions should be first converted to just usual
regulator_set_voltage()eventually. In the PBIAS case it's really a mux plus a comparator, but we can set it up as a regulator. And on some boards it can be an external regulator like we have the legacy callbacks for inmach-omap2/hsmmc.c.Agree these .before, .after functions are for dual volt pbias i/o cell programming based on regulator voltage, but modeling pbias register programming via regulator might be overdo
Probably not as then you don't need to export any custom functions from the pbias code.
Quoted 9 lines
Quoted 5 lines
This all we can simplify quite a bit by defining the PBIAS register as pinctrl-single,bits with two different named modes. One for 1.8V and for 3.3V. This way the PBIAS register is abstracted for various omaps in the .dts file as the register is different.
Sometimes pbias register (like in omap3) has bits fields other than mmc1 pbias bits, in which case it will be difficult to abstract via pinctrl-single
with mask bits for non-mmc1 pbias bits.
Yes exactly, that's what you can totally define with pinconf-single,bits in omap3.dtsi and omap4.dtsi files. Then from the pbias handling regulator code you just request named pinctrl states which are now the same from pbias driver point of view.
Regards,
Tony
v2 cover mmc: omap_hsmmc: dt pbias and regulator voltage switch
This patch series adds support for configuring pbias register needed for switching (ON/OFF, voltage scaling 3V, 1.8V) vmmc regulator suppling OMAP mmc/sd1 i/o pads for device tree boot.
The control module registers are needed for mmc pbias i/o, speed mode configuration of mmc1 and loopback clock configuration of mmc2.
With voltage switch support (pbias i/o) added for dt, enhance regulator deferred probe handling by adding needs_vmmc and needs_vmmc_aux to indicate whether regulator is applicable so that omap_hsmmc can handle regulator deferred probe error properly.
Remove the assumption that vmmc_aux regulator to be present only if vmmc is available. Platforms can have fixed-always-ON regulator for vmmc and/or vmmc_aux in such cases vmmc regulator needed not be specified in board file.
Balaji T K (10):
ARM: OMAP2+: add needs_vmmc to hsmmc_info
mmc: omap_hsmmc: make vcc and vcc_aux independent
mmc: omap_hsmmc: use needs_vmmc
mmc: omap_hsmmc: update needs_vmmc for dt
mmc: omap_hsmmc: remove use_reg
mmc: omap_hsmmc: add support for pbias configuration in dt
mmc: omap_hsmmc: remove dt pbias workaround
ARM: dts: omap3: split omap3_pmx_core
ARM: dts: omap3: add pbias and mmc_init pinctrl states
ARM: dts: omap4: add pbias and mmc_init pinctrl states
arch/arm/boot/dts/omap3-beagle-xm.dts | 42 ++++++ arch/arm/boot/dts/omap3-beagle.dts | 70 +++++++++- arch/arm/boot/dts/omap3.dtsi | 21 +++- arch/arm/boot/dts/omap4-panda-common.dtsi | 34 +++++ arch/arm/boot/dts/omap4-sdp.dts | 34 +++++ arch/arm/boot/dts/omap4.dtsi | 11 ++ arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 + arch/arm/mach-omap2/board-cm-t35.c | 2 + arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 3 + arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-omap3beagle.c | 2 + arch/arm/mach-omap2/board-omap3evm.c | 3 + arch/arm/mach-omap2/board-omap3logic.c | 1 + arch/arm/mach-omap2/board-omap3pandora.c | 3 + arch/arm/mach-omap2/board-omap3stalker.c | 2 + arch/arm/mach-omap2/board-omap3touchbook.c | 2 + arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rm680.c | 1 + arch/arm/mach-omap2/board-rx51-peripherals.c | 3 + arch/arm/mach-omap2/board-zoom-peripherals.c | 4 + arch/arm/mach-omap2/hsmmc.c | 2 + arch/arm/mach-omap2/hsmmc.h | 2 + drivers/mmc/host/omap_hsmmc.c | 188 +++++++++++++++++--------- include/linux/platform_data/mmc-omap.h | 2 + 26 files changed, 367 insertions(+), 72 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v2 1/10 ARM: OMAP2+: add needs_vmmc to hsmmc_info
Add needs_vmmc and needs_vmmc_aux to indicate whether regulator is applicable so that omap_hsmmc can handle deferred probe error properly for regulators.
Remove the assumption that vmmc_aux regulator to be available only if vmmc is present. Platforms can have fixed-always-ON regulator for vmmc and/or vmmc_aux in such cases regulator needed not be specified in board file.
--- arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 +++ arch/arm/mach-omap2/board-cm-t35.c | 2 ++ arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 3 +++ arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-omap3beagle.c | 2 ++ arch/arm/mach-omap2/board-omap3evm.c | 3 +++ arch/arm/mach-omap2/board-omap3logic.c | 1 + arch/arm/mach-omap2/board-omap3pandora.c | 3 +++ arch/arm/mach-omap2/board-omap3stalker.c | 2 ++ arch/arm/mach-omap2/board-omap3touchbook.c | 2 ++ arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rm680.c | 1 + arch/arm/mach-omap2/board-rx51-peripherals.c | 3 +++ arch/arm/mach-omap2/board-zoom-peripherals.c | 4 ++++ arch/arm/mach-omap2/hsmmc.c | 2 ++ arch/arm/mach-omap2/hsmmc.h | 2 ++ include/linux/platform_data/mmc-omap.h | 2 ++ 19 files changed, 39 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -0
@@ -211,6 +211,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .ext_clock = 1, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-3430sdp.c +3 -0
@@ -184,12 +184,15 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 4, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .mmc = 2, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 7, .deferred = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-cm-t35.c +2 -0
@@ -364,6 +364,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .mmc = 2,
arch/arm/mach-omap2/board-devkit8000.c +1 -0
@@ -99,6 +99,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, .deferred = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-igep0020.c +3 -0
@@ -284,6 +284,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, },#if defined(CONFIG_LIBERTAS_SDIO ) || defined(CONFIG_LIBERTAS_SDIO_MODULE ) {
@@ -291,6 +292,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, },#endif {}/* Terminator */
arch/arm/mach-omap2/board-ldp.c +1 -0
@@ -315,6 +315,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3beagle.c +2 -0
@@ -264,6 +264,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3evm.c +3 -0
@@ -279,6 +279,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = 63, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, },#ifdef CONFIG_WILINK_PLATFORM_DATA {
@@ -288,6 +290,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, .nonremovable = true, + .needs_vmmc = 1, },#endif {}/* Terminator */
arch/arm/mach-omap2/board-omap3logic.c +1 -0
@@ -104,6 +104,7 @@ static struct omap2_hsmmc_info __initdata board_mmc_info[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3pandora.c +3 -0
@@ -283,6 +283,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .gpio_wp = 126, .ext_clock = 0, .deferred = true, + .needs_vmmc = 1, }, { .mmc = 2,
@@ -292,6 +293,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .ext_clock = 1, .transceiver = true, .deferred = true, + .needs_vmmc = 1, }, { .mmc = 3,
@@ -299,6 +301,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .init_card = pandora_wl1251_init_card, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3stalker.c +2 -0
@@ -172,6 +172,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = 23, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-omap3touchbook.c +2 -0
@@ -103,6 +103,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-overo.c +1 -0
@@ -255,6 +255,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, { .mmc = 2,
arch/arm/mach-omap2/board-rm680.c +1 -0
@@ -106,6 +106,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {/* Terminator */ } };
arch/arm/mach-omap2/board-rx51-peripherals.c +3 -0
@@ -496,6 +496,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .gpio_cd = 160, .gpio_wp = -EINVAL, .power_saving = true, + .needs_vmmc = 1, }, { .name = "internal",
@@ -507,6 +508,8 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .nonremovable = true, .power_saving = true, .remux = rx51_mmc2_remux, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/board-zoom-peripherals.c +4 -0
@@ -255,6 +255,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .power_saving = true, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .name = "internal",
@@ -264,6 +266,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .nonremovable = true, .power_saving = true, + .needs_vmmc = 1, }, { .name = "wl1271",
@@ -272,6 +275,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, .nonremovable = true, + .needs_vmmc = 1, }, {}/* Terminator */ };
arch/arm/mach-omap2/hsmmc.c +2 -0
@@ -313,6 +313,8 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, c->mmc, 1); mmc->slots[0 ].name = hc_name; mmc->nr_slots =1 ; + mmc->needs_vmmc = c->needs_vmmc; + mmc->needs_vmmc_aux = c->needs_vmmc_aux; mmc->slots[0 ].caps = c->caps; mmc->slots[0 ].pm_caps = c->pm_caps; mmc->slots[0 ].internal_clock = !c->ext_clock;
arch/arm/mach-omap2/hsmmc.h +2 -0
@@ -33,6 +33,8 @@ struct omap2_hsmmc_info {void (*remux)(struct device *dev,int slot,int power_on);/* init some special card */ void (*init_card)(struct mmc_card *card); + unsigned needs_vmmc:1; + unsigned needs_vmmc_aux:1; };#if defined(CONFIG_MMC_OMAP_HS ) || defined(CONFIG_MMC_OMAP_HS_MODULE )
include/linux/platform_data/mmc-omap.h +2 -0
@@ -66,6 +66,8 @@ struct omap_mmc_platform_data {/* Register offset deviation */ u16 reg_offset; + unsigned needs_vmmc:1; + unsigned needs_vmmc_aux:1;struct omap_mmc_slot_data {
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 01/10] ARM: OMAP2+: add needs_vmmc to hsmmc_info
Quoted 6 lines · Balaji T K
Add
needs_vmmcandneeds_vmmc_auxto indicate whether regulator is applicable so thatomap_hsmmccan handle deferred probe error properly for regulators.
Remove the assumption thatvmmc_auxregulator to be available only if vmmc is present. Platforms can have fixed-always-ON regulator for vmmc and/orvmmc_auxin such cases regulator needed not be specified in board file.
Looks good to me, I suggest you resend this again a bit later once the other changes are merged so we can avoid a dependency between arch/arm/mach-omap2 and MMC changes.
Regards,
Tony
Quoted 329 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 +++ arch/arm/mach-omap2/board-cm-t35.c | 2 ++ arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 3 +++ arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-omap3beagle.c | 2 ++ arch/arm/mach-omap2/board-omap3evm.c | 3 +++ arch/arm/mach-omap2/board-omap3logic.c | 1 + arch/arm/mach-omap2/board-omap3pandora.c | 3 +++ arch/arm/mach-omap2/board-omap3stalker.c | 2 ++ arch/arm/mach-omap2/board-omap3touchbook.c | 2 ++ arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rm680.c | 1 + arch/arm/mach-omap2/board-rx51-peripherals.c | 3 +++ arch/arm/mach-omap2/board-zoom-peripherals.c | 4 ++++ arch/arm/mach-omap2/hsmmc.c | 2 ++ arch/arm/mach-omap2/hsmmc.h | 2 ++ include/linux/platform_data/mmc-omap.h | 2 ++ 19 files changed, 39 insertions(+), 0 deletions(-)arch/arm/mach-omap2/board-2430sdp.c +1
-0@@ -211,6 +211,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .ext_clock = 1, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-3430sdp.c +3
-0@@ -184,12 +184,15 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 4, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .mmc = 2, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 7, .deferred = true, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-cm-t35.c +2
-0@@ -364,6 +364,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .mmc = 2,arch/arm/mach-omap2/board-devkit8000.c +1
-0@@ -99,6 +99,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, .deferred = true, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-igep0020.c +3
-0@@ -284,6 +284,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, },#if defined(CONFIG_LIBERTAS_SDIO ) || defined(CONFIG_LIBERTAS_SDIO_MODULE ) {@@ -291,6 +292,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, },#endif {}/* Terminator */ arch/arm/mach-omap2/board-ldp.c +1
-0@@ -315,6 +315,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-omap3beagle.c +2
-0@@ -264,6 +264,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_wp = -EINVAL, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-omap3evm.c +3
-0@@ -279,6 +279,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = 63, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, },#ifdef CONFIG_WILINK_PLATFORM_DATA {@@ -288,6 +290,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, .nonremovable = true, + .needs_vmmc = 1, },#endif {}/* Terminator */ arch/arm/mach-omap2/board-omap3logic.c +1
-0@@ -104,6 +104,7 @@ static struct omap2_hsmmc_info __initdata board_mmc_info[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-omap3pandora.c +3
-0@@ -283,6 +283,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .gpio_wp = 126, .ext_clock = 0, .deferred = true, + .needs_vmmc = 1, }, { .mmc = 2,@@ -292,6 +293,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .ext_clock = 1, .transceiver = true, .deferred = true, + .needs_vmmc = 1, }, { .mmc = 3,@@ -299,6 +301,7 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, .init_card = pandora_wl1251_init_card, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-omap3stalker.c +2
-0@@ -172,6 +172,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd = -EINVAL, .gpio_wp = 23, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-omap3touchbook.c +2
-0@@ -103,6 +103,8 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-overo.c +1
-0@@ -255,6 +255,7 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, { .mmc = 2,arch/arm/mach-omap2/board-rm680.c +1
-0@@ -106,6 +106,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .needs_vmmc = 1, }, {/* Terminator */ } };arch/arm/mach-omap2/board-rx51-peripherals.c +3
-0@@ -496,6 +496,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .gpio_cd = 160, .gpio_wp = -EINVAL, .power_saving = true, + .needs_vmmc = 1, }, { .name = "internal",@@ -507,6 +508,8 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .nonremovable = true, .power_saving = true, .remux = rx51_mmc2_remux, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/board-zoom-peripherals.c +4
-0@@ -255,6 +255,8 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .power_saving = true, .deferred = true, + .needs_vmmc = 1, + .needs_vmmc_aux = 1, }, { .name = "internal",@@ -264,6 +266,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .nonremovable = true, .power_saving = true, + .needs_vmmc = 1, }, { .name = "wl1271",@@ -272,6 +275,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_wp = -EINVAL, .gpio_cd = -EINVAL, .nonremovable = true, + .needs_vmmc = 1, }, {}/* Terminator */ };arch/arm/mach-omap2/hsmmc.c +2
-0@@ -313,6 +313,8 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, c->mmc, 1); mmc->slots[0 ].name = hc_name; mmc->nr_slots =1 ; + mmc->needs_vmmc = c->needs_vmmc; + mmc->needs_vmmc_aux = c->needs_vmmc_aux; mmc->slots[0 ].caps = c->caps; mmc->slots[0 ].pm_caps = c->pm_caps; mmc->slots[0 ].internal_clock = !c->ext_clock;arch/arm/mach-omap2/hsmmc.h +2
-0@@ -33,6 +33,8 @@ struct omap2_hsmmc_info {void (*remux)(struct device *dev,int slot,int power_on);/* init some special card */ void (*init_card)(struct mmc_card *card); + unsigned needs_vmmc:1; + unsigned needs_vmmc_aux:1; };#if defined(CONFIG_MMC_OMAP_HS ) || defined(CONFIG_MMC_OMAP_HS_MODULE )include/linux/platform_data/mmc-omap.h +2
-0@@ -66,6 +66,8 @@ struct omap_mmc_platform_data {/* Register offset deviation */ u16 reg_offset; + unsigned needs_vmmc:1; + unsigned needs_vmmc_aux:1;struct omap_mmc_slot_data {Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 01/10] ARM: OMAP2+: add needs_vmmc to hsmmc_info
Quoted 8 lines · Tony Lindgren
Quoted 6 lines · Balaji T K
Add
needs_vmmcandneeds_vmmc_auxto indicate whether regulator is applicable so thatomap_hsmmccan handle deferred probe error properly for regulators.
Remove the assumption thatvmmc_auxregulator to be available only if vmmc is present. Platforms can have fixed-always-ON regulator for vmmc and/orvmmc_auxin such cases regulator needed not be specified in board file.
Quoted 4 lines
Looks good to me, I suggest you resend this again a bit later once the other changes are merged so we can avoid a dependency between
arch/arm/mach-omap2and MMC changes.
Ok, will separate the board changes and send the rest via mmc tree
Quoted 27 lines
Regards,
Tony
Quoted 23 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/mach-omap2/board-2430sdp.c | 1 + arch/arm/mach-omap2/board-3430sdp.c | 3 +++ arch/arm/mach-omap2/board-cm-t35.c | 2 ++ arch/arm/mach-omap2/board-devkit8000.c | 1 + arch/arm/mach-omap2/board-igep0020.c | 3 +++ arch/arm/mach-omap2/board-ldp.c | 1 + arch/arm/mach-omap2/board-omap3beagle.c | 2 ++ arch/arm/mach-omap2/board-omap3evm.c | 3 +++ arch/arm/mach-omap2/board-omap3logic.c | 1 + arch/arm/mach-omap2/board-omap3pandora.c | 3 +++ arch/arm/mach-omap2/board-omap3stalker.c | 2 ++ arch/arm/mach-omap2/board-omap3touchbook.c | 2 ++ arch/arm/mach-omap2/board-overo.c | 1 + arch/arm/mach-omap2/board-rm680.c | 1 + arch/arm/mach-omap2/board-rx51-peripherals.c | 3 +++ arch/arm/mach-omap2/board-zoom-peripherals.c | 4 ++++ arch/arm/mach-omap2/hsmmc.c | 2 ++ arch/arm/mach-omap2/hsmmc.h | 2 ++ include/linux/platform_data/mmc-omap.h | 2 ++ 19 files changed, 39 insertions(+), 0 deletions(-)
PATCH v2 2/10 mmc: omap_hsmmc: make vcc and vcc_aux independent
In reply to Balaji T Khandle vcc and vcc_aux independently
--- drivers/mmc/host/omap_hsmmc.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +5 -4
@@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!host->vcc && !host->vcc_aux)return 0 ;/* * With DT, never turn OFF the regulator for MMC1. This is because
@@ -280,11 +280,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 ); }
@@ -292,7 +293,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 );
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 02/10] mmc: omap_hsmmc: make vcc and vcc_aux independent
Quoted 12 lines · Balaji T K
handle vcc and
vcc_auxindependentlySigned-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)drivers/mmc/host/omap_hsmmc.c +0
-0
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 259
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c +1
-1@@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!host->vcc && !host->vcc_aux)return 0 ;/* * With DT, never turn OFF the regulator for MMC1. This is because
Doesn't the above change break MMC for most boards that only pass one regulator and no aux regulator?
Regards,
Tony
Quoted 27 lines
drivers/mmc/host/omap_hsmmc.c +4
-3@@ -280,11 +280,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 ); }@@ -292,7 +293,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 );Signature · 1 line
1.7.5.4
Re: [PATCH v2 02/10] mmc: omap_hsmmc: make vcc and vcc_aux independent
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Balaji T K
handle vcc and
vcc_auxindependentlySigned-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
Quoted 17 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 259
Quoted 13 lines
drivers/mmc/host/omap_hsmmc.c +1
-1@@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!host->vcc && !host->vcc_aux)return 0 ;/* * With DT, never turn OFF the regulator for MMC1. This is because Doesn't the above change break MMC for most boards that only pass one regulator and no aux regulator?
No, I want to skip regulator operation in set_power function iff both regulator are not present.
Earlier vcc was assumed/mandatory if vcc_aux is present.
Now, regulator operation will be handled if either one of vcc/vcc_aux is present,
Quoted 31 lines
Regards,
Tony
Quoted 27 lines
drivers/mmc/host/omap_hsmmc.c +4
-4@@ -280,11 +280,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 ); }@@ -292,7 +293,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 ); --1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 02/10] mmc: omap_hsmmc: make vcc and vcc_aux independent
Quoted 27 lines · Balaji T K
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Balaji T K
handle vcc and
vcc_auxindependentlySigned-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)Quoted 17 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 259
Quoted 13 lines
drivers/mmc/host/omap_hsmmc.c +1
-1@@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,* If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!host->vcc && !host->vcc_aux)return 0 ;/* * With DT, never turn OFF the regulator for MMC1. This is because Doesn't the above change break MMC for most boards that only pass one regulator and no aux regulator?
Quoted 5 lines
No, I want to skip regulator operation in
set_powerfunction iff both regulator are not present.Earlier vcc was assumed/mandatory if
vcc_auxis present.
Now, regulator operation will be handled if either one of vcc/vcc_aux is present,
Ah OK yes sorry I misread your patch.
Regards,
Tony
PATCH v2 3/10 mmc: omap_hsmmc: use needs_vmmc
In reply to Balaji T KUpdate needs_vmmc with info passed from board file via platform data pdata->needs_vmmc.
Use needs_vmmc/needs_vmmc_aux to check whether regulator is mandatory and handle regulator errors like EPROBE_DEFER properly
--- drivers/mmc/host/omap_hsmmc.c | 65 ++++++++++++++++++++++------------------ 1 files changed, 36 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +36 -29
@@ -184,6 +184,8 @@ struct omap_hsmmc_host {struct omap_hsmmc_next next_data;struct omap_mmc_platform_data *pdata; + int needs_vmmc:1; + int needs_vmmc_aux:1; };static int omap_hsmmc_card_detect (struct device *dev,int slot)
@@ -312,11 +314,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)int ocr_value =0 ; reg =regulator_get (host->dev,"vmmc" ); -if (IS_ERR (reg)) { -dev_err (host->dev,"vmmc regulator missing\n" ); +if (IS_ERR (reg) && host->needs_vmmc) { +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; + } +mmc_slot (host).set_power = omap_hsmmc_set_power; +if (!IS_ERR (reg)) { host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);if (!mmc_slot (host).ocr_mask) {
@@ -329,31 +333,33 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return -EINVAL ; } } + } -/* Allow an aux regulator */ - reg =regulator_get (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 ; +/* Allow an aux regulator */ + reg =regulator_get (host->dev,"vmmc_aux" ); + host->vcc_aux =IS_ERR (reg) ?NULL : reg; +if (IS_ERR (reg) && host->needs_vmmc_aux) { +dev_err (host->dev,"unable to get vmmc_aux regulator %ld\n" , +PTR_ERR (reg)); +return PTR_ERR (reg); + } -mmc_slot (host).set_power (host->dev, host->slot_id, -1 , vdd); -mmc_slot (host).set_power (host->dev, host->slot_id, -0 ,0 ); - } +/* For eMMC do not power off when not in sleep state */ +if (mmc_slot (host).no_regulator_off_init || + (!host->needs_vmmc && !host->needs_vmmc_aux)) +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 ); }return 0 ;
@@ -1833,6 +1839,8 @@ 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->needs_vmmc = pdata->needs_vmmc; + host->needs_vmmc_aux = pdata->needs_vmmc_aux;platform_set_drvdata (pdev, host);
@@ -1972,7 +1980,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)if (omap_hsmmc_have_reg () && !mmc_slot (host).set_power) { ret =omap_hsmmc_reg_get (host);if (ret) - goto err_reg; + goto err_irq_cd; host->use_reg =1 ; }
@@ -2029,7 +2037,6 @@ err_slot_name: err_irq_cd:if (host->use_reg)omap_hsmmc_reg_put (host); -err_reg:if (host->pdata->cleanup) host->pdata->cleanup (&pdev->dev); err_irq_cd_init:
Signature · 1 line
1.7.5.4
PATCH v2 4/10 mmc: omap_hsmmc: update needs_vmmc for dt
In reply to Balaji T Kupdate needs_vmmc, needs_vmmc_aux for dt boot
--- drivers/mmc/host/omap_hsmmc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +3 -0
@@ -1763,6 +1763,9 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)if (of_find_property (np,"ti,needs-special-hs-handling" ,NULL )) pdata->slots[0 ].features |=HSMMC_HAS_HSPE_SUPPORT ; + pdata->needs_vmmc =of_property_read_bool (np,"vmmc-supply" ); + pdata->needs_vmmc_aux =of_property_read_bool (np,"vmmc_aux-supply" ); + return pdata; }#else
Signature · 1 line
1.7.5.4
PATCH v2 5/10 mmc: omap_hsmmc: remove use_reg
In reply to Balaji T KSince regulator_put can handle NULL / IS_ERR(regulator) use_reg can be removed, so that regulator_put in omap_hsmmc_reg_put can be reused for vmmc_aux regulator error scenario.
--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -6
@@ -179,7 +179,6 @@ struct omap_hsmmc_host {int context_loss;int protect_card;int reqs_blocked; -int use_reg;int req_in_progress;struct omap_hsmmc_next next_data;
@@ -1984,7 +1983,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) ret =omap_hsmmc_reg_get (host);if (ret) goto err_irq_cd; - host->use_reg =1 ; } mmc->ocr_avail =mmc_slot (host).ocr_mask;
@@ -2038,8 +2036,7 @@ err_slot_name:mmc_remove_host (mmc);free_irq (mmc_slot (host).card_detect_irq, host); err_irq_cd: -if (host->use_reg) -omap_hsmmc_reg_put (host); +omap_hsmmc_reg_put (host);if (host->pdata->cleanup) host->pdata->cleanup (&pdev->dev); err_irq_cd_init:
@@ -2075,8 +2072,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->pdata->cleanup) host->pdata->cleanup (&pdev->dev);free_irq (host->irq, host);
Signature · 1 line
1.7.5.4
PATCH v2 6/10 mmc: omap_hsmmc: add support for pbias configuration in dt
In reply to Balaji T KPBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined as pbias_off, pbias_1v8, pbias_3v.
pinctrl state mmc_init is used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (in control_mmc1 for omap4)
--- drivers/mmc/host/omap_hsmmc.c | 83 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 78 insertions(+), 5 deletions(-)
drivers/mmc/host/omap_hsmmc.c +78 -5
@@ -182,6 +182,9 @@ struct omap_hsmmc_host {int req_in_progress;struct omap_hsmmc_next next_data; +struct pinctrl *pinctrl; +struct pinctrl_state *pbias_off, *pbias_1v8, *pbias_3v, *mmc_init; +struct omap_mmc_platform_data *pdata; int needs_vmmc:1; int needs_vmmc_aux:1;
@@ -267,6 +270,12 @@ 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->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
@@ -304,6 +313,25 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +/* 100ms delay required for PBIAS configuration */ +msleep (100 ); +if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + }else if (((1 << vdd) <=MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" ); + }else if (((1 << vdd) >MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + } +usleep_range (350 ,400 ); +return ret; }
@@ -1775,6 +1803,52 @@ static inline struct omap_mmc_platform_data }#endif +static int omap_hsmmc_pinctrl_init (struct omap_hsmmc_host *host) +{ +int ret =0 ; + + host->pinctrl =devm_pinctrl_get (host->dev); +if (IS_ERR (host->pinctrl)) { + host->pinctrl =NULL ; +dev_warn (host->dev, +"pins are not configured from the driver\n" ); +return 0 ; + } + + host->mmc_init =pinctrl_lookup_state (host->pinctrl,"mmc_init" ); +if (IS_ERR (host->mmc_init)) { +dev_vdbg (host->dev,"optional: mmc_init lookup error" ); + host->mmc_init =NULL ; + }else { + ret =pinctrl_select_state (host->pinctrl, host->mmc_init); +if (ret <0 ) { +dev_err (host->dev,"pinctrl mmc_init select error\n" ); + goto err_pinctrl; + } + } + + host->pbias_off =pinctrl_lookup_state (host->pinctrl,"pbias_off" ); +if (IS_ERR (host->pbias_off)) { +dev_vdbg (host->dev,"optional: pbias_off lookup error" ); + host->pbias_off =NULL ; + } + + host->pbias_1v8 =pinctrl_lookup_state (host->pinctrl,"pbias_1v8" ); +if (IS_ERR (host->pbias_1v8)) { +dev_vdbg (host->dev,"optional: pbias_1v8 lookup error" ); + host->pbias_1v8 =NULL ; + } + + host->pbias_3v =pinctrl_lookup_state (host->pinctrl,"pbias_3v" ); +if (IS_ERR (host->pbias_3v)) { +dev_vdbg (host->dev,"optional: pbias_3v lookup error" ); + host->pbias_3v =NULL ; + } + +err_pinctrl: +return ret; +} +static int omap_hsmmc_probe (struct platform_device *pdev) {struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;
@@ -1785,7 +1859,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)const struct of_device_id *match;dma_cap_mask_t mask;unsigned tx_req, rx_req; -struct pinctrl *pinctrl; match =of_match_device (of_match_ptr (omap_mmc_of_match), &pdev->dev);if (match) {
@@ -2005,10 +2078,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_disable_irq (host); - pinctrl =devm_pinctrl_get_select_default (&pdev->dev); -if (IS_ERR (pinctrl)) -dev_warn (&pdev->dev, -"pins are not configured from the driver\n" ); + ret =omap_hsmmc_pinctrl_init (host); +if (ret) + goto err_pinctrl_state;omap_hsmmc_protect_card (host);
@@ -2034,6 +2106,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) err_slot_name:mmc_remove_host (mmc); +err_pinctrl_state:free_irq (mmc_slot (host).card_detect_irq, host); err_irq_cd:omap_hsmmc_reg_put (host);
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 44 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 83 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 78 insertions(+), 5 deletions(-)drivers/mmc/host/omap_hsmmc.c +9
-0@@ -182,6 +182,9 @@ struct omap_hsmmc_host {int req_in_progress;struct omap_hsmmc_next next_data; +struct pinctrl *pinctrl; +struct pinctrl_state *pbias_off, *pbias_1v8, *pbias_3v, *mmc_init; +struct omap_mmc_platform_data *pdata; int needs_vmmc:1; int needs_vmmc_aux:1;@@ -267,6 +270,12 @@ 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->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 317
Quoted 5 lines
drivers/mmc/host/omap_hsmmc.c +2
-0@@ -304,6 +313,25 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); +/* 100ms delay required for PBIAS configuration */ +msleep (100 );
Hmm, why is the delay needed before the configuration? Is this something you could avoid by reading the pinconf state maybe?
Quoted 9 lines
drivers/mmc/host/omap_hsmmc.c +9
-0+if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + }else if (((1 << vdd) <=MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" );
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 336
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +8
-0+ }else if (((1 << vdd) >MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + } +usleep_range (350 ,400 ); +return ret; }
Maybe add some macro for doing the if (((1 << vdd) <= MMC_VDD_165_195)... tests?
Quoted 39 lines
drivers/mmc/host/omap_hsmmc.c +35
-0@@ -1775,6 +1803,52 @@ static inline struct omap_mmc_platform_data }#endif +static int omap_hsmmc_pinctrl_init (struct omap_hsmmc_host *host) +{ +int ret =0 ; + + host->pinctrl =devm_pinctrl_get (host->dev); +if (IS_ERR (host->pinctrl)) { + host->pinctrl =NULL ; +dev_warn (host->dev, +"pins are not configured from the driver\n" ); +return 0 ; + } + + host->mmc_init =pinctrl_lookup_state (host->pinctrl,"mmc_init" ); +if (IS_ERR (host->mmc_init)) { +dev_vdbg (host->dev,"optional: mmc_init lookup error" ); + host->mmc_init =NULL ; + }else { + ret =pinctrl_select_state (host->pinctrl, host->mmc_init); +if (ret <0 ) { +dev_err (host->dev,"pinctrl mmc_init select error\n" ); + goto err_pinctrl; + } + } + + host->pbias_off =pinctrl_lookup_state (host->pinctrl,"pbias_off" ); +if (IS_ERR (host->pbias_off)) { +dev_vdbg (host->dev,"optional: pbias_off lookup error" ); + host->pbias_off =NULL ; + } + + host->pbias_1v8 =pinctrl_lookup_state (host->pinctrl,"pbias_1v8" ); +if (IS_ERR (host->pbias_1v8)) { +dev_vdbg (host->dev,"optional: pbias_1v8 lookup error" ); + host->pbias_1v8 =NULL ; + }
drivers/mmc/host/omap_hsmmc.c static inline struct omap_mmc_platform_data · line 1850
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10
-0+ + host->pbias_3v =pinctrl_lookup_state (host->pinctrl,"pbias_3v" ); +if (IS_ERR (host->pbias_3v)) { +dev_vdbg (host->dev,"optional: pbias_3v lookup error" ); + host->pbias_3v =NULL ; + } + +err_pinctrl: +return ret; +}
Linus W may have some comments on this, although this is not the standard muxing stuff. The "mmc_init" state pins should be added to just the regular default state? Note that you can have phandles to however many sets of pins there.
Quoted 26 lines
drivers/mmc/host/omap_hsmmc.c +3
-5static int omap_hsmmc_probe (struct platform_device *pdev) {struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;@@ -1785,7 +1859,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)const struct of_device_id *match;dma_cap_mask_t mask;unsigned tx_req, rx_req; -struct pinctrl *pinctrl; match =of_match_device (of_match_ptr (omap_mmc_of_match), &pdev->dev);if (match) {@@ -2005,10 +2078,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_disable_irq (host); - pinctrl =devm_pinctrl_get_select_default (&pdev->dev); -if (IS_ERR (pinctrl)) -dev_warn (&pdev->dev, -"pins are not configured from the driver\n" ); + ret =omap_hsmmc_pinctrl_init (host); +if (ret) + goto err_pinctrl_state;omap_hsmmc_protect_card (host);
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_probe(struct platform_device *pdev) · line 2112
Quoted 7 lines
drivers/mmc/host/omap_hsmmc.c +1
-0@@ -2034,6 +2106,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) err_slot_name:mmc_remove_host (mmc); +err_pinctrl_state:free_irq (mmc_slot (host).card_detect_irq, host); err_irq_cd:omap_hsmmc_reg_put (host);
Regards,
Tony
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 48 lines · Tony Lindgren
Quoted 47 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 83 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 78 insertions(+), 5 deletions(-)drivers/mmc/host/omap_hsmmc.c +9
-0@@ -182,6 +182,9 @@ struct omap_hsmmc_host {int req_in_progress;struct omap_hsmmc_next next_data; +struct pinctrl *pinctrl; +struct pinctrl_state *pbias_off, *pbias_1v8, *pbias_3v, *mmc_init; +struct omap_mmc_platform_data *pdata; int needs_vmmc:1; int needs_vmmc_aux:1;@@ -267,6 +270,12 @@ 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->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + } +/* * Assume Vcc regulator is used only to power the card ... OMAP * VDDS is used to power the pins, optionally with a transceiver to @@ -304,6 +313,25 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,if (mmc_slot (host).after_set_reg)mmc_slot (host).after_set_reg (dev, slot, power_on, vdd);
Quoted 5 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 317
Quoted 2 lines
drivers/mmc/host/omap_hsmmc.c +2
-0+/* 100ms delay required for PBIAS configuration */ +msleep (100 );Hmm, why is the delay needed before the configuration? Is this something you could avoid by reading the pinconf state maybe?
This delay is needed for regulator voltage to stabilize.
Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/omap_hsmmc.c +13
-0+if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + }else if (((1 << vdd) <=MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" ); + }else if (((1 << vdd) >MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 )
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 336
Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c +4
-0+dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + } +usleep_range (350 ,400 ); +return ret; }Maybe add some macro for doing the if (((1 << vdd) <=
MMC_VDD_165_195)... tests?
OK
Quoted 47 lines
Quoted 47 lines
drivers/mmc/host/omap_hsmmc.c +42
-0@@ -1775,6 +1803,52 @@ static inline struct omap_mmc_platform_data }#endif +static int omap_hsmmc_pinctrl_init (struct omap_hsmmc_host *host) +{ +int ret =0 ; + + host->pinctrl =devm_pinctrl_get (host->dev); +if (IS_ERR (host->pinctrl)) { + host->pinctrl =NULL ; +dev_warn (host->dev, +"pins are not configured from the driver\n" ); +return 0 ; + } + + host->mmc_init =pinctrl_lookup_state (host->pinctrl,"mmc_init" ); +if (IS_ERR (host->mmc_init)) { +dev_vdbg (host->dev,"optional: mmc_init lookup error" ); + host->mmc_init =NULL ; + }else { + ret =pinctrl_select_state (host->pinctrl, host->mmc_init); +if (ret <0 ) { +dev_err (host->dev,"pinctrl mmc_init select error\n" ); + goto err_pinctrl; + } + } + + host->pbias_off =pinctrl_lookup_state (host->pinctrl,"pbias_off" ); +if (IS_ERR (host->pbias_off)) { +dev_vdbg (host->dev,"optional: pbias_off lookup error" ); + host->pbias_off =NULL ; + } + + host->pbias_1v8 =pinctrl_lookup_state (host->pinctrl,"pbias_1v8" ); +if (IS_ERR (host->pbias_1v8)) { +dev_vdbg (host->dev,"optional: pbias_1v8 lookup error" ); + host->pbias_1v8 =NULL ; + } + + host->pbias_3v =pinctrl_lookup_state (host->pinctrl,"pbias_3v" ); +if (IS_ERR (host->pbias_3v)) { +dev_vdbg (host->dev,"optional: pbias_3v lookup error" ); + host->pbias_3v =NULL ; + } +
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c static inline struct omap_mmc_platform_data · line 1850
Quoted 3 lines
drivers/mmc/host/omap_hsmmc.c +3
-0+err_pinctrl: +return ret; +}Linus W may have some comments on this, although this is not the standard muxing stuff. The "
mmc_init" state pins should be added to just the regular default state? Note that you can have phandles to however many sets of pins there.
Yes, can add &mmc_init pin config to default state.
Quoted 39 lines
Quoted 27 lines
drivers/mmc/host/omap_hsmmc.c +3
-5static int omap_hsmmc_probe (struct platform_device *pdev) {struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;@@ -1785,7 +1859,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)const struct of_device_id *match;dma_cap_mask_t mask;unsigned tx_req, rx_req; -struct pinctrl *pinctrl; match =of_match_device (of_match_ptr (omap_mmc_of_match), &pdev->dev);if (match) {@@ -2005,10 +2078,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_disable_irq (host); - pinctrl =devm_pinctrl_get_select_default (&pdev->dev); -if (IS_ERR (pinctrl)) -dev_warn (&pdev->dev, -"pins are not configured from the driver\n" ); + ret =omap_hsmmc_pinctrl_init (host); +if (ret) + goto err_pinctrl_state;omap_hsmmc_protect_card (host);drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_probe(struct platform_device *pdev) · line 2112
Quoted 7 lines
drivers/mmc/host/omap_hsmmc.c +1
-0@@ -2034,6 +2106,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) err_slot_name:mmc_remove_host (mmc); +err_pinctrl_state:free_irq (mmc_slot (host).card_detect_irq, host); err_irq_cd:omap_hsmmc_reg_put (host);Regards,
Tony
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
In reply to Tony LindgrenQuoted 2 lines · Tony Lindgren
Linus W may have some comments on this, although this is not the standard muxing stuff.
It's in the wrong subsystem and needs to be rewritten IMO.
Yours,
Linus Walleij
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
In reply to Balaji T KQuoted 7 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.
Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>
You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
Quoted 7 lines
drivers/mmc/host/omap_hsmmc.c +7
-0+/* 100ms delay required for PBIAS configuration */ +msleep (100 ); +if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + } else if (((1 << vdd) <= MMC_VDD_165_195) && host->pinctrl &&
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 332
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10
-0+ host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" ); + } else if (((1 << vdd) > MMC_VDD_165_195) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + }
So why does the pin control API control bias voltage?
This seem so intuitively wrong as it can possibly get, clearly this is regulator territory.
This also looks strange from an MMC point of view.
It just seems these bits in these registers should be poked at by the regulator world, not the pinctrl world. That the bits are in the middle of pinctrl things does not really matter.
Quoted 1 line
+
usleep_range(350, 400);
And the regulator framework supports power-on delays.
Yours,
Linus Walleij
Tony Lindgren
maintainerRe: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 40 lines · Linus Walleij
Quoted 7 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
Quoted 7 lines
drivers/mmc/host/omap_hsmmc.c +7
-0+/* 100ms delay required for PBIAS configuration */ +msleep (100 ); +if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + } else if (((1 << vdd) <= MMC_VDD_165_195) && host->pinctrl &&drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, · line 332
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10
-0+ host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" ); + } else if (((1 << vdd) > MMC_VDD_165_195) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + }
Quoted 1 line
So why does the pin control API control bias voltage?
I agree, it should be a regulator for the MMC driver and that's what I already suggested earlier. Having it as a regulator allows us to get rid of all the non-standard before and after calls in the omap_hsmmc.c. This way the omap_hsmmc.c code can handle the internal and external voltages the same way.
Quoted 2 lines
This seem so intuitively wrong as it can possibly get, clearly this is regulator territory.
The PBIAS for MMC1 is a mux + comparator for the MMC pin, so it makes sense for the regulator driver to access the register via pinctrl API. I think the reason why we have registers like this and the USB comparators in the omap SCM (System Control Module) as the all seem to relate to pin states.
Quoted 1 line
This also looks strange from an MMC point of view.
Yes I agree, it should be a regulator for MMC. Doing it this way just adds yet more code that's usable for only one of the omap MMC controllers.
Quoted 7 lines
It just seems these bits in these registers should be poked at by the regulator world, not the pinctrl world. That the bits are in the middle of pinctrl things does not really matter.
Quoted 1 line
+
usleep_range(350, 400);And the regulator framework supports power-on delays.
Yes. And it seems that the delays should not be needed, but instead the comparator bits should be checked.
Regards,
Tony
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 13 lines · On Thursday 13 June 2013 02:53:54 Tony Lindgren wrote:
Quoted 12 lines · Linus Walleij
Quoted 11 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
The SH pinctrl driver registers an MMC regulator. The code is available atgit://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git. Look at drivers/pinctrl/sh-pfc/pfc-sh73a0.c in tags/renesas-next-20130611v2.
Quoted 54 lines
Quoted 21 lines
Quoted 19 lines
drivers/mmc/host/omap_hsmmc.c +4
-0+/* 100ms delay required for PBIAS configuration */ +msleep (100 ); +if (!vdd && host->pinctrl && host->pbias_off) { + ret = pinctrl_select_state(host->pinctrl,
host->pbias_off);(quoted diff) +2
-0+ if (ret < 0) + dev_err(host->dev, "pinctrl pbias_off selecterror\n"); + } else if (((1 << vdd) <=
MMC_VDD_165_195) &&host->pinctrl&& +host->pbias_1v8) {
+ ret = pinctrl_select_state(host->pinctrl,host->pbias_1v8);(quoted diff) +2
-0+ if (ret < 0) + dev_err(host->dev, "pinctrl pbias_1v8 selecterror\n"); + } else if (((1 << vdd) >
MMC_VDD_165_195) &&host->pinctrl&& +host->pbias_3v) {
+ ret = pinctrl_select_state(host->pinctrl,host->pbias_3v);(quoted diff) +2
-0+ if (ret < 0) + dev_err(host->dev, "pinctrl pbias_3v selectQuoted 1 line
error\n"); + }
Quoted 1 line
So why does the pin control API control bias voltage?
I agree, it should be a regulator for the MMC driver and that's what I already suggested earlier. Having it as a regulator allows us to get rid of all the non-standard before and after calls in the
omap_hsmmc.c. This way theomap_hsmmc.ccode can handle the internal and external voltages the same way.Quoted 2 lines
This seem so intuitively wrong as it can possibly get, clearly this is regulator territory.
The PBIAS for MMC1 is a mux + comparator for the MMC pin, so it makes sense for the regulator driver to access the register via pinctrl API. I think the reason why we have registers like this and the USB comparators in the omap SCM (System Control Module) as the all seem to relate to pin states.
Quoted 1 line
This also looks strange from an MMC point of view.
Yes I agree, it should be a regulator for MMC. Doing it this way just adds yet more code that's usable for only one of the omap MMC controllers.
Quoted 7 lines
It just seems these bits in these registers should be poked at by the regulator world, not the pinctrl world. That the bits are in the middle of pinctrl things does not really matter.
Quoted 1 line
+
usleep_range(350, 400);And the regulator framework supports power-on delays.
Yes. And it seems that the delays should not be needed, but instead the comparator bits should be checked.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 19 lines · Laurent Pinchart
Quoted 18 lines · On Thursday 13 June 2013 02:53:54 Tony Lindgren wrote:
Quoted 17 lines · Linus Walleij
Quoted 7 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
The SH pinctrl driver registers an MMC regulator. The code is available at
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git. Look atdrivers/pinctrl/sh-pfc/pfc-sh73a0.cin tags/renesas-next-20130611v2.
Hi,
Thanks for the link, I think I need some time to understand where pfc->window[1].virt is coming from.
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Hi,
Quoted 25 lines · On Thursday 13 June 2013 20:22:42 Balaji T K wrote:
Quoted 24 lines · Laurent Pinchart
Quoted 22 lines · On Thursday 13 June 2013 02:53:54 Tony Lindgren wrote:
Quoted 21 lines · Linus Walleij
Quoted 8 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states
are defined aspbias_off,pbias_1v8,pbias_3v.Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
Quoted 6 lines
Quoted 3 lines
The SH pinctrl driver registers an MMC regulator. The code is available at
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git. Look atdrivers/pinctrl/sh-pfc/pfc-sh73a0.cin tags/renesas-next-20130611v2.Thanks for the link, I think I need some time to understand where pfc->window[1].virt is coming from.
That's just the ioremapped pinctrl device address spaced.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
In reply to Tony LindgrenQuoted 20 lines · Tony Lindgren
Quoted 19 lines · Linus Walleij
Quoted 17 lines · Balaji T K
drivers/mmc/host/omap_hsmmc.c +17
-0+/* 100ms delay required for PBIAS configuration */ +msleep (100 ); +if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + }else if (((1 << vdd) <=MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" ); + }else if (((1 << vdd) >MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + }
Quoted 7 lines
Quoted 1 line
So why does the pin control API control bias voltage?
I agree, it should be a regulator for the MMC driver and that's what I already suggested earlier. Having it as a regulator allows us to get rid of all the non-standard before and after calls in the
omap_hsmmc.c. This way theomap_hsmmc.ccode can handle the internal and external voltages the same way.
So someone is not taking the OMAP maintainers word for it and instead trying to push this past the pinctrl maintainer?
Grrr.... OK I'll assume good faith and I therefore conclude that this must have been just some kind of mistake in the act.
Yours,
Linus Walleij
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
In reply to Tony LindgrenQuoted 41 lines · Tony Lindgren
Quoted 40 lines · Linus Walleij
Quoted 7 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
Quoted 17 lines
drivers/mmc/host/omap_hsmmc.c +17
-0+/* 100ms delay required for PBIAS configuration */ +msleep (100 ); +if (!vdd && host->pinctrl && host->pbias_off) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_off); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_off select error\n" ); + }else if (((1 << vdd) <=MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_1v8) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_1v8); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_1v8 select error\n" ); + }else if (((1 << vdd) >MMC_VDD_165_195 ) && host->pinctrl && + host->pbias_3v) { + ret =pinctrl_select_state (host->pinctrl, host->pbias_3v); +if (ret <0 ) +dev_err (host->dev,"pinctrl pbias_3v select error\n" ); + }
Quoted 11 lines
Quoted 1 line
So why does the pin control API control bias voltage?
I agree, it should be a regulator for the MMC driver and that's what I already suggested earlier. Having it as a regulator allows us to get rid of all the non-standard before and after calls in the
omap_hsmmc.c. This way theomap_hsmmc.ccode can handle the internal and external voltages the same way.Quoted 2 lines
This seem so intuitively wrong as it can possibly get, clearly this is regulator territory.
It is not really a regulator, CONTROL_PBIAS_LITE is just a register in control module which configures pad/pin on SOC. In this case PBIAS cells are powered down before any voltage changes and after the external voltage supplied to VDDS_MMC of OMAP stabilizes pbias cells is powered ON again with specific Voltage which is given to OMAP for MMC io pins
For OMAP2430, OMAP3430 It additionally has a bit for speed mode control which are set always (static config)
I am quoting pbias register field description from TRM for reference
BIT2 PBIASSPEEDCTRL0 Speed Control for MMC I/O
0b0 => 26 MHz I/O max speed
0b1 => 52 MHz I/O max speed
BIT26 MMC1_PWRDNZ PWRDNZ control to MMC1 IO This bit is used to protect the MMC1 I/O cell when SDMMC1_VDDS is not stable.0x0: Software must clear this bit when SDMMC1_VDDS changes.0x1: Software must set this bit only when SDMMC1_VDDS is stable.
BIT25 MMC1_PBIASLITE_HIZ_MODE HIZ_MODE from MMC1 PBIASLITE 0x0: PBIAS in normal operation mode0x1: PBIAS output is in high impedence state
BIT24 MMC1_PBIASLITE_SUPPLY_HI SUPPLY_HI_OUT from MMC1 PBIASLITE _OUT Read 0x0: SDMMC1_VDDS = 1.8V
Read 0x1: SDMMC1_VDDS = 3V
BIT23 MMC1_PBIASLITE_VMODE_ER VMODE ERROR from MMC1 PBIASLITE ROR Read 0x0: VMODE level is same as SUPPLY_HI_OUT Read 0x1: VMODE level is not same asSUPPLY_HI_OUT
BIT22 MMC1_PBIASLITE_PWRDNZ PWRDNZ control to MMC1 PBIASLITE This bit is used to protect the MMC1_PBIAS cell (MMC1 I/O cell associated) when SDMMC1_VDDS is not stable. 0x0: Software must clear this bit when SDMMC1_VDDS changes.0x1: Software must set this bit only when SDMMC1_VDDS is stable.
BIT21 MMC1_PBIASLITE_VMODE VMODE control to MMC1 PBIASLITE 0x0: SDMMC1_VDDS = 1.8V0x1: SDMMC1_VDDS = 3V
Quoted 6 lines
The PBIAS for MMC1 is a mux + comparator for the MMC pin, so it makes sense for the regulator driver to access the register via pinctrl API. I think the reason why we have registers like this and the USB comparators in the omap SCM (System Control Module) as the all seem to relate to pin states.
Quoted 6 lines
Quoted 1 line
This also looks strange from an MMC point of view.
Yes I agree, it should be a regulator for MMC. Doing it this way just adds yet more code that's usable for only one of the omap MMC controllers.
the only other user for pbias which I can find is USB pin configuration in arch/arm/mach-omap2/board-omap3logic.c where it is statically programmed for 3V which can be modeled as well as default pinctrl state.
Quoted 2 lines
Quoted 2 lines
It just seems these bits in these registers should be poked at by the regulator world, not the pinctrl world.
You mean regulator via pinctrl APIs, I think It will just move the code from omap_hsmmc to a new regulator file with it own init data for pinctrl.
Not sure if Regulator maintainer will agree to it.
Moreover what I needs is three different states 0V, 0 to 1.8V, 3 V to 3.3V not 0, 1.8V, 3V. plus pbias register fields got moved around between omap3, omap4 and omap5, That was one of the reason for moving to pinctrl states.
Quoted 2 lines
Quoted 2 lines
That the bits are
in the middle of pinctrl things does not really matter.
It thought pinctrl-single,bits in pinctrl-single.c is introduced precisely for such misc control register which has bit configuration affecting different module i/o pads.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
+
usleep_range(350, 400);And the regulator framework supports power-on delays.
Yes. And it seems that the delays should not be needed, but instead the comparator bits should be checked.
But, Not all OMAP has such support to read comparator bits.
Quoted 5 lines
Regards,
Tony
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 9 lines · Balaji T K
[Me]
Quoted 2 lines
Quoted 2 lines
This seem so intuitively wrong as it can possibly get, clearly this is regulator territory.
It is not really a regulator,
CONTROL_PBIAS_LITEis just a register in control module which configures pad/pin on SOC. In this case PBIAS cells are powered down before any voltage changes and after the external voltage supplied toVDDS_MMCof OMAP stabilizes pbias cells is powered ON again with specific Voltage which is given to OMAP for MMC io pins
So there is some external actual regulator supplying the voltage and then that is looped back in to the pads. (I understand this is quite a common construction.)
Anyway since it is obviously removing and applying voltage to the pins, I think this is more of a cascaded regulator. We use regulators for simple light-switches and things you know.
We have generic pinconf options for things like current but not voltage really. It's because in the case of pin current configuration it's basically about how many driver stages (totempoles) you connect to the output, which is very different from the voltages we're dealing with here.
So I think these bits go into a regulator driver:
Quoted 25 lines
BIT26
MMC1_PWRDNZPWRDNZ control to MMC1 IO This bit is used to protect the MMC1 I/O cell whenSDMMC1_VDDSis not stable.0x0: Software must clear this bit whenSDMMC1_VDDSchanges.0x1: Software must set this bit only whenSDMMC1_VDDSis stable.BIT24
MMC1_PBIASLITE_SUPPLY_HISUPPLY_HI_OUTfrom MMC1 PBIASLITE_OUTRead0x0:SDMMC1_VDDS= 1.8V
Read0x1:SDMMC1_VDDS= 3VBIT23
MMC1_PBIASLITE_VMODE_ERVMODE ERROR from MMC1 PBIASLITE ROR Read0x0: VMODE level is same asSUPPLY_HI_OUTRead0x1: VMODE level is not same asSUPPLY_HI_OUTBIT22
MMC1_PBIASLITE_PWRDNZPWRDNZ control to MMC1 PBIASLITE This bit is used to protect theMMC1_PBIAScell (MMC1 I/O cell associated) whenSDMMC1_VDDSis not stable.0x0: Software must clear this bit whenSDMMC1_VDDSchanges.0x1: Software must set this bit only whenSDMMC1_VDDSis stable.
Quoted 3 lines
BIT21
MMC1_PBIASLITE_VMODEVMODE control to MMC1 PBIASLITE0x0:SDMMC1_VDDS= 1.8V0x1:SDMMC1_VDDS= 3V
This looks much more cascaded regulator control than anything else to me.
Quoted 2 lines
For OMAP2430, OMAP3430 It additionally has a bit for speed mode control which are set always (static config)
I guess you mean this:
Quoted 3 lines
BIT2 PBIASSPEEDCTRL0 Speed Control for MMC I/O
0b0 => 26 MHz I/O max speed
0b1 => 52 MHz I/O max speed
This seems to belong to the MMC host driver.
It is common that registers contain indiviual bits that end up in different subsystems. Speed mode seems to belong in the MMC driver.
The infrastructure used to spread out responsibility across different drivers from a common register range or even for certain bits in a certain register, is regmap. Check for example mfd/syscon.c.
Quoted 3 lines
BIT25
MMC1_PBIASLITE_HIZ_MODEHIZ_MODEfrom MMC1 PBIASLITE0x0: PBIAS in normal operation mode0x1: PBIAS output is in high impedence state
This is actually pin config. But if it makes sense it should also be part of the MMC regulator driver.
Quoted 2 lines
You mean regulator via pinctrl APIs, I think It will just move the code from
omap_hsmmcto a new regulator file with it own init data for pinctrl.
No I'm not saying you should use pinctrl as a "back-end" for this. I mean you shall instantiate a regulator and let the callback ops vtable for that regulator poke these bits.
Quoted 1 line
Not sure if Regulator maintainer will agree to it.
I will respect Marks judgement on this for sure.
Quoted 4 lines
Moreover what I needs is three different states 0V, 0 to 1.8V, 3 V to 3.3V not 0, 1.8V, 3V. plus pbias register fields got moved around between omap3, omap4
and omap5, That was one of the reason for moving to pinctrl states.
The regulator framework supports selector tables just like this.
Where the register fields are located does not matter.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
That the bits are
in the middle of pinctrl things does not really matter.It thought pinctrl-single,bits in
pinctrl-single.cis introduced precisely for such misc control register which has bit configuration affecting different module i/o pads.
No. If we go down that road *anything* that is connected to a pad becomes part of the pinctrl subsystem, then pinctrl-single becomes some kind of hardware abstraction or BIOS, and that is *not* the intent. It is only supposed to deal with the bits there that are 100% related to what pinctrl does, nothing else.
Yours,
Linus Walleij
A message that is not in the archive (sent off-list or not yet received): CACRpkdY6cZ+bT-C9Go3sZVw6ErQqTm0m9__uKQrkg4eUU1thHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 8 lines · Linus Walleij
Quoted 2 lines · Balaji T K
You mean regulator via pinctrl APIs, I think It will just move the code from
omap_hsmmcto a new regulator file with it own init data for pinctrl.No I'm not saying you should use pinctrl as a "back-end" for this. I mean you shall instantiate a regulator and let the callback ops vtable for that regulator poke these bits.
The interface to omap_hsmmc.c should be the regulator framework. This is because it allows us to clean up all the messed up before and after functions that really implement various GPIO regulators etc.
Quoted 9 lines
Quoted 3 lines
It thought pinctrl-single,bits in
pinctrl-single.cis introduced precisely for such misc control register which has bit configuration affecting different module i/o pads.No. If we go down that road *anything* that is connected to a pad becomes part of the pinctrl subsystem, then pinctrl-single becomes some kind of hardware abstraction or BIOS, and that is *not* the intent. It is only supposed to deal with the bits there that are 100% related to what pinctrl does, nothing else.
Sounds like the way to go is to do a standalone regulator driver that optionally uses pinctrl-single,bits. But only for the bits in the PBIAS register that are 100% related to pinctrl.
In any case the PBIAS regulator driver should be a separate driver as it may need to be a child of the SCM driver for PM needs in the future.
Regards,
Tony
Mark Brown
maintainerRe: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 8 lines · Tony Lindgren
Quoted 5 lines · Linus Walleij
No. If we go down that road *anything* that is connected to a pad becomes part of the pinctrl subsystem, then pinctrl-single becomes some kind of hardware abstraction or BIOS, and that is *not* the intent. It is only supposed to deal with the bits there that are 100% related to what pinctrl does, nothing else.
Quoted 7 lines
Sounds like the way to go is to do a standalone regulator driver that optionally uses pinctrl-single,bits. But only for the bits in the PBIAS register that are 100% related to pinctrl.
In any case the PBIAS regulator driver should be a separate driver as it may need to be a child of the SCM driver for PM needs in the future.
This all seems sensible to me.
v3 cover mmc: omap_hsmmc: pbias dt and cleanup
Few 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 (8):
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: dts: add pbias-supply
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
mmc: omap_hsmmc: remove pbias workaround
.../bindings/regulator/pbias-regulator.txt | 21 ++ arch/arm/boot/dts/dra7-evm.dts | 1 + arch/arm/boot/dts/dra7.dtsi | 12 + arch/arm/boot/dts/omap2430.dtsi | 12 + arch/arm/boot/dts/omap3-beagle-xm.dts | 1 + arch/arm/boot/dts/omap3-beagle.dts | 1 + arch/arm/boot/dts/omap3-devkit8000.dts | 1 + arch/arm/boot/dts/omap3-evm-common.dtsi | 1 + arch/arm/boot/dts/omap3-gta04.dts | 1 + arch/arm/boot/dts/omap3-igep.dtsi | 1 + arch/arm/boot/dts/omap3-n900.dts | 1 + arch/arm/boot/dts/omap3-overo.dtsi | 1 + arch/arm/boot/dts/omap3-zoom3.dts | 1 + arch/arm/boot/dts/omap3.dtsi | 12 + arch/arm/boot/dts/omap3430-sdp.dts | 1 + arch/arm/boot/dts/omap4-panda-common.dtsi | 1 + arch/arm/boot/dts/omap4-sdp.dts | 1 + arch/arm/boot/dts/omap4-var-som.dts | 1 + arch/arm/boot/dts/omap4.dtsi | 12 + arch/arm/boot/dts/omap5-uevm.dts | 1 + arch/arm/boot/dts/omap5.dtsi | 12 + arch/arm/configs/omap2plus_defconfig | 2 + drivers/mmc/host/omap_hsmmc.c | 113 +++++---- drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 264 ++++++++++++++++++++ 26 files changed, 434 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
RFC PATCH v3 1/8 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: [RFC PATCH v3 1/8] mmc: omap_hsmmc: use devm_regulator API
Quoted 31 lines · Balaji T K
Use
devm_regulatorAPI, while at it usedevm_regulator_get_optionalfor optionalvmmc_auxsupplySigned-off-by Balaji T K <[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 370
Quoted 7 lines
drivers/mmc/host/omap_hsmmc.c +0
-2@@ -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 ; }
While you are touching this code I would suggest to convert to mmc_regulator_get_supply instead. That mean the vmmc_aux change name to vqmmc though, so you need to adapt for this as well then.
Kind regards
Ulf Hansson
Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c +0
-1--1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH v3 1/8] mmc: omap_hsmmc: use devm_regulator API
Quoted 33 lines · Ulf Hansson
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]>--- 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 */ @@ -366,8 +366,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
Quoted 11 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 370
Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c +0
-2static 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 ; }While you are touching this code I would suggest to convert to
mmc_regulator_get_supplyinstead. That mean thevmmc_auxchange name to vqmmc though, so you need to adapt for this as well then.
Hi Ulf,
Thanks for the comments, I will address it on separate series.
Thanks and Regards,
Balaji T K
RFC PATCH v3 2/8 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: [RFC PATCH v3 2/8] mmc: omap_hsmmc: handle vcc and vcc_aux independently
Quoted 63 lines · Balaji T K
handle vcc and
vcc_auxindependently to reduce indent.Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)drivers/mmc/host/omap_hsmmc.c +11
-9@@ -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 */
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 352
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +0
-10-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). -*/
The above problem is handled by the mmc core layer. I certainly think you shall adopt your code to it.
Kind regards
Ulf Hansson
Quoted 31 lines
drivers/mmc/host/omap_hsmmc.c +12
-9-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 ; --1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH v3 2/8] mmc: omap_hsmmc: handle vcc and vcc_aux independently
Quoted 63 lines · Ulf Hansson
Quoted 62 lines · Balaji T K
handle vcc and
vcc_auxindependently to reduce indent.Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)drivers/mmc/host/omap_hsmmc.c +11
-8@@ -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;
Quoted 14 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 352
Quoted 11 lines
drivers/mmc/host/omap_hsmmc.c +0
-11-/* 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). -*/ The above problem is handled by the mmc core layer. I certainly think you shall adopt your code to it.
Hi Ulf,
how about optional vqmmc, omap_hsmmc does call mmc_regulator_set_ocr for vmmc Am I missing something?
Quoted 35 lines
Kind regards
Ulf HanssonQuoted 31 lines
drivers/mmc/host/omap_hsmmc.c +12
-9-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 ; --1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH v3 2/8] mmc: omap_hsmmc: handle vcc and vcc_aux independently
Quoted 90 lines · Balaji T K
Quoted 73 lines · Ulf Hansson
Quoted 71 lines · Balaji T K
handle vcc and
vcc_auxindependently to reduce indent.Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)drivers/mmc/host/omap_hsmmc.c +3
-2@@ -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); }drivers/mmc/host/omap_hsmmc.c +1
-1@@ -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);drivers/mmc/host/omap_hsmmc.c +2
-2@@ -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) {drivers/mmc/host/omap_hsmmc.c +5
-3@@ -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;Quoted 15 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 352
Quoted 11 lines
drivers/mmc/host/omap_hsmmc.c +0
-11-/* 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). -*/ The above problem is handled by the mmc core layer. I certainly think you shall adopt your code to it.
Quoted 5 lines
Hi Ulf,
how about optional vqmmc,
omap_hsmmcdoes callmmc_regulator_set_ocrfor vmmc
Am I missing something?
Hi Balaji,
Sorry for being to vague, let me elaborate.
1. Before omap_hsmmc_probe returns, it invokes mmc_add_host().
2. mmc_add_host() -> mmc_start_host() -> > mmc_power_up().
3. mmc_power_up() invokes the host driver's .set_ios() callback, to makes sure boot-on regulators are kept enabled. Otherwise the late_initcall, regulator_init_complete() will potentially cut power for unused regulators.
This is important because there are SoCs that are only capable of power cycling the VCC regulator but not VCCQ. According to the eMMC spec, we must not cut VCC without sending the SLEEP cmd first. Obviously, since we prevent VCC from being cut, we need to prevent VCCQ from being cut as well.
Normally a .set_ios() function's invokes mmc_regulator_set_ocr() for the VCC regulator. VCCQ ("vmmc_aux") is handled by directly using the regulator API (I guess we could invent an API similar to mmc_regulator_set_ocr() but for VCCQ, but that is a future task).
So, from a host driver perspective you could add a local variable to cache the "enabled" state of the VCCQ regulator. By leaving the default state to "disabled", you will trigger it to be enabled once mmc_power_up() invokes your .set_ios() callback. Vice verse will then happen when mmc_power_off gets invoked.
Finally, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE, if your SoC can cut both VCC and VCCQ for your eMMC slots. For SD cards only VCC should be needed to enable MMC_CAP2_FULL_PWR_CYCLE.
Kind regards
Ulf Hansson
Quoted 43 lines
Quoted 41 lines
Kind regards
Ulf HanssonQuoted 35 lines
drivers/mmc/host/omap_hsmmc.c +11
-8-if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux && regulator_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;--
1.7.5.4--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH v3 2/8] mmc: omap_hsmmc: handle vcc and vcc_aux independently
Quoted 127 lines · Ulf Hansson
Quoted 90 lines · Balaji T K
Quoted 73 lines · Ulf Hansson
Quoted 71 lines · Balaji T K
handle vcc and
vcc_auxindependently to reduce indent.Signed-off-by Balaji T K <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 54 +++++++++++++++++++---------------------- 1 files changed, 25 insertions(+), 29 deletions(-)drivers/mmc/host/omap_hsmmc.c +3
-2@@ -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); }drivers/mmc/host/omap_hsmmc.c +1
-1@@ -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);drivers/mmc/host/omap_hsmmc.c +2
-2@@ -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) {drivers/mmc/host/omap_hsmmc.c +5
-3@@ -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;Quoted 15 lines
drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) · line 352
Quoted 11 lines
drivers/mmc/host/omap_hsmmc.c +0
-11-/* 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). -*/ The above problem is handled by the mmc core layer. I certainly think you shall adopt your code to it.
Quoted 5 lines
Hi Ulf,
how about optional vqmmc,
omap_hsmmcdoes callmmc_regulator_set_ocrfor vmmc
Am I missing something?Hi Balaji,
Sorry for being to vague, let me elaborate.
1. Before
omap_hsmmc_probereturns, it invokesmmc_add_host().2.
mmc_add_host()->mmc_start_host()-> >mmc_power_up().3.
mmc_power_up()invokes the host driver's .set_ios() callback, to makes sure boot-on regulators are kept enabled. Otherwise thelate_initcall,regulator_init_complete()will potentially cut power for unused regulators.This is important because there are SoCs that are only capable of power cycling the VCC regulator but not VCCQ. According to the eMMC spec, we must not cut VCC without sending the SLEEP cmd first. Obviously, since we prevent VCC from being cut, we need to prevent VCCQ from being cut as well.
Normally a .set_ios() function's invokes
mmc_regulator_set_ocr()for the VCC regulator. VCCQ ("vmmc_aux") is handled by directly using the regulator API (I guess we could invent an API similar tommc_regulator_set_ocr()but for VCCQ, but that is a future task).So, from a host driver perspective you could add a local variable to cache the "enabled" state of the VCCQ regulator. By leaving the default state to "disabled", you will trigger it to be enabled once
mmc_power_up()invokes your .set_ios() callback. Vice verse will then happen whenmmc_power_offgets invoked.
Quoted 4 lines
Finally, don't forget to enable
MMC_CAP2_FULL_PWR_CYCLE, if your SoC can cut both VCC and VCCQ for your eMMC slots. For SD cards only VCC should be needed to enableMMC_CAP2_FULL_PWR_CYCLE.
Hi Ulf,
Thanks for the explanation. I need to check if the Work around (power ON and then power OFF) are there for legacy reason or needed for TI SDIO detection on soft reset, if it is latter need to figure out a way to fix TI SDIO before removing it.
Quoted 47 lines
Kind regards
Ulf HanssonQuoted 43 lines
Quoted 41 lines
Kind regards
Ulf HanssonQuoted 35 lines
drivers/mmc/host/omap_hsmmc.c +11
-8-if (regulator_is_enabled (host->vcc) >0 || - (host->vcc_aux && regulator_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;--
1.7.5.4--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1385043627-30439-1-git-send-email-balajitk-l0cyMroinI0@public.gmane.org
RFC PATCH v3 3/8 regulator: add pbias regulator support
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.
--- .../bindings/regulator/pbias-regulator.txt | 21 ++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 264 ++++++++++++++++++++ 4 files changed, 293 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 +21 -0
@@ -0,0 +1,21 @@ +PBIAS internal regulator for SD card i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "regulator-pbias-omap2" for OMAP2 + - "regulator-pbias-omap3" for OMAP3 + - "regulator-pbias-omap4" for OMAP4 + - "regulator-pbias-omap5" for OMAP5, DRA7 +- pbias-reg-offset: PBIAS control register offset from syscon base address + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
drivers/regulator/Kconfig +7 -0
@@ -369,6 +369,13 @@ 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 && MFD_SYSCON + help + 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 +264 -0
264 lines not on this page · raw message
Signature · 6 lines
1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerRe: [RFC PATCH v3 3/8] regulator: add pbias regulator support
Quoted 12 lines · Balaji T K
drivers/regulator/pbias-regulator.c new file +12
-0+static int pbias_regulator_set_voltage (struct regulator_dev *dev, +int min_uV,int max_uV,unsigned *selector) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (dev); +const struct pbias_bit_map *bmap = data->bmap; +int ret, vmode; + +if (min_uV <=1800000 ) + vmode =0 ; +else if (min_uV >1800000 ) + vmode = bmap->vmode; +
drivers/regulator/pbias-regulator.c line 74
Quoted 10 lines
drivers/regulator/pbias-regulator.c new file +9
-0+ ret =regmap_update_bits (data->syscon, data->pbias_reg, + bmap->vmode, vmode); + data->voltage = min_uV; +static int pbias_regulator_get_voltage (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); + +return data->voltage; +}
These don't match up with each other - the get and set voltage calls should reflect what the hardware state is, not what was requested by the caller. You should be able to use the regmap helpers I think.
drivers/regulator/pbias-regulator.c line 83
Quoted 8 lines
drivers/regulator/pbias-regulator.c new file +8
-0+static int pbias_regulator_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_bit_map *bmap = data->bmap; +int ret; + + ret =regmap_update_bits (data->syscon, data->pbias_reg, + bmap->enable_mask, bmap->enable);
regulator_enable_regmap() and similarly for disable() and is_enabled().
drivers/regulator/pbias-regulator.c line 185
Quoted 9 lines
drivers/regulator/pbias-regulator.c new file +9
-0+ supply_name = initdata->constraints.name; + +of_property_read_u32 (np,"startup-delay-us" , &startup_delay); + ret =of_property_read_u32 (np,"pbias-reg-offset" , + &drvdata->pbias_reg); +if (ret) { +dev_err (&pdev->dev,"no pbias-reg-offset property set\n" ); +return ret; + }
This looks like it should be added as a standard property for overridig the regulator delay if it can't be set based on the compatible string alone due to board dependencies. Do something like what's done for regulator-ramp-delay.
drivers/regulator/pbias-regulator.c line 227
Quoted 3 lines
drivers/regulator/pbias-regulator.c new file +3
-0+err_regulator: +kfree (drvdata->desc.name); +return ret;
devm_kzalloc().
drivers/regulator/pbias-regulator.c line 253
Quoted 5 lines
drivers/regulator/pbias-regulator.c new file +5
-0+static int __init pbias_regulator_init (void ) +{ +return platform_driver_register (&pbias_regulator_driver); +} +subsys_initcall (pbias_regulator_init);
module_platform_driver().
Re: [RFC PATCH v3 3/8] regulator: add pbias regulator support
Quoted 18 lines · Mark Brown
Quoted 15 lines · Balaji T K
drivers/regulator/pbias-regulator.c new file +15
-0+static int pbias_regulator_set_voltage (struct regulator_dev *dev, +int min_uV,int max_uV,unsigned *selector) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (dev); +const struct pbias_bit_map *bmap = data->bmap; +int ret, vmode; + +if (min_uV <=1800000 ) + vmode =0 ; +else if (min_uV >1800000 ) + vmode = bmap->vmode; + + ret =regmap_update_bits (data->syscon, data->pbias_reg, + bmap->vmode, vmode); + data->voltage = min_uV;
Quoted 11 lines
drivers/regulator/pbias-regulator.c line 74
Quoted 6 lines
drivers/regulator/pbias-regulator.c new file +6
-0+static int pbias_regulator_get_voltage (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); + +return data->voltage; +}These don't match up with each other - the get and set voltage calls should reflect what the hardware state is, not what was requested by the caller. You should be able to use the regmap helpers I think.
Hi,
get_voltage returns the min_uV, saved in set_voltage since pbias only need to programmed if the voltage supply in for pbias cell is less than or greater than 1.8V, so vmode bit will be set for 3V and also for 3.3V too.
Quoted 11 lines
drivers/regulator/pbias-regulator.c line 83
Quoted 8 lines
drivers/regulator/pbias-regulator.c new file +8
-0+static int pbias_regulator_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_bit_map *bmap = data->bmap; +int ret; + + ret =regmap_update_bits (data->syscon, data->pbias_reg, + bmap->enable_mask, bmap->enable);
regulator_enable_regmap()and similarly fordisable()andis_enabled().
I don't think regmap helper can be used here, to enable pbias cells I need reset a bit field (to bring pbias out of high impedence mode) and also set a bit (to bring it out of power down mode)
Quoted 15 lines
drivers/regulator/pbias-regulator.c line 185
Quoted 9 lines
drivers/regulator/pbias-regulator.c new file +9
-0+ supply_name = initdata->constraints.name; + +of_property_read_u32 (np,"startup-delay-us" , &startup_delay); + ret =of_property_read_u32 (np,"pbias-reg-offset" , + &drvdata->pbias_reg); +if (ret) { +dev_err (&pdev->dev,"no pbias-reg-offset property set\n" ); +return ret; + }This looks like it should be added as a standard property for overridig the regulator delay if it can't be set based on the compatible string alone due to board dependencies. Do something like what's done for regulator-ramp-delay.
Quoted 6 lines
drivers/regulator/pbias-regulator.c line 227
Quoted 3 lines
drivers/regulator/pbias-regulator.c new file +3
-0+err_regulator: +kfree (drvdata->desc.name); +return ret;
devm_kzalloc().
Will assign desc name statically
Quoted 7 lines
drivers/regulator/pbias-regulator.c line 253
Quoted 5 lines
drivers/regulator/pbias-regulator.c new file +5
-0+static int __init pbias_regulator_init (void ) +{ +return platform_driver_register (&pbias_regulator_driver); +} +subsys_initcall (pbias_regulator_init);
module_platform_driver().
OK
Mark Brown
maintainerRe: [RFC PATCH v3 3/8] regulator: add pbias regulator support
Quoted 9 lines · Balaji T K
Quoted 3 lines · Mark Brown
These don't match up with each other - the get and set voltage calls should reflect what the hardware state is, not what was requested by the caller. You should be able to use the regmap helpers I think.
get_voltagereturns themin_uV, saved inset_voltagesince pbias only need to programmed if the voltage supply in for pbias cell is less than or greater than 1.8V, so vmode bit will be set for 3V and also for 3.3V too.
That's the problem...
RFC PATCH v3 4/8 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
RFC PATCH v3 5/8 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 | 12 ++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 12 ++++++++++++ arch/arm/boot/dts/omap3.dtsi | 12 ++++++++++++ arch/arm/boot/dts/omap4.dtsi | 12 ++++++++++++ arch/arm/boot/dts/omap5.dtsi | 12 ++++++++++++ 5 files changed, 60 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +12 -0
@@ -119,6 +119,18 @@ pinctrl-single,function-mask = <0x3fffffff>; }; + tisyscon: tisyscon@4A100600 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002E00 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap5"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
arch/arm/boot/dts/omap2430.dtsi +12 -0
@@ -29,6 +29,18 @@ pinctrl-single,function-mask = <0x3f>; }; + tisyscon: tisyscon@490024A0 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x490024A0 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap2"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
arch/arm/boot/dts/omap3.dtsi +12 -0
@@ -130,6 +130,18 @@ pinctrl-single,function-mask = <0xff1f>; }; + tisyscon: tisyscon@48002520 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x48002520 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap3"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
arch/arm/boot/dts/omap4.dtsi +12 -0
@@ -134,6 +134,18 @@ pinctrl-single,function-mask = <0x7fff>; }; + tisyscon: tisyscon@4A100600 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A100600 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap4"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
arch/arm/boot/dts/omap5.dtsi +12 -0
@@ -130,6 +130,18 @@ pinctrl-single,function-mask = <0x7fff>; }; + tisyscon: tisyscon@4A002E00 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002E00 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap5"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
Signature · 1 line
1.7.5.4
RFC PATCH v3 6/8 ARM: dts: add pbias-supply
In reply to Balaji T KAdd pbias-supply to mmc1/sd card.
--- arch/arm/boot/dts/dra7-evm.dts | 1 + arch/arm/boot/dts/omap3-beagle-xm.dts | 1 + arch/arm/boot/dts/omap3-beagle.dts | 1 + arch/arm/boot/dts/omap3-devkit8000.dts | 1 + arch/arm/boot/dts/omap3-evm-common.dtsi | 1 + arch/arm/boot/dts/omap3-gta04.dts | 1 + arch/arm/boot/dts/omap3-igep.dtsi | 1 + arch/arm/boot/dts/omap3-n900.dts | 1 + arch/arm/boot/dts/omap3-overo.dtsi | 1 + arch/arm/boot/dts/omap3-zoom3.dts | 1 + arch/arm/boot/dts/omap3430-sdp.dts | 1 + arch/arm/boot/dts/omap4-panda-common.dtsi | 1 + arch/arm/boot/dts/omap4-sdp.dts | 1 + arch/arm/boot/dts/omap4-var-som.dts | 1 + arch/arm/boot/dts/omap5-uevm.dts | 1 + 15 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7-evm.dts +1 -0
@@ -261,6 +261,7 @@ &mmc1 { status = "okay"; vmmc-supply = <&ldo1_reg>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; };
arch/arm/boot/dts/omap3-beagle-xm.dts +1 -0
@@ -166,6 +166,7 @@ &mmc1 { vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap3-beagle.dts +1 -0
@@ -129,6 +129,7 @@ &mmc1 { vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap3-devkit8000.dts +1 -0
@@ -86,6 +86,7 @@ &mmc1 { vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap3-evm-common.dtsi +1 -0
@@ -64,6 +64,7 @@ &mmc1 { vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap3-gta04.dts +1 -0
@@ -142,6 +142,7 @@ pinctrl-0 = <&mmc1_pins>; vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; };
arch/arm/boot/dts/omap3-igep.dtsi +1 -0
@@ -114,6 +114,7 @@ pinctrl-0 = <&mmc1_pins>; vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap3-n900.dts +1 -0
@@ -354,6 +354,7 @@ pinctrl-names = "default"; pinctrl-0 = <&mmc1_pins>; vmmc-supply = <&vmmc1>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ };
arch/arm/boot/dts/omap3-overo.dtsi +1 -0
@@ -61,6 +61,7 @@ /* on board microSD slot */ &mmc1 { vmmc-supply = <&vmmc1>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; };
arch/arm/boot/dts/omap3-zoom3.dts +1 -0
@@ -168,6 +168,7 @@ &mmc1 { vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; pinctrl-names = "default"; pinctrl-0 = <&mmc1_pins>;
arch/arm/boot/dts/omap3430-sdp.dts +1 -0
@@ -34,6 +34,7 @@ &mmc1 { vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap4-panda-common.dtsi +1 -0
@@ -346,6 +346,7 @@ &mmc1 { vmmc-supply = <&vmmc>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap4-sdp.dts +1 -0
@@ -416,6 +416,7 @@ &mmc1 { vmmc-supply = <&vmmc>; + pbias-supply = <&pbias_regulator>; bus-width = <8>; };
arch/arm/boot/dts/omap4-var-som.dts +1 -0
@@ -75,6 +75,7 @@ &mmc1 { vmmc-supply = <&vmmc>; + pbias-supply = <&pbias_regulator>; ti,bus-width = <8>; ti,non-removable; };
arch/arm/boot/dts/omap5-uevm.dts +1 -0
@@ -204,6 +204,7 @@ &mmc1 { vmmc-supply = <&ldo9_reg>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; };
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [RFC PATCH v3 6/8] ARM: dts: add pbias-supply
Quoted 1 line · Balaji T K
Add pbias-supply to mmc1/sd card.
...
arch/arm/boot/dts/dra7-evm.dts line 266
Quoted 9 lines
arch/arm/boot/dts/dra7-evm.dts +1
-0@@ -261,6 +261,7 @@ &mmc1 { status = "okay"; vmmc-supply = <&ldo1_reg>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; };
You may not need to patch this in at all. I think the PBIAS is there only for the first slot and it's hardwired so it's always there. If that's the case, then you can just always request it. Or use the compatible flag if needed.
Regards,
Tony
Re: [RFC PATCH v3 6/8] ARM: dts: add pbias-supply
Quoted 4 lines · Tony Lindgren
Quoted 1 line · Balaji T K
Add pbias-supply to mmc1/sd card.
...
Quoted 14 lines
arch/arm/boot/dts/dra7-evm.dts line 266
Quoted 9 lines
arch/arm/boot/dts/dra7-evm.dts +1
-0@@ -261,6 +261,7 @@ &mmc1 { status = "okay"; vmmc-supply = <&ldo1_reg>; + pbias-supply = <&pbias_regulator>; bus-width = <4>; };You may not need to patch this in at all. I think the PBIAS is there only for the first slot and it's hardwired so it's always there. If that's the case, then you can just always request it. Or use the compatible flag if needed.
pbias is not applicable for mmc1 on am33xx and is applicable for only for OMAP2-OMAP5, so I can add pbias-supply to omapx.dtsi files
Quoted 5 lines
Regards,
Tony
RFC PATCH v3 7/8 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
@@ -179,6 +180,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
RFC PATCH v3 8/8 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
v4 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 | 21 ++ arch/arm/boot/dts/dra7.dtsi | 14 ++ arch/arm/boot/dts/omap2430.dtsi | 14 ++ arch/arm/boot/dts/omap3.dtsi | 14 ++ arch/arm/boot/dts/omap4.dtsi | 14 ++ arch/arm/boot/dts/omap5.dtsi | 14 ++ 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 | 232 ++++++++++++++++++++ 11 files changed, 399 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 v4 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 v4 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 v4 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 | 21 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 232 ++++++++++++++++++++ 4 files changed, 263 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 +21 -0
@@ -0,0 +1,21 @@ +PBIAS internal regulator for SD card i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "regulator-pbias-omap2" for OMAP2 + - "regulator-pbias-omap3" for OMAP3 + - "regulator-pbias-omap4" for OMAP4 + - "regulator-pbias-omap5" for OMAP5, DRA7 +- pbias-reg-offset: PBIAS control register offset from syscon base address + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + 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 && 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 +232 -0
232 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Mark Brown
maintainerRe: [PATCH v4 3/7] regulator: add pbias regulator support
drivers/regulator/Kconfig config REGULATOR_PALMAS · line 374
Quoted 3 lines · Balaji T K
drivers/regulator/Kconfig +3
-0+config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on ARCH_OMAP && MFD_SYSCON
That should be (ARCH_OMAP || COMPILE_TEST) && MFD_SYSCON
Quoted 5 lines
drivers/regulator/pbias-regulator.c new file +5
-0+static int pbias_regulator_set_voltage (struct regulator_dev *dev, +int min_uV,int max_uV,unsigned *selector) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (dev); +const struct pbias_reg_info *info = data->info;
drivers/regulator/pbias-regulator.c line 63
Quoted 10 lines
drivers/regulator/pbias-regulator.c new file +10
-0+int ret, vmode; + +if (min_uV <=1800000 ) + vmode =0 ; +else if (min_uV >1800000 ) + vmode = info->vmode; + + ret =regmap_update_bits (data->syscon, data->pbias_reg, + info->vmode, vmode); + data->voltage = min_uV;
This is exactly the same as it was the first time it was posted and is still buggy. To repeat the get and set voltage functions should reflect the actual voltage set in the hardware.
drivers/regulator/pbias-regulator.c line 107
Quoted 10 lines
drivers/regulator/pbias-regulator.c new file +10
-0+static int pbias_regulator_is_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_reg_info *info = data->info; +int value; + +regmap_read (data->syscon, data->pbias_reg, &value); + +return value & info->enable_mask; +}
If the enable mask really can have multiple bits this won't do the right thing - it'll return true if any bits are set. It needs to make sure all the bits are set.
Quoted 1 line
+#if
CONFIG_OF
Why?
drivers/regulator/pbias-regulator.c line 197
Quoted 1 line
drivers/regulator/pbias-regulator.c new file +1
-0+ drvdata->desc.n_voltages =3 ;
This doesn't match your implementation which can only set two voltages.
Re: [PATCH v4 3/7] regulator: add pbias regulator support
Quoted 8 lines · Mark Brown
drivers/regulator/Kconfig config REGULATOR_PALMAS · line 374
Quoted 3 lines · Balaji T K
drivers/regulator/Kconfig +3
-0+config REGULATOR_PBIAS + tristate "PBIAS OMAP regulator driver" + depends on ARCH_OMAP && MFD_SYSCONThat should be (
ARCH_OMAP||COMPILE_TEST) &&MFD_SYSCON
Ok
Quoted 11 lines
Quoted 11 lines
drivers/regulator/pbias-regulator.c new file +11
-0+static int pbias_regulator_set_voltage (struct regulator_dev *dev, +int min_uV,int max_uV,unsigned *selector) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (dev); +const struct pbias_reg_info *info = data->info; +int ret, vmode; + +if (min_uV <=1800000 ) + vmode =0 ; +else if (min_uV >1800000 ) + vmode = info->vmode;
Quoted 9 lines
drivers/regulator/pbias-regulator.c line 63
Quoted 4 lines
drivers/regulator/pbias-regulator.c new file +4
-0+ + ret =regmap_update_bits (data->syscon, data->pbias_reg, + info->vmode, vmode); + data->voltage = min_uV;This is exactly the same as it was the first time it was posted and is still buggy. To repeat the get and set voltage functions should reflect the actual voltage set in the hardware.
my bad, will fix it.
Quoted 6 lines
Quoted 6 lines
drivers/regulator/pbias-regulator.c new file +6
-0+static int pbias_regulator_is_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_reg_info *info = data->info; +int value; +
Quoted 9 lines
drivers/regulator/pbias-regulator.c line 107
Quoted 4 lines
drivers/regulator/pbias-regulator.c new file +4
-0+regmap_read (data->syscon, data->pbias_reg, &value); + +return value & info->enable_mask; +}If the enable mask really can have multiple bits this won't do the right thing - it'll return true if any bits are set. It needs to make sure all the bits are set.
True, will fix it.
Quoted 3 lines
Quoted 1 line
+#if
CONFIG_OFWhy?
Driver is DT only, Will remove it.
Quoted 5 lines
drivers/regulator/pbias-regulator.c line 197
Quoted 2 lines
drivers/regulator/pbias-regulator.c new file +1
-0+ drvdata->desc.n_voltages =3 ;This doesn't match your implementation which can only set two voltages.
I considered power-off too, will make it 2 then.
Thanks and Regards,
Balaji T K
PATCH v5 3/7 regulator: add pbias regulator support
In reply to Mark Brownpbias 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.
--- Documentation/devicetree/bindings/regulator/pbias-regulator.txt | 21 drivers/regulator/Kconfig | 9 drivers/regulator/Makefile | 1 drivers/regulator/pbias-regulator.c | 236 ++++++++++ 4 files changed, 267 insertions(+) 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 +21 -0
@@ -0,0 +1,21 @@ +PBIAS internal regulator for SD card i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "regulator-pbias-omap2" for OMAP2 + - "regulator-pbias-omap3" for OMAP3 + - "regulator-pbias-omap4" for OMAP4 + - "regulator-pbias-omap5" for OMAP5, DRA7 +- pbias-reg-offset: PBIAS control register offset from syscon base address + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + 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) += 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 +236 -0
236 lines not on this page · raw message
Tony Lindgren
maintainerRe: [PATCH v5 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.
Good to see this, few comments below.
Quoted 13 lines
+++
lo/Documentation/devicetree/bindings/regulator/pbias-regulator.txt2013-12-10 16:58:28.907927745 +0530Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +11
-0@@ -0,0 +1,21 @@ +PBIAS internal regulator for SD card i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "regulator-pbias-omap2" for OMAP2 + - "regulator-pbias-omap3" for OMAP3 + - "regulator-pbias-omap4" for OMAP4 + - "regulator-pbias-omap5" for OMAP5, DRA7 +- pbias-reg-offset: PBIAS control register offset from syscon base address + +Optional properties:
Documentation/devicetree/bindings/regulator/pbias-regulator.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +10
-0+- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator { + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };
This does not seem to support the other PBIAS controls the same register has?
drivers/regulator/Kconfig config REGULATOR_PALMAS · line 380
Quoted 13 lines
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. +
The PBIAS register is not just for MMC. Depending on the SoC revision, you may also have 2 - 3 PBIAS devices in the same register. Please check the 2430 TRM, it has also I2C secondary pulls in this same register. And on 3430, there PBIAS register has also SIM voltage bits.
Certainly nothing stops from intially implementing the MMC pieces as those are needed badly, but it should be done in a way where adding support for the other PBIAS bits can be done easily.
You're also missing the PBIAS interrupts, so it might be worth checking the code from that point of view also to make sure adding the support for interrupts won't require massive changes to the driver.
Regards,
Tony
Tony Lindgren
maintainerRe: [PATCH v5 3/7] regulator: add pbias regulator support
Quoted 18 lines · Tony Lindgren
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.Good to see this, few comments below.
Quoted 10 lines
+++
lo/Documentation/devicetree/bindings/regulator/pbias-regulator.txt2013-12-10 16:58:28.907927745 +0530Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +8
-0@@ -0,0 +1,21 @@ +PBIAS internal regulator for SD card i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "regulator-pbias-omap2" for OMAP2 + - "regulator-pbias-omap3" for OMAP3 + - "regulator-pbias-omap4" for OMAP4 + - "regulator-pbias-omap5" for OMAP5, DRA7
Quoted 8 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt line 16
Quoted 8 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +8
-0+- pbias-reg-offset: PBIAS control register offset from syscon base address + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator {
Hmm one more comment. This should containe the standard property:
reg = <0x02b0 0x4>;
And the parent SCM driver should claim the whole SCM GENERAL register area as defined in "Table 13-68. GENERAL Register Summary" for omap3 for example. So that would be the following for the parent:
reg = <0x48002270 xxx>;
The size needs to be checked and it may need multiple regions or instances defined. That way we can use the drivers/mfd/syscon.c SCM driver for all the misc registers without having to redo the bindings.
Regards,
Tony
Re: [PATCH v5 3/7] regulator: add pbias regulator support
In reply to Tony LindgrenQuoted 26 lines · Tony Lindgren
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.Good to see this, few comments below.
Quoted 18 lines
+++
lo/Documentation/devicetree/bindings/regulator/pbias-regulator.txt2013-12-10 16:58:28.907927745 +0530Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +16
-0@@ -0,0 +1,21 @@ +PBIAS internal regulator for SD card i/o pads on OMAP SoCs. + +Required properties: +- compatible: + - "regulator-pbias-omap2" for OMAP2 + - "regulator-pbias-omap3" for OMAP3 + - "regulator-pbias-omap4" for OMAP4 + - "regulator-pbias-omap5" for OMAP5, DRA7 +- pbias-reg-offset: PBIAS control register offset from syscon base address + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + +Example: + + pbias_regulator: pbias_regulator {
Quoted 9 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt line 21
Quoted 5 lines
Documentation/devicetree/bindings/regulator/pbias-regulator.txt new file +5
-0+ pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + };This does not seem to support the other PBIAS controls the same register has?
Hi Tony,
Thanks for the comments,
Quoted 4 lines
Quoted 4 lines
drivers/regulator/Kconfig +0
-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.
Quoted 11 lines
drivers/regulator/Kconfig config REGULATOR_PALMAS · line 380
Quoted 9 lines
drivers/regulator/Kconfig +9
-0+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. +The PBIAS register is not just for MMC. Depending on the SoC revision,
yes, SIM pbias bit mapping are similar to MMC.
I will try to add sim pbias to my next version.
Quoted 2 lines
you may also have 2 - 3 PBIAS devices in the same register. Please check the 2430 TRM, it has also I2C secondary pulls in this same register. And
This regulator driver will only control bits related to voltage settings and is not touching other bits by using masks.
Quoted 6 lines
on 3430, there PBIAS register has also SIM voltage bits.
Certainly nothing stops from intially implementing the MMC pieces as those are needed badly, but it should be done in a way where adding support for the other PBIAS bits can be done easily.
yes, It can be easily done for SIM pbias control.
Quoted 4 lines
You're also missing the PBIAS interrupts, so it might be worth checking the code from that point of view also to make sure adding the support for interrupts won't require massive changes to the driver.
PBIAS interrupts were never used in non-dt case, so did not consider while adapting for DT. However it can be added later on.
Thanks and Regards,
Balaji T K
Mark Brown
maintainerRe: [PATCH v5 3/7] regulator: add pbias regulator support
In reply to Balaji T KQuoted 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.
This looks OK from a regulator API point of view but I expect a new version is required to address Tony's concerns.
PATCH v4 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 v4 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 | 14 ++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 14 ++++++++++++++ 5 files changed, 70 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +14 -0
@@ -119,6 +119,19 @@ pinctrl-single,function-mask = <0x3fffffff>; }; + tisyscon: tisyscon@4A100600 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002E00 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap5"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <10>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -485,6 +498,7 @@ dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; status = "disabled"; + pbias-supply = <&pbias_regulator>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap2430.dtsi +14 -0
@@ -29,6 +29,19 @@ pinctrl-single,function-mask = <0x3f>; }; + tisyscon: tisyscon@490024A0 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x490024A0 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap2"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +196,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_regulator>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap3.dtsi +14 -0
@@ -137,6 +137,19 @@ pinctrl-single,function-mask = <0xff1f>; }; + tisyscon: tisyscon@48002520 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x48002520 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap3"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -351,6 +364,7 @@ ti,dual-volt; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_regulator>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap4.dtsi +14 -0
@@ -134,6 +134,19 @@ pinctrl-single,function-mask = <0x7fff>; }; + tisyscon: tisyscon@4A100600 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A100600 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap4"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <10>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -367,6 +380,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_regulator>; }; mmc2: mmc@480b4000 {
arch/arm/boot/dts/omap5.dtsi +14 -0
@@ -130,6 +130,19 @@ pinctrl-single,function-mask = <0x7fff>; }; + tisyscon: tisyscon@4A002E00 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002E00 0x4>; + pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap5"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <10>; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -409,6 +422,7 @@ ti,needs-special-reset; dmas = <&sdma 61>, <&sdma 62>; dma-names = "tx", "rx"; + pbias-supply = <&pbias_regulator>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v4 5/7] ARM: dts: add pbias dt node
Quoted 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 | 14 ++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 14 ++++++++++++++ 5 files changed, 70 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0
arch/arm/boot/dts/dra7.dtsi line 124
Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi +3
-0@@ -119,6 +119,19 @@ pinctrl-single,function-mask = <0x3fffffff>; }; + tisyscon: tisyscon@4A100600 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002E00 0x4>;
This should map the whole GENERAL area of the SCM register space instead in one or multiple sections or driver instances. This way the same driver can be used for the misc SCM registers from other drivers.
If you don't define it that way now, you'll end up with broken child driver offsets in the .dts files later on.
arch/arm/boot/dts/dra7.dtsi line 131
Quoted 7 lines
arch/arm/boot/dts/dra7.dtsi +7
-0+ pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap5"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <10>;
Then the pbias_regulator needs to have the standard reg property as an offset from the SCM GENERAL base address.
Regards,
Tony
Re: [PATCH v4 5/7] ARM: dts: add pbias dt node
Quoted 21 lines · Tony Lindgren
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 | 14 ++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 14 ++++++++++++++ 5 files changed, 70 insertions(+), 0 deletions(-)arch/arm/boot/dts/dra7.dtsi +0
-0@@ -119,6 +119,19 @@ pinctrl-single,function-mask = <0x3fffffff>; };
Quoted 8 lines
arch/arm/boot/dts/dra7.dtsi line 124
Quoted 3 lines
arch/arm/boot/dts/dra7.dtsi +3
-0+ tisyscon: tisyscon@4A100600 { + compatible = "ti,control-syscon", "syscon", "simple-bus"; + reg = <0x4A002E00 0x4>;This should map the whole GENERAL area of the SCM register space instead in one or multiple sections or driver instances. This way the same driver can be used for the misc SCM registers from other drivers.
Hi,
OK, make sense, others driver wont have to patch the base address later on.
Quoted 2 lines
If you don't define it that way now, you'll end up with broken child driver offsets in the .dts files later on.
yes, Unless someone changes the base and not the offset, given that all are in one dtsi
Quoted 11 lines
arch/arm/boot/dts/dra7.dtsi line 131
Quoted 8 lines
arch/arm/boot/dts/dra7.dtsi +7
-0+ pbias_regulator: pbias_regulator { + compatible = "regulator-pbias-omap5"; + pbias-reg-offset = <0>; + regulator-name = "pbias_regulator"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <10>;Then the
pbias_regulatorneeds to have the standard reg property as an offset from the SCM GENERAL base address.
OK
PATCH v4 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 v4 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
v6 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 | 17 ++ arch/arm/boot/dts/dra7.dtsi | 19 ++ arch/arm/boot/dts/omap2430.dtsi | 19 ++ arch/arm/boot/dts/omap3.dtsi | 19 ++ arch/arm/boot/dts/omap4.dtsi | 19 ++ arch/arm/boot/dts/omap5.dtsi | 19 ++ 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 v6 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 v6 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 v6 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.
---
Add support for sim pbias and get pbias register offset via standard reg property
.../bindings/regulator/pbias-regulator.txt | 17 ++ drivers/regulator/Kconfig | 9 + drivers/regulator/Makefile | 1 + drivers/regulator/pbias-regulator.c | 255 ++++++++++++++++++++ 4 files changed, 282 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 +17 -0
@@ -0,0 +1,17 @@ +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>; + regulator-enable-ramp-delay = <100>; + };
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
A message that is not in the archive (sent off-list or not yet received): 1387456720-7202-4-git-send-email-balajitk-l0cyMroinI0@public.gmane.org
Re: [PATCH v6 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.
This is basically fine from a regulator point of view but I'd like to see some review from the OMAP side given the concerns raised last time.
Tony Lindgren
maintainerRe: [PATCH v6 3/7] regulator: add pbias regulator support
In reply to Balaji T KLooks good to me, just few minor comments below.
drivers/regulator/pbias-regulator.c line 5
Quoted 8 lines · Balaji T K
drivers/regulator/pbias-regulator.c new file +5
-0@@ -0,0 +1,255 @@ +/* +* pbias-regulator.c +* +* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Balaji T K <[email protected]>
Maybe use 2013 here instead?
drivers/regulator/pbias-regulator.c line 89
Quoted 11 lines
drivers/regulator/pbias-regulator.c new file +11
-0+static int pbias_regulator_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_reg_info *info = data->info; +int ret; + + ret =regmap_update_bits (data->syscon, data->pbias_reg, + info->enable_mask, info->enable); + +return ret; +}
Do we need need to check the values after enable here? AFAIK setting the PBIAS voltage change can also fail and that's probably why it has also the interrupt available.
Quoted 24 lines
drivers/regulator/pbias-regulator.c new file +24
-0+static const struct pbias_reg_info pbias_mmc_omap3 = { + .enable =BIT (1 ), + .enable_mask =BIT (1 ), + .vmode =BIT (0 ), + .name ="pbias_mmc_omap3" +}; + +static const struct pbias_reg_info pbias_sim_omap3 = { + .enable =BIT (9 ), + .enable_mask =BIT (9 ), + .vmode =BIT (8 ), + .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 ), + .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 ),
drivers/regulator/pbias-regulator.c line 154
Quoted 10 lines
drivers/regulator/pbias-regulator.c new file +9
-0+ .vmode = BIT(21), + .name = "pbias_mmc_omap5" +}; +static struct of_regulator_match pbias_matches[] = { + { .name ="pbias_mmc_omap3" , .driver_data = (void *)&pbias_mmc_omap3}, + { .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}, +};
We probably need also pbias_mmc_omap2430 as that regiter mapping is separate from omap3?
Other than that, good to see this finally happen. This should allow us to get rid of most of the platform data callbacks for omap_hsmmc.c driver.
Regards,
Tony
Re: [PATCH v6 3/7] regulator: add pbias regulator support
Quoted 13 lines · Tony Lindgren
Looks good to me, just few minor comments below.
drivers/regulator/pbias-regulator.c line 5
Quoted 8 lines · Balaji T K
drivers/regulator/pbias-regulator.c new file +5
-0@@ -0,0 +1,255 @@ +/* +* pbias-regulator.c +* +* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Balaji T K <[email protected]> Maybe use 2013 here instead?
yes
Quoted 15 lines
drivers/regulator/pbias-regulator.c line 89
Quoted 12 lines
drivers/regulator/pbias-regulator.c new file +11
-0+static int pbias_regulator_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_reg_info *info = data->info; +int ret; + + ret =regmap_update_bits (data->syscon, data->pbias_reg, + info->enable_mask, info->enable); + +return ret; +}Do we need need to check the values after enable here? AFAIK setting the PBIAS voltage change can also fail and that's probably why it has
failure due to mismatch in input voltage, should to be avoided and should be taken care in s/w by the caller before pbias regulator set voltage/enable.
Quoted 2 lines
also the interrupt available.
But interrupt was never used/tested AFAIK, there is some settling time before the generated interrupt status is truely valid, so pbias interrupt is not reliable.
Quoted 28 lines
Quoted 28 lines
drivers/regulator/pbias-regulator.c new file +27
-0+static const struct pbias_reg_info pbias_mmc_omap3 = { + .enable =BIT (1 ), + .enable_mask =BIT (1 ), + .vmode =BIT (0 ), + .name ="pbias_mmc_omap3" +}; + +static const struct pbias_reg_info pbias_sim_omap3 = { + .enable =BIT (9 ), + .enable_mask =BIT (9 ), + .vmode =BIT (8 ), + .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 ), + .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 ), + .name ="pbias_mmc_omap5" +};
Quoted 10 lines
drivers/regulator/pbias-regulator.c line 154
Quoted 6 lines
drivers/regulator/pbias-regulator.c new file +6
-0+static struct of_regulator_match pbias_matches[] = { + { .name ="pbias_mmc_omap3" , .driver_data = (void *)&pbias_mmc_omap3}, + { .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}, +};We probably need also
pbias_mmc_omap2430as that regiter mapping is separate from omap3?
between omap2430 and omap3430, 3460 pbias register address are different, other than that enable,enable_mask and vmode are
one and the same, so re-used "pbias_mmc_omap3" name and struct pbias_reg_info pbias_mmc_omap3 for omap2430 too, save one entry in of_regulator_match!
If separate name is needed for omap2430, I can add one for 2430, and reuse the "const struct pbias_reg_info pbias_mmc_omap3" of omap3 since the bit map for enable/disable and voltage configuration will be same. Then pbias_matches will look like.
Quoted 7 lines
drivers/regulator/pbias-regulator.c line 154
Quoted 7 lines
drivers/regulator/pbias-regulator.c new file +7
-0+static struct of_regulator_match pbias_matches[] = { + { .name ="pbias_mmc_omap2430" , .driver_data = (void *)&pbias_mmc_omap3}, + { .name ="pbias_mmc_omap3" , .driver_data = (void *)&pbias_mmc_omap3}, + { .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}, +};
Let me know if you still think that separate regulator name is needed for 2430, I can respin this series.
Quoted 7 lines
Other than that, good to see this finally happen. This should allow us to get rid of most of the platform data callbacks for
omap_hsmmc.cdriver.Regards,
Tony
Tony Lindgren
maintainerRe: [PATCH v6 3/7] regulator: add pbias regulator support
Quoted 19 lines · Balaji T K
Quoted 6 lines · Tony Lindgren
Quoted 6 lines
drivers/regulator/pbias-regulator.c new file +6
-0+static int pbias_regulator_enable (struct regulator_dev *rdev) +{ +struct pbias_regulator_data *data =rdev_get_drvdata (rdev); +const struct pbias_reg_info *info = data->info; +int ret; +Quoted 8 lines
drivers/regulator/pbias-regulator.c line 89
Quoted 5 lines
drivers/regulator/pbias-regulator.c new file +5
-0+ ret =regmap_update_bits (data->syscon, data->pbias_reg, + info->enable_mask, info->enable); + +return ret; +}Do we need need to check the values after enable here? AFAIK setting the PBIAS voltage change can also fail and that's probably why it has
failure due to mismatch in input voltage, should to be avoided and should be taken care in s/w by the caller before pbias regulator set voltage/enable.
Quoted 6 lines
Quoted 2 lines
also the interrupt available.
But interrupt was never used/tested AFAIK, there is some settling time before the generated interrupt status is truely valid, so pbias interrupt is not reliable.
OK. Do we need the standard regulator property startup-delay-us for the PBIAS regulator then? Or if it's always fixed, I guess it could be done in the pbias_regulator_enable()?
Quoted 9 lines
Quoted 3 lines
We probably need also
pbias_mmc_omap2430as that regiter mapping is separate from omap3?between omap2430 and omap3430, 3460 pbias register address are different, other than that enable,enable_mask and vmode are
one and the same, so re-used "pbias_mmc_omap3" name and structpbias_reg_infopbias_mmc_omap3for omap2430 too, save one entry inof_regulator_match!
Quoted 4 lines
If separate name is needed for omap2430, I can add one for 2430, and reuse the "const struct
pbias_reg_infopbias_mmc_omap3" of omap3 since the bit map for enable/disable and voltage configuration will be same. Thenpbias_matcheswill look like.
If they truly are compatible, then usually the earliest revision name is used. So I guess we should use the omap2430 naming instead of omap3 naming.
Quoted 10 lines
Quoted 7 lines
drivers/regulator/pbias-regulator.c line 154
Quoted 7 lines
drivers/regulator/pbias-regulator.c new file +7
-0+static struct of_regulator_match pbias_matches[] = { + { .name ="pbias_mmc_omap2430" , .driver_data = (void *)&pbias_mmc_omap3}, + { .name ="pbias_mmc_omap3" , .driver_data = (void *)&pbias_mmc_omap3}, + { .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}, +};Let me know if you still think that separate regulator name is needed for 2430, I can respin this series.
Sounds like using the omap2430 naming would solve that.
Regards,
Tony
Mark Brown
maintainerRe: [PATCH v6 3/7] regulator: add pbias regulator support
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Balaji T K
But interrupt was never used/tested AFAIK, there is some settling time before the generated interrupt status is truely valid, so pbias interrupt is not reliable.
OK. Do we need the standard regulator property startup-delay-us for the PBIAS regulator then? Or if it's always fixed, I guess it could be done in the
pbias_regulator_enable()?
That delay is supposed to be the time for the startup of the supply rather than any detection code. It should be set using enable_time in the driver if it's not system dependent - the property is there for cases where the delay depends on system configuration (eg, due to the capacitor values).
Tony Lindgren
maintainerRe: [PATCH v6 3/7] regulator: add pbias regulator support
Quoted 11 lines · Mark Brown
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Balaji T K
But interrupt was never used/tested AFAIK, there is some settling time before the generated interrupt status is truely valid, so pbias interrupt is not reliable.
OK. Do we need the standard regulator property startup-delay-us for the PBIAS regulator then? Or if it's always fixed, I guess it could be done in the
pbias_regulator_enable()?
Quoted 5 lines
That delay is supposed to be the time for the startup of the supply rather than any detection code. It should be set using
enable_timein the driver if it's not system dependent - the property is there for cases where the delay depends on system configuration (eg, due to the capacitor values).
OK thanks. Let's try enable_time first then as we've had a fixed value for years for it. If there's some difference based on the card capacitance etc that can be added if needed.
Regards,
Tony
Re: [PATCH v6 3/7] regulator: add pbias regulator support
Quoted 18 lines · Tony Lindgren
Quoted 11 lines · Mark Brown
Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Balaji T K
But interrupt was never used/tested AFAIK, there is some settling time before the generated interrupt status is truely valid, so pbias interrupt is not reliable.
OK. Do we need the standard regulator property startup-delay-us for the PBIAS regulator then? Or if it's always fixed, I guess it could be done in the
pbias_regulator_enable()?Quoted 5 lines
That delay is supposed to be the time for the startup of the supply rather than any detection code. It should be set using
enable_timein the driver if it's not system dependent - the property is there for cases where the delay depends on system configuration (eg, due to the capacitor values).
Quoted 3 lines
OK thanks. Let's try
enable_timefirst then as we've had a fixed value for years for it. If there's some difference based on the card capacitance etc that can be added if needed.
I used regulator-enable-ramp-delay to set constraints->enable_time based on SoC. Since it is not board dependent, I will drop regulator-enable-ramp-delay from dt and pass the value via driver_data.
Thanks and Regards,
Balaji T K
PATCH v6 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 v6 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.
---
Added control module region which has pbias register. remaining control module region for syscon can be added later when needed.
arch/arm/boot/dts/dra7.dtsi | 19 +++++++++++++++++++ arch/arm/boot/dts/omap2430.dtsi | 19 +++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 19 +++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 19 +++++++++++++++++++ arch/arm/boot/dts/omap5.dtsi | 19 +++++++++++++++++++ 5 files changed, 95 insertions(+), 0 deletions(-)
arch/arm/boot/dts/dra7.dtsi +19 -0
@@ -110,6 +110,24 @@ 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>; + regulator-enable-ramp-delay = <100>; + }; + }; + }; + dra7_pmx_core: pinmux@4a003400 { compatible = "pinctrl-single"; reg = <0x4a003400 0x0464>;
@@ -485,6 +503,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 +19 -0
@@ -29,6 +29,24 @@ 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_omap3 { + regulator-name = "pbias_mmc_omap3"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + }; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
@@ -183,6 +201,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 +19 -0
@@ -137,6 +137,24 @@ 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_omap3 { + regulator-name = "pbias_mmc_omap3"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + }; + }; + }; + gpio1: gpio@48310000 { compatible = "ti,omap3-gpio"; reg = <0x48310000 0x200>;
@@ -351,6 +369,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 +19 -0
@@ -134,6 +134,24 @@ 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>; + regulator-enable-ramp-delay = <10>; + }; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -367,6 +385,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 +19 -0
@@ -130,6 +130,24 @@ 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>; + regulator-enable-ramp-delay = <100>; + }; + }; + }; + sdma: dma-controller@4a056000 { compatible = "ti,omap4430-sdma"; reg = <0x4a056000 0x1000>;
@@ -409,6 +427,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
Tony Lindgren
maintainerRe: [PATCH v6 5/7] ARM: dts: add pbias dt node
Quoted 27 lines · Balaji T K
arch/arm/boot/dts/dra7.dtsi +1
-0@@ -485,6 +503,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 +11
-0@@ -29,6 +29,24 @@ 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_omap3 { + regulator-name = "pbias_mmc_omap3";
arch/arm/boot/dts/omap2430.dtsi line 52
Quoted 10 lines
arch/arm/boot/dts/omap2430.dtsi +7
-0+ regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + }; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;
Here too you may need to set up pbias_mmc_omap2430?
Regards,
Tony
Re: [PATCH v6 5/7] ARM: dts: add pbias dt node
Quoted 32 lines · Tony Lindgren
Quoted 31 lines · Balaji T K
arch/arm/boot/dts/dra7.dtsi +1
-0@@ -485,6 +503,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 +15
-0@@ -29,6 +29,24 @@ 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_omap3 { + regulator-name = "pbias_mmc_omap3"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + };
Quoted 9 lines
arch/arm/boot/dts/omap2430.dtsi line 52
Quoted 6 lines
arch/arm/boot/dts/omap2430.dtsi +3
-0+ }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;Here too you may need to set up
pbias_mmc_omap2430?
2430 pbias reg config is same as 3430/3630 w.r.t to mmc pbias i/o, hence using the same name, if you think regulator name needs to be changed let me know the more appropriate one.
Tony Lindgren
maintainerRe: [PATCH v6 5/7] ARM: dts: add pbias dt node
Quoted 43 lines · Balaji T K
Quoted 32 lines · Tony Lindgren
Quoted 31 lines · Balaji T K
arch/arm/boot/dts/dra7.dtsi +1
-0@@ -485,6 +503,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 +15
-0@@ -29,6 +29,24 @@ 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_omap3 { + regulator-name = "pbias_mmc_omap3"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + };Quoted 9 lines
arch/arm/boot/dts/omap2430.dtsi line 52
Quoted 6 lines
arch/arm/boot/dts/omap2430.dtsi +3
-0+ }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;Here too you may need to set up
pbias_mmc_omap2430?
Quoted 3 lines
2430 pbias reg config is same as 3430/3630 w.r.t to mmc pbias i/o, hence using the same name, if you think regulator name needs to be changed let me know the more appropriate one.
If they are compatible then we should use the earliest revision number which would be 2430 instead of omap3 :)
Tony
Re: [PATCH v6 5/7] ARM: dts: add pbias dt node
Quoted 44 lines · Tony Lindgren
Quoted 43 lines · Balaji T K
Quoted 41 lines · Tony Lindgren
Quoted 27 lines · Balaji T K
arch/arm/boot/dts/dra7.dtsi +1
-0@@ -485,6 +503,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 +11
-0@@ -29,6 +29,24 @@ 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_omap3 { + regulator-name = "pbias_mmc_omap3";arch/arm/boot/dts/omap2430.dtsi line 52
Quoted 10 lines
arch/arm/boot/dts/omap2430.dtsi +7
-0+ regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <100>; + }; + }; + }; + gpio1: gpio@4900c000 { compatible = "ti,omap2-gpio"; reg = <0x4900c000 0x200>;Here too you may need to set up
pbias_mmc_omap2430?
Quoted 6 lines
Quoted 3 lines
2430 pbias reg config is same as 3430/3630 w.r.t to mmc pbias i/o, hence using the same name, if you think regulator name needs to be changed let me know the more appropriate one.
If they are compatible then we should use the earliest revision number which would be 2430 instead of omap3 :)
I went with most commonly used omap SoC :-)
Quoted 3 lines
Tony
PATCH v6 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 v6 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 v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
In reply to Linus WalleijQuoted 13 lines · Linus Walleij
Quoted 11 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)
Quoted 8 lines
Quoted 1 line
Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
I haven't seem much of this patch-set, but this certainly looks like it should be handled by a GPIO regulator instead of pinctrl. States are easily declared in a 'struct gpio_regulator_state', which the framework then uses to set the correct pins for the required voltage.
And yes, 'vqmmc' is a good place to store the this regulator.
Signature · 8 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- 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 v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 20 lines · Lee Jones
Quoted 18 lines · Linus Walleij
Quoted 7 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Quoted 9 lines
Quoted 3 lines
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
I haven't seem much of this patch-set, but this certainly looks like it should be handled by a GPIO regulator instead of pinctrl. States are easily declared in a 'struct
gpio_regulator_state', which the framework then uses to set the correct pins for the required voltage.
Thanks for the pointer, but wondering why is it named as gpio-regulator and how it is different from fixed-regulator.
After going through git log description, I understand that voltage/current level for a particular regulator is controlled by a set of pad/pin on the POWER IC and pad/pin may be usually connected to gpio pins if it is needs to be configurable and ground/pulled for constant voltage.
Collection of gpios logic level are modeled as state for particular voltage. But gpio is not used in my case.
Quoted 2 lines
And yes, 'vqmmc' is a good place to store the this regulator.
Re: [PATCH v2 06/10] mmc: omap_hsmmc: add support for pbias configuration in dt
Quoted 38 lines · Balaji T K
Quoted 20 lines · Lee Jones
Quoted 18 lines · Linus Walleij
Quoted 7 lines · Balaji T K
PBIAS register configuration is based on the regulator voltage which supplies these pbias cells, sd i/o pads.
With PBIAS register address and bit definitions different across omap[3,4,5], Simplify PBIAS configuration under three different regulator voltage levels - O V, 1.8 V, 3 V. Corresponding pinctrl states are defined aspbias_off,pbias_1v8,pbias_3v.Quoted 5 lines
pinctrl state
mmc_initis used for configuring speed mode, loopback clock (in devconf0/devconf1/prog_io1 register for omap3) and pull strength configuration (incontrol_mmc1for omap4)Signed-off-by Balaji T K <[email protected]>You *need* Lee Jones and Mark Brown to review this. Maybe Laurent has something to add too.
Quoted 9 lines
Quoted 3 lines
Ux500 had the very same thing, and there this was solved using a GPIO regulator for "vqmmc" a level-shifter. I vaguely remember Laurent doing something similar with the SH stuff.
I haven't seem much of this patch-set, but this certainly looks like it should be handled by a GPIO regulator instead of pinctrl. States are easily declared in a 'struct
gpio_regulator_state', which the framework then uses to set the correct pins for the required voltage.Thanks for the pointer, but wondering why is it named as gpio-regulator and how it is different from fixed-regulator.
After going through git log description, I understand that voltage/current level for a particular regulator is controlled by a set of pad/pin on the POWER IC and pad/pin may be usually connected to gpio pins if it is needs to be configurable and ground/pulled for constant voltage.
Quoted 4 lines
Collection of gpios logic level are modeled as state for particular voltage. But gpio is not used in my case.
Quoted 1 line
And yes, 'vqmmc' is a good place to store the this regulator.
As I say, I didn't see much of the code, only parts which looked similar a voltage level-shifter.
The difference between fixed and gpio regulators, is that the former is exactly that, 'fixed'. You can turn voltage on and off using a gpio pin, but you can't shift the voltage. Something which is required of your use-case. The latter switches between voltgages via a set of gpio pins, for instance, your use-case could look somelike like:
static struct gpio_regulator_state sdi0_reg_states[] = {
{ .value = 3300000, .gpios = (1 << 0) },
{ .value = 1800000, .gpios = (0 << 0) },
};But if there aren't any gpio pins involved, then this isn't what you want either.
Signature · 4 lines
Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 7/10 mmc: omap_hsmmc: remove dt pbias workaround
In reply to Balaji T KWith pbias support in place remove dt workaround for pbias
--- drivers/mmc/host/omap_hsmmc.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -19
@@ -161,7 +161,6 @@ struct omap_hsmmc_host {*/ struct regulator *vcc;struct regulator *vcc_aux; -int pbias_disable;void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */
@@ -259,13 +258,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc && !host->vcc_aux)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);
@@ -1552,13 +1544,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
@@ -1956,10 +1942,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 && host->mapbase ==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
A message that is not in the archive (sent off-list or not yet received): 1370546059-24181-1-git-send-email-balajitk-l0cyMroinI0@public.gmane.org
PATCH v2 8/10 ARM: dts: omap3: split omap3_pmx_core
omap3_pmx_core: padconf register are in two banks 0x48003000 to 0x48002268 and 0x480025c0 to 0x480025f8.
split omap3_pmx_core into 2 banks as register between 0x48002270 and 0x48002564 belongs to type pinctrl-single,bit-per-mux with access to certain bit fields with bit field mask.
--- arch/arm/boot/dts/omap3-beagle.dts | 28 ++++++++++++++++++++-------- arch/arm/boot/dts/omap3.dtsi | 11 ++++++++++- 2 files changed, 30 insertions(+), 9 deletions(-)
arch/arm/boot/dts/omap3-beagle.dts +20 -8
@@ -76,17 +76,11 @@ &omap3_pmx_core { pinctrl-names = "default"; pinctrl-0 = < - &hsusbb2_pins + &hsusbb2_pins1 >; - hsusbb2_pins: pinmux_hsusbb2_pins { + hsusbb2_pins1: pinmux_hsusbb2_pins1 { pinctrl-single,pins = < - 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ - 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ - 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ - 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ - 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ - 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
@@ -97,6 +91,24 @@ }; }; +&omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = < + &hsusbb2_pins2 + >; + + hsusbb2_pins2: pinmux_hsusbb2_pins2 { + pinctrl-single,pins = < + 0x50 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ + 0x52 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ + 0x54 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ + 0x56 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ + 0x58 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ + 0x5A 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;
arch/arm/boot/dts/omap3.dtsi +10 -1
@@ -95,7 +95,16 @@ omap3_pmx_core: pinmux@48002030 { compatible = "ti,omap3-padconf", "pinctrl-single"; - reg = <0x48002030 0x05cc>; + reg = <0x48002030 0x238>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,register-width = <16>; + pinctrl-single,function-mask = <0x7f1f>; + }; + + omap3_pmx_core2: pinmux@480025a0 { + compatible = "ti,omap3-padconf", "pinctrl-single"; + reg = <0x480025a0 0x5c>; #address-cells = <1>; #size-cells = <0>; pinctrl-single,register-width = <16>;
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 08/10] ARM: dts: omap3: split omap3_pmx_core
Quoted 6 lines · Balaji T K
omap3_pmx_core: padconf register are in two banks0x48003000to0x48002268and0x480025c0to0x480025f8.split
omap3_pmx_coreinto 2 banks as register between0x48002270and0x48002564belongs to type pinctrl-single,bit-per-mux with access to certain bit fields with bit field mask.
Is this the right patch for the description? THe patch seems to deal with USB pins.
Also, let's not hog any pins under the pinmux controllers, those make unloading pinctrl-single impossible which is not nice for distros and development.
Instead, the pins should be under mmc1 in omap[345].dtsi files.
Regards,
Tony
Quoted 80 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/omap3-beagle.dts | 28 ++++++++++++++++++++-------- arch/arm/boot/dts/omap3.dtsi | 11 ++++++++++- 2 files changed, 30 insertions(+), 9 deletions(-)arch/arm/boot/dts/omap3-beagle.dts +20
-8@@ -76,17 +76,11 @@ &omap3_pmx_core { pinctrl-names = "default"; pinctrl-0 = < - &hsusbb2_pins + &hsusbb2_pins1 >; - hsusbb2_pins: pinmux_hsusbb2_pins { + hsusbb2_pins1: pinmux_hsusbb2_pins1 { pinctrl-single,pins = < - 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ - 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ - 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ - 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ - 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ - 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */@@ -97,6 +91,24 @@ }; }; +&omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = < + &hsusbb2_pins2 + >; + + hsusbb2_pins2: pinmux_hsusbb2_pins2 { + pinctrl-single,pins = < + 0x50 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ + 0x52 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ + 0x54 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ + 0x56 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ + 0x58 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ + 0x5A 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;arch/arm/boot/dts/omap3.dtsi +10
-1@@ -95,7 +95,16 @@ omap3_pmx_core: pinmux@48002030 { compatible = "ti,omap3-padconf", "pinctrl-single"; - reg = <0x48002030 0x05cc>; + reg = <0x48002030 0x238>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,register-width = <16>; + pinctrl-single,function-mask = <0x7f1f>; + }; + + omap3_pmx_core2: pinmux@480025a0 { + compatible = "ti,omap3-padconf", "pinctrl-single"; + reg = <0x480025a0 0x5c>; #address-cells = <1>; #size-cells = <0>; pinctrl-single,register-width = <16>;Signature · 1 line
1.7.5.4
Re: [PATCH v2 08/10] ARM: dts: omap3: split omap3_pmx_core
Quoted 8 lines · Tony Lindgren
Quoted 6 lines · Balaji T K
omap3_pmx_core: padconf register are in two banks0x48003000to0x48002268and0x480025c0to0x480025f8.split
omap3_pmx_coreinto 2 banks as register between0x48002270and0x48002564belongs to type pinctrl-single,bit-per-mux with access to certain bit fields with bit field mask.
Quoted 6 lines
Is this the right patch for the description? THe patch seems to deal with USB pins.
Also, let's not hog any pins under the pinmux controllers, those make unloading pinctrl-single impossible which is not nice for distros and development.
omap3_pmx_core is not continuous, so had to split into two and updated the only user in second bank (omap3_pmx_core2) which happened to be usb, CC Roger for USB dynamic pin mux selection.
Quoted 87 lines
Instead, the pins should be under mmc1 in omap[345].dtsi files.
Regards,
Tony
Quoted 80 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/omap3-beagle.dts | 28 ++++++++++++++++++++-------- arch/arm/boot/dts/omap3.dtsi | 11 ++++++++++- 2 files changed, 30 insertions(+), 9 deletions(-)arch/arm/boot/dts/omap3-beagle.dts +20
-8@@ -76,17 +76,11 @@ &omap3_pmx_core { pinctrl-names = "default"; pinctrl-0 = < - &hsusbb2_pins + &hsusbb2_pins1 >; - hsusbb2_pins: pinmux_hsusbb2_pins { + hsusbb2_pins1: pinmux_hsusbb2_pins1 { pinctrl-single,pins = < - 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ - 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ - 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ - 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ - 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ - 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */@@ -97,6 +91,24 @@ }; }; +&omap3_pmx_core2 { + pinctrl-names = "default"; + pinctrl-0 = < + &hsusbb2_pins2 + >; + + hsusbb2_pins2: pinmux_hsusbb2_pins2 { + pinctrl-single,pins = < + 0x50 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ + 0x52 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ + 0x54 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ + 0x56 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ + 0x58 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ + 0x5A 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;arch/arm/boot/dts/omap3.dtsi +10
-2@@ -95,7 +95,16 @@ omap3_pmx_core: pinmux@48002030 { compatible = "ti,omap3-padconf", "pinctrl-single"; - reg = <0x48002030 0x05cc>; + reg = <0x48002030 0x238>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,register-width = <16>; + pinctrl-single,function-mask = <0x7f1f>; + }; + + omap3_pmx_core2: pinmux@480025a0 { + compatible = "ti,omap3-padconf", "pinctrl-single"; + reg = <0x480025a0 0x5c>; #address-cells = <1>; #size-cells = <0>; pinctrl-single,register-width = <16>; --1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 08/10] ARM: dts: omap3: split omap3_pmx_core
Quoted 12 lines · Balaji T K
Quoted 11 lines · Tony Lindgren
Quoted 6 lines · Balaji T K
omap3_pmx_core: padconf register are in two banks0x48003000to0x48002268and0x480025c0to0x480025f8.split
omap3_pmx_coreinto 2 banks as register between0x48002270and0x48002564belongs to type pinctrl-single,bit-per-mux with access to certain bit fields with bit field mask.Is this the right patch for the description? THe patch seems to deal with USB pins.
Quoted 7 lines
Quoted 3 lines
Also, let's not hog any pins under the pinmux controllers, those make unloading pinctrl-single impossible which is not nice for distros and development.
omap3_pmx_coreis not continuous, so had to split into two and updated the only user in second bank (omap3_pmx_core2) which happened to be usb, CC Roger for USB dynamic pin mux selection.
I see. OK yes we can split it as that saves memory too for the unused registers. While at it, please move remove the hogs from the pmx entries and move the pins to the drivers claiming them.
Regards,
TOny
PATCH v2 9/10 ARM: dts: omap3: add pbias and mmc_init pinctrl states
In reply to Balaji T Kadd pbias states for pbias 0, 1.8V, 3V
add omap3 sd/mmc2 loop back clock config for devconf1 in mmc2_init pinctrl state add OMAP3430 sd/mmc1 loop back clock config for devconf0 in mmc1_init pinctrl state add OMAP3630 sd/mmc1 speed mode config for prog_io1 in mmc1_init pinctrl state
--- arch/arm/boot/dts/omap3-beagle-xm.dts | 42 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap3-beagle.dts | 42 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 10 ++++++++ 3 files changed, 94 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3-beagle-xm.dts +42 -0
@@ -59,6 +59,40 @@ }; }; +&omap3_pmx_general { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x2b0 0x1 0x3 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x2b0 0x2 0x3 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x2b0 0x3 0x3 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x1d8 0x100000 0x100000 /* prog_io1 */ + >; + }; + + mmc2_init: pinmux_mmc2_init { + pinctrl-single,bits = < + 0x68 0x40 0x40 /* devconf1 */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;
@@ -95,12 +129,20 @@ }; &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; bus-width = <8>; }; &mmc2 { + pinctrl-names = "mmc_init"; + pinctrl-1 = <&mmc2_init>; status = "disabled"; };
arch/arm/boot/dts/omap3-beagle.dts +42 -0
60 lines not on this page · raw message
arch/arm/boot/dts/omap3.dtsi +10 -0
@@ -111,6 +111,16 @@ pinctrl-single,function-mask = <0x7f1f>; }; + omap3_pmx_general: pinmux@48002270 { + compatible = "ti,omap3-padconf", "pinctrl-single"; + reg = <0x48002270 0x2f4>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + omap3_pmx_wkup: pinmux@0x48002a00 { compatible = "ti,omap3-padconf", "pinctrl-single"; reg = <0x48002a00 0x5c>;
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 09/10] ARM: dts: omap3: add pbias and mmc_init pinctrl states
Quoted 4 lines · Balaji T K
add pbias states for pbias 0, 1.8V, 3V
add omap3 sd/mmc2 loop back clock config for devconf1 inmmc2_initpinctrl state add OMAP3430 sd/mmc1 loop back clock config for devconf0 inmmc1_initpinctrl state add OMAP3630 sd/mmc1 speed mode config forprog_io1inmmc1_initpinctrl state
Looks OK to me, except these should be under mmc1 for omap[345].dtsi files.
Regards,
Tony
Quoted 163 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/omap3-beagle-xm.dts | 42 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap3-beagle.dts | 42 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 10 ++++++++ 3 files changed, 94 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap3-beagle-xm.dts +42
-0@@ -59,6 +59,40 @@ }; }; +&omap3_pmx_general { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x2b0 0x1 0x3 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x2b0 0x2 0x3 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x2b0 0x3 0x3 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x1d8 0x100000 0x100000 /* prog_io1 */ + >; + }; + + mmc2_init: pinmux_mmc2_init { + pinctrl-single,bits = < + 0x68 0x40 0x40 /* devconf1 */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;@@ -95,12 +129,20 @@ }; &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; bus-width = <8>; }; &mmc2 { + pinctrl-names = "mmc_init"; + pinctrl-1 = <&mmc2_init>; status = "disabled"; };arch/arm/boot/dts/omap3-beagle.dts +42
-0@@ -109,6 +109,40 @@ }; }; +&omap3_pmx_general { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x2b0 0x5 0x7 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x2b0 0x6 0x7 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x2b0 0x7 0x7 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x4 0x01000000 0x01000000 /* devconf0 */ + >; + }; + + mmc2_init: pinmux_mmc2_init { + pinctrl-single,bits = < + 0x68 0x40 0x40 /* devconf1 */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;@@ -122,12 +156,20 @@ /include/ "twl4030.dtsi" &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc1>; vmmc_aux-supply = <&vsim>; bus-width = <8>; }; &mmc2 { + pinctrl-names = "mmc_init"; + pinctrl-1 = <&mmc2_init>; status = "disabled"; };arch/arm/boot/dts/omap3.dtsi +10
-0@@ -111,6 +111,16 @@ pinctrl-single,function-mask = <0x7f1f>; }; + omap3_pmx_general: pinmux@48002270 { + compatible = "ti,omap3-padconf", "pinctrl-single"; + reg = <0x48002270 0x2f4>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + omap3_pmx_wkup: pinmux@0x48002a00 { compatible = "ti,omap3-padconf", "pinctrl-single"; reg = <0x48002a00 0x5c>;Signature · 1 line
1.7.5.4
Re: [PATCH v2 09/10] ARM: dts: omap3: add pbias and mmc_init pinctrl states
Quoted 8 lines · Tony Lindgren
Quoted 4 lines · Balaji T K
add pbias states for pbias 0, 1.8V, 3V
add omap3 sd/mmc2 loop back clock config for devconf1 inmmc2_initpinctrl state add OMAP3430 sd/mmc1 loop back clock config for devconf0 inmmc1_initpinctrl state add OMAP3630 sd/mmc1 speed mode config forprog_io1inmmc1_initpinctrl stateLooks OK to me, except these should be under mmc1 for omap[345].dtsi files.
I think I can move &omap3_pmx_general to omap3.dtsi and override &pbias_1v8, &pbias_3v in omap36xx.dtsi, but I doubt pinctrl-[0,1,2,3,4] since pull up setting can vary between boards.
Quoted 56 lines
Regards,
Tony
Quoted 52 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/omap3-beagle-xm.dts | 42 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap3-beagle.dts | 42 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/omap3.dtsi | 10 ++++++++ 3 files changed, 94 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap3-beagle-xm.dts +34
-0@@ -59,6 +59,40 @@ }; }; +&omap3_pmx_general { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x2b0 0x1 0x3 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x2b0 0x2 0x3 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x2b0 0x3 0x3 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x1d8 0x100000 0x100000 /* prog_io1 */ + >; + }; + + mmc2_init: pinmux_mmc2_init { + pinctrl-single,bits = < + 0x68 0x40 0x40 /* devconf1 */ + >; + }; +}; + &i2c1 { clock-frequency = <2600000>;
Tony Lindgren
maintainerRe: [PATCH v2 09/10] ARM: dts: omap3: add pbias and mmc_init pinctrl states
Quoted 7 lines · Balaji T K
Quoted 6 lines · Tony Lindgren
Quoted 4 lines · Balaji T K
add pbias states for pbias 0, 1.8V, 3V
add omap3 sd/mmc2 loop back clock config for devconf1 inmmc2_initpinctrl state add OMAP3430 sd/mmc1 loop back clock config for devconf0 inmmc1_initpinctrl state add OMAP3630 sd/mmc1 speed mode config forprog_io1inmmc1_initpinctrl state
Quoted 6 lines
Quoted 2 lines
Looks OK to me, except these should be under mmc1 for omap[345].dtsi files.
I think I can move
&omap3_pmx_generaltoomap3.dtsiand override&pbias_1v8,&pbias_3vinomap36xx.dtsi, but I doubt pinctrl-[0,1,2,3,4] since pull up setting can vary between boards.
OK makes sense to me if it's board specific.
Regards,
Tony
PATCH v2 10/10 ARM: dts: omap4: add pbias and mmc_init pinctrl states
In reply to Balaji T Kadd pbias states for pbias 0, 1.8V, 3V
add sd/mmc1 pull strength values for control_mmc1 in mmc_init pinctrl state
--- arch/arm/boot/dts/omap4-panda-common.dtsi | 34 +++++++++++++++++++++++++++++ arch/arm/boot/dts/omap4-sdp.dts | 34 +++++++++++++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 11 +++++++++ 3 files changed, 79 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda-common.dtsi +34 -0
@@ -137,6 +137,34 @@ }; }; +&omap4_padconf_global { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x60 0x00000000 0x07e00000 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x60 0x04400000 0x07e00000 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x60 0x04600000 0x07e00000 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x88 0xce000000 0xfe000000 /* control_mmc1 */ + >; + }; +}; + &i2c1 { pinctrl-names = "default"; pinctrl-0 = <&i2c1_pins>;
@@ -197,6 +225,12 @@ }; &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc>; bus-width = <8>; };
arch/arm/boot/dts/omap4-sdp.dts +34 -0
@@ -142,6 +142,34 @@ }; }; +&omap4_padconf_global { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x60 0x00000000 0x07e00000 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x60 0x04400000 0x07e00000 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x60 0x04600000 0x07e00000 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x88 0xce000000 0xfe000000 /* control_mmc1 */ + >; + }; +}; + &omap4_pmx_core { pinctrl-names = "default"; pinctrl-0 = <
@@ -381,6 +409,12 @@ }; &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc>; bus-width = <8>; };
arch/arm/boot/dts/omap4.dtsi +11 -0
@@ -114,6 +114,17 @@ pinctrl-single,register-width = <16>; pinctrl-single,function-mask = <0x7fff>; }; + + omap4_padconf_global: pinmux@4a100600 { + compatible = "ti,omap4-padconf", "pinctrl-single"; + reg = <0x4a1005a0 0x170>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + omap4_pmx_wkup: pinmux@4a31e040 { compatible = "ti,omap4-padconf", "pinctrl-single"; reg = <0x4a31e040 0x0038>;
Signature · 1 line
1.7.5.4
Tony Lindgren
maintainerRe: [PATCH v2 10/10] ARM: dts: omap4: add pbias and mmc_init pinctrl states
Quoted 2 lines · Balaji T K
add pbias states for pbias 0, 1.8V, 3V
add sd/mmc1 pull strength values forcontrol_mmc1inmmc_initpinctrl state
This too should be under mmc1 in the omap4.dtsi file.
Tony
Quoted 136 lines
Signed-off-by Balaji T K <[email protected]>--- arch/arm/boot/dts/omap4-panda-common.dtsi | 34 +++++++++++++++++++++++++++++ arch/arm/boot/dts/omap4-sdp.dts | 34 +++++++++++++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 11 +++++++++ 3 files changed, 79 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4-panda-common.dtsi +34
-0@@ -137,6 +137,34 @@ }; }; +&omap4_padconf_global { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x60 0x00000000 0x07e00000 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x60 0x04400000 0x07e00000 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x60 0x04600000 0x07e00000 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x88 0xce000000 0xfe000000 /* control_mmc1 */ + >; + }; +}; + &i2c1 { pinctrl-names = "default"; pinctrl-0 = <&i2c1_pins>;@@ -197,6 +225,12 @@ }; &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc>; bus-width = <8>; };arch/arm/boot/dts/omap4-sdp.dts +34
-0@@ -142,6 +142,34 @@ }; }; +&omap4_padconf_global { + pinctrl-names = "default"; + pinctrl-0 = <>; + pbias_off: pinmux_pbias_off { + pinctrl-single,bits = < + 0x60 0x00000000 0x07e00000 /* pbias */ + >; + }; + + pbias_1v8: pinmux_pbias_1v8 { + pinctrl-single,bits = < + 0x60 0x04400000 0x07e00000 /* pbias */ + >; + }; + + pbias_3v: pinmux_pbias_3v { + pinctrl-single,bits = < + 0x60 0x04600000 0x07e00000 /* pbias */ + >; + }; + + mmc1_init: pinmux_mmc1_init { + pinctrl-single,bits = < + 0x88 0xce000000 0xfe000000 /* control_mmc1 */ + >; + }; +}; + &omap4_pmx_core { pinctrl-names = "default"; pinctrl-0 = <@@ -381,6 +409,12 @@ }; &mmc1 { + pinctrl-names = "default", "mmc_init", "pbias_off", "pbias_1v8", "pbias_3v"; + pinctrl-0 = <>; + pinctrl-1 = <&mmc1_init>; + pinctrl-2 = <&pbias_off>; + pinctrl-3 = <&pbias_1v8>; + pinctrl-4 = <&pbias_3v>; vmmc-supply = <&vmmc>; bus-width = <8>; };arch/arm/boot/dts/omap4.dtsi +11
-0@@ -114,6 +114,17 @@ pinctrl-single,register-width = <16>; pinctrl-single,function-mask = <0x7fff>; }; + + omap4_padconf_global: pinmux@4a100600 { + compatible = "ti,omap4-padconf", "pinctrl-single"; + reg = <0x4a1005a0 0x170>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-single,bit-per-mux; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + omap4_pmx_wkup: pinmux@4a31e040 { compatible = "ti,omap4-padconf", "pinctrl-single"; reg = <0x4a31e040 0x0038>;Signature · 1 line
1.7.5.4
PATCH 7/13 mmc: omap_hsmmc: remove dt pbias workaround
In reply to Balaji T KWith pbias control support in place remove dt workaround for pbias
--- drivers/mmc/host/omap_hsmmc.c | 15 +-------------- 1 files changed, 1 insertions(+), 14 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -14
@@ -256,13 +256,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,*/ if (!host->vcc && !host->vcc_aux)return 0 ; -/* -* With DT, never turn OFF the regulator. This is because -* the pbias cell programming support is still missing when -* booting with Device tree -*/ -if (dev->of_node && !vdd) -return 0 ;if (mmc_slot (host).before_set_reg)mmc_slot (host).before_set_reg (dev, slot, power_on, vdd);
@@ -1528,13 +1521,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 when booting with device -* tree. -*/ - !host->dev->of_node) { + (ios->vdd ==DUAL_VOLT_OCR_BIT )) {/* * The mmc_select_voltage fn of the core does * not seem to set the power_mode to
Signature · 1 line
1.7.5.4
PATCH 8/13 Documentation: dt: mmc: omap hsmmc
In reply to Balaji T KUpdate ti-omap-hsmmc devicetree documentation with omap-hsmmc-control binding information for MMC1/MMC2 in different OMAP SoCs.
--- .../devicetree/bindings/mmc/ti-omap-hsmmc.txt | 34 ++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt +34 -0
@@ -31,3 +31,37 @@ Example: vmmc-supply = <&vmmc>; /* phandle to regulator node */ ti,non-removable; }; + +OMAP HSMMC CONTROL + +Required properties: +- compatible: Should be "ti,omap-hsmmc-control" +- reg : Address and length of the register set for the device. It contains + the address of "pbias" and/or "prog_io1" and/or "ctrl_mmc1" and/or "devconf1" + and/or "devconf0" +- reg-names: The names of the register addresses corresponding to the registers + filled in "reg". +- ti,ctrl-type: This is used to differentiate mmc1, mmc2 on different + omap SOCs like 2430, omap3, omap3630, omap4, omap5. + MMC1 pbias programming is same for omap2430 and omap3 but differs across + omap3,4,5. + Should be "0" for no control mmc module configuration + Should be "1" for MMC1 on OMAP2430 for MMC1 pbias, loopback + and speed mode configuration + Should be "2" for MMC2 on OMAP2430, OMAP3 for loopback clock configuration + Should be "3" for MMC1 on OMAP3430 for MMC1 pbias, loopback + and speed mode configuration + Should be "4" for MMC1 on OMAP3630 for MMC1 pbias, loopback + and speed mode configuration + Should be "5" for MMC1 on OMAP4 for MMC1 pbias configuration + Should be "6" for MMC2 on OMAP4 for loopback clock configuration + Should be "7" for MMC1 on OMAP5 for MMC1 pbias configuration + +Example: +omap_control_mmc1: omap-hsmmc-control@4A100600 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x4A100600 0x4>, + <0x4A100628 0x4>; + reg-names = "pbias", "mmc1"; + ctrl-type = <5>; +};
Signature · 1 line
1.7.5.4
PATCH 9/13 ARM: dts: omap3: Add omap control mmc data
In reply to Balaji T KAdd omap-hsmmc-control data to omap3.
Update with pbias and devconf0 register address for mmc1. Update with devconf1 register address for mmc2
--- arch/arm/boot/dts/omap3.dtsi | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3.dtsi +17 -0
@@ -218,15 +218,32 @@ ti,spi-num-cs = <1>; }; + omap_control_mmc1: omap-hsmmc-control@48002520 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x48002520 0x4>, + <0x48002274 0x4>; + reg-names = "pbias", "devconf0"; + ctrl-type = <3>; + }; + mmc1: mmc@4809c000 { compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc1"; ti,dual-volt; + ctrl-module = <&omap_control_mmc1>; + }; + + omap_control_mmc2: omap-hsmmc-control@480022D8 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x480022D8 0x4>; + reg-names = "devconf1"; + ctrl-type = <2>; }; mmc2: mmc@480b4000 { compatible = "ti,omap3-hsmmc"; ti,hwmods = "mmc2"; + ctrl-module = <&omap_control_mmc2>; }; mmc3: mmc@480ad000 {
Signature · 1 line
1.7.5.4
PATCH 10/13 ARM: dts: omap36xx: Add omap control mmc data
In reply to Balaji T KAdd omap-hsmmc-control data to omap630.
Update with pbias and prog_io1 register address.
--- arch/arm/boot/dts/omap36xx.dtsi | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap36xx.dtsi +7 -0
@@ -23,3 +23,10 @@ }; }; }; +&omap_control_mmc1 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x48002520 0x4>, + <0x48002448 0x4>; + reg-names = "pbias", "prog_io1"; + ctrl-type = <4>; +};
Signature · 1 line
1.7.5.4
PATCH 11/13 ARM: dts: omap4: Add omap control mmc data
In reply to Balaji T KAdd omap-hsmmc-control data to omap4.
Update with pbias register address for configuration of pbias dual volt i/o cells in mmc1 and control_mmc1 register address for i/o strength configuration
--- arch/arm/boot/dts/omap4.dtsi | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4.dtsi +9 -0
@@ -292,6 +292,14 @@ ti,spi-num-cs = <1>; }; + omap_control_mmc1: omap-hsmmc-control@4A100600 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x4A100600 0x4>, + <0x4A100628 0x4>; + reg-names = "pbias", "mmc1"; + ctrl-type = <5>; + }; + mmc1: mmc@4809c000 { compatible = "ti,omap4-hsmmc"; reg = <0x4809c000 0x400>;
@@ -299,6 +307,7 @@ ti,hwmods = "mmc1"; ti,dual-volt; ti,needs-special-reset; + ctrl-module = <&omap_control_mmc1>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
PATCH 12/13 ARM: dts: omap5: Add omap control mmc data
In reply to Balaji T KAdd omap-hsmmc-control data to omap5.
Update with pbias register address, used for pbias dual volt i/o cells in mmc1.
--- arch/arm/boot/dts/omap5.dtsi | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap5.dtsi +8 -0
@@ -289,6 +289,13 @@ clock-frequency = <48000000>; }; + omap_control_mmc1: omap-hsmmc-control@4a002E00 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x4a002E00 0x4>; + reg-names = "pbias"; + ctrl-type = <7>; + }; + mmc1: mmc@4809c000 { compatible = "ti,omap4-hsmmc"; reg = <0x4809c000 0x400>;
@@ -296,6 +303,7 @@ ti,hwmods = "mmc1"; ti,dual-volt; ti,needs-special-reset; + ctrl-module = <&omap_control_mmc1>; }; mmc2: mmc@480b4000 {
Signature · 1 line
1.7.5.4
PATCH 13/13 ARM: dts: am3517: add omap_control_mmc
In reply to Balaji T KAdd omap-hsmmc-control data to am3517 board.
Update with devconf1 register address, used for loopback clock configuration in mmc2.
--- arch/arm/boot/dts/am3517-evm.dts | 20 ++++++++++++++++++++ arch/arm/boot/dts/am3517_mt_ventoux.dts | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/boot/dts/am3517-evm.dts +20 -0
@@ -30,3 +30,23 @@ &i2c3 { clock-frequency = <400000>; }; + +&omap_control_mmc1 { + compatible = "ti,omap-hsmmc-control"; + ctrl-type = <0>; +}; + +omap_control_mmc2: omap-hsmmc-control@480022D8 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x480022D8 0x4>; + reg-names = "devconf1"; + ctrl-type = <2>; +}; + +&mmc1 { + bus-width = <8>; +}; + +&mmc2 { + status = "disabled"; +};
arch/arm/boot/dts/am3517_mt_ventoux.dts +20 -0
@@ -25,3 +25,23 @@ }; }; }; + +&omap_control_mmc1 { + compatible = "ti,omap-hsmmc-control"; + ctrl-type = <0>; +}; + +omap_control_mmc2: omap-hsmmc-control@480022D8 { + compatible = "ti,omap-hsmmc-control"; + reg = <0x480022D8 0x4>; + reg-names = "devconf1"; + ctrl-type = <2>; +}; + +&mmc1 { + bus-width = <8>; +}; + +&mmc2 { + status = "disabled"; +};
Signature · 1 line
1.7.5.4