mtd: spi-nor-core: Set dummy buswidth equal to data buswidth
PATCH 2/30 mtd: spi-nor-core: Set dummy buswidth equal to data buswidth
From: T Karthik Reddy <[email protected]>
In current implementation dummy buswidth is set equal to address buswidth. In case of quad spi (mode 1-1-4), where address width is 1 the dummy bytes will be calculated to 1(8 dummy cycles) and dummy buswidth is set to 1. Due to this, the controller driver will introduce 8 dummy cycles on data line(D0) during read operation.
But since we are using 4 data lines in case of qspi, we need to change this dummy bus width to 4. This will make dummy bytes to 4 inplace of 1. This will be taken care in controller driver by dividing with dummy buswidth again as in below code, which makes dummy cycles to 8 as earlier.
dummy_cycles = op->dummy.nbytes * 8 / op->dummy.buswidth;
So with this change dummy cycles will be on all data lines(D0-D3) and it is taken care for all the configurations(single, dual, quad and octal).
--- drivers/mtd/spi/spi-nor-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi/spi-nor-core.c +1 -1
@@ -260,7 +260,7 @@ void spi_nor_setup_op(const struct spi_nor *nor, op->addr.buswidth =spi_nor_get_protocol_addr_nbits (proto);if (op->dummy.nbytes) - op->dummy.buswidth =spi_nor_get_protocol_addr_nbits (proto); + op->dummy.buswidth =spi_nor_get_protocol_data_nbits (proto);if (op->data.nbytes) op->data.buswidth =spi_nor_get_protocol_data_nbits (proto);
Signature · 1 line
2.27.0
Hi Tejas Bhumkar,
Am 06.12.2023 um 06:30 schrieb Tejas Bhumkar:
Quoted 8 lines
From: T Karthik Reddy <[email protected]>
In current implementation dummy buswidth is set equal to address buswidth. In case of quad spi (mode 1-1-4), where address width is 1 the dummy bytes will be calculated to 1(8 dummy cycles) and dummy buswidth is set to 1. Due to this, the controller driver will introduce 8 dummy cycles on data line(D0) during read operation.
Quoted 5 lines
But since we are using 4 data lines in case of qspi, we need to change this dummy bus width to 4. This will make dummy bytes to 4 inplace of 1. This will be taken care in controller driver by dividing with dummy buswidth again as in below code, which makes dummy cycles to 8 as earlier.
Do you have any specification that states that the dummy lines use the data and not the address width?
Both u-boot and the Linux kernel use the address width for the calculation of the dummy bytes until now.
Quoted 25 lines
dummy_cycles=op->dummy.nbytes* 8 /op->dummy.buswidth;So with this change dummy cycles will be on all data lines(D0-D3) and it is taken care for all the
configurations(single, dual, quad and octal).Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by T Karthik Reddy <[email protected]>Signed-off-by Tejas Bhumkar <[email protected]>--- drivers/mtd/spi/spi-nor-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mtd/spi/spi-nor-core.c +1
-1@@ -260,7 +260,7 @@ void spi_nor_setup_op(const struct spi_nor *nor, op->addr.buswidth =spi_nor_get_protocol_addr_nbits (proto);if (op->dummy.nbytes) - op->dummy.buswidth =spi_nor_get_protocol_addr_nbits (proto); + op->dummy.buswidth =spi_nor_get_protocol_data_nbits (proto);if (op->data.nbytes) op->data.buswidth =spi_nor_get_protocol_data_nbits (proto);