include/spd_bin.h: Add SPD IO layer
[coreboot2.git] / src / include / spi_sdcard.h
blob8f64e5eea9267ae926e9eec9ccaf9dad50e3ec49
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef _SPI_SDCARD_H_
4 #define _SPI_SDCARD_H_
6 #include <stddef.h>
8 struct spi_sdcard {
9 int type;
10 struct spi_slave slave;
13 int spi_sdcard_init(struct spi_sdcard *card,
14 const unsigned int bus,
15 const unsigned int cs);
17 int spi_sdcard_single_read(const struct spi_sdcard *card,
18 size_t block_address,
19 void *buff);
21 int spi_sdcard_multiple_read(const struct spi_sdcard *card,
22 size_t start_block_address,
23 size_t end_block_address,
24 void *buff);
26 int spi_sdcard_single_write(const struct spi_sdcard *card,
27 size_t block_address,
28 void *buff);
30 int spi_sdcard_read(const struct spi_sdcard *card,
31 void *dest,
32 size_t offset,
33 size_t count);
35 int spi_sdcard_multiple_write(const struct spi_sdcard *card,
36 size_t start_block_address,
37 size_t end_block_address,
38 void *buff);
40 int spi_sdcard_erase(const struct spi_sdcard *card,
41 size_t start_block_address,
42 size_t end_block_address);
44 int spi_sdcard_erase_all(const struct spi_sdcard *card);
46 /* get the sdcard size in bytes */
47 size_t spi_sdcard_size(const struct spi_sdcard *card);
49 #endif /* _SPI_SDCARD_H_ */