Commit 06ec045feeea08993834e2f1d2d1e4ec52cdeff1

Authored by Jean-Jacques Hiblot
Committed by Jaehoon Chung
1 parent bb7b4ef370

mmc: dm: get the IO-line and main voltage regulators from the dts

Get a reference to the regulator devices from the dts and store them
in the struct mmc for later use.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Showing 2 changed files with 18 additions and 10 deletions Side-by-side Diff

... ... @@ -1618,21 +1618,25 @@
1618 1618 static int mmc_power_init(struct mmc *mmc)
1619 1619 {
1620 1620 #if CONFIG_IS_ENABLED(DM_MMC)
1621   -#if defined(CONFIG_DM_REGULATOR) && !defined(CONFIG_SPL_BUILD)
1622   - struct udevice *vmmc_supply;
  1621 +#if CONFIG_IS_ENABLED(DM_REGULATOR)
1623 1622 int ret;
1624 1623  
1625 1624 ret = device_get_supply_regulator(mmc->dev, "vmmc-supply",
1626   - &vmmc_supply);
1627   - if (ret) {
  1625 + &mmc->vmmc_supply);
  1626 + if (ret)
1628 1627 debug("%s: No vmmc supply\n", mmc->dev->name);
1629   - return 0;
1630   - }
1631 1628  
1632   - ret = regulator_set_enable(vmmc_supply, true);
1633   - if (ret) {
1634   - puts("Error enabling VMMC supply\n");
1635   - return ret;
  1629 + ret = device_get_supply_regulator(mmc->dev, "vqmmc-supply",
  1630 + &mmc->vqmmc_supply);
  1631 + if (ret)
  1632 + debug("%s: No vqmmc supply\n", mmc->dev->name);
  1633 +
  1634 + if (mmc->vmmc_supply) {
  1635 + ret = regulator_set_enable(mmc->vmmc_supply, true);
  1636 + if (ret) {
  1637 + puts("Error enabling VMMC supply\n");
  1638 + return ret;
  1639 + }
1636 1640 }
1637 1641 #endif
1638 1642 #else /* !CONFIG_DM_MMC */
... ... @@ -457,6 +457,10 @@
457 457 int ddr_mode;
458 458 #if CONFIG_IS_ENABLED(DM_MMC)
459 459 struct udevice *dev; /* Device for this MMC controller */
  460 +#if CONFIG_IS_ENABLED(DM_REGULATOR)
  461 + struct udevice *vmmc_supply; /* Main voltage regulator (Vcc)*/
  462 + struct udevice *vqmmc_supply; /* IO voltage regulator (Vccq)*/
  463 +#endif
460 464 #endif
461 465 };
462 466