Skip to content

Commit e63201f

Browse files
linuswstorulf
authored andcommitted
mmc: omap_hsmmc: Delete platform data GPIO CD and WP
The OMAP HSMMC driver has some elaborate and hairy handling for passing GPIO card detect and write protect lines from a boardfile into the driver: the machine defines a struct omap2_hsmmc_info that is copied into struct omap_hsmmc_platform_data by omap_hsmmc_pdata_init() in arch/arm/mach-omap2/hsmmc.c. However the .gpio_cd and .gpio_wp fields are not copied from omap2_hsmmc_info to omap_hsmmc_platform_data by omap_hsmmc_pdata_init() so they remain unused. The only platform defining omap2_hsmmc_info also define both to -1, unused. It turn out there are no boardfiles passing any valid GPIO lines into the OMAP HSMMC driver at all. And since we are not going to add any more OMAP2 boardfiles, we can delete this card detect and write protect handling altogether. This seems to also fix a bug: the card detect callback mmc_gpio_get_cd() in the slot GPIO core needs to be called by drivers utilizing slot GPIO. It appears the the boardfile quirks were not doing this right, so this would only get called for boardfiles, i.e. since no boardfile was using it, never. Just assign mmc_gpio_get_cd() unconditionally to omap_hsmmc_ops .get_cd() so card detects from the device tree works. AFAICT card detect with GPIO lines assigned from mmc_of_parse() are not working at the moment, but that is no regression since it probably never worked. Cc: Tony Lindgren <tony@atomide.com> Cc: linux-omap@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 7838a8d commit e63201f

File tree

4 files changed

+1
-57
lines changed

4 files changed

+1
-57
lines changed

arch/arm/mach-omap2/hsmmc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ struct omap2_hsmmc_info {
1212
u8 mmc; /* controller 1/2/3 */
1313
u32 caps; /* 4/8 wires and any additional host
1414
* capabilities OR'd (ref. linux/mmc/host.h) */
15-
int gpio_cd; /* or -EINVAL */
16-
int gpio_wp; /* or -EINVAL */
1715
struct platform_device *pdev; /* mmc controller instance */
1816
/* init some special card */
1917
void (*init_card)(struct mmc_card *card);

arch/arm/mach-omap2/pdata-quirks.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ static struct omap2_hsmmc_info pandora_mmc3[] = {
363363
{
364364
.mmc = 3,
365365
.caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
366-
.gpio_cd = -EINVAL,
367-
.gpio_wp = -EINVAL,
368366
.init_card = pandora_wl1251_init_card,
369367
},
370368
{} /* Terminator */

drivers/mmc/host/omap_hsmmc.c

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@
3030
#include <linux/clk.h>
3131
#include <linux/of.h>
3232
#include <linux/of_irq.h>
33-
#include <linux/of_gpio.h>
3433
#include <linux/of_device.h>
3534
#include <linux/mmc/host.h>
3635
#include <linux/mmc/core.h>
3736
#include <linux/mmc/mmc.h>
3837
#include <linux/mmc/slot-gpio.h>
3938
#include <linux/io.h>
4039
#include <linux/irq.h>
41-
#include <linux/gpio.h>
4240
#include <linux/regulator/consumer.h>
4341
#include <linux/pinctrl/consumer.h>
4442
#include <linux/pm_runtime.h>
@@ -206,7 +204,6 @@ struct omap_hsmmc_host {
206204
#define HSMMC_SDIO_IRQ_ENABLED (1 << 1) /* SDIO irq enabled */
207205
struct omap_hsmmc_next next_data;
208206
struct omap_hsmmc_platform_data *pdata;
209-
int (*card_detect)(struct device *dev);
210207
};
211208

212209
struct omap_mmc_of_data {
@@ -216,13 +213,6 @@ struct omap_mmc_of_data {
216213

217214
static void omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host);
218215

219-
static int omap_hsmmc_card_detect(struct device *dev)
220-
{
221-
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
222-
223-
return mmc_gpio_get_cd(host->mmc);
224-
}
225-
226216
static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
227217
{
228218
int ret;
@@ -467,29 +457,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
467457
return 0;
468458
}
469459

470-
static int omap_hsmmc_gpio_init(struct mmc_host *mmc,
471-
struct omap_hsmmc_host *host,
472-
struct omap_hsmmc_platform_data *pdata)
473-
{
474-
int ret;
475-
476-
if (gpio_is_valid(pdata->gpio_cd)) {
477-
ret = mmc_gpio_request_cd(mmc, pdata->gpio_cd, 0);
478-
if (ret)
479-
return ret;
480-
481-
host->card_detect = omap_hsmmc_card_detect;
482-
}
483-
484-
if (gpio_is_valid(pdata->gpio_wp)) {
485-
ret = mmc_gpio_request_ro(mmc, pdata->gpio_wp);
486-
if (ret)
487-
return ret;
488-
}
489-
490-
return 0;
491-
}
492-
493460
/*
494461
* Start clock to the card
495462
*/
@@ -1539,15 +1506,6 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
15391506
omap_hsmmc_set_bus_mode(host);
15401507
}
15411508

1542-
static int omap_hsmmc_get_cd(struct mmc_host *mmc)
1543-
{
1544-
struct omap_hsmmc_host *host = mmc_priv(mmc);
1545-
1546-
if (!host->card_detect)
1547-
return -ENOSYS;
1548-
return host->card_detect(host->dev);
1549-
}
1550-
15511509
static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card)
15521510
{
15531511
struct omap_hsmmc_host *host = mmc_priv(mmc);
@@ -1686,7 +1644,7 @@ static struct mmc_host_ops omap_hsmmc_ops = {
16861644
.pre_req = omap_hsmmc_pre_req,
16871645
.request = omap_hsmmc_request,
16881646
.set_ios = omap_hsmmc_set_ios,
1689-
.get_cd = omap_hsmmc_get_cd,
1647+
.get_cd = mmc_gpio_get_cd,
16901648
.get_ro = mmc_gpio_get_ro,
16911649
.init_card = omap_hsmmc_init_card,
16921650
.enable_sdio_irq = omap_hsmmc_enable_sdio_irq,
@@ -1813,9 +1771,6 @@ static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
18131771
if (of_find_property(np, "ti,dual-volt", NULL))
18141772
pdata->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
18151773

1816-
pdata->gpio_cd = -EINVAL;
1817-
pdata->gpio_wp = -EINVAL;
1818-
18191774
if (of_find_property(np, "ti,non-removable", NULL)) {
18201775
pdata->nonremovable = true;
18211776
pdata->no_regulator_off_init = true;
@@ -1900,10 +1855,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
19001855
host->pbias_enabled = 0;
19011856
host->vqmmc_enabled = 0;
19021857

1903-
ret = omap_hsmmc_gpio_init(mmc, host, pdata);
1904-
if (ret)
1905-
goto err_gpio;
1906-
19071858
platform_set_drvdata(pdev, host);
19081859

19091860
if (pdev->dev.of_node)
@@ -2045,7 +1996,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
20451996
if (host->dbclk)
20461997
clk_disable_unprepare(host->dbclk);
20471998
err1:
2048-
err_gpio:
20491999
mmc_free_host(mmc);
20502000
err:
20512001
return ret;

include/linux/platform_data/hsmmc-omap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ struct omap_hsmmc_platform_data {
7070
/* string specifying a particular variant of hardware */
7171
char *version;
7272

73-
int gpio_cd; /* gpio (card detect) */
74-
int gpio_wp; /* gpio (write protect) */
7573
/* if we have special card, init it using this callback */
7674
void (*init_card)(struct mmc_card *card);
7775

0 commit comments

Comments
 (0)