coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
sd_mmc.h File Reference
#include <commonlib/sd_mmc_ctrlr.h>
#include <commonlib/storage.h>
#include <stddef.h>
#include <console/console.h>
Include dependency graph for sd_mmc.h:
This graph shows which files directly or indirectly include this file:

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)
 

Functions

int sd_mmc_enter_standby (struct storage_media *media)
 
uint64_t sd_mmc_extract_uint32_bits (const uint32_t *array, int start, int count)
 
int sd_mmc_go_idle (struct storage_media *media)
 
int sd_mmc_send_status (struct storage_media *media, ssize_t tries)
 
int sd_mmc_set_blocklen (struct sd_mmc_ctrlr *ctrlr, int len)
 
int mmc_change_freq (struct storage_media *media)
 
int mmc_complete_op_cond (struct storage_media *media)
 
const char * mmc_partition_name (struct storage_media *media, unsigned int partition_number)
 
int mmc_send_ext_csd (struct sd_mmc_ctrlr *ctrlr, unsigned char *ext_csd)
 
int mmc_send_op_cond (struct storage_media *media)
 
int mmc_set_bus_width (struct storage_media *media)
 
int mmc_set_partition (struct storage_media *media, unsigned int partition_number)
 
int mmc_update_capacity (struct storage_media *media)
 
int sd_change_freq (struct storage_media *media)
 
const char * sd_partition_name (struct storage_media *media, unsigned int partition_number)
 
int sd_send_if_cond (struct storage_media *media)
 
int sd_send_op_cond (struct storage_media *media)
 
int sd_set_bus_width (struct storage_media *media)
 
int sd_set_partition (struct storage_media *media, unsigned int partition_number)
 

Macro Definition Documentation

◆ IS_SD

#define IS_SD (   x)    (x->version & SD_VERSION_SD)

Definition at line 13 of file sd_mmc.h.

◆ sd_mmc_debug

#define sd_mmc_debug (   format...)
Value:
do { \
if (CONFIG(SD_MMC_DEBUG)) \
printk(BIOS_DEBUG, format); \
} while (0)
@ CONFIG
Definition: dsi_common.h:201
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128

Definition at line 77 of file sd_mmc.h.

◆ sd_mmc_error

#define sd_mmc_error (   format...)    printk(BIOS_ERR, format)

Definition at line 87 of file sd_mmc.h.

◆ SD_MMC_IO_RETRIES

#define SD_MMC_IO_RETRIES   1000

Definition at line 11 of file sd_mmc.h.

◆ sd_mmc_trace

#define sd_mmc_trace (   format...)
Value:
do { \
if (CONFIG(SD_MMC_TRACE)) \
printk(BIOS_DEBUG, format); \
} while (0)

Definition at line 82 of file sd_mmc.h.

◆ sdhc_debug

#define sdhc_debug (   format...)
Value:
do { \
if (CONFIG(SDHC_DEBUG)) \
printk(BIOS_DEBUG, format); \
} while (0)

Definition at line 64 of file sd_mmc.h.

◆ sdhc_error

#define sdhc_error (   format...)    printk(BIOS_ERR, format)

Definition at line 74 of file sd_mmc.h.

◆ sdhc_trace

#define sdhc_trace (   format...)
Value:
do { \
if (CONFIG(SDHC_TRACE)) \
printk(BIOS_DEBUG, format); \
} while (0)

Definition at line 69 of file sd_mmc.h.

◆ SET_BUS_WIDTH

#define SET_BUS_WIDTH (   ctrlr,
  width 
)
Value:
do { \
ctrlr->bus_width = width; \
ctrlr->set_ios(ctrlr); \
} while (0)
static int width
Definition: bochs.c:42

Definition at line 15 of file sd_mmc.h.

◆ SET_CLOCK

#define SET_CLOCK (   ctrlr,
  clock_hz 
)
Value:
do { \
ctrlr->request_hz = clock_hz; \
ctrlr->set_ios(ctrlr); \
} while (0)

Definition at line 21 of file sd_mmc.h.

◆ SET_TIMING

#define SET_TIMING (   ctrlr,
  timing_value 
)
Value:
do { \
ctrlr->timing = timing_value; \
ctrlr->set_ios(ctrlr); \
} while (0)

Definition at line 27 of file sd_mmc.h.

Function Documentation

◆ mmc_change_freq()

◆ mmc_complete_op_cond()

int mmc_complete_op_cond ( struct storage_media media)

◆ mmc_partition_name()

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().

Here is the caller graph for this function:

◆ mmc_send_ext_csd()

◆ mmc_send_op_cond()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_set_bus_width()

int mmc_set_bus_width ( struct storage_media media)

◆ mmc_set_partition()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmc_update_capacity()

◆ sd_change_freq()

◆ sd_mmc_enter_standby()

◆ sd_mmc_extract_uint32_bits()

uint64_t sd_mmc_extract_uint32_bits ( const uint32_t array,
int  start,
int  count 
)

Definition at line 17 of file sd_mmc.c.

References count, and value.

Referenced by mmc_update_capacity(), sd_mmc_enter_standby(), and storage_startup().

Here is the caller graph for this function:

◆ sd_mmc_go_idle()

int sd_mmc_go_idle ( struct storage_media media)

◆ sd_mmc_send_status()

◆ sd_mmc_set_blocklen()

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().

Here is the caller graph for this function:

◆ sd_partition_name()

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().

Here is the caller graph for this function:

◆ sd_send_if_cond()

◆ sd_send_op_cond()

◆ sd_set_bus_width()

◆ sd_set_partition()

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().

Here is the caller graph for this function: