Google is committed to advancing racial equity for Black communities. See how.

fuchsia.hardware.sdmmc

PROTOCOLS

InBandInterrupt

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

Callback

Request

NameType

Response

NameType

Sdmmc

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

HostInfo

Get host info.

Request

NameType

Response

NameType
s zx/status
info SdmmcHostInfo

HwReset

Issue a hw reset.

Request

NameType

Response

NameType

PerformTuning

Perform tuning.

Request

NameType
cmd_idx uint32

Response

NameType
s zx/status

RegisterInBandInterrupt

Request

NameType
interrupt_cb InBandInterrupt

Response

NameType
s zx/status

RegisterVmo

In the methods below, vmo_id is used to uniquely identify a VMO that will be passed to Request in an SdmmcBufferRegion. VMO IDs are chosen by the caller, and may be any uint32 value. Registers a VMO and transfers ownership to the protocol implementation. vmo_rights is a bit field containing SdmmcVmoRight values, and determines the read/write permissions used by the implementation when pinning or mapping the VMO. The implementation may pin vmo during this call or any time it is used in a request, and may keep it pinned until the VMO is unregistered. client_id may be in [0, SDMMC_MAX_CLIENT_ID] and identifies the ID space for this VMO to be registered in (that is, two different VMOs may use the same ID if they are registered for different clients).

Request

NameType
vmo_id uint32
client_id uint8
vmo handle<vmo>
offset uint64
size uint64
vmo_rights uint32

Response

NameType
status zx/status

Request

Issue a request.

Request

NameType
req SdmmcReq

Response

NameType
s zx/status

RequestNew

Perform the request. The protocol implementation chooses whether or not to use DMA depending on the properties of the request and the capabilities of the controller.

Clients are responsible for performing the following cache operations:

After read requests:

  • Call zx_cache_flush with ZX_CACHE_FLUSH_DATA | ZX_CACHE_FLUSH_INVALIDATE on buffers that have been mapped by the client.
  • Call zx_vmo_op_range with ZX_VMO_OP_CACHE_CLEAN_INVALIDATE on all other buffers.

Note that writing to any portion of a buffer before DoRwTxnNew has returned can corrupt the received data.

Before write requests:

  • Call zx_cache_flush with ZX_CACHE_FLUSH_DATA on buffers that have been mapped by the client.
  • Call zx_vmo_op_range with ZX_VMO_OP_CACHE_CLEAN on all other buffers.

Request

NameType
req SdmmcReqNew

Response

NameType
status zx/status
response uint32[4]

SetBusFreq

Set bus frequency, zero means disable the clock to the card.

Request

NameType
bus_freq uint32

Response

NameType
s zx/status

SetBusWidth

Set bus width.

Request

NameType
bus_width SdmmcBusWidth

Response

NameType
s zx/status

SetSignalVoltage

Set signal voltage.

Request

NameType
voltage SdmmcVoltage

Response

NameType
s zx/status

SetTiming

Set mmc timing.

Request

NameType
timing SdmmcTiming

Response

NameType
s zx/status

UnregisterVmo

The callee unmaps/unpins the VMO and returns ownership to the caller.

Request

NameType
vmo_id uint32
client_id uint8

Response

NameType
status zx/status
vmo handle<vmo>

STRUCTS

SdmmcBufferRegion

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameTypeDescriptionDefault
buffer SdmmcBuffer No default
type SdmmcBufferType No default
offset uint64

Offset into the VMO to start reading or writing. This is relative to the offset passed to RegisterVmo if type is VMO_ID.

No default
size uint64

Number of bytes to read from or write to this buffer region.

No default

SdmmcHostInfo

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameTypeDescriptionDefault
caps uint64

Controller capabilities

No default
max_transfer_size uint64

Maximum data request size

No default
max_transfer_size_non_dma uint64 No default
max_buffer_regions uint64

The number of buffer regions that may be used in a single request.

No default
prefs uint64

Host specific preferences

No default

SdmmcReq

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

sdmmc requests. one per command

NameTypeDescriptionDefault
cmd_idx uint32 No default
cmd_flags uint32 No default
arg uint32 No default
blockcount uint16

data command parameters

No default
blocksize uint16 No default
use_dma bool No default
dma_vmo handle<vmo>

Used if use_dma is true

No default
virt vector<uint8>

Used if use_dma is false

No default
buf_offset uint64

offset into dma_vmo or virt

No default
pmt handle<handle> No default
probe_tuning_cmd bool No default
response uint32[4]

response data

No default
status zx/status

status

No default

SdmmcReqNew

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameTypeDescriptionDefault
cmd_idx uint32 No default
cmd_flags uint32 No default
arg uint32 No default
blocksize uint32 No default
probe_tuning_cmd bool

If true, the SDMMC driver should not print any error messages for this request. This is used for initialization and tuning, when some requests are expected to fail.

No default
client_id uint8

The client ID for this request. Only VMOs registered with this client may be present in buffers below.

No default
buffers vector<SdmmcBufferRegion> No default

ENUMS

SdmmcBufferType

Type: uint32

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
VMO_ID 1
VMO_HANDLE 2

SdmmcBusWidth

Type: uint8

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
ONE 0
FOUR 1
EIGHT 2
MAX 3

SdmmcHostCap

Type: uint64

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
BUS_WIDTH_8 1
DMA 2
VOLTAGE_330 4
AUTO_CMD12 8
SDR104 16
SDR50 32
DDR50 64
NO_TUNING_SDR50 128

The host does not require tuning for SDR50.

SdmmcHostPrefs

Type: uint64

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
DISABLE_HS400 1
DISABLE_HS200 2
DISABLE_HSDDR 4

SdmmcTiming

Type: uint8

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
LEGACY 0
HS 1
HSDDR 2
HS200 3
HS400 4
SDR12 5
SDR25 6
SDR50 7
SDR104 8
DDR50 9
MAX 10

SdmmcVmoRight

Type: uint32

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
READ 1
WRITE 2

SdmmcVoltage

Type: uint8

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameValueDescription
V330 0
V180 1
MAX 2

UNIONS

SdmmcBuffer

Defined in fuchsia.hardware.sdmmc/sdmmc.banjo

NameTypeDescription
vmo_id uint32

The ID of a VMO that was previously registered.

vmo handle<vmo>

An unregistered VMO of which the protocol implementation does not take ownership. The VMO is pinned upon entering Request and is unpinned before returning.

CONSTANTS

NameValueTypeDescription
SDMMC_MAX_CLIENT_ID 7 uint8

The max value of client_id fields below. There is no known need for more than eight clients at the moment, however if that changes later this value will be increased.

SDMMC_PAGES_COUNT 512 uint64

number of pages per request - 2M per request matches DMA_DESC_COUNT in dev/block/sdhci (PAGE_SIZE / sizeof(zx_paddr_t))