From: Lothar Waßmann Date: Fri, 21 Aug 2015 14:27:35 +0000 (+0200) Subject: mmc: read extcsd and check if requested change of RST_N_FUNCTION is possible X-Git-Tag: KARO-TX6-2015-09-18~4034^2^2~2 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=646ef54b3ad7968469f4c242f0ebc9498d5c5d6d mmc: read extcsd and check if requested change of RST_N_FUNCTION is possible --- diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 0c2fe351ba..c0bab82714 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1881,6 +1881,19 @@ int mmc_set_part_conf(struct mmc *mmc, u8 ack, u8 part_num, u8 access) */ 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); }