This commit is contained in:
Tom Rini 2016-10-28 09:08:13 -04:00
commit ec1eaad065
4 changed files with 39 additions and 17 deletions

View File

@ -116,13 +116,7 @@ int get_mmc_num(void)
int mmc_get_next_devnum(void) int mmc_get_next_devnum(void)
{ {
int ret; return blk_find_max_devnum(IF_TYPE_MMC);
ret = blk_find_max_devnum(IF_TYPE_MMC);
if (ret < 0)
return ret;
return ret;
} }
struct blk_desc *mmc_get_blk_desc(struct mmc *mmc) struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
@ -243,7 +237,6 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
struct udevice *mmc_dev = dev_get_parent(bdev); struct udevice *mmc_dev = dev_get_parent(bdev);
struct mmc *mmc = mmc_get_mmc_dev(mmc_dev); struct mmc *mmc = mmc_get_mmc_dev(mmc_dev);
struct blk_desc *desc = dev_get_uclass_platdata(bdev); struct blk_desc *desc = dev_get_uclass_platdata(bdev);
int ret;
if (desc->hwpart == hwpart) if (desc->hwpart == hwpart)
return 0; return 0;
@ -251,11 +244,7 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
if (mmc->part_config == MMCPART_NOAVAILABLE) if (mmc->part_config == MMCPART_NOAVAILABLE)
return -EMEDIUMTYPE; return -EMEDIUMTYPE;
ret = mmc_switch_part(mmc, hwpart); return mmc_switch_part(mmc, hwpart);
if (ret)
return ret;
return 0;
} }
static const struct blk_ops mmc_blk_ops = { static const struct blk_ops mmc_blk_ops = {

View File

@ -15,6 +15,7 @@
#include <errno.h> #include <errno.h>
#include <mmc.h> #include <mmc.h>
#include <part.h> #include <part.h>
#include <power/regulator.h>
#include <malloc.h> #include <malloc.h>
#include <memalign.h> #include <memalign.h>
#include <linux/list.h> #include <linux/list.h>
@ -1582,6 +1583,31 @@ __weak void board_mmc_power_init(void)
{ {
} }
static int mmc_power_init(struct mmc *mmc)
{
board_mmc_power_init();
#if defined(CONFIG_DM_MMC) && defined(CONFIG_DM_REGULATOR) && \
!defined(CONFIG_SPL_BUILD)
struct udevice *vmmc_supply;
int ret;
ret = device_get_supply_regulator(mmc->dev, "vmmc-supply",
&vmmc_supply);
if (ret) {
debug("%s: No vmmc supply\n", mmc->dev->name);
return 0;
}
ret = regulator_set_enable(vmmc_supply, true);
if (ret) {
puts("Error enabling VMMC supply\n");
return ret;
}
#endif
return 0;
}
int mmc_start_init(struct mmc *mmc) int mmc_start_init(struct mmc *mmc)
{ {
bool no_card; bool no_card;
@ -1606,7 +1632,9 @@ int mmc_start_init(struct mmc *mmc)
#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT #ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
mmc_adapter_card_type_ident(); mmc_adapter_card_type_ident();
#endif #endif
board_mmc_power_init(); err = mmc_power_init(mmc);
if (err)
return err;
#ifdef CONFIG_DM_MMC_OPS #ifdef CONFIG_DM_MMC_OPS
/* The device has already been probed ready for use */ /* The device has already been probed ready for use */

View File

@ -242,6 +242,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
sdhci_writel(host, cmd->cmdarg, SDHCI_ARGUMENT); sdhci_writel(host, cmd->cmdarg, SDHCI_ARGUMENT);
#ifdef CONFIG_MMC_SDMA #ifdef CONFIG_MMC_SDMA
trans_bytes = ALIGN(trans_bytes, CONFIG_SYS_CACHELINE_SIZE);
flush_cache(start_addr, trans_bytes); flush_cache(start_addr, trans_bytes);
#endif #endif
sdhci_writew(host, SDHCI_MAKE_CMD(cmd->cmdidx, flags), SDHCI_COMMAND); sdhci_writew(host, SDHCI_MAKE_CMD(cmd->cmdidx, flags), SDHCI_COMMAND);
@ -607,9 +608,11 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
* In case of Host Controller v3.00, find out whether clock * In case of Host Controller v3.00, find out whether clock
* multiplier is supported. * multiplier is supported.
*/ */
caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >> caps_1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
SDHCI_CLOCK_MUL_SHIFT; host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >>
SDHCI_CLOCK_MUL_SHIFT;
}
return 0; return 0;
} }

View File

@ -151,7 +151,9 @@ U_BOOT_DRIVER(socfpga_dwmmc_drv) = {
.id = UCLASS_MMC, .id = UCLASS_MMC,
.of_match = socfpga_dwmmc_ids, .of_match = socfpga_dwmmc_ids,
.ofdata_to_platdata = socfpga_dwmmc_ofdata_to_platdata, .ofdata_to_platdata = socfpga_dwmmc_ofdata_to_platdata,
.ops = &dm_dwmci_ops,
.bind = socfpga_dwmmc_bind, .bind = socfpga_dwmmc_bind,
.probe = socfpga_dwmmc_probe, .probe = socfpga_dwmmc_probe,
.priv_auto_alloc_size = sizeof(struct dwmci_socfpga_priv_data), .priv_auto_alloc_size = sizeof(struct dwmci_socfpga_priv_data),
.platdata_auto_alloc_size = sizeof(struct socfpga_dwmci_plat),
}; };