coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
sdhci.h File Reference
Include dependency graph for sdhci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SDHCI_DMA_ADDRESS   0x00
 
#define SDHCI_BLOCK_SIZE   0x04
 
#define SDHCI_MAKE_BLKSZ(dma, blksz)   (((dma & 0x7) << 12) | (blksz & 0xFFF))
 
#define SDHCI_BLOCK_COUNT   0x06
 
#define SDHCI_ARGUMENT   0x08
 
#define SDHCI_TRANSFER_MODE   0x0C
 
#define SDHCI_TRNS_DMA   0x01
 
#define SDHCI_TRNS_BLK_CNT_EN   0x02
 
#define SDHCI_TRNS_ACMD12   0x04
 
#define SDHCI_TRNS_READ   0x10
 
#define SDHCI_TRNS_MULTI   0x20
 
#define SDHCI_COMMAND   0x0E
 
#define SDHCI_CMD_RESP_MASK   0x03
 
#define SDHCI_CMD_CRC   0x08
 
#define SDHCI_CMD_INDEX   0x10
 
#define SDHCI_CMD_DATA   0x20
 
#define SDHCI_CMD_ABORTCMD   0xC0
 
#define SDHCI_CMD_RESP_NONE   0x00
 
#define SDHCI_CMD_RESP_LONG   0x01
 
#define SDHCI_CMD_RESP_SHORT   0x02
 
#define SDHCI_CMD_RESP_SHORT_BUSY   0x03
 
#define SDHCI_MAKE_CMD(c, f)   (((c & 0xff) << 8) | (f & 0xff))
 
#define SDHCI_GET_CMD(c)   ((c>>8) & 0x3f)
 
#define SDHCI_RESPONSE   0x10
 
#define SDHCI_BUFFER   0x20
 
#define SDHCI_PRESENT_STATE   0x24
 
#define SDHCI_CMD_INHIBIT   0x00000001
 
#define SDHCI_DATA_INHIBIT   0x00000002
 
#define SDHCI_DOING_WRITE   0x00000100
 
#define SDHCI_DOING_READ   0x00000200
 
#define SDHCI_SPACE_AVAILABLE   0x00000400
 
#define SDHCI_DATA_AVAILABLE   0x00000800
 
#define SDHCI_CARD_PRESENT   0x00010000
 
#define SDHCI_CARD_STATE_STABLE   0x00020000
 
#define SDHCI_CARD_DETECT_PIN_LEVEL   0x00040000
 
#define SDHCI_WRITE_PROTECT   0x00080000
 
#define SDHCI_HOST_CONTROL   0x28
 
#define SDHCI_CTRL_LED   0x01
 
#define SDHCI_CTRL_4BITBUS   0x02
 
#define SDHCI_CTRL_HISPD   0x04
 
#define SDHCI_CTRL_DMA_MASK   0x18
 
#define SDHCI_CTRL_SDMA   0x00
 
#define SDHCI_CTRL_ADMA1   0x08
 
#define SDHCI_CTRL_ADMA32   0x10
 
#define SDHCI_CTRL_ADMA64   0x18
 
#define SDHCI_CTRL_8BITBUS   0x20
 
#define SDHCI_CTRL_CD_TEST_INS   0x40
 
#define SDHCI_CTRL_CD_TEST   0x80
 
#define SDHCI_POWER_CONTROL   0x29
 
#define SDHCI_POWER_ON   0x01
 
#define SDHCI_POWER_180   0x0A
 
#define SDHCI_POWER_300   0x0C
 
#define SDHCI_POWER_330   0x0E
 
#define SDHCI_BLOCK_GAP_CONTROL   0x2A
 
#define SDHCI_WAKE_UP_CONTROL   0x2B
 
#define SDHCI_WAKE_ON_INT   0x01
 
#define SDHCI_WAKE_ON_INSERT   0x02
 
#define SDHCI_WAKE_ON_REMOVE   0x04
 
#define SDHCI_CLOCK_CONTROL   0x2C
 
#define SDHCI_DIVIDER_SHIFT   8
 
#define SDHCI_DIVIDER_HI_SHIFT   6
 
#define SDHCI_DIV_MASK   0xFF
 
#define SDHCI_DIV_MASK_LEN   8
 
#define SDHCI_DIV_HI_MASK   0x300
 
#define SDHCI_CLOCK_CARD_EN   0x0004
 
#define SDHCI_CLOCK_INT_STABLE   0x0002
 
#define SDHCI_CLOCK_INT_EN   0x0001
 
#define SDHCI_TIMEOUT_CONTROL   0x2E
 
#define SDHCI_SOFTWARE_RESET   0x2F
 
#define SDHCI_RESET_ALL   0x01
 
#define SDHCI_RESET_CMD   0x02
 
#define SDHCI_RESET_DATA   0x04
 
#define SDHCI_INT_STATUS   0x30
 
#define SDHCI_INT_ENABLE   0x34
 
#define SDHCI_SIGNAL_ENABLE   0x38
 
#define SDHCI_INT_RESPONSE   0x00000001
 
#define SDHCI_INT_DATA_END   0x00000002
 
#define SDHCI_INT_DMA_END   0x00000008
 
#define SDHCI_INT_SPACE_AVAIL   0x00000010
 
#define SDHCI_INT_DATA_AVAIL   0x00000020
 
#define SDHCI_INT_CARD_INSERT   0x00000040
 
