diff options
author | Aaron Durbin <adurbin@chromium.org> | 2018-01-29 11:30:17 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2018-01-30 05:37:47 +0000 |
commit | 1fcc9f3125f88595a89392e9736ebb01e7788842 (patch) | |
tree | 998555b6275b5b22e6e73f14ff2baab99841b32c /src/include | |
parent | 3c0d7cfb947d12bdadc5d1898d23d29c93e0ec03 (diff) |
drivers/spi: support cmd opcode deduction for spi_crop_chunk()
spi_crop_chunk() currently supports deducting the command length
when determining maximum payload size in a transaction. Add support
for deducting just the opcode part of the command by replacing
deduct_cmd_len field to generic flags field. The two enums supported
drive the logic within spi_crop_chunk():
SPI_CNTRLR_DEDUCT_CMD_LEN
SPI_CNTRLR_DEDUCT_OPCODE_LEN
All existing users of deduct_cmd_len were converted to using the
flags field.
BUG=b:65485690
Change-Id: I771fba684f0ed76ffdc8573aa10f775070edc691
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/23491
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/spi-generic.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/include/spi-generic.h b/src/include/spi-generic.h index a3298f8376..20c7cc72c7 100644 --- a/src/include/spi-generic.h +++ b/src/include/spi-generic.h @@ -97,6 +97,17 @@ struct spi_cfg { struct spi_flash; +enum { + /* Deduct the command length from the spi_crop_chunk() calculation for + sizing a transaction. */ + SPI_CNTRLR_DEDUCT_CMD_LEN = 1 << 0, + /* Remove the opcode size from the command length used in the + spi_crop_chunk() calculation. Controllers which have a dedicated + register for the command byte would set this flag which would + allow the use of the maximum transfer size. */ + SPI_CNTRLR_DEDUCT_OPCODE_LEN = 1 << 1, +}; + /*----------------------------------------------------------------------- * Representation of a SPI controller. * @@ -108,8 +119,7 @@ struct spi_flash; * max_xfer_size: Maximum transfer size supported by the controller * (0 = invalid, * SPI_CTRLR_DEFAULT_MAX_XFER_SIZE = unlimited) - * deduct_cmd_len: Whether cmd_len should be deducted from max_xfer_size - * when calculating max_data_size + * flags: See SPI_CNTRLR_* enums above. * * Following member is provided by specialized SPI controllers that are * actually SPI flash controllers. @@ -127,7 +137,7 @@ struct spi_ctrlr { int (*xfer_vector)(const struct spi_slave *slave, struct spi_op vectors[], size_t count); uint32_t max_xfer_size; - bool deduct_cmd_len; + uint32_t flags; int (*flash_probe)(const struct spi_slave *slave, struct spi_flash *flash); int (*flash_protect)(const struct spi_flash *flash, |