![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <inttypes.h>
#include <string.h>
#include <console/console.h>
#include <commonlib/sd_mmc_ctrlr.h>
#include <device/mmio.h>
#include <timer.h>
#include "mmc.h"
Go to the source code of this file.
Macros | |
#define | AM335X_TIMEOUT_MSEC 1000 |
#define | SYSCONFIG_SOFTRESET (0x1 << 1) |
#define | SYSSTATUS_RESETDONE (0x01 << 0) |
#define | CON_INIT (0x1 << 1) |
#define | CMD_INDEX(x) (x << 24) |
#define | CMD_RSP_TYPE_NO_RESP (0x0 << 16) |
#define | CMD_RSP_TYPE_136B (0x1 << 16) |
#define | CMD_RSP_TYPE_48B (0x2 << 16) |
#define | CMD_RSP_TYPE_48B_BUSY (0x3 << 16) |
#define | CMD_DP_DATA (0x1 << 21) |
#define | CMD_DDIR_READ (0x1 << 4) |
#define | HCTL_DTW_1BIT (0x0 << 1) |
#define | HCTL_SDBP (0x1 << 8) |
#define | HCTL_SDVS_VS30 (0x6 << 9) |
#define | SYSCTL_ICE (0x1 << 0) |
#define | SYSCTL_ICS (0x1 << 1) |
#define | SYSCTL_CEN (0x1 << 2) |
#define | SYSCTL_DTO_15 (0xE << 16) |
#define | STAT_ERRI (0x01 << 15) |
#define | STAT_ERROR_MASK (0xff << 15 | 0x3 << 24 | 0x03 << 28) |
#define | STAT_CC (0x1 << 0) |
#define | IE_CC (0x1 << 0) |
#define | IE_TC (0x1 << 1) |
#define | IE_BRR (0x1 << 5) |
#define | IE_ERRORS (0xff << 15 | 0x3 << 24 | 0x03 << 28) |
#define | CAPA_VS18 (0x01 << 26) |
#define | CAPA_VS30 (0x01 << 25) |
Functions | |
static int | am335x_wait_for_reg (const void *addr, uint32_t mask, unsigned long timeout) |
static int | am335x_mmc_init (struct am335x_mmc *mmc) |
static int | am335x_send_cmd (struct sd_mmc_ctrlr *ctrlr, struct mmc_command *cmd, struct mmc_data *data) |
static void | set_ios (struct sd_mmc_ctrlr *ctrlr) |
int | am335x_mmc_init_storage (struct am335x_mmc_host *mmc_host) |
|
static |
Definition at line 67 of file mmc.c.
References AM335X_TIMEOUT_MSEC, am335x_wait_for_reg(), am335x_mmc::capa, CAPA_VS30, clrbits32, am335x_mmc::cmd, am335x_mmc::con, CON_INIT, am335x_mmc::hctl, HCTL_DTW_1BIT, HCTL_SDBP, HCTL_SDVS_VS30, am335x_mmc::ie, IE_CC, IE_ERRORS, IE_TC, read32(), setbits32, am335x_mmc::stat, STAT_CC, am335x_mmc::sysconfig, SYSCONFIG_SOFTRESET, am335x_mmc::sysctl, SYSCTL_CEN, SYSCTL_DTO_15, SYSCTL_ICE, SYSCTL_ICS, am335x_mmc::sysstatus, SYSSTATUS_RESETDONE, and write32().
Referenced by am335x_mmc_init_storage().
int am335x_mmc_init_storage | ( | struct am335x_mmc_host * | mmc_host | ) |
Definition at line 258 of file mmc.c.
References am335x_mmc_init(), am335x_send_cmd(), sd_mmc_ctrlr::b_max, BIOS_ERR, sd_mmc_ctrlr::bus_hz, sd_mmc_ctrlr::bus_width, sd_mmc_ctrlr::f_max, sd_mmc_ctrlr::f_min, memset(), MMC_VDD_30_31, printk, am335x_mmc_host::reg, am335x_mmc_host::sd_mmc_ctrlr, sd_mmc_ctrlr::send_cmd, set_ios(), sd_mmc_ctrlr::set_ios, and sd_mmc_ctrlr::voltages.
Referenced by boot_device_init().
|
static |
Definition at line 108 of file mmc.c.
References AM335X_TIMEOUT_MSEC, am335x_wait_for_reg(), am335x_mmc::arg, BIOS_ERR, BIOS_WARNING, am335x_mmc::blk, CARD_RSP_NONE, CARD_RSP_R1, CARD_RSP_R1b, CARD_RSP_R2, CARD_RSP_R3, clrbits32, am335x_mmc::cmd, CMD_DDIR_READ, CMD_DP_DATA, CMD_INDEX, CMD_RSP_TYPE_136B, CMD_RSP_TYPE_48B, CMD_RSP_TYPE_48B_BUSY, CMD_RSP_TYPE_NO_RESP, container_of, count, am335x_mmc::data, DATA_FLAG_READ, DATA_FLAG_WRITE, am335x_mmc::ie, IE_BRR, IE_CC, IE_TC, MMC_CMD_SET_BLOCKLEN, NULL, printk, read32(), am335x_mmc_host::reg, am335x_mmc::rsp10, am335x_mmc::rsp32, am335x_mmc::rsp54, am335x_mmc::rsp76, setbits32, am335x_mmc::stat, STAT_ERRI, STAT_ERROR_MASK, and write32().
Referenced by am335x_mmc_init_storage().
Definition at line 48 of file mmc.c.
References addr, BIOS_DEBUG, mask, mono_time_add_msecs(), mono_time_after(), printk, read32(), and timer_monotonic_get().
Referenced by am335x_mmc_init(), am335x_send_cmd(), and set_ios().
|
static |
Definition at line 222 of file mmc.c.
References AM335X_TIMEOUT_MSEC, am335x_wait_for_reg(), sd_mmc_ctrlr::bus_hz, clrbits32, container_of, sd_mmc_ctrlr::f_max, sd_mmc_ctrlr::f_min, MAX, MIN, read32(), am335x_mmc_host::reg, sd_mmc_ctrlr::request_hz, am335x_mmc_host::sd_clock_hz, setbits32, am335x_mmc::sysctl, SYSCTL_CEN, SYSCTL_ICS, and write32().
Referenced by am335x_mmc_init_storage().