diff mbox series

[RESEND] Revert "spi: zynq_qspi: Use dummy buswidth in dummy byte calculation"

Message ID 20230427065355.7413-1-stefan.herbrechtsmeier-oss@weidmueller.com
State Accepted
Commit 99c1abae411d8e4f6ad2ba8b151bfc8ea163c93a
Delegated to: Michal Simek
Headers show
Series [RESEND] Revert "spi: zynq_qspi: Use dummy buswidth in dummy byte calculation" | expand

Commit Message

Stefan Herbrechtsmeier April 27, 2023, 6:53 a.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

This reverts commit e09784728689de7949d4cdd559a9590e0bfcc702. The
commit wrongly divides the dummy bytes by dummy bus width to calculate
the dummy bytes. The framework already converts the dummy cycles to the
number of bytes and the controller use the SPI flash command to
determine the dummy cycles via the address width.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>

---

 drivers/spi/zynq_qspi.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Michal Simek April 27, 2023, 7:09 a.m. UTC | #1
On 4/27/23 08:53, Stefan Herbrechtsmeier wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> This reverts commit e09784728689de7949d4cdd559a9590e0bfcc702. The
> commit wrongly divides the dummy bytes by dummy bus width to calculate
> the dummy bytes. The framework already converts the dummy cycles to the
> number of bytes and the controller use the SPI flash command to
> determine the dummy cycles via the address width.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> Acked-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
> 
> ---
> 
>   drivers/spi/zynq_qspi.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
> index 00e3ffcd1d..d1d4048966 100644
> --- a/drivers/spi/zynq_qspi.c
> +++ b/drivers/spi/zynq_qspi.c
> @@ -676,7 +676,6 @@ static int zynq_qspi_exec_op(struct spi_slave *slave,
>   			     const struct spi_mem_op *op)
>   {
>   	int op_len, pos = 0, ret, i;
> -	u32 dummy_bytes = 0;
>   	unsigned int flag = 0;
>   	const u8 *tx_buf = NULL;
>   	u8 *rx_buf = NULL;
> @@ -689,11 +688,6 @@ static int zynq_qspi_exec_op(struct spi_slave *slave,
>   	}
>   
>   	op_len = op->cmd.nbytes + op->addr.nbytes + op->dummy.nbytes;
> -	if (op->dummy.nbytes) {
> -		op_len = op->cmd.nbytes + op->addr.nbytes +
> -			 op->dummy.nbytes / op->dummy.buswidth;
> -		dummy_bytes = op->dummy.nbytes / op->dummy.buswidth;
> -	}
>   
>   	u8 op_buf[op_len];
>   
> @@ -707,8 +701,8 @@ static int zynq_qspi_exec_op(struct spi_slave *slave,
>   		pos += op->addr.nbytes;
>   	}
>   
> -	if (dummy_bytes)
> -		memset(op_buf + pos, 0xff, dummy_bytes);
> +	if (op->dummy.nbytes)
> +		memset(op_buf + pos, 0xff, op->dummy.nbytes);
>   
>   	/* 1st transfer: opcode + address + dummy cycles */
>   	/* Make sure to set END bit if no tx or rx data messages follow */


Applied.
M
diff mbox series

Patch

diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index 00e3ffcd1d..d1d4048966 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -676,7 +676,6 @@  static int zynq_qspi_exec_op(struct spi_slave *slave,
 			     const struct spi_mem_op *op)
 {
 	int op_len, pos = 0, ret, i;
-	u32 dummy_bytes = 0;
 	unsigned int flag = 0;
 	const u8 *tx_buf = NULL;
 	u8 *rx_buf = NULL;
@@ -689,11 +688,6 @@  static int zynq_qspi_exec_op(struct spi_slave *slave,
 	}
 
 	op_len = op->cmd.nbytes + op->addr.nbytes + op->dummy.nbytes;
-	if (op->dummy.nbytes) {
-		op_len = op->cmd.nbytes + op->addr.nbytes +
-			 op->dummy.nbytes / op->dummy.buswidth;
-		dummy_bytes = op->dummy.nbytes / op->dummy.buswidth;
-	}
 
 	u8 op_buf[op_len];
 
@@ -707,8 +701,8 @@  static int zynq_qspi_exec_op(struct spi_slave *slave,
 		pos += op->addr.nbytes;
 	}
 
-	if (dummy_bytes)
-		memset(op_buf + pos, 0xff, dummy_bytes);
+	if (op->dummy.nbytes)
+		memset(op_buf + pos, 0xff, op->dummy.nbytes);
 
 	/* 1st transfer: opcode + address + dummy cycles */
 	/* Make sure to set END bit if no tx or rx data messages follow */