Commit 8af74edc30bb60a90a5c4d2769ff3129b187796e
Committed by
Jagan Teki
1 parent
48263504c8
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
drivers: spi: allow limiting reads
For some SPI controllers it's not possible to keep the CS active between transfers and they are limited to a known number of bytes. This splits spi_flash reads into different iterations in order to respect the SPI controller limits. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
Showing 2 changed files with 6 additions and 0 deletions Side-by-side Diff
drivers/mtd/spi/spi_flash.c
include/spi.h
... | ... | @@ -86,6 +86,8 @@ |
86 | 86 | * @cs: ID of the chip select connected to the slave. |
87 | 87 | * @mode: SPI mode to use for this slave (see SPI mode flags) |
88 | 88 | * @wordlen: Size of SPI word in number of bits |
89 | + * @max_read_size: If non-zero, the maximum number of bytes which can | |
90 | + * be read at once. | |
89 | 91 | * @max_write_size: If non-zero, the maximum number of bytes which can |
90 | 92 | * be written at once, excluding command bytes. |
91 | 93 | * @memory_map: Address of read-only SPI flash access. |
... | ... | @@ -102,6 +104,7 @@ |
102 | 104 | #endif |
103 | 105 | uint mode; |
104 | 106 | unsigned int wordlen; |
107 | + unsigned int max_read_size; | |
105 | 108 | unsigned int max_write_size; |
106 | 109 | void *memory_map; |
107 | 110 |