drivers/spi/spi-generic: document SPI_CNTRLR_DEDUCT_CMD_LEN better
This should make it a bit clearer what the differences between SPI_CNTRLR_DEDUCT_OPCODE_LEN and SPI_CNTRLR_DEDUCT_CMD_LEN and the corresponding functionality in spi_crop_chunk are. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I809adebb182fc0866b93372b5b486117176da388 Reviewed-on: https://review.coreboot.org/c/coreboot/+/60122 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
parent
e3ae755575
commit
55dce1d55d
|
@ -98,6 +98,10 @@ unsigned int spi_crop_chunk(const struct spi_slave *slave, unsigned int cmd_len,
|
||||||
if (deduct_opcode_len)
|
if (deduct_opcode_len)
|
||||||
cmd_len--;
|
cmd_len--;
|
||||||
|
|
||||||
|
/* Subtract command length from useable buffer size. If
|
||||||
|
deduct_opcode_len is set, only subtract the number command bytes
|
||||||
|
after the opcode. If the adjusted cmd_len is larger than ctrlr_max
|
||||||
|
return 0 to inidicate an error. */
|
||||||
if (deduct_cmd_len) {
|
if (deduct_cmd_len) {
|
||||||
if (ctrlr_max >= cmd_len) {
|
if (ctrlr_max >= cmd_len) {
|
||||||
ctrlr_max -= cmd_len;
|
ctrlr_max -= cmd_len;
|
||||||
|
|
|
@ -111,7 +111,8 @@ enum ctrlr_prot_type {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* Deduct the command length from the spi_crop_chunk() calculation for
|
/* Deduct the command length from the spi_crop_chunk() calculation for
|
||||||
sizing a transaction. */
|
sizing a transaction. If SPI_CNTRLR_DEDUCT_OPCODE_LEN is set, only
|
||||||
|
the bytes after the command byte will be deducted. */
|
||||||
SPI_CNTRLR_DEDUCT_CMD_LEN = 1 << 0,
|
SPI_CNTRLR_DEDUCT_CMD_LEN = 1 << 0,
|
||||||
/* Remove the opcode size from the command length used in the
|
/* Remove the opcode size from the command length used in the
|
||||||
spi_crop_chunk() calculation. Controllers which have a dedicated
|
spi_crop_chunk() calculation. Controllers which have a dedicated
|
||||||
|
|
Loading…
Reference in New Issue