2022-08-16 05:04:27 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2022 NXP
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ZEPHYR_SUBSYS_SD_SD_OPS_H_
|
|
|
|
#define ZEPHYR_SUBSYS_SD_SD_OPS_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Switches voltage of SD card to 1.8V, as described by
|
2024-01-25 02:41:19 +08:00
|
|
|
* "Signal voltage switch procedure" in section 3.6.1 of SD host controller specification.
|
2022-08-16 05:04:27 +08:00
|
|
|
*/
|
|
|
|
int sdmmc_switch_voltage(struct sd_card *card);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reads card identification register, and decodes it
|
|
|
|
*/
|
2022-08-31 00:13:05 +08:00
|
|
|
int card_read_cid(struct sd_card *card);
|
2022-08-16 05:04:27 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read card specific data register
|
|
|
|
*/
|
|
|
|
int sdmmc_read_csd(struct sd_card *card);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Requests card to publish a new relative card address, and move from
|
|
|
|
* identification to data mode
|
|
|
|
*/
|
|
|
|
int sdmmc_request_rca(struct sd_card *card);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Selects card, moving it into data transfer mode
|
|
|
|
*/
|
|
|
|
int sdmmc_select_card(struct sd_card *card);
|
|
|
|
|
|
|
|
/* Returns 1 if host supports UHS, zero otherwise */
|
|
|
|
static inline int sdmmc_host_uhs(struct sdhc_host_props *props)
|
|
|
|
{
|
|
|
|
return (props->host_caps.sdr50_support |
|
|
|
|
props->host_caps.uhs_2_support |
|
|
|
|
props->host_caps.sdr104_support |
|
|
|
|
props->host_caps.ddr50_support)
|
|
|
|
& (props->host_caps.vol_180_support);
|
|
|
|
}
|
|
|
|
|
2022-08-31 00:13:05 +08:00
|
|
|
int card_ioctl(struct sd_card *card, uint8_t cmd, void *buf);
|
|
|
|
|
|
|
|
int card_read_blocks(struct sd_card *card, uint8_t *rbuf,
|
|
|
|
uint32_t start_block, uint32_t num_blocks);
|
|
|
|
|
|
|
|
int card_write_blocks(struct sd_card *card, const uint8_t *wbuf,
|
|
|
|
uint32_t start_block, uint32_t num_blocks);
|
|
|
|
|
|
|
|
int card_app_command(struct sd_card *card, int relative_card_address);
|
|
|
|
|
|
|
|
int sdmmc_read_status(struct sd_card *card);
|
|
|
|
|
|
|
|
int sdmmc_wait_ready(struct sd_card *card);
|
|
|
|
|
2022-08-16 05:04:27 +08:00
|
|
|
#endif /* ZEPHYR_SUBSYS_SD_SD_OPS_H_ */
|