blob: 028f6a351e4624e060eb605970e5a12f59a49471 [file] [log] [blame]
Angel Pons32859fc2020-04-02 23:48:27 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Xiang Wangb1349452019-08-27 15:57:23 +08002
3#ifndef _SPI_SDCARD_H_
4#define _SPI_SDCARD_H_
5
6struct spi_sdcard {
7 int type;
8 struct spi_slave slave;
9};
10
11int spi_sdcard_init(struct spi_sdcard *card,
12 const unsigned int bus,
13 const unsigned int cs);
14
15int spi_sdcard_single_read(const struct spi_sdcard *card,
16 size_t block_address,
17 void *buff);
18
19int spi_sdcard_multiple_read(const struct spi_sdcard *card,
20 size_t start_block_address,
21 size_t end_block_address,
22 void *buff);
23
24int spi_sdcard_single_write(const struct spi_sdcard *card,
25 size_t block_address,
26 void *buff);
27
28int spi_sdcard_read(const struct spi_sdcard *card,
29 void *dest,
30 size_t offset,
31 size_t count);
32
33int spi_sdcard_multiple_write(const struct spi_sdcard *card,
34 size_t start_block_address,
35 size_t end_block_address,
36 void *buff);
37
38int spi_sdcard_erase(const struct spi_sdcard *card,
39 size_t start_block_address,
40 size_t end_block_address);
41
42int spi_sdcard_erase_all(const struct spi_sdcard *card);
43
44/* get the sdcard size in bytes */
45size_t spi_sdcard_size(const struct spi_sdcard *card);
46
47#endif /* _SPI_SDCARD_H_ */