![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <commonlib/sd_mmc_ctrlr.h>
#include <commonlib/storage.h>
#include <stddef.h>
#include <console/console.h>
Go to the source code of this file.
Macros | |
#define | SD_MMC_IO_RETRIES 1000 |
#define | IS_SD(x) (x->version & SD_VERSION_SD) |
#define | SET_BUS_WIDTH(ctrlr, width) |
#define | SET_CLOCK(ctrlr, clock_hz) |
#define | SET_TIMING(ctrlr, timing_value) |
#define | sdhc_debug(format...) |
#define | sdhc_trace(format...) |
#define | sdhc_error(format...) printk(BIOS_ERR, format) |
#define | sd_mmc_debug(format...) |
#define | sd_mmc_trace(format...) |
#define | sd_mmc_error(format...) printk(BIOS_ERR, format) |
#define sd_mmc_debug | ( | format... | ) |
#define sd_mmc_trace | ( | format... | ) |
#define sdhc_debug | ( | format... | ) |
#define sdhc_trace | ( | format... | ) |
#define SET_BUS_WIDTH | ( | ctrlr, | |
width | |||
) |
#define SET_CLOCK | ( | ctrlr, | |
clock_hz | |||
) |
#define SET_TIMING | ( | ctrlr, | |
timing_value | |||
) |
int mmc_change_freq | ( | struct storage_media * | media | ) |
Definition at line 309 of file mmc.c.
References ALLOC_CACHE_ALIGN_BUFFER, sd_mmc_ctrlr::caps, storage_media::caps, storage_media::ctrlr, DRVR_CAP_ENHANCED_STROBE, DRVR_CAP_HS200, DRVR_CAP_HS400, EXT_CSD_CARD_TYPE, EXT_CSD_STROBE_SUPPORT, media, MMC_HS400, MMC_HS_200MHZ, mmc_select_hs(), mmc_select_hs200(), mmc_select_hs400(), mmc_send_ext_csd(), MMC_VERSION_4, and storage_media::version.
Referenced by storage_startup().
int mmc_complete_op_cond | ( | struct storage_media * | media | ) |
Definition at line 65 of file mmc.c.
References CARD_UNUSABLE_ERR, storage_media::high_capacity, media, MMC_INIT_TIMEOUT_US_MS, mmc_send_op_cond_iter(), MMC_VERSION_UNKNOWN, storage_media::ocr, OCR_BUSY, OCR_HCS, storage_media::op_cond_response, storage_media::rca, mmc_command::response, stopwatch_expired(), stopwatch_init_msecs_expire(), udelay(), and storage_media::version.
Referenced by sd_mmc_enter_standby().
const char* mmc_partition_name | ( | struct storage_media * | media, |
unsigned int | partition_number | ||
) |
Definition at line 514 of file mmc.c.
References ARRAY_SIZE.
Referenced by storage_partition_name().
int mmc_send_ext_csd | ( | struct sd_mmc_ctrlr * | ctrlr, |
unsigned char * | ext_csd | ||
) |
Definition at line 96 of file mmc.c.
References mmc_data::blocks, mmc_data::blocksize, CARD_RSP_R1, mmc_command::cmdarg, mmc_command::cmdidx, CONFIG, DATA_FLAG_READ, mmc_data::dest, mmc_command::flags, mmc_data::flags, MMC_CMD_SEND_EXT_CSD, mmc_command::resp_type, sd_mmc_trace, and sd_mmc_ctrlr::send_cmd.
Referenced by mmc_change_freq(), mmc_set_bus_width(), and mmc_update_capacity().
int mmc_send_op_cond | ( | struct storage_media * | media | ) |
Definition at line 45 of file mmc.c.
References CARD_IN_PROGRESS, mmc_command::cmdarg, media, mmc_send_op_cond_iter(), OCR_BUSY, and storage_media::op_cond_response.
Referenced by early_mmc_wake_hw(), mtk_emmc_early_init(), and sd_mmc_enter_standby().
int mmc_set_bus_width | ( | struct storage_media * | media | ) |
Definition at line 341 of file mmc.c.
References ALLOC_CACHE_ALIGN_BUFFER, storage_media::caps, storage_media::ctrlr, DRVR_CAP_HS200, DRVR_CAP_HS400, EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_8, EXT_CSD_ERASE_GROUP_DEF, EXT_CSD_HC_ERASE_GRP_SIZE, EXT_CSD_PARTITIONING_SUPPORT, EXT_CSD_REV, EXT_CSD_SEC_CNT, EXT_CSD_SIZE, media, memcmp(), mmc_send_ext_csd(), mmc_switch(), SET_BUS_WIDTH, and width.
Referenced by storage_startup().
int mmc_set_partition | ( | struct storage_media * | media, |
unsigned int | partition_number | ||
) |
Definition at line 491 of file mmc.c.
References storage_media::capacity, EXT_CSD_PART_ACCESS_MASK, EXT_CSD_PART_CONF, media, MMC_PARTITION_GP4, mmc_switch(), and storage_media::partition_config.
Referenced by storage_set_partition().
int mmc_update_capacity | ( | struct storage_media * | media | ) |
Definition at line 388 of file mmc.c.
References ALLOC_CACHE_ALIGN_BUFFER, storage_media::capacity, storage_media::csd, storage_media::ctrlr, storage_media::erase_blocks, EXT_CSD_BOOT_SIZE_MULT, EXT_CSD_ERASE_GROUP_DEF, EXT_CSD_GP_SIZE_MULT_GP0, EXT_CSD_GP_SIZE_MULT_GP1, EXT_CSD_GP_SIZE_MULT_GP2, EXT_CSD_GP_SIZE_MULT_GP3, EXT_CSD_HC_WP_GRP_SIZE, EXT_CSD_PART_ACCESS_MASK, EXT_CSD_PART_CONF, EXT_CSD_PARTITION_ENABLE, EXT_CSD_REV, EXT_CSD_RPMB_SIZE_MULT, EXT_CSD_SEC_CNT, EXT_CSD_SIZE, EXT_CSD_TRIM_MULT, KiB, media, MMC_PARTITION_BOOT_1, MMC_PARTITION_BOOT_2, MMC_PARTITION_GP1, MMC_PARTITION_GP2, MMC_PARTITION_GP3, MMC_PARTITION_GP4, MMC_PARTITION_RPMB, MMC_PARTITION_USER, mmc_send_ext_csd(), mmc_switch(), MMC_VERSION_4, storage_media::partition_config, sd_mmc_extract_uint32_bits(), sdhc_error, storage_media::trim_mult, storage_media::version, and storage_media::write_bl_len.
Referenced by storage_startup().
int sd_change_freq | ( | struct storage_media * | media | ) |
Definition at line 120 of file sd.c.
References ALLOC_CACHE_ALIGN_BUFFER, be32toh(), mmc_data::blocks, mmc_data::blocksize, sd_mmc_ctrlr::bus_hz, BUS_TIMING_SD_HS, sd_mmc_ctrlr::caps, storage_media::caps, CARD_RSP_R1, mmc_command::cmdarg, mmc_command::cmdidx, storage_media::ctrlr, DATA_FLAG_READ, delay(), mmc_data::dest, DRVR_CAP_4BIT, DRVR_CAP_HS, DRVR_CAP_HS52, mmc_command::flags, mmc_data::flags, media, MMC_CMD_APP_CMD, ntohl, NULL, storage_media::rca, mmc_command::resp_type, storage_media::scr, SD_CMD_APP_SEND_SCR, SD_DATA_4BIT, SD_HIGHSPEED_BUSY, SD_HIGHSPEED_SUPPORTED, sd_mmc_error, sd_recalculate_clock(), sd_switch(), SD_SWITCH_CHECK, SD_SWITCH_SWITCH, SD_VERSION_1_0, SD_VERSION_1_10, SD_VERSION_2, sd_mmc_ctrlr::send_cmd, SET_TIMING, udelay(), and storage_media::version.
Referenced by storage_startup().
int sd_mmc_enter_standby | ( | struct storage_media * | media | ) |
Definition at line 139 of file sd_mmc.c.
References CARD_IN_PROGRESS, CARD_RSP_R2, CARD_RSP_R6, CARD_TIMEOUT, CARD_UNUSABLE_ERR, storage_media::cid, mmc_command::cmdarg, mmc_command::cmdidx, CONFIG, storage_media::csd, storage_media::ctrlr, mmc_command::flags, IS_SD, media, memcpy(), MMC_CMD_ALL_SEND_CID, MMC_CMD_SEND_CSD, mmc_complete_op_cond(), mmc_send_op_cond(), MMC_VERSION_1_2, MMC_VERSION_1_4, MMC_VERSION_2_2, MMC_VERSION_3, MMC_VERSION_4, MMC_VERSION_UNKNOWN, NULL, storage_media::rca, storage_media::read_bl_len, mmc_command::resp_type, mmc_command::response, SD_CMD_SEND_RELATIVE_ADDR, sd_mmc_calculate_transfer_speed(), sd_mmc_debug, sd_mmc_error, sd_mmc_extract_uint32_bits(), sd_mmc_go_idle(), SD_MMC_IO_RETRIES, sd_mmc_send_status(), sd_send_if_cond(), sd_send_op_cond(), sd_mmc_ctrlr::send_cmd, SET_BUS_WIDTH, SET_CLOCK, storage_media::tran_speed, storage_media::version, version, and storage_media::write_bl_len.
Referenced by storage_setup_media().
Definition at line 17 of file sd_mmc.c.
Referenced by mmc_update_capacity(), sd_mmc_enter_standby(), and storage_startup().
int sd_mmc_go_idle | ( | struct storage_media * | media | ) |
Definition at line 68 of file sd_mmc.c.
References CARD_RSP_NONE, mmc_command::cmdarg, mmc_command::cmdidx, storage_media::ctrlr, mmc_command::flags, mdelay(), sd_mmc_ctrlr::mdelay_after_cmd0, sd_mmc_ctrlr::mdelay_before_cmd0, media, MMC_CMD_GO_IDLE_STATE, NULL, mmc_command::resp_type, and sd_mmc_ctrlr::send_cmd.
Referenced by early_mmc_wake_hw(), mtk_emmc_early_init(), and sd_mmc_enter_standby().
int sd_mmc_send_status | ( | struct storage_media * | media, |
ssize_t | tries | ||
) |
Definition at line 94 of file sd_mmc.c.
References CARD_COMM_ERR, CARD_RSP_R1, CARD_TIMEOUT, mmc_command::cmdarg, mmc_command::cmdidx, storage_media::ctrlr, mmc_command::flags, media, MMC_CMD_SEND_STATUS, MMC_STATUS_CURR_STATE, MMC_STATUS_MASK, MMC_STATUS_RDY_FOR_DATA, NULL, storage_media::rca, mmc_command::resp_type, mmc_command::response, sd_mmc_error, sd_mmc_trace, sd_mmc_ctrlr::send_cmd, and udelay().
Referenced by mmc_select_hs(), mmc_select_hs400(), mmc_switch(), sd_mmc_enter_standby(), storage_block_erase(), storage_read(), and storage_write().
int sd_mmc_set_blocklen | ( | struct sd_mmc_ctrlr * | ctrlr, |
int | len | ||
) |
Definition at line 128 of file sd_mmc.c.
References CARD_RSP_R1, mmc_command::cmdarg, mmc_command::cmdidx, mmc_command::flags, MMC_CMD_SET_BLOCKLEN, NULL, mmc_command::resp_type, and sd_mmc_ctrlr::send_cmd.
Referenced by storage_block_setup().
const char* sd_partition_name | ( | struct storage_media * | media, |
unsigned int | partition_number | ||
) |
Definition at line 280 of file sd.c.
Referenced by storage_partition_name().
int sd_send_if_cond | ( | struct storage_media * | media | ) |
Definition at line 15 of file sd.c.
References CARD_RSP_R7, CARD_UNUSABLE_ERR, mmc_command::cmdarg, mmc_command::cmdidx, storage_media::ctrlr, mmc_command::flags, media, NULL, mmc_command::resp_type, mmc_command::response, SD_CMD_SEND_IF_COND, SD_VERSION_2, sd_mmc_ctrlr::send_cmd, storage_media::version, and sd_mmc_ctrlr::voltages.
Referenced by sd_mmc_enter_standby().
int sd_send_op_cond | ( | struct storage_media * | media | ) |
Definition at line 35 of file sd.c.
References CARD_RSP_R1, CARD_RSP_R3, CARD_UNUSABLE_ERR, mmc_command::cmdarg, mmc_command::cmdidx, storage_media::ctrlr, mmc_command::flags, storage_media::high_capacity, media, MMC_CMD_APP_CMD, NULL, storage_media::ocr, OCR_BUSY, OCR_HCS, storage_media::rca, mmc_command::resp_type, mmc_command::response, SD_CMD_APP_SEND_OP_COND, SD_MMC_IO_RETRIES, SD_VERSION_1_0, SD_VERSION_2, sd_mmc_ctrlr::send_cmd, udelay(), storage_media::version, and sd_mmc_ctrlr::voltages.
Referenced by sd_mmc_enter_standby().
int sd_set_bus_width | ( | struct storage_media * | media | ) |
Definition at line 239 of file sd.c.
References storage_media::caps, CARD_RSP_R1, mmc_command::cmdarg, mmc_command::cmdidx, storage_media::ctrlr, DRVR_CAP_4BIT, mmc_command::flags, media, MMC_CMD_APP_CMD, NULL, storage_media::rca, mmc_command::resp_type, SD_CMD_APP_SET_BUS_WIDTH, sd_mmc_ctrlr::send_cmd, and SET_BUS_WIDTH.
Referenced by storage_startup().
int sd_set_partition | ( | struct storage_media * | media, |
unsigned int | partition_number | ||
) |
Definition at line 268 of file sd.c.
References media, and storage_media::partition_config.
Referenced by storage_set_partition().