Commit 05cbeb7c3612da8d4bafa82be05092450a500052
1 parent
7a61b0b58f
Exists in
smarc_8mq_lf_v2020.04
and in
20 other branches
dm: mmc: Don't call board_mmc_power_init() with driver model
We should not call out to board code from drivers. With driver model, mmc_power_init() already has code to use a named regulator, but the legacy code path remains. Update the code to make this clear. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 11 additions and 4 deletions Side-by-side Diff
drivers/mmc/mmc.c
| ... | ... | @@ -1608,17 +1608,17 @@ |
| 1608 | 1608 | return 0; |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | +#ifndef CONFIG_DM_MMC | |
| 1611 | 1612 | /* board-specific MMC power initializations. */ |
| 1612 | 1613 | __weak void board_mmc_power_init(void) |
| 1613 | 1614 | { |
| 1614 | 1615 | } |
| 1616 | +#endif | |
| 1615 | 1617 | |
| 1616 | 1618 | static int mmc_power_init(struct mmc *mmc) |
| 1617 | 1619 | { |
| 1618 | - board_mmc_power_init(); | |
| 1619 | - | |
| 1620 | -#if defined(CONFIG_DM_MMC) && defined(CONFIG_DM_REGULATOR) && \ | |
| 1621 | - !defined(CONFIG_SPL_BUILD) | |
| 1620 | +#if defined(CONFIG_DM_MMC) | |
| 1621 | +#if defined(CONFIG_DM_REGULATOR) && !defined(CONFIG_SPL_BUILD) | |
| 1622 | 1622 | struct udevice *vmmc_supply; |
| 1623 | 1623 | int ret; |
| 1624 | 1624 | |
| ... | ... | @@ -1634,6 +1634,13 @@ |
| 1634 | 1634 | puts("Error enabling VMMC supply\n"); |
| 1635 | 1635 | return ret; |
| 1636 | 1636 | } |
| 1637 | +#endif | |
| 1638 | +#else /* !CONFIG_DM_MMC */ | |
| 1639 | + /* | |
| 1640 | + * Driver model should use a regulator, as above, rather than calling | |
| 1641 | + * out to board code. | |
| 1642 | + */ | |
| 1643 | + board_mmc_power_init(); | |
| 1637 | 1644 | #endif |
| 1638 | 1645 | return 0; |
| 1639 | 1646 | } |