static struct list_head mmc_devices;
static int cur_dev_num = -1;
+static int mmc_dev_count;
__weak int board_mmc_getwp(struct mmc *mmc)
{
INIT_LIST_HEAD(&mmc->link);
list_add_tail(&mmc->link, &mmc_devices);
+ mmc_dev_count++;
return mmc;
}
return cur_dev_num;
}
+int get_mmc_dev_count(void)
+{
+ return mmc_dev_count;
+}
+
void mmc_set_preinit(struct mmc *mmc, int preinit)
{
mmc->preinit = preinit;
*/
int mmc_set_rst_n_function(struct mmc *mmc, u8 enable)
{
+ int ret;
+ ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
+
+ ret = mmc_send_ext_csd(mmc, ext_csd);
+ if (ret)
+ return ret;
+
+ if (ext_csd[EXT_CSD_RST_N_FUNCTION] != 0 &&
+ ext_csd[EXT_CSD_RST_N_FUNCTION] != enable) {
+ printf("RST_N_FUNCTION is already set to %u; cannot change to %u\n",
+ ext_csd[EXT_CSD_RST_N_FUNCTION], enable);
+ return -EINVAL;
+ }
return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_RST_N_FUNCTION,
enable);
}