#define SDHCI_INT_CARD_REMOVE   0x00000080
 
#define SDHCI_INT_CARD_INT   0x00000100
 
#define SDHCI_INT_ERROR   0x00008000
 
#define SDHCI_INT_TIMEOUT   0x00010000
 
#define SDHCI_INT_CRC   0x00020000
 
#define SDHCI_INT_END_BIT   0x00040000
 
#define SDHCI_INT_INDEX   0x00080000
 
#define SDHCI_INT_DATA_TIMEOUT   0x00100000
 
#define SDHCI_INT_DATA_CRC   0x00200000
 
#define SDHCI_INT_DATA_END_BIT   0x00400000
 
#define SDHCI_INT_BUS_POWER   0x00800000
 
#define SDHCI_INT_ACMD12ERR   0x01000000
 
#define SDHCI_INT_ADMA_ERROR   0x02000000
 
#define SDHCI_INT_NORMAL_MASK   0x00007FFF
 
#define SDHCI_INT_ERROR_MASK   0xFFFF8000
 
#define SDHCI_INT_CMD_MASK
 
#define SDHCI_INT_DATA_MASK
 
#define SDHCI_INT_ALL_MASK   ((unsigned int)-1)
 
#define SDHCI_ACMD12_ERR   0x3C
 
#define SDHCI_HOST_CONTROL2   0x3E
 
#define SDHCI_CTRL_UHS_MASK   0x0007
 
#define SDHCI_CTRL_UHS_SDR12   0x0000
 
#define SDHCI_CTRL_UHS_SDR25   0x0001
 
#define SDHCI_CTRL_UHS_SDR50   0x0002
 
#define SDHCI_CTRL_UHS_SDR104   0x0003
 
#define SDHCI_CTRL_UHS_DDR50   0x0004
 
#define SDHCI_CTRL_HS400   0x0005 /* reserved value in SDIO spec */
 
#define SDHCI_CTRL_VDD_180   0x0008
 
#define SDHCI_CTRL_DRV_TYPE_MASK   0x0030
 
#define SDHCI_CTRL_DRV_TYPE_B   0x0000
 
#define SDHCI_CTRL_DRV_TYPE_A   0x0010
 
#define SDHCI_CTRL_DRV_TYPE_C   0x0020
 
#define SDHCI_CTRL_DRV_TYPE_D   0x0030
 
#define SDHCI_CTRL_EXEC_TUNING   0x0040
 
#define SDHCI_CTRL_TUNED_CLK   0x0080
 
#define SDHCI_CTRL_PRESET_VAL_ENABLE   0x8000
 
#define SDHCI_CAPABILITIES   0x40
 
#define SDHCI_TIMEOUT_CLK_MASK   0x0000003F
 
#define SDHCI_TIMEOUT_CLK_SHIFT   0
 
#define SDHCI_TIMEOUT_CLK_UNIT   0x00000080
 
#define SDHCI_CLOCK_BASE_MASK   0x00003F00
 
#define SDHCI_CLOCK_V3_BASE_MASK   0x0000FF00
 
#define SDHCI_CLOCK_BASE_SHIFT   8
 
#define SDHCI_MAX_BLOCK_MASK   0x00030000
 
#define SDHCI_MAX_BLOCK_SHIFT   16
 
#define SDHCI_CAN_DO_8BIT   0x00040000
 
#define SDHCI_CAN_DO_ADMA2   0x00080000
 
#define SDHCI_CAN_DO_ADMA1   0x00100000
 
#define SDHCI_CAN_DO_HISPD   0x00200000
 
#define SDHCI_CAN_DO_SDMA   0x00400000
 
#define SDHCI_CAN_VDD_330   0x01000000
 
#define SDHCI_CAN_VDD_300   0x02000000
 
#define SDHCI_CAN_VDD_180   0x04000000
 
#define SDHCI_CAN_64BIT   0x10000000
 
#define SDHCI_CAPABILITIES_1   0x44
 
#define SDHCI_SUPPORT_HS400   0x80000000
 
#define SDHCI_MAX_CURRENT   0x48
 
#define SDHCI_SET_ACMD12_ERROR   0x50
 
#define SDHCI_SET_INT_ERROR   0x52
 
#define SDHCI_ADMA_ERROR   0x54
 
#define SDHCI_ADMA_ADDRESS   0x58
 
#define SDHCI_SLOT_INT_STATUS   0xFC
 
#define SDHCI_HOST_VERSION   0xFE
 
#define SDHCI_VENDOR_VER_MASK   0xFF00
 
#define SDHCI_VENDOR_VER_SHIFT   8
 
#define SDHCI_SPEC_VER_MASK   0x00FF
 
#define SDHCI_SPEC_VER_SHIFT   0
 
#define SDHCI_SPEC_100   0
 
#define SDHCI_SPEC_200   1
 
#define SDHCI_SPEC_300   2
 
#define SDHCI_MAX_DIV_SPEC_200   256
 
#define SDHCI_MAX_DIV_SPEC_300   2046
 
#define SDHCI_DEFAULT_BOUNDARY_SIZE   (512 * 1024)
 
#define SDHCI_DEFAULT_BOUNDARY_ARG   (7)
 
#define SDHCI_MAX_PER_DESCRIPTOR   0x10000
 
#define SDHCI_ADMA_VALID   (1 << 0)
 
#define SDHCI_ADMA_END   (1 << 1)
 
#define SDHCI_ADMA_INT   (1 << 2)
 
#define SDHCI_ACT_NOP   (0 << 4)
 
#define SDHCI_ACT_TRAN   (2 << 4)
 
#define SDHCI_ACT_LINK   (3 << 4)
 

Functions

static void sdhci_writel (struct sdhci_ctrlr *sdhci_ctrlr, u32 val, int reg)
 
static void sdhci_writew (struct sdhci_ctrlr *sdhci_ctrlr, u16 val, int reg)
 
static void sdhci_writeb (struct sdhci_ctrlr *sdhci_ctrlr, u8 val, int reg)
 
static u32 sdhci_readl (struct sdhci_ctrlr *sdhci_ctrlr, int reg)
 
static u16 sdhci_readw (struct sdhci_ctrlr *sdhci_ctrlr, int reg)
 
static u8 sdhci_readb (struct sdhci_ctrlr *sdhci_ctrlr, int reg)
 
void sdhci_reset (struct sdhci_ctrlr *sdhci_ctrlr, u8 mask)
 
void sdhci_cmd_done (struct sdhci_ctrlr *sdhci_ctrlr, struct mmc_command *cmd)
 
int sdhci_setup_adma (struct sdhci_ctrlr *sdhci_ctrlr, struct mmc_data *data)
 
int sdhci_complete_adma (struct sdhci_ctrlr *sdhci_ctrlr, struct mmc_command *cmd)
 

Macro Definition Documentation

◆ SDHCI_ACMD12_ERR

#define SDHCI_ACMD12_ERR   0x3C

Definition at line 137 of file sdhci.h.

◆ SDHCI_ACT_LINK

#define SDHCI_ACT_LINK   (3 << 4)

Definition at line 226 of file sdhci.h.

◆ SDHCI_ACT_NOP

#define SDHCI_ACT_NOP   (0 << 4)

Definition at line 224 of file sdhci.h.

◆ SDHCI_ACT_TRAN

#define SDHCI_ACT_TRAN   (2 << 4)

Definition at line 225 of file sdhci.h.

◆ SDHCI_ADMA_ADDRESS

#define SDHCI_ADMA_ADDRESS   0x58

Definition at line 190 of file sdhci.h.

◆ SDHCI_ADMA_END

#define SDHCI_ADMA_END   (1 << 1)

Definition at line 222 of file sdhci.h.

◆ SDHCI_ADMA_ERROR

#define SDHCI_ADMA_ERROR   0x54

Definition at line 186 of file sdhci.h.

◆ SDHCI_ADMA_INT

#define SDHCI_ADMA_INT   (1 << 2)

Definition at line 223 of file sdhci.h.

◆ SDHCI_ADMA_VALID

#define SDHCI_ADMA_VALID   (1 << 0)

Definition at line 221 of file sdhci.h.

◆ SDHCI_ARGUMENT

#define SDHCI_ARGUMENT   0x08

Definition at line 19 of file sdhci.h.

◆ SDHCI_BLOCK_COUNT

#define SDHCI_BLOCK_COUNT   0x06

Definition at line 17 of file sdhci.h.

◆ SDHCI_BLOCK_GAP_CONTROL

#define SDHCI_BLOCK_GAP_CONTROL   0x2A

Definition at line 78 of file sdhci.h.

◆ SDHCI_BLOCK_SIZE

#define SDHCI_BLOCK_SIZE   0x04

Definition at line 14 of file sdhci.h.

◆ SDHCI_BUFFER

#define SDHCI_BUFFER   0x20

Definition at line 45 of file sdhci.h.

◆ SDHCI_CAN_64BIT

#define SDHCI_CAN_64BIT   0x10000000

Definition at line 174 of file sdhci.h.

◆ SDHCI_CAN_DO_8BIT

#define SDHCI_CAN_DO_8BIT   0x00040000

Definition at line 166 of file sdhci.h.

◆ SDHCI_CAN_DO_ADMA1

#define SDHCI_CAN_DO_ADMA1   0x00100000

Definition at line 168 of file sdhci.h.

◆ SDHCI_CAN_DO_ADMA2

#define SDHCI_CAN_DO_ADMA2   0x00080000

Definition at line 167 of file sdhci.h.

◆ SDHCI_CAN_DO_HISPD

#define SDHCI_CAN_DO_HISPD   0x00200000

Definition at line 169 of file sdhci.h.

◆ SDHCI_CAN_DO_SDMA

#define SDHCI_CAN_DO_SDMA   0x00400000

Definition at line 170 of file sdhci.h.

◆ SDHCI_CAN_VDD_180

#define SDHCI_CAN_VDD_180   0x04000000

Definition at line 173 of file sdhci.h.

◆ SDHCI_CAN_VDD_300

#define SDHCI_CAN_VDD_300   0x02000000

Definition at line 172 of file sdhci.h.

◆ SDHCI_CAN_VDD_330

#define SDHCI_CAN_VDD_330   0x01000000

Definition at line 171 of file sdhci.h.

◆ SDHCI_CAPABILITIES

#define SDHCI_CAPABILITIES   0x40

Definition at line 157 of file sdhci.h.

◆ SDHCI_CAPABILITIES_1

#define SDHCI_CAPABILITIES_1   0x44

Definition at line 176 of file sdhci.h.

◆ SDHCI_CARD_DETECT_PIN_LEVEL

#define SDHCI_CARD_DETECT_PIN_LEVEL   0x00040000

