aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap_hsmmc.c
diff options
context:
space:
mode:
authorAndreas Fenkart <afenkart@gmail.com>2014-11-08 09:33:14 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2014-11-26 08:30:55 -0500
commit326119c9923711d782e71e197429b1bab16125e1 (patch)
tree829c2379945a1e47d89955f47df9c2c6731464b9 /drivers/mmc/host/omap_hsmmc.c
parentdf206c313987bff595d2199f3bbf9b160e666b32 (diff)
mmc: omap_hsmmc: remove unnecessary omap_hsmmc_slot_data indirection
omap_hsmmc supports only one slot per controller, see OMAP_MMC_MAX_SLOTS. This unnecessary indirection leads to confusion in the omap_hsmmc driver. For example the card_detect callback is not installed by platform code but from the driver probe function. So it should be a field of omap_hsmmc_host. But since it is declared under the platform slot while the drivers struct omap_hsmmc_host has no slot abstraction, this looks like a bug, especially when not familiar that this driver only supports 1 slot anyway. Either we should add a slot abstraction to omap_hsmmc_host or remove it from the platform data struct. Removed since slot multiplexing is an un-implemented feature Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Andreas Fenkart <afenkart@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c175
1 files changed, 89 insertions, 86 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 03e8e9aa3756..291b9e125d46 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -155,7 +155,7 @@
155 * omap.c controller driver. Luckily this is not currently done on any known 155 * omap.c controller driver. Luckily this is not currently done on any known
156 * omap_hsmmc.c device. 156 * omap_hsmmc.c device.
157 */ 157 */
158#define mmc_slot(host) (host->pdata->slots[host->slot_id]) 158#define mmc_pdata(host) host->pdata
159 159
160/* 160/*
161 * MMC Host controller read/write API's 161 * MMC Host controller read/write API's
@@ -236,7 +236,7 @@ static int omap_hsmmc_card_detect(struct device *dev, int slot)
236 struct omap_hsmmc_platform_data *mmc = host->pdata; 236 struct omap_hsmmc_platform_data *mmc = host->pdata;
237 237
238 /* NOTE: assumes card detect signal is active-low */ 238 /* NOTE: assumes card detect signal is active-low */
239 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); 239 return !gpio_get_value_cansleep(mmc->switch_pin);
240} 240}
241 241
242static int omap_hsmmc_get_wp(struct device *dev, int slot) 242static int omap_hsmmc_get_wp(struct device *dev, int slot)
@@ -245,7 +245,7 @@ static int omap_hsmmc_get_wp(struct device *dev, int slot)
245 struct omap_hsmmc_platform_data *mmc = host->pdata; 245 struct omap_hsmmc_platform_data *mmc = host->pdata;
246 246
247 /* NOTE: assumes write protect signal is active-high */ 247 /* NOTE: assumes write protect signal is active-high */
248 return gpio_get_value_cansleep(mmc->slots[0].gpio_wp); 248 return gpio_get_value_cansleep(mmc->gpio_wp);
249} 249}
250 250
251static int omap_hsmmc_get_cover_state(struct device *dev, int slot) 251static int omap_hsmmc_get_cover_state(struct device *dev, int slot)
@@ -254,7 +254,7 @@ static int omap_hsmmc_get_cover_state(struct device *dev, int slot)
254 struct omap_hsmmc_platform_data *mmc = host->pdata; 254 struct omap_hsmmc_platform_data *mmc = host->pdata;
255 255
256 /* NOTE: assumes card detect signal is active-low */ 256 /* NOTE: assumes card detect signal is active-low */
257 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); 257 return !gpio_get_value_cansleep(mmc->switch_pin);
258} 258}
259 259
260#ifdef CONFIG_PM 260#ifdef CONFIG_PM
@@ -264,7 +264,7 @@ static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot)
264 struct omap_hsmmc_host *host = dev_get_drvdata(dev); 264 struct omap_hsmmc_host *host = dev_get_drvdata(dev);
265 struct omap_hsmmc_platform_data *mmc = host->pdata; 265 struct omap_hsmmc_platform_data *mmc = host->pdata;
266 266
267 disable_irq(mmc->slots[0].card_detect_irq); 267 disable_irq(mmc->card_detect_irq);
268 return 0; 268 return 0;
269} 269}
270 270
@@ -273,7 +273,7 @@ static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)
273 struct omap_hsmmc_host *host = dev_get_drvdata(dev); 273 struct omap_hsmmc_host *host = dev_get_drvdata(dev);
274 struct omap_hsmmc_platform_data *mmc = host->pdata; 274 struct omap_hsmmc_platform_data *mmc = host->pdata;
275 275
276 enable_irq(mmc->slots[0].card_detect_irq); 276 enable_irq(mmc->card_detect_irq);
277 return 0; 277 return 0;
278} 278}
279 279
@@ -300,8 +300,8 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
300 if (!host->vcc) 300 if (!host->vcc)
301 return 0; 301 return 0;
302 302
303 if (mmc_slot(host).before_set_reg) 303 if (mmc_pdata(host)->before_set_reg)
304 mmc_slot(host).before_set_reg(dev, slot, power_on, vdd); 304 mmc_pdata(host)->before_set_reg(dev, slot, power_on, vdd);
305 305
306 if (host->pbias) { 306 if (host->pbias) {
307 if (host->pbias_enabled == 1) { 307 if (host->pbias_enabled == 1) {
@@ -363,8 +363,8 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
363 } 363 }
364 } 364 }
365 365
366 if (mmc_slot(host).after_set_reg) 366 if (mmc_pdata(host)->after_set_reg)
367 mmc_slot(host).after_set_reg(dev, slot, power_on, vdd); 367 mmc_pdata(host)->after_set_reg(dev, slot, power_on, vdd);
368 368
369error_set_power: 369error_set_power:
370 return ret; 370 return ret;
@@ -383,18 +383,18 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
383 } else { 383 } else {
384 host->vcc = reg; 384 host->vcc = reg;
385 ocr_value = mmc_regulator_get_ocrmask(reg); 385 ocr_value = mmc_regulator_get_ocrmask(reg);
386 if (!mmc_slot(host).ocr_mask) { 386 if (!mmc_pdata(host)->ocr_mask) {
387 mmc_slot(host).ocr_mask = ocr_value; 387 mmc_pdata(host)->ocr_mask = ocr_value;
388 } else { 388 } else {
389 if (!(mmc_slot(host).ocr_mask & ocr_value)) { 389 if (!(mmc_pdata(host)->ocr_mask & ocr_value)) {
390 dev_err(host->dev, "ocrmask %x is not supported\n", 390 dev_err(host->dev, "ocrmask %x is not supported\n",
391 mmc_slot(host).ocr_mask); 391 mmc_pdata(host)->ocr_mask);
392 mmc_slot(host).ocr_mask = 0; 392 mmc_pdata(host)->ocr_mask = 0;
393 return -EINVAL; 393 return -EINVAL;
394 } 394 }
395 } 395 }
396 } 396 }
397 mmc_slot(host).set_power = omap_hsmmc_set_power; 397 mmc_pdata(host)->set_power = omap_hsmmc_set_power;
398 398
399 /* Allow an aux regulator */ 399 /* Allow an aux regulator */
400 reg = devm_regulator_get_optional(host->dev, "vmmc_aux"); 400 reg = devm_regulator_get_optional(host->dev, "vmmc_aux");
@@ -404,7 +404,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
404 host->pbias = IS_ERR(reg) ? NULL : reg; 404 host->pbias = IS_ERR(reg) ? NULL : reg;
405 405
406 /* For eMMC do not power off when not in sleep state */ 406 /* For eMMC do not power off when not in sleep state */
407 if (mmc_slot(host).no_regulator_off_init) 407 if (mmc_pdata(host)->no_regulator_off_init)
408 return 0; 408 return 0;
409 /* 409 /*
410 * To disable boot_on regulator, enable regulator 410 * To disable boot_on regulator, enable regulator
@@ -412,10 +412,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
412 */ 412 */
413 if ((host->vcc && regulator_is_enabled(host->vcc) > 0) || 413 if ((host->vcc && regulator_is_enabled(host->vcc) > 0) ||
414 (host->vcc_aux && regulator_is_enabled(host->vcc_aux))) { 414 (host->vcc_aux && regulator_is_enabled(host->vcc_aux))) {
415 int vdd = ffs(mmc_slot(host).ocr_mask) - 1; 415 int vdd = ffs(mmc_pdata(host)->ocr_mask) - 1;
416 416
417 mmc_slot(host).set_power(host->dev, host->slot_id, 1, vdd); 417 mmc_pdata(host)->set_power(host->dev, host->slot_id, 1, vdd);
418 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); 418 mmc_pdata(host)->set_power(host->dev, host->slot_id, 0, 0);
419 } 419 }
420 420
421 return 0; 421 return 0;
@@ -423,7 +423,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
423 423
424static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host) 424static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host)
425{ 425{
426 mmc_slot(host).set_power = NULL; 426 mmc_pdata(host)->set_power = NULL;
427} 427}
428 428
429static inline int omap_hsmmc_have_reg(void) 429static inline int omap_hsmmc_have_reg(void)
@@ -453,51 +453,53 @@ static int omap_hsmmc_gpio_init(struct omap_hsmmc_platform_data *pdata)
453{ 453{
454 int ret; 454 int ret;
455 455
456 if (gpio_is_valid(pdata->slots[0].switch_pin)) { 456 if (gpio_is_valid(pdata->switch_pin)) {
457 if (pdata->slots[0].cover) 457 if (pdata->cover)
458 pdata->slots[0].get_cover_state = 458 pdata->get_cover_state =
459 omap_hsmmc_get_cover_state; 459 omap_hsmmc_get_cover_state;
460 else 460 else
461 pdata->slots[0].card_detect = omap_hsmmc_card_detect; 461 pdata->card_detect = omap_hsmmc_card_detect;
462 pdata->slots[0].card_detect_irq = 462 pdata->card_detect_irq =
463 gpio_to_irq(pdata->slots[0].switch_pin); 463 gpio_to_irq(pdata->switch_pin);
464 ret = gpio_request(pdata->slots[0].switch_pin, "mmc_cd"); 464 ret = gpio_request(pdata->switch_pin, "mmc_cd");
465 if (ret) 465 if (ret)
466 return ret; 466 return ret;
467 ret = gpio_direction_input(pdata->slots[0].switch_pin); 467 ret = gpio_direction_input(pdata->switch_pin);
468 if (ret) 468 if (ret)
469 goto err_free_sp; 469 goto err_free_sp;
470 } else 470 } else {
471 pdata->slots[0].switch_pin = -EINVAL; 471 pdata->switch_pin = -EINVAL;
472 }
472 473
473 if (gpio_is_valid(pdata->slots[0].gpio_wp)) { 474 if (gpio_is_valid(pdata->gpio_wp)) {
474 pdata->slots[0].get_ro = omap_hsmmc_get_wp; 475 pdata->get_ro = omap_hsmmc_get_wp;
475 ret = gpio_request(pdata->slots[0].gpio_wp, "mmc_wp"); 476 ret = gpio_request(pdata->gpio_wp, "mmc_wp");
476 if (ret) 477 if (ret)
477 goto err_free_cd; 478 goto err_free_cd;
478 ret = gpio_direction_input(pdata->slots[0].gpio_wp); 479 ret = gpio_direction_input(pdata->gpio_wp);
479 if (ret) 480 if (ret)
480 goto err_free_wp; 481 goto err_free_wp;
481 } else 482 } else {
482 pdata->slots[0].gpio_wp = -EINVAL; 483 pdata->gpio_wp = -EINVAL;
484 }
483 485
484 return 0; 486 return 0;
485 487
486err_free_wp: 488err_free_wp:
487 gpio_free(pdata->slots[0].gpio_wp); 489 gpio_free(pdata->gpio_wp);
488err_free_cd: 490err_free_cd:
489 if (gpio_is_valid(pdata->slots[0].switch_pin)) 491 if (gpio_is_valid(pdata->switch_pin))
490err_free_sp: 492err_free_sp:
491 gpio_free(pdata->slots[0].switch_pin); 493 gpio_free(pdata->switch_pin);
492 return ret; 494 return ret;
493} 495}
494 496
495static void omap_hsmmc_gpio_free(struct omap_hsmmc_platform_data *pdata) 497static void omap_hsmmc_gpio_free(struct omap_hsmmc_platform_data *pdata)
496{ 498{
497 if (gpio_is_valid(pdata->slots[0].gpio_wp)) 499 if (gpio_is_valid(pdata->gpio_wp))
498 gpio_free(pdata->slots[0].gpio_wp); 500 gpio_free(pdata->gpio_wp);
499 if (gpio_is_valid(pdata->slots[0].switch_pin)) 501 if (gpio_is_valid(pdata->switch_pin))
500 gpio_free(pdata->slots[0].switch_pin); 502 gpio_free(pdata->switch_pin);
501} 503}
502 504
503/* 505/*
@@ -607,7 +609,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host *host)
607 * in capabilities register 609 * in capabilities register
608 * - MMC/SD clock coming out of controller > 25MHz 610 * - MMC/SD clock coming out of controller > 25MHz
609 */ 611 */
610 if ((mmc_slot(host).features & HSMMC_HAS_HSPE_SUPPORT) && 612 if ((mmc_pdata(host)->features & HSMMC_HAS_HSPE_SUPPORT) &&
611 (ios->timing != MMC_TIMING_MMC_DDR52) && 613 (ios->timing != MMC_TIMING_MMC_DDR52) &&
612 ((OMAP_HSMMC_READ(host->base, CAPA) & HSS) == HSS)) { 614 ((OMAP_HSMMC_READ(host->base, CAPA) & HSS) == HSS)) {
613 regval = OMAP_HSMMC_READ(host->base, HCTL); 615 regval = OMAP_HSMMC_READ(host->base, HCTL);
@@ -791,8 +793,8 @@ int omap_hsmmc_cover_is_closed(struct omap_hsmmc_host *host)
791{ 793{
792 int r = 1; 794 int r = 1;
793 795
794 if (mmc_slot(host).get_cover_state) 796 if (mmc_pdata(host)->get_cover_state)
795 r = mmc_slot(host).get_cover_state(host->dev, host->slot_id); 797 r = mmc_pdata(host)->get_cover_state(host->dev, host->slot_id);
796 return r; 798 return r;
797} 799}
798 800
@@ -816,7 +818,7 @@ omap_hsmmc_show_slot_name(struct device *dev, struct device_attribute *attr,
816 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); 818 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev);
817 struct omap_hsmmc_host *host = mmc_priv(mmc); 819 struct omap_hsmmc_host *host = mmc_priv(mmc);
818 820
819 return sprintf(buf, "%s\n", mmc_slot(host).name); 821 return sprintf(buf, "%s\n", mmc_pdata(host)->name);
820} 822}
821 823
822static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL); 824static DEVICE_ATTR(slot_name, S_IRUGO, omap_hsmmc_show_slot_name, NULL);
@@ -1061,7 +1063,7 @@ static inline void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host,
1061 * OMAP4 ES2 and greater has an updated reset logic. 1063 * OMAP4 ES2 and greater has an updated reset logic.
1062 * Monitor a 0->1 transition first 1064 * Monitor a 0->1 transition first
1063 */ 1065 */
1064 if (mmc_slot(host).features & HSMMC_HAS_UPDATED_RESET) { 1066 if (mmc_pdata(host)->features & HSMMC_HAS_UPDATED_RESET) {
1065 while ((!(OMAP_HSMMC_READ(host->base, SYSCTL) & bit)) 1067 while ((!(OMAP_HSMMC_READ(host->base, SYSCTL) & bit))
1066 && (i++ < limit)) 1068 && (i++ < limit))
1067 udelay(1); 1069 udelay(1);
@@ -1210,12 +1212,12 @@ static int omap_hsmmc_switch_opcond(struct omap_hsmmc_host *host, int vdd)
1210 clk_disable_unprepare(host->dbclk); 1212 clk_disable_unprepare(host->dbclk);
1211 1213
1212 /* Turn the power off */ 1214 /* Turn the power off */
1213 ret = mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); 1215 ret = mmc_pdata(host)->set_power(host->dev, host->slot_id, 0, 0);
1214 1216
1215 /* Turn the power ON with given VDD 1.8 or 3.0v */ 1217 /* Turn the power ON with given VDD 1.8 or 3.0v */
1216 if (!ret) 1218 if (!ret)
1217 ret = mmc_slot(host).set_power(host->dev, host->slot_id, 1, 1219 ret = mmc_pdata(host)->set_power(host->dev, host->slot_id, 1,
1218 vdd); 1220 vdd);
1219 pm_runtime_get_sync(host->dev); 1221 pm_runtime_get_sync(host->dev);
1220 if (host->dbclk) 1222 if (host->dbclk)
1221 clk_prepare_enable(host->dbclk); 1223 clk_prepare_enable(host->dbclk);
@@ -1259,11 +1261,11 @@ err:
1259/* Protect the card while the cover is open */ 1261/* Protect the card while the cover is open */
1260static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host) 1262static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host)
1261{ 1263{
1262 if (!mmc_slot(host).get_cover_state) 1264 if (!mmc_pdata(host)->get_cover_state)
1263 return; 1265 return;
1264 1266
1265 host->reqs_blocked = 0; 1267 host->reqs_blocked = 0;
1266 if (mmc_slot(host).get_cover_state(host->dev, host->slot_id)) { 1268 if (mmc_pdata(host)->get_cover_state(host->dev, host->slot_id)) {
1267 if (host->protect_card) { 1269 if (host->protect_card) {
1268 dev_info(host->dev, "%s: cover is closed, " 1270 dev_info(host->dev, "%s: cover is closed, "
1269 "card is now accessible\n", 1271 "card is now accessible\n",
@@ -1286,13 +1288,13 @@ static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host)
1286static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) 1288static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)
1287{ 1289{
1288 struct omap_hsmmc_host *host = dev_id; 1290 struct omap_hsmmc_host *host = dev_id;
1289 struct omap_hsmmc_slot_data *slot = &mmc_slot(host); 1291 struct omap_hsmmc_platform_data *pdata = host->pdata;
1290 int carddetect; 1292 int carddetect;
1291 1293
1292 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); 1294 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");
1293 1295
1294 if (slot->card_detect) 1296 if (pdata->card_detect)
1295 carddetect = slot->card_detect(host->dev, host->slot_id); 1297 carddetect = pdata->card_detect(host->dev, host->slot_id);
1296 else { 1298 else {
1297 omap_hsmmc_protect_card(host); 1299 omap_hsmmc_protect_card(host);
1298 carddetect = -ENOSYS; 1300 carddetect = -ENOSYS;
@@ -1618,12 +1620,12 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1618 if (ios->power_mode != host->power_mode) { 1620 if (ios->power_mode != host->power_mode) {
1619 switch (ios->power_mode) { 1621 switch (ios->power_mode) {
1620 case MMC_POWER_OFF: 1622 case MMC_POWER_OFF:
1621 mmc_slot(host).set_power(host->dev, host->slot_id, 1623 mmc_pdata(host)->set_power(host->dev, host->slot_id,
1622 0, 0); 1624 0, 0);
1623 break; 1625 break;
1624 case MMC_POWER_UP: 1626 case MMC_POWER_UP:
1625 mmc_slot(host).set_power(host->dev, host->slot_id, 1627 mmc_pdata(host)->set_power(host->dev, host->slot_id,
1626 1, ios->vdd); 1628 1, ios->vdd);
1627 break; 1629 break;
1628 case MMC_POWER_ON: 1630 case MMC_POWER_ON:
1629 do_send_init_stream = 1; 1631 do_send_init_stream = 1;
@@ -1668,26 +1670,26 @@ static int omap_hsmmc_get_cd(struct mmc_host *mmc)
1668{ 1670{
1669 struct omap_hsmmc_host *host = mmc_priv(mmc); 1671 struct omap_hsmmc_host *host = mmc_priv(mmc);
1670 1672
1671 if (!mmc_slot(host).card_detect) 1673 if (!mmc_pdata(host)->card_detect)
1672 return -ENOSYS; 1674 return -ENOSYS;
1673 return mmc_slot(host).card_detect(host->dev, host->slot_id); 1675 return mmc_pdata(host)->card_detect(host->dev, host->slot_id);
1674} 1676}
1675 1677
1676static int omap_hsmmc_get_ro(struct mmc_host *mmc) 1678static int omap_hsmmc_get_ro(struct mmc_host *mmc)
1677{ 1679{
1678 struct omap_hsmmc_host *host = mmc_priv(mmc); 1680 struct omap_hsmmc_host *host = mmc_priv(mmc);
1679 1681
1680 if (!mmc_slot(host).get_ro) 1682 if (!mmc_pdata(host)->get_ro)
1681 return -ENOSYS; 1683 return -ENOSYS;
1682 return mmc_slot(host).get_ro(host->dev, 0); 1684 return mmc_pdata(host)->get_ro(host->dev, 0);
1683} 1685}
1684 1686
1685static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card) 1687static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card)
1686{ 1688{
1687 struct omap_hsmmc_host *host = mmc_priv(mmc); 1689 struct omap_hsmmc_host *host = mmc_priv(mmc);
1688 1690
1689 if (mmc_slot(host).init_card) 1691 if (mmc_pdata(host)->init_card)
1690 mmc_slot(host).init_card(card); 1692 mmc_pdata(host)->init_card(card);
1691} 1693}
1692 1694
1693static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable) 1695static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
@@ -1978,33 +1980,33 @@ static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
1978 1980
1979 /* This driver only supports 1 slot */ 1981 /* This driver only supports 1 slot */
1980 pdata->nr_slots = 1; 1982 pdata->nr_slots = 1;
1981 pdata->slots[0].switch_pin = cd_gpio; 1983 pdata->switch_pin = cd_gpio;
1982 pdata->slots[0].gpio_wp = wp_gpio; 1984 pdata->gpio_wp = wp_gpio;
1983 1985
1984 if (of_find_property(np, "ti,non-removable", NULL)) { 1986 if (of_find_property(np, "ti,non-removable", NULL)) {
1985 pdata->slots[0].nonremovable = true; 1987 pdata->nonremovable = true;
1986 pdata->slots[0].no_regulator_off_init = true; 1988 pdata->no_regulator_off_init = true;
1987 } 1989 }
1988 of_property_read_u32(np, "bus-width", &bus_width); 1990 of_property_read_u32(np, "bus-width", &bus_width);
1989 if (bus_width == 4) 1991 if (bus_width == 4)
1990 pdata->slots[0].caps |= MMC_CAP_4_BIT_DATA; 1992 pdata->caps |= MMC_CAP_4_BIT_DATA;
1991 else if (bus_width == 8) 1993 else if (bus_width == 8)
1992 pdata->slots[0].caps |= MMC_CAP_8_BIT_DATA; 1994 pdata->caps |= MMC_CAP_8_BIT_DATA;
1993 1995
1994 if (of_find_property(np, "ti,needs-special-reset", NULL)) 1996 if (of_find_property(np, "ti,needs-special-reset", NULL))
1995 pdata->slots[0].features |= HSMMC_HAS_UPDATED_RESET; 1997 pdata->features |= HSMMC_HAS_UPDATED_RESET;
1996 1998
1997 if (!of_property_read_u32(np, "max-frequency", &max_freq)) 1999 if (!of_property_read_u32(np, "max-frequency", &max_freq))
1998 pdata->max_freq = max_freq; 2000 pdata->max_freq = max_freq;
1999 2001
2000 if (of_find_property(np, "ti,needs-special-hs-handling", NULL)) 2002 if (of_find_property(np, "ti,needs-special-hs-handling", NULL))
2001 pdata->slots[0].features |= HSMMC_HAS_HSPE_SUPPORT; 2003 pdata->features |= HSMMC_HAS_HSPE_SUPPORT;
2002 2004
2003 if (of_find_property(np, "keep-power-in-suspend", NULL)) 2005 if (of_find_property(np, "keep-power-in-suspend", NULL))
2004 pdata->slots[0].pm_caps |= MMC_PM_KEEP_POWER; 2006 pdata->pm_caps |= MMC_PM_KEEP_POWER;
2005 2007
2006 if (of_find_property(np, "enable-sdio-wakeup", NULL)) 2008 if (of_find_property(np, "enable-sdio-wakeup", NULL))
2007 pdata->slots[0].pm_caps |= MMC_PM_WAKE_SDIO_IRQ; 2009 pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
2008 2010
2009 return pdata; 2011 return pdata;
2010} 2012}
@@ -2144,14 +2146,14 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2144 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 2146 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
2145 MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_ERASE; 2147 MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_ERASE;
2146 2148
2147 mmc->caps |= mmc_slot(host).caps; 2149 mmc->caps |= mmc_pdata(host)->caps;
2148 if (mmc->caps & MMC_CAP_8_BIT_DATA) 2150 if (mmc->caps & MMC_CAP_8_BIT_DATA)
2149 mmc->caps |= MMC_CAP_4_BIT_DATA; 2151 mmc->caps |= MMC_CAP_4_BIT_DATA;
2150 2152
2151 if (mmc_slot(host).nonremovable) 2153 if (mmc_pdata(host)->nonremovable)
2152 mmc->caps |= MMC_CAP_NONREMOVABLE; 2154 mmc->caps |= MMC_CAP_NONREMOVABLE;
2153 2155
2154 mmc->pm_caps = mmc_slot(host).pm_caps; 2156 mmc->pm_caps = mmc_pdata(host)->pm_caps;
2155 2157
2156 omap_hsmmc_conf_bus_power(host); 2158 omap_hsmmc_conf_bus_power(host);
2157 2159
@@ -2204,19 +2206,19 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2204 goto err_irq; 2206 goto err_irq;
2205 } 2207 }
2206 2208
2207 if (omap_hsmmc_have_reg() && !mmc_slot(host).set_power) { 2209 if (omap_hsmmc_have_reg() && !mmc_pdata(host)->set_power) {
2208 ret = omap_hsmmc_reg_get(host); 2210 ret = omap_hsmmc_reg_get(host);
2209 if (ret) 2211 if (ret)
2210 goto err_irq; 2212 goto err_irq;
2211 host->use_reg = 1; 2213 host->use_reg = 1;
2212 } 2214 }
2213 2215
2214 mmc->ocr_avail = mmc_slot(host).ocr_mask; 2216 mmc->ocr_avail = mmc_pdata(host)->ocr_mask;
2215 2217
2216 /* Request IRQ for card detect */ 2218 /* Request IRQ for card detect */
2217 if ((mmc_slot(host).card_detect_irq)) { 2219 if ((mmc_pdata(host)->card_detect_irq)) {
2218 ret = devm_request_threaded_irq(&pdev->dev, 2220 ret = devm_request_threaded_irq(&pdev->dev,
2219 mmc_slot(host).card_detect_irq, 2221 mmc_pdata(host)->card_detect_irq,
2220 NULL, omap_hsmmc_detect, 2222 NULL, omap_hsmmc_detect,
2221 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 2223 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
2222 mmc_hostname(mmc), host); 2224 mmc_hostname(mmc), host);
@@ -2247,12 +2249,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2247 2249
2248 mmc_add_host(mmc); 2250 mmc_add_host(mmc);
2249 2251
2250 if (mmc_slot(host).name != NULL) { 2252 if (mmc_pdata(host)->name != NULL) {
2251 ret = device_create_file(&mmc->class_dev, &dev_attr_slot_name); 2253 ret = device_create_file(&mmc->class_dev, &dev_attr_slot_name);
2252 if (ret < 0) 2254 if (ret < 0)
2253 goto err_slot_name; 2255 goto err_slot_name;
2254 } 2256 }
2255 if (mmc_slot(host).card_detect_irq && mmc_slot(host).get_cover_state) { 2257 if (mmc_pdata(host)->card_detect_irq &&
2258 mmc_pdata(host)->get_cover_state) {
2256 ret = device_create_file(&mmc->class_dev, 2259 ret = device_create_file(&mmc->class_dev,
2257 &dev_attr_cover_switch); 2260 &dev_attr_cover_switch);
2258 if (ret < 0) 2261 if (ret < 0)