blob: 8f64e5eea9267ae926e9eec9ccaf9dad50e3ec49 [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
Elyes HAOUAS5817c562020-07-12 09:03:22 +02006#include <stddef.h>
7
Xiang Wangb1349452019-08-27 15:57:23 +08008struct spi_sdcard {
9 int type;
10 struct spi_slave slave;
11};
12
13int spi_sdcard_init(struct spi_sdcard *card,
14 const unsigned int bus,
15 const unsigned int cs);
16
17int spi_sdcard_single_read(const struct spi_sdcard *card,
18 size_t block_address,
19 void *buff);
20
21int spi_sdcard_multiple_read(const struct spi_sdcard *card,
22 size_t start_block_address,
23 size_t end_block_address,
24 void *buff);
25
26int spi_sdcard_single_write(const struct spi_sdcard *card,
27 size_t block_address,
28 void *buff);
29
30int spi_sdcard_read(const struct spi_sdcard *card,
31 void *dest,
32 size_t offset,
33 size_t count);
34
35int spi_sdcard_multiple_write(const struct spi_sdcard *card,
36 size_t start_block_address,
37 size_t end_block_address,
38 void *buff);
39
40int spi_sdcard_erase(const struct spi_sdcard *card,
41 size_t start_block_address,
42 size_t end_block_address);
43
44int spi_sdcard_erase_all(const struct spi_sdcard *card);
45
46/* get the sdcard size in bytes */
47size_t spi_sdcard_size(const struct spi_sdcard *card);
48
49#endif /* _SPI_SDCARD_H_ */