Definition at line 56 of file sdhci.h.

◆ SDHCI_CARD_PRESENT

#define SDHCI_CARD_PRESENT   0x00010000

Definition at line 54 of file sdhci.h.

◆ SDHCI_CARD_STATE_STABLE

#define SDHCI_CARD_STATE_STABLE   0x00020000

Definition at line 55 of file sdhci.h.

◆ SDHCI_CLOCK_BASE_MASK

#define SDHCI_CLOCK_BASE_MASK   0x00003F00

Definition at line 161 of file sdhci.h.

◆ SDHCI_CLOCK_BASE_SHIFT

#define SDHCI_CLOCK_BASE_SHIFT   8

Definition at line 163 of file sdhci.h.

◆ SDHCI_CLOCK_CARD_EN

#define SDHCI_CLOCK_CARD_EN   0x0004

Definition at line 91 of file sdhci.h.

◆ SDHCI_CLOCK_CONTROL

#define SDHCI_CLOCK_CONTROL   0x2C

Definition at line 85 of file sdhci.h.

◆ SDHCI_CLOCK_INT_EN

#define SDHCI_CLOCK_INT_EN   0x0001

Definition at line 93 of file sdhci.h.

◆ SDHCI_CLOCK_INT_STABLE

#define SDHCI_CLOCK_INT_STABLE   0x0002

Definition at line 92 of file sdhci.h.

◆ SDHCI_CLOCK_V3_BASE_MASK

#define SDHCI_CLOCK_V3_BASE_MASK   0x0000FF00

Definition at line 162 of file sdhci.h.

◆ SDHCI_CMD_ABORTCMD

#define SDHCI_CMD_ABORTCMD   0xC0

Definition at line 33 of file sdhci.h.

◆ SDHCI_CMD_CRC

#define SDHCI_CMD_CRC   0x08

Definition at line 30 of file sdhci.h.

◆ SDHCI_CMD_DATA

#define SDHCI_CMD_DATA   0x20

Definition at line 32 of file sdhci.h.

◆ SDHCI_CMD_INDEX

#define SDHCI_CMD_INDEX   0x10

Definition at line 31 of file sdhci.h.

◆ SDHCI_CMD_INHIBIT

#define SDHCI_CMD_INHIBIT   0x00000001

Definition at line 48 of file sdhci.h.

◆ SDHCI_CMD_RESP_LONG

#define SDHCI_CMD_RESP_LONG   0x01

Definition at line 36 of file sdhci.h.

◆ SDHCI_CMD_RESP_MASK

#define SDHCI_CMD_RESP_MASK   0x03

Definition at line 29 of file sdhci.h.

◆ SDHCI_CMD_RESP_NONE

#define SDHCI_CMD_RESP_NONE   0x00

Definition at line 35 of file sdhci.h.

◆ SDHCI_CMD_RESP_SHORT

#define SDHCI_CMD_RESP_SHORT   0x02

Definition at line 37 of file sdhci.h.

◆ SDHCI_CMD_RESP_SHORT_BUSY

#define SDHCI_CMD_RESP_SHORT_BUSY   0x03

Definition at line 38 of file sdhci.h.

◆ SDHCI_COMMAND

#define SDHCI_COMMAND   0x0E

Definition at line 28 of file sdhci.h.

◆ SDHCI_CTRL_4BITBUS

#define SDHCI_CTRL_4BITBUS   0x02

Definition at line 61 of file sdhci.h.

◆ SDHCI_CTRL_8BITBUS

#define SDHCI_CTRL_8BITBUS   0x20

Definition at line 68 of file sdhci.h.

◆ SDHCI_CTRL_ADMA1

#define SDHCI_CTRL_ADMA1   0x08

Definition at line 65 of file sdhci.h.

◆ SDHCI_CTRL_ADMA32

#define SDHCI_CTRL_ADMA32   0x10

Definition at line 66 of file sdhci.h.

◆ SDHCI_CTRL_ADMA64

#define SDHCI_CTRL_ADMA64   0x18

Definition at line 67 of file sdhci.h.

◆ SDHCI_CTRL_CD_TEST

#define SDHCI_CTRL_CD_TEST   0x80

Definition at line 70 of file sdhci.h.

◆ SDHCI_CTRL_CD_TEST_INS

#define SDHCI_CTRL_CD_TEST_INS   0x40

Definition at line 69 of file sdhci.h.

◆ SDHCI_CTRL_DMA_MASK

#define SDHCI_CTRL_DMA_MASK   0x18

Definition at line 63 of file sdhci.h.

◆ SDHCI_CTRL_DRV_TYPE_A

#define SDHCI_CTRL_DRV_TYPE_A   0x0010

Definition at line 150 of file sdhci.h.

◆ SDHCI_CTRL_DRV_TYPE_B

#define SDHCI_CTRL_DRV_TYPE_B   0x0000

Definition at line 149 of file sdhci.h.

◆ SDHCI_CTRL_DRV_TYPE_C

#define SDHCI_CTRL_DRV_TYPE_C   0x0020

Definition at line 151 of file sdhci.h.

◆ SDHCI_CTRL_DRV_TYPE_D

#define SDHCI_CTRL_DRV_TYPE_D   0x0030

Definition at line 152 of file sdhci.h.

◆ SDHCI_CTRL_DRV_TYPE_MASK

#define SDHCI_CTRL_DRV_TYPE_MASK   0x0030

Definition at line 148 of file sdhci.h.

◆ SDHCI_CTRL_EXEC_TUNING

#define SDHCI_CTRL_EXEC_TUNING   0x0040

Definition at line 153 of file sdhci.h.

◆ SDHCI_CTRL_HISPD

#define SDHCI_CTRL_HISPD   0x04

Definition at line 62 of file sdhci.h.

◆ SDHCI_CTRL_HS400

#define SDHCI_CTRL_HS400   0x0005 /* reserved value in SDIO spec */

Definition at line 146 of file sdhci.h.

◆ SDHCI_CTRL_LED

#define SDHCI_CTRL_LED   0x01

Definition at line 60 of file sdhci.h.

◆ SDHCI_CTRL_PRESET_VAL_ENABLE

#define SDHCI_CTRL_PRESET_VAL_ENABLE   0x8000

Definition at line 155 of file sdhci.h.

◆ SDHCI_CTRL_SDMA

#define SDHCI_CTRL_SDMA   0x00

Definition at line 64 of file sdhci.h.

◆ SDHCI_CTRL_TUNED_CLK

#define SDHCI_CTRL_TUNED_CLK   0x0080

Definition at line 154 of file sdhci.h.

◆ SDHCI_CTRL_UHS_DDR50

#define SDHCI_CTRL_UHS_DDR50   0x0004

Definition at line 145 of file sdhci.h.

◆ SDHCI_CTRL_UHS_MASK

#define SDHCI_CTRL_UHS_MASK   0x0007

Definition at line 140 of file sdhci.h.

◆ SDHCI_CTRL_UHS_SDR104

#define SDHCI_CTRL_UHS_SDR104   0x0003

Definition at line 144 of file sdhci.h.

◆ SDHCI_CTRL_UHS_SDR12

#define SDHCI_CTRL_UHS_SDR12   0x0000

Definition at line 141 of file sdhci.h.

◆ SDHCI_CTRL_UHS_SDR25

#define SDHCI_CTRL_UHS_SDR25   0x0001

Definition at line 142 of file sdhci.h.

◆ SDHCI_CTRL_UHS_SDR50

#define SDHCI_CTRL_UHS_SDR50   0x0002

Definition at line 143 of file sdhci.h.

◆ SDHCI_CTRL_VDD_180

#define SDHCI_CTRL_VDD_180   0x0008

Definition at line 147 of file sdhci.h.

◆ SDHCI_DATA_AVAILABLE

#define SDHCI_DATA_AVAILABLE   0x00000800

Definition at line 53 of file sdhci.h.

◆ SDHCI_DATA_INHIBIT

#define SDHCI_DATA_INHIBIT   0x00000002

Definition at line 49 of file sdhci.h.

◆ SDHCI_DEFAULT_BOUNDARY_ARG

#define SDHCI_DEFAULT_BOUNDARY_ARG   (7)

Definition at line 216 of file sdhci.h.

◆ SDHCI_DEFAULT_BOUNDARY_SIZE

#define SDHCI_DEFAULT_BOUNDARY_SIZE   (512 * 1024)

Definition at line 215 of file sdhci.h.

◆ SDHCI_DIV_HI_MASK

#define SDHCI_DIV_HI_MASK   0x300

Definition at line 90 of file sdhci.h.

◆ SDHCI_DIV_MASK

#define SDHCI_DIV_MASK   0xFF

Definition at line 88 of file sdhci.h.

◆ SDHCI_DIV_MASK_LEN

#define SDHCI_DIV_MASK_LEN   8

Definition at line 89 of file sdhci.h.

◆ SDHCI_DIVIDER_HI_SHIFT

#define SDHCI_DIVIDER_HI_SHIFT   6

Definition at line 87 of file sdhci.h.

◆ SDHCI_DIVIDER_SHIFT

#define SDHCI_DIVIDER_SHIFT   8

Definition at line 86 of file sdhci.h.

◆ SDHCI_DMA_ADDRESS

#define SDHCI_DMA_ADDRESS   0x00

Definition at line 12 of file sdhci.h.

◆ SDHCI_DOING_READ

#define SDHCI_DOING_READ   0x00000200

Definition at line 51 of file sdhci.h.

◆ SDHCI_DOING_WRITE

#define SDHCI_DOING_WRITE   0x00000100

Definition at line 50 of file sdhci.h.

◆ SDHCI_GET_CMD

#define SDHCI_GET_CMD (   c)    ((c>>8) & 0x3f)

Definition at line 41 of file sdhci.h.

◆ SDHCI_HOST_CONTROL

#define SDHCI_HOST_CONTROL   0x28

Definition at line 59 of file sdhci.h.

◆ SDHCI_HOST_CONTROL2

#define SDHCI_HOST_CONTROL2   0x3E

Definition at line 139 of file sdhci.h.

◆ SDHCI_HOST_VERSION

#define SDHCI_HOST_VERSION   0xFE

Definition at line 196 of file sdhci.h.

◆ SDHCI_INT_ACMD12ERR

#define SDHCI_INT_ACMD12ERR   0x01000000

Definition at line 122 of file sdhci.h.

◆ SDHCI_INT_ADMA_ERROR

#define SDHCI_INT_ADMA_ERROR   0x02000000

Definition at line 123 of file sdhci.h.

◆ SDHCI_INT_ALL_MASK

#define SDHCI_INT_ALL_MASK   ((unsigned int)-1)

Definition at line 135 of file sdhci.h.

◆ SDHCI_INT_BUS_POWER

#define SDHCI_INT_BUS_POWER   0x00800000

Definition at line 121 of file sdhci.h.

◆ SDHCI_INT_CARD_INSERT

#define SDHCI_INT_CARD_INSERT   0x00000040

Definition at line 110 of file sdhci.h.

◆ SDHCI_INT_CARD_INT

#define SDHCI_INT_CARD_INT   0x00000100

Definition at line 112 of file sdhci.h.

◆ SDHCI_INT_CARD_REMOVE

#define SDHCI_INT_CARD_REMOVE   0x00000080

Definition at line 111 of file sdhci.h.

◆ SDHCI_INT_CMD_MASK

#define SDHCI_INT_CMD_MASK
Value:
#define SDHCI_INT_END_BIT
Definition: sdhci.h:116
#define SDHCI_INT_RESPONSE
Definition: sdhci.h:105
#define SDHCI_INT_CRC
Definition: sdhci.h:115
#define SDHCI_INT_TIMEOUT
Definition: sdhci.h:114
#define SDHCI_INT_INDEX
Definition: sdhci.h:117

Definition at line 128 of file sdhci.h.

◆ SDHCI_INT_CRC

#define SDHCI_INT_CRC   0x00020000

Definition at line 115 of file sdhci.h.

◆ SDHCI_INT_DATA_AVAIL

#define SDHCI_INT_DATA_AVAIL   0x00000020

Definition at line 109 of file sdhci.h.

◆ SDHCI_INT_DATA_CRC

#define SDHCI_INT_DATA_CRC   0x00200000

Definition at line 119 of file sdhci.h.

◆ SDHCI_INT_DATA_END

#define SDHCI_INT_DATA_END   0x00000002

Definition at line 106 of file sdhci.h.

◆ SDHCI_INT_DATA_END_BIT

#define SDHCI_INT_DATA_END_BIT   0x00400000

Definition at line 120 of file sdhci.h.

◆ SDHCI_INT_DATA_MASK

#define SDHCI_INT_DATA_MASK
Value:
#define SDHCI_INT_ADMA_ERROR
Definition: sdhci.h:123
#define SDHCI_INT_DATA_CRC
Definition: sdhci.h:119
#define SDHCI_INT_SPACE_AVAIL
Definition: sdhci.h:108
#define SDHCI_INT_DATA_TIMEOUT
Definition: sdhci.h:118
#define SDHCI_INT_DATA_END_BIT
Definition: sdhci.h:120
#define SDHCI_INT_DATA_AVAIL
Definition: sdhci.h:109
#define SDHCI_INT_DMA_END
Definition: sdhci.h:107
#define SDHCI_INT_DATA_END
Definition: sdhci.h:106

Definition at line 131 of file sdhci.h.

◆ SDHCI_INT_DATA_TIMEOUT

#define SDHCI_INT_DATA_TIMEOUT   0x00100000

Definition at line 118 of file sdhci.h.

◆ SDHCI_INT_DMA_END

#define SDHCI_INT_DMA_END   0x00000008

Definition at line 107 of file sdhci.h.

◆ SDHCI_INT_ENABLE

#define SDHCI_INT_ENABLE   0x34

Definition at line 103 of file sdhci.h.

◆ SDHCI_INT_END_BIT

#define SDHCI_INT_END_BIT   0x00040000

Definition at line 116 of file sdhci.h.

◆ SDHCI_INT_ERROR

#define SDHCI_INT_ERROR   0x00008000

Definition at line 113 of file sdhci.h.

◆ SDHCI_INT_ERROR_MASK

#define SDHCI_INT_ERROR_MASK   0xFFFF8000

Definition at line 126 of file sdhci.h.

◆ SDHCI_INT_INDEX

#define SDHCI_INT_INDEX   0x00080000

Definition at line 117 of file sdhci.h.

◆ SDHCI_INT_NORMAL_MASK

#define SDHCI_INT_NORMAL_MASK   0x00007FFF

Definition at line 125 of file sdhci.h.

◆ SDHCI_INT_RESPONSE

#define SDHCI_INT_RESPONSE   0x00000001

Definition at line 105 of file sdhci.h.

◆ SDHCI_INT_SPACE_AVAIL

#define SDHCI_INT_SPACE_AVAIL   0x00000010

Definition at line 108 of file sdhci.h.

◆ SDHCI_INT_STATUS

#define SDHCI_INT_STATUS   0x30

Definition at line 102 of file sdhci.h.

◆ SDHCI_INT_TIMEOUT

#define SDHCI_INT_TIMEOUT   0x00010000

Definition at line 114 of file sdhci.h.

◆ SDHCI_MAKE_BLKSZ

#define SDHCI_MAKE_BLKSZ (   dma,
  blksz 
)    (((dma & 0x7) << 12) | (blksz & 0xFFF))

Definition at line 15 of file sdhci.h.

◆ SDHCI_MAKE_CMD

#define SDHCI_MAKE_CMD (   c,
 
)    (((c & 0xff) << 8) | (f & 0xff))

Definition at line 40 of file sdhci.h.

◆ SDHCI_MAX_BLOCK_MASK

#define SDHCI_MAX_BLOCK_MASK   0x00030000

Definition at line 164 of file sdhci.h.

◆ SDHCI_MAX_BLOCK_SHIFT

#define SDHCI_MAX_BLOCK_SHIFT   16

Definition at line 165 of file sdhci.h.

◆ SDHCI_MAX_CURRENT

#define SDHCI_MAX_CURRENT   0x48

Definition at line 179 of file sdhci.h.

◆ SDHCI_MAX_DIV_SPEC_200

#define SDHCI_MAX_DIV_SPEC_200   256

Definition at line 209 of file sdhci.h.

◆ SDHCI_MAX_DIV_SPEC_300

#define SDHCI_MAX_DIV_SPEC_300   2046

Definition at line 210 of file sdhci.h.

◆ SDHCI_MAX_PER_DESCRIPTOR

#define SDHCI_MAX_PER_DESCRIPTOR   0x10000

Definition at line 218 of file sdhci.h.

◆ SDHCI_POWER_180

#define SDHCI_POWER_180   0x0A

Definition at line 74 of file sdhci.h.

◆ SDHCI_POWER_300

#define SDHCI_POWER_300   0x0C

Definition at line 75 of file sdhci.h.

◆ SDHCI_POWER_330

#define SDHCI_POWER_330   0x0E

Definition at line 76 of file sdhci.h.

◆ SDHCI_POWER_CONTROL

#define SDHCI_POWER_CONTROL   0x29

Definition at line 72 of file sdhci.h.

◆ SDHCI_POWER_ON

#define SDHCI_POWER_ON   0x01

Definition at line 73 of file sdhci.h.

◆ SDHCI_PRESENT_STATE

#define SDHCI_PRESENT_STATE   0x24

Definition at line 47 of file sdhci.h.

◆ SDHCI_RESET_ALL

#define SDHCI_RESET_ALL   0x01

Definition at line 98 of file sdhci.h.

◆ SDHCI_RESET_CMD

#define SDHCI_RESET_CMD   0x02

Definition at line 99 of file sdhci.h.

◆ SDHCI_RESET_DATA

#define SDHCI_RESET_DATA   0x04

Definition at line 100 of file sdhci.h.

◆ SDHCI_RESPONSE

#define SDHCI_RESPONSE   0x10

Definition at line 43 of file sdhci.h.

◆ SDHCI_SET_ACMD12_ERROR

#define SDHCI_SET_ACMD12_ERROR   0x50

Definition at line 183 of file sdhci.h.

◆ SDHCI_SET_INT_ERROR

#define SDHCI_SET_INT_ERROR   0x52

Definition at line 184 of file sdhci.h.

◆ SDHCI_SIGNAL_ENABLE

#define SDHCI_SIGNAL_ENABLE   0x38

Definition at line 104 of file sdhci.h.

◆ SDHCI_SLOT_INT_STATUS

#define SDHCI_SLOT_INT_STATUS   0xFC

Definition at line 194 of file sdhci.h.

◆ SDHCI_SOFTWARE_RESET

#define SDHCI_SOFTWARE_RESET   0x2F

Definition at line 97 of file sdhci.h.

◆ SDHCI_SPACE_AVAILABLE

#define SDHCI_SPACE_AVAILABLE   0x00000400

Definition at line 52 of file sdhci.h.

◆ SDHCI_SPEC_100

#define SDHCI_SPEC_100   0

Definition at line 201 of file sdhci.h.

◆ SDHCI_SPEC_200

#define SDHCI_SPEC_200   1

Definition at line 202 of file sdhci.h.

◆ SDHCI_SPEC_300

#define SDHCI_SPEC_300   2

Definition at line 203 of file sdhci.h.

◆ SDHCI_SPEC_VER_MASK

#define SDHCI_SPEC_VER_MASK   0x00FF

Definition at line 199 of file sdhci.h.

◆ SDHCI_SPEC_VER_SHIFT

#define SDHCI_SPEC_VER_SHIFT   0

Definition at line 200 of file sdhci.h.

◆ SDHCI_SUPPORT_HS400

#define SDHCI_SUPPORT_HS400   0x80000000

Definition at line 177 of file sdhci.h.

◆ SDHCI_TIMEOUT_CLK_MASK

#define SDHCI_TIMEOUT_CLK_MASK   0x0000003F

Definition at line 158 of file sdhci.h.

◆ SDHCI_TIMEOUT_CLK_SHIFT

#define SDHCI_TIMEOUT_CLK_SHIFT   0

Definition at line 159 of file sdhci.h.

◆ SDHCI_TIMEOUT_CLK_UNIT

#define SDHCI_TIMEOUT_CLK_UNIT   0x00000080

Definition at line 160 of file sdhci.h.

◆ SDHCI_TIMEOUT_CONTROL

#define SDHCI_TIMEOUT_CONTROL   0x2E

Definition at line 95 of file sdhci.h.

◆ SDHCI_TRANSFER_MODE

#define SDHCI_TRANSFER_MODE   0x0C

Definition at line 21 of file sdhci.h.

◆ SDHCI_TRNS_ACMD12

#define SDHCI_TRNS_ACMD12   0x04

Definition at line 24 of file sdhci.h.

◆ SDHCI_TRNS_BLK_CNT_EN

#define SDHCI_TRNS_BLK_CNT_EN   0x02

Definition at line 23 of file sdhci.h.

◆ SDHCI_TRNS_DMA

#define SDHCI_TRNS_DMA   0x01

Definition at line 22 of file sdhci.h.

◆ SDHCI_TRNS_MULTI

#define SDHCI_TRNS_MULTI   0x20

Definition at line 26 of file sdhci.h.

◆ SDHCI_TRNS_READ

#define SDHCI_TRNS_READ   0x10

Definition at line 25 of file sdhci.h.

◆ SDHCI_VENDOR_VER_MASK

#define SDHCI_VENDOR_VER_MASK   0xFF00

Definition at line 197 of file sdhci.h.

◆ SDHCI_VENDOR_VER_SHIFT

#define SDHCI_VENDOR_VER_SHIFT   8

Definition at line 198 of file sdhci.h.

◆ SDHCI_WAKE_ON_INSERT

#define SDHCI_WAKE_ON_INSERT   0x02

Definition at line 82 of file sdhci.h.

◆ SDHCI_WAKE_ON_INT

#define SDHCI_WAKE_ON_INT   0x01

Definition at line 81 of file sdhci.h.

◆ SDHCI_WAKE_ON_REMOVE

#define SDHCI_WAKE_ON_REMOVE   0x04

Definition at line 83 of file sdhci.h.

◆ SDHCI_WAKE_UP_CONTROL

#define SDHCI_WAKE_UP_CONTROL   0x2B

Definition at line 80 of file sdhci.h.

◆ SDHCI_WRITE_PROTECT

#define SDHCI_WRITE_PROTECT   0x00080000

Definition at line 57 of file sdhci.h.

Function Documentation

◆ sdhci_cmd_done()

void sdhci_cmd_done ( struct sdhci_ctrlr sdhci_ctrlr,
struct mmc_command cmd 
)

Definition at line 46 of file sdhci.c.

References CARD_RSP_136, mmc_command::resp_type, mmc_command::response, sdhc_log_response(), sdhc_trace, sdhci_readb(), sdhci_readl(), and SDHCI_RESPONSE.

Referenced by sdhci_complete_adma(), and sdhci_send_command_bounced().

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

◆ sdhci_complete_adma()

int sdhci_complete_adma ( struct sdhci_ctrlr sdhci_ctrlr,
struct mmc_command cmd 
)

◆ sdhci_readb()

static u8 sdhci_readb ( struct sdhci_ctrlr sdhci_ctrlr,
int  reg 
)
inlinestatic

Definition at line 255 of file sdhci.h.

References sdhci_ctrlr::ioaddr, and read8().

Referenced by sdhci_cmd_done(), sdhci_display_bus_width(), sdhci_display_voltage(), sdhci_led_control(), sdhci_reset(), sdhci_set_ios(), and sdhci_set_power().

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

◆ sdhci_readl()

static u32 sdhci_readl ( struct sdhci_ctrlr sdhci_ctrlr,
int  reg 
)
inlinestatic

Definition at line 245 of file sdhci.h.

References sdhci_ctrlr::ioaddr, and read32().

Referenced by sdhci_cmd_done(), sdhci_complete_adma(), sdhci_init(), sdhci_pre_init(), sdhci_send_command_bounced(), sdhci_transfer_data(), and sdhci_update().

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

◆ sdhci_readw()

static u16 sdhci_readw ( struct sdhci_ctrlr sdhci_ctrlr,
int  reg 
)
inlinestatic

Definition at line 250 of file sdhci.h.

References sdhci_ctrlr::ioaddr, and read16().

Referenced by sdhci_display_bus_width(), sdhci_display_clock(), sdhci_is_tuning_complete(), sdhci_pre_init(), sdhci_set_clock(), sdhci_set_uhs_signaling(), and sdhci_tuning_start().

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

◆ sdhci_reset()

void sdhci_reset ( struct sdhci_ctrlr sdhci_ctrlr,
u8  mask 
)

Definition at line 29 of file sdhci.c.

References mask, sdhc_error, sdhci_readb(), SDHCI_SOFTWARE_RESET, sdhci_writeb(), stopwatch_expired(), stopwatch_init_msecs_expire(), and udelay().

Referenced by sdhci_complete_adma(), sdhci_pre_init(), and sdhci_send_command_bounced().

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

◆ sdhci_setup_adma()

◆ sdhci_writeb()

static void sdhci_writeb ( struct sdhci_ctrlr sdhci_ctrlr,
u8  val,
int  reg 
)
inlinestatic

Definition at line 240 of file sdhci.h.

References sdhci_ctrlr::ioaddr, val, and write8().

Referenced by sdhci_init(), sdhci_led_control(), sdhci_reset(), sdhci_set_ios(), and sdhci_set_power().

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

◆ sdhci_writel()

static void sdhci_writel ( struct sdhci_ctrlr sdhci_ctrlr,
u32  val,
int  reg 
)
inlinestatic

Definition at line 228 of file sdhci.h.

References sdhci_ctrlr::ioaddr, val, and write32().

Referenced by sdhci_complete_adma(), sdhci_init(), sdhci_send_command_bounced(), sdhci_setup_adma(), and sdhci_transfer_data().

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

◆ sdhci_writew()

static void sdhci_writew ( struct sdhci_ctrlr sdhci_ctrlr,
u16  val,
int  reg 
)
inlinestatic

Definition at line 234 of file sdhci.h.

References sdhci_ctrlr::ioaddr, val, and write16().

Referenced by sdhci_send_command_bounced(), sdhci_set_clock(), sdhci_set_uhs_signaling(), and sdhci_tuning_start().

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