diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/fsl_esdhc.c | 1 | ||||
-rw-r--r-- | drivers/mmc/mmc.c | 35 | ||||
-rw-r--r-- | drivers/mmc/mmc_spi.c | 5 | ||||
-rw-r--r-- | drivers/mmc/omap_hsmmc.c | 1 |
4 files changed, 41 insertions, 1 deletions
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index d2355be6b01..ec953f07d71 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -525,6 +525,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) mmc->f_min = 400000; mmc->f_max = MIN(gd->sdhc_clk, 52000000); + mmc->b_max = 0; mmc_register(mmc); return 0; diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index f6d31f58488..1d089a7d11e 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -577,6 +577,18 @@ int mmc_change_freq(struct mmc *mmc) return 0; } +int mmc_switch_part(int dev_num, unsigned int part_num) +{ + struct mmc *mmc = find_mmc_device(dev_num); + + if (!mmc) + return -1; + + return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF, + (mmc->part_config & ~PART_ACCESS_MASK) + | (part_num & PART_ACCESS_MASK)); +} + int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp) { struct mmc_cmd cmd; @@ -899,6 +911,7 @@ int mmc_startup(struct mmc *mmc) return err; } + mmc->part_config = MMCPART_NOAVAILABLE; if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) { /* check ext_csd version and capacity */ err = mmc_send_ext_csd(mmc, ext_csd); @@ -907,6 +920,10 @@ int mmc_startup(struct mmc *mmc) ext_csd[214] << 16 | ext_csd[215] << 24; mmc->capacity *= 512; } + + /* store the partition info of emmc */ + if (ext_csd[160] & PART_SUPPORT) + mmc->part_config = ext_csd[179]; } if (IS_SD(mmc)) @@ -1048,6 +1065,9 @@ int mmc_init(struct mmc *mmc) { int err; + if (mmc->has_init) + return 0; + err = mmc->init(mmc); if (err) @@ -1062,6 +1082,9 @@ int mmc_init(struct mmc *mmc) if (err) return err; + /* The internal partition reset to user partition(0) at every CMD0*/ + mmc->part_num = 0; + /* Test for SD version 2 */ err = mmc_send_if_cond(mmc); @@ -1078,7 +1101,12 @@ int mmc_init(struct mmc *mmc) } } - return mmc_startup(mmc); + err = mmc_startup(mmc); + if (err) + mmc->has_init = 0; + else + mmc->has_init = 1; + return err; } /* @@ -1110,6 +1138,11 @@ void print_mmc_devices(char separator) printf("\n"); } +int get_mmc_num(void) +{ + return cur_dev_num; +} + int mmc_initialize(bd_t *bis) { INIT_LIST_HEAD (&mmc_devices); diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c index dc7574cbe55..49fb9e02a91 100644 --- a/drivers/mmc/mmc_spi.c +++ b/drivers/mmc/mmc_spi.c @@ -208,6 +208,11 @@ static int mmc_spi_request(struct mmc *mmc, struct mmc_cmd *cmd, cmd->response[0] = swab32(cmd->response[0]); debug("r32 %x\n", cmd->response[0]); break; + case MMC_CMD_SEND_STATUS: + spi_xfer(spi, 1 * 8, NULL, cmd->response, 0); + cmd->response[0] = (cmd->response[0] & 0xff) ? + MMC_STATUS_ERROR : MMC_STATUS_RDY_FOR_DATA; + break; } } else { debug("%s:data %x %x %x\n", __func__, diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 957b9877a01..ef12ecd5e36 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -30,6 +30,7 @@ #include <twl4030.h> #include <asm/io.h> #include <asm/arch/mmc_host_def.h> +#include <asm/arch/sys_proto.h> /* If we fail after 1 second wait, something is really bad */ #define MAX_RETRY_MS 1000 |