Re: [U-Boot] [PATCH v3 02/10] drivers: spi: consider command bytes when sending transfers

2017-06-04 Thread Daniel Schwierzeck


Am 03.06.2017 um 11:57 schrieb Álvaro Fernández Rojas:
> Command bytes are part of the written bytes and they should be taken into
> account when sending a spi transfer.
> 
> Signed-off-by: Álvaro Fernández Rojas 
> Reviewed-by: Simon Glass 

Reviewed-by: Daniel Schwierzeck 

> ---
>  v3: Fix bug introduced in v2: sizeof(cmd) vs len
>  v2: Introduce changes requested by Simon Glass:
>   - Always include command bytes when determining max write size.
> 
>  drivers/mtd/spi/spi_flash.c | 2 +-
>  include/spi.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

-- 
- Daniel



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 02/10] drivers: spi: consider command bytes when sending transfers

2017-06-03 Thread Álvaro Fernández Rojas
Command bytes are part of the written bytes and they should be taken into
account when sending a spi transfer.

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Simon Glass 
---
 v3: Fix bug introduced in v2: sizeof(cmd) vs len
 v2: Introduce changes requested by Simon Glass:
  - Always include command bytes when determining max write size.

 drivers/mtd/spi/spi_flash.c | 2 +-
 include/spi.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 5ee33d8..1e194ce 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -380,7 +380,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 
offset,
 
if (spi->max_write_size)
chunk_len = min(chunk_len,
-   (size_t)spi->max_write_size);
+   spi->max_write_size - sizeof(cmd));
 
spi_flash_addr(write_addr, cmd);
 
diff --git a/include/spi.h b/include/spi.h
index d0fa537..c4e1da6 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -89,7 +89,7 @@ struct dm_spi_slave_platdata {
  * @max_read_size: If non-zero, the maximum number of bytes which can
  * be read at once.
  * @max_write_size:If non-zero, the maximum number of bytes which can
- * be written at once, excluding command bytes.
+ * be written at once.
  * @memory_map:Address of read-only SPI flash access.
  * @flags: Indication of SPI flags.
  */
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot