52 for (
int i = 0; i < max_iters; i++) {
108 data.
dest = (
char *)ext_csd;
113 rv = ctrlr->
send_cmd(ctrlr, &cmd, &data);
115 if (!rv &&
CONFIG(SD_MMC_TRACE)) {
120 for (i = 0; i < size; i++) {
138 (index << 16) | (
value << 8));
174 sdhc_debug(
"SDHCI switched MMC to high speed\n");
200 return ctrlr->
send_cmd(ctrlr, &cmd, &data);
212 for (index = 0; index < 40; index++) {
252 sdhc_debug(
"SDHCI switched MMC to 8-bit DDR\n");
296 sdhc_debug(
"SDHCI switched MMC to 8-bit SDR\n");
429 hc_erase_size = ext_csd[224] * 512 *
KiB;
476 sdhc_error(
"Failed to enable partition access\n");
492 unsigned int partition_number)
504 partition_config |= partition_number;
515 unsigned int partition_number)
517 static const char *
const partition_name[8] = {
528 if (partition_number >=
ARRAY_SIZE(partition_name))
530 return partition_name[partition_number];
#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size)
static int mmc_switch(struct storage_media *media, uint8_t index, uint8_t value)
int mmc_set_partition(struct storage_media *media, unsigned int partition_number)
static int mmc_send_op_cond_iter(struct storage_media *media, struct mmc_command *cmd, int use_arg)
static int mmc_bus_tuning(struct storage_media *media)
int mmc_update_capacity(struct storage_media *media)
int mmc_change_freq(struct storage_media *media)
static int mmc_select_hs200(struct storage_media *media)
int mmc_set_bus_width(struct storage_media *media)
const char * mmc_partition_name(struct storage_media *media, unsigned int partition_number)
static int mmc_select_hs(struct storage_media *media)
static int mmc_select_hs400(struct storage_media *media)
int mmc_complete_op_cond(struct storage_media *media)
int mmc_send_ext_csd(struct sd_mmc_ctrlr *ctrlr, unsigned char *ext_csd)
int mmc_send_op_cond(struct storage_media *media)
static int mmc_send_tuning_seq(struct sd_mmc_ctrlr *ctrlr, char *buffer)
static void mmc_recalculate_clock(struct storage_media *media)
#define MMC_INIT_TIMEOUT_US_MS
#define MMC_SWITCH_MODE_WRITE_BYTE
#define EXT_CSD_HC_ERASE_GRP_SIZE
#define MMC_PARTITION_GP1
#define MMC_PARTITION_GP4
#define EXT_CSD_GP_SIZE_MULT_GP1
#define EXT_CSD_BUS_WIDTH
#define EXT_CSD_DDR_BUS_WIDTH_8
#define EXT_CSD_PART_CONF
#define MMC_PARTITION_RPMB
#define MMC_PARTITION_BOOT_1
#define EXT_CSD_RPMB_SIZE_MULT
#define EXT_CSD_BOOT_SIZE_MULT
#define EXT_CSD_TIMING_HS
#define EXT_CSD_TRIM_MULT
#define EXT_CSD_BUS_WIDTH_8
#define EXT_CSD_TIMING_HS200
#define EXT_CSD_TIMING_HS400
#define EXT_CSD_GP_SIZE_MULT_GP3
#define EXT_CSD_HC_WP_GRP_SIZE
#define EXT_CSD_GP_SIZE_MULT_GP0
#define EXT_CSD_BUS_WIDTH_STROBE
#define EXT_CSD_HS_TIMING
#define EXT_CSD_GP_SIZE_MULT_GP2
#define EXT_CSD_PARTITION_ENABLE
#define MMC_PARTITION_BOOT_2
#define EXT_CSD_ERASE_GROUP_DEF
#define EXT_CSD_STROBE_SUPPORT
#define MMC_PARTITION_GP2
#define MMC_VERSION_UNKNOWN
#define EXT_CSD_CARD_TYPE
#define EXT_CSD_PARTITIONING_SUPPORT
#define MMC_PARTITION_GP3
#define MMC_PARTITION_USER
#define EXT_CSD_PART_ACCESS_MASK
static int stopwatch_expired(struct stopwatch *sw)
static void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
u8 buffer[C2P_BUFFER_MAXSIZE]
uint64_t sd_mmc_extract_uint32_bits(const uint32_t *array, int start, int count)
int sd_mmc_send_status(struct storage_media *media, ssize_t tries)
#define SET_TIMING(ctrlr, timing_value)
#define sdhc_debug(format...)
#define sd_mmc_trace(format...)
#define SET_BUS_WIDTH(ctrlr, width)
#define sdhc_error(format...)
#define SD_MMC_IO_RETRIES
#define sd_mmc_error(format...)
#define SET_CLOCK(ctrlr, clock_hz)
#define DRVR_CAP_HS200_TUNING
#define CMD_FLAG_IGNORE_INHIBIT
#define BUS_TIMING_MMC_HS400ES
#define BUS_TIMING_MMC_HS
#define CARD_UNUSABLE_ERR
#define DRVR_CAP_ENHANCED_STROBE
#define BUS_TIMING_MMC_HS400
#define MMC_CMD_AUTO_TUNING_SEQUENCE
#define MMC_CMD_SEND_OP_COND
#define MMC_CMD_SEND_EXT_CSD
#define BUS_TIMING_MMC_HS200
unsigned long long uint64_t
int memcmp(const void *s1, const void *s2, size_t n)
void(* tuning_start)(struct sd_mmc_ctrlr *ctrlr, int retune)
int(* send_cmd)(struct sd_mmc_ctrlr *ctrlr, struct mmc_command *cmd, struct mmc_data *data)
int(* is_tuning_complete)(struct sd_mmc_ctrlr *ctrlr, int *successful)