blob: c12a020a018a59b9369e351c637f697ba6a3b543 [file] [log] [blame]
Daniel DeGrasse94c858e2022-08-15 16:04:27 -05001/*
2 * Copyright 2022 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7
8#ifndef ZEPHYR_SUBSYS_SD_SD_OPS_H_
9#define ZEPHYR_SUBSYS_SD_SD_OPS_H_
10
11/*
12 * Switches voltage of SD card to 1.8V, as described by
Pisit Sawangvonganan4889c9c2024-01-25 01:41:19 +070013 * "Signal voltage switch procedure" in section 3.6.1 of SD host controller specification.
Daniel DeGrasse94c858e2022-08-15 16:04:27 -050014 */
15int sdmmc_switch_voltage(struct sd_card *card);
16
17/*
18 * Reads card identification register, and decodes it
19 */
Declan Snydercad243d2022-08-30 11:13:05 -050020int card_read_cid(struct sd_card *card);
Daniel DeGrasse94c858e2022-08-15 16:04:27 -050021
22/*
23 * Read card specific data register
24 */
25int sdmmc_read_csd(struct sd_card *card);
26
27/*
28 * Requests card to publish a new relative card address, and move from
29 * identification to data mode
30 */
31int sdmmc_request_rca(struct sd_card *card);
32
33/*
34 * Selects card, moving it into data transfer mode
35 */
36int sdmmc_select_card(struct sd_card *card);
37
38/* Returns 1 if host supports UHS, zero otherwise */
39static inline int sdmmc_host_uhs(struct sdhc_host_props *props)
40{
41 return (props->host_caps.sdr50_support |
42 props->host_caps.uhs_2_support |
43 props->host_caps.sdr104_support |
44 props->host_caps.ddr50_support)
45 & (props->host_caps.vol_180_support);
46}
47
Declan Snydercad243d2022-08-30 11:13:05 -050048int card_ioctl(struct sd_card *card, uint8_t cmd, void *buf);
49
50int card_read_blocks(struct sd_card *card, uint8_t *rbuf,
51 uint32_t start_block, uint32_t num_blocks);
52
53int card_write_blocks(struct sd_card *card, const uint8_t *wbuf,
54 uint32_t start_block, uint32_t num_blocks);
55
56int card_app_command(struct sd_card *card, int relative_card_address);
57
58int sdmmc_read_status(struct sd_card *card);
59
60int sdmmc_wait_ready(struct sd_card *card);
61
Daniel DeGrasse94c858e2022-08-15 16:04:27 -050062#endif /* ZEPHYR_SUBSYS_SD_SD_OPS_H_ */