mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 23:51:33 +00:00
spi: spi-mem: Fix read data size issue
When slave drivers don't set the max_read_size, the spi-mem should directly use data.nbytes and not limit to any size. But current logic will limit to the max_write_size. Signed-off-by: Ye Li <ye.li@nxp.com> Acked-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
This commit is contained in:
parent
0e80dda32c
commit
535b1fdb8e
1 changed files with 5 additions and 3 deletions
|
@ -430,12 +430,14 @@ int spi_mem_adjust_op_size(struct spi_slave *slave, struct spi_mem_op *op)
|
||||||
if (slave->max_write_size && len > slave->max_write_size)
|
if (slave->max_write_size && len > slave->max_write_size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (op->data.dir == SPI_MEM_DATA_IN && slave->max_read_size)
|
if (op->data.dir == SPI_MEM_DATA_IN) {
|
||||||
op->data.nbytes = min(op->data.nbytes,
|
if (slave->max_read_size)
|
||||||
|
op->data.nbytes = min(op->data.nbytes,
|
||||||
slave->max_read_size);
|
slave->max_read_size);
|
||||||
else if (slave->max_write_size)
|
} else if (slave->max_write_size) {
|
||||||
op->data.nbytes = min(op->data.nbytes,
|
op->data.nbytes = min(op->data.nbytes,
|
||||||
slave->max_write_size - len);
|
slave->max_write_size - len);
|
||||||
|
}
|
||||||
|
|
||||||
if (!op->data.nbytes)
|
if (!op->data.nbytes)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in a new issue