Commit 707ac1ad17c09a952b366709d98a5f454cfab909

Authored by Simon Glass
Committed by Pantelis Antoniou
1 parent ebe78bb993

tegra: mmc: Set the removable flag correctly

If the mmc device is non-removable (as indicated by the device tree), set
the flag so that users of the device know.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

Showing 1 changed file with 8 additions and 4 deletions Side-by-side Diff

drivers/mmc/tegra_mmc.c
... ... @@ -528,7 +528,7 @@
528 528 .getcd = tegra_mmc_getcd,
529 529 };
530 530  
531   -static int do_mmc_init(int dev_index)
  531 +static int do_mmc_init(int dev_index, bool removable)
532 532 {
533 533 struct mmc_host *host;
534 534 struct mmc *mmc;
... ... @@ -573,6 +573,7 @@
573 573 host->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
574 574  
575 575 mmc = mmc_create(&host->cfg, host);
  576 + mmc->block_dev.removable = removable;
576 577 if (mmc == NULL)
577 578 return -1;
578 579  
... ... @@ -586,7 +587,8 @@
586 587 * @param node Device index (0-3)
587 588 * @param host Structure to fill in (reg, width, mmc_id)
588 589 */
589   -static int mmc_get_config(const void *blob, int node, struct mmc_host *host)
  590 +static int mmc_get_config(const void *blob, int node, struct mmc_host *host,
  591 + bool *removablep)
590 592 {
591 593 debug("%s: node = %d\n", __func__, node);
592 594  
... ... @@ -619,6 +621,7 @@
619 621 GPIOD_IS_IN);
620 622 gpio_request_by_name_nodev(blob, node, "power-gpios", 0,
621 623 &host->pwr_gpio, GPIOD_IS_OUT);
  624 + *removablep = !fdtdec_get_bool(blob, node, "non-removable");
622 625  
623 626 debug("%s: found controller at %p, width = %d, periph_id = %d\n",
624 627 __func__, host->reg, host->width, host->mmc_id);
... ... @@ -636,6 +639,7 @@
636 639 static int process_nodes(const void *blob, int node_list[], int count)
637 640 {
638 641 struct mmc_host *host;
  642 + bool removable;
639 643 int i, node;
640 644  
641 645 debug("%s: count = %d\n", __func__, count);
642 646  
... ... @@ -649,11 +653,11 @@
649 653 host = &mmc_host[i];
650 654 host->id = i;
651 655  
652   - if (mmc_get_config(blob, node, host)) {
  656 + if (mmc_get_config(blob, node, host, &removable)) {
653 657 printf("%s: failed to decode dev %d\n", __func__, i);
654 658 return -1;
655 659 }
656   - do_mmc_init(i);
  660 + do_mmc_init(i, removable);
657 661 }
658 662 return 0;
659 663 }