Skip to contentSkip to conversation

spi: cadence_qspi_apb: Improve indirect write transaction

PATCH New Vignesh R 3 participants 12 messages Oct 6, 2016 – Oct 20, 2016 SPI

lore
Share & tools
lore

Vignesh R

author
#0 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +8 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
 		/* Handle non-4-byte aligned access to avoid data abort. */
-		if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+		if ((uintptr_t)txbuf % 4) {
 			writesb(plat->ahbbase, txbuf, write_bytes);
-		else
+		} else {
 			writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+			if (write_bytes % 4) {
+				writesb(plat->ahbbase,
+					txbuf + rounddown(write_bytes, 4),
+					write_bytes % 4);
+			}
+		}
 
 		ret = wait_for_bit("QSPI", plat->regbase + CQSPI_REG_SDRAMLEVEL,
 				   CQSPI_REG_SDRAMLEVEL_WR_MASK <<
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 30 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +8 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
 		/* Handle non-4-byte aligned access to avoid data abort. */
-		if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+		if ((uintptr_t)txbuf % 4) {
 			writesb(plat->ahbbase, txbuf, write_bytes);
-		else
+		} else {
 			writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+			if (write_bytes % 4) {
+				writesb(plat->ahbbase,
+					txbuf + rounddown(write_bytes, 4),
+					write_bytes % 4);
+			}
+		}
 
 		ret = wait_for_bit("QSPI", plat->regbase + CQSPI_REG_SDRAMLEVEL,
 				   CQSPI_REG_SDRAMLEVEL_WR_MASK <<
Signature · 2 lines
Regards
Vignesh
#2 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 31 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 17 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +1 -1
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
 		/* Handle non-4-byte aligned access to avoid data abort. */
-		if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+		if ((uintptr_t)txbuf % 4) {
 			writesb(plat->ahbbase, txbuf, write_bytes);
Quoted 8 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 8 lines
drivers/spi/cadence_qspi_apb.c +6 -1
-		else
+		} else {
 			writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+			if (write_bytes % 4) {
+				writesb(plat->ahbbase,
+					txbuf + rounddown(write_bytes, 4),
+					write_bytes % 4);
+			}

You can probably pull this block from the else branch.

Quoted 6 lines
Quoted 5 lines
drivers/spi/cadence_qspi_apb.c +1 -0
+		}
 
 		ret = wait_for_bit("QSPI", plat->regbase + CQSPI_REG_SDRAMLEVEL,
 				   CQSPI_REG_SDRAMLEVEL_WR_MASK <<
Signature · 2 lines
Best regards,
Marek Vasut
author
#3 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Hi,

Quoted 34 lines · Marek Vasut
Quoted 33 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 19 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +2 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
 		/* Handle non-4-byte aligned access to avoid data abort. */
-		if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+		if ((uintptr_t)txbuf % 4) {
 			writesb(plat->ahbbase, txbuf, write_bytes);
-		else
+		} else {
Quoted 8 lines
Quoted 6 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 6 lines
drivers/spi/cadence_qspi_apb.c +5 -0
 			writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+			if (write_bytes % 4) {
+				writesb(plat->ahbbase,
+					txbuf + rounddown(write_bytes, 4),
+					write_bytes % 4);
+			}

You can probably pull this block from the else branch.

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Signature · 2 lines
Regards
Vignesh
#4 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 46 lines · Vignesh R

Hi,

Quoted 34 lines · Marek Vasut
Quoted 33 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 19 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +2 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
 		/* Handle non-4-byte aligned access to avoid data abort. */
-		if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+		if ((uintptr_t)txbuf % 4) {
 			writesb(plat->ahbbase, txbuf, write_bytes);
-		else
+		} else {
Quoted 8 lines
Quoted 6 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 6 lines
drivers/spi/cadence_qspi_apb.c +5 -0
 			writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+			if (write_bytes % 4) {
+				writesb(plat->ahbbase,
+					txbuf + rounddown(write_bytes, 4),
+					write_bytes % 4);
+			}

You can probably pull this block from the else branch.

Quoted 3 lines

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Sure , just send a V2 and CC me.

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

In reply to Vignesh R
Quoted 46 lines · Vignesh R

Hi,

Quoted 34 lines · Marek Vasut
Quoted 33 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 19 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +2 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
 	while (remaining > 0) {
 		write_bytes = remaining > page_size ? page_size : remaining;
 		/* Handle non-4-byte aligned access to avoid data abort. */
-		if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+		if ((uintptr_t)txbuf % 4) {
 			writesb(plat->ahbbase, txbuf, write_bytes);
-		else
+		} else {
Quoted 8 lines
Quoted 6 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 6 lines
drivers/spi/cadence_qspi_apb.c +5 -0
 			writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+			if (write_bytes % 4) {
+				writesb(plat->ahbbase,
+					txbuf + rounddown(write_bytes, 4),
+					write_bytes % 4);
+			}

You can probably pull this block from the else branch.

Quoted 1 line

Yeah, I guess writesb() can handle zero byte write request I believe.

Hmmmm, good point, in which case this is OK as-is.

Quoted 1 line

With above change, can I have your Acked-by/Reviewed-by?

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

In reply to Vignesh R
Quoted 46 lines · Vignesh R

Hi,

Quoted 34 lines · Marek Vasut
Quoted 33 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 19 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +2 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
    while (remaining > 0) {
            write_bytes = remaining > page_size ? page_size : remaining;
            /* Handle non-4-byte aligned access to avoid data abort. */
-           if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+           if ((uintptr_t)txbuf % 4) {
                    writesb(plat->ahbbase, txbuf, write_bytes);
-           else
+           } else {
Quoted 8 lines
Quoted 6 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 6 lines
drivers/spi/cadence_qspi_apb.c +5 -0
                    writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+                   if (write_bytes % 4) {
+                           writesb(plat->ahbbase,
+                                   txbuf + rounddown(write_bytes, 4),
+                                   write_bytes % 4);
+                   }

You can probably pull this block from the else branch.

Quoted 3 lines

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Also try to get the 'sf update' data before and after and append it on commit message.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#7 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 47 lines · Jagan Teki
Quoted 46 lines · Vignesh R

Hi,

Quoted 42 lines · Marek Vasut
Quoted 31 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 17 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +1 -1
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
    while (remaining > 0) {
            write_bytes = remaining > page_size ? page_size : remaining;
            /* Handle non-4-byte aligned access to avoid data abort. */
-           if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+           if ((uintptr_t)txbuf % 4) {
                    writesb(plat->ahbbase, txbuf, write_bytes);
Quoted 8 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 8 lines
drivers/spi/cadence_qspi_apb.c +6 -1
-           else
+           } else {
                    writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+                   if (write_bytes % 4) {
+                           writesb(plat->ahbbase,
+                                   txbuf + rounddown(write_bytes, 4),
+                                   write_bytes % 4);
+                   }

You can probably pull this block from the else branch.

Quoted 6 lines
Quoted 3 lines

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Also try to get the 'sf update' data before and after and append it on commit message.

Why? Seems useless to me.

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 48 lines · Marek Vasut
Quoted 47 lines · Jagan Teki
Quoted 46 lines · Vignesh R

Hi,

Quoted 42 lines · Marek Vasut
Quoted 31 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 17 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +1 -1
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
    while (remaining > 0) {
            write_bytes = remaining > page_size ? page_size : remaining;
            /* Handle non-4-byte aligned access to avoid data abort. */
-           if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+           if ((uintptr_t)txbuf % 4) {
                    writesb(plat->ahbbase, txbuf, write_bytes);
Quoted 8 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 8 lines
drivers/spi/cadence_qspi_apb.c +6 -1
-           else
+           } else {
                    writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+                   if (write_bytes % 4) {
+                           writesb(plat->ahbbase,
+                                   txbuf + rounddown(write_bytes, 4),
+                                   write_bytes % 4);
+                   }

You can probably pull this block from the else branch.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Also try to get the 'sf update' data before and after and append it on commit message.

Why? Seems useless to me.

Since it's a performance improvement patch better to have that numbers, no harm getting that data.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#9 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 53 lines · Jagan Teki
Quoted 52 lines · Marek Vasut
Quoted 51 lines · Jagan Teki
Quoted 49 lines · Vignesh R

Hi,

Quoted 34 lines · Marek Vasut
Quoted 33 lines · Vignesh R
Quoted 8 lines · Vignesh R

If the write transaction size(write_bytes) is not a multiple of word length, then issue word length writes till the we reach the dangling bytes. On the final write, issue byte by byte write to complete the transaction. This marginally improves write throughput when performing random sized writes to the flash.

---

Gentle ping... Any comments?

Quoted 19 lines

Tested on K2G GP EVM.

 drivers/spi/cadence_qspi_apb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/cadence_qspi_apb.c +2 -2
index e285d3c1e761..4b891f227243 100644
@@ -752,10 +752,16 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat,
    while (remaining > 0) {
            write_bytes = remaining > page_size ? page_size : remaining;
            /* Handle non-4-byte aligned access to avoid data abort. */
-           if (((uintptr_t)txbuf % 4) || (write_bytes % 4))
+           if ((uintptr_t)txbuf % 4) {
                    writesb(plat->ahbbase, txbuf, write_bytes);
-           else
+           } else {
Quoted 8 lines
Quoted 6 lines

drivers/spi/cadence_qspi_apb.c int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, · line 763

Quoted 6 lines
drivers/spi/cadence_qspi_apb.c +5 -0
                    writesl(plat->ahbbase, txbuf, write_bytes >> 2);
+                   if (write_bytes % 4) {
+                           writesb(plat->ahbbase,
+                                   txbuf + rounddown(write_bytes, 4),
+                                   write_bytes % 4);
+                   }

You can probably pull this block from the else branch.

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Also try to get the 'sf update' data before and after and append it on commit message.

Why? Seems useless to me.

Since it's a performance improvement patch better to have that numbers, no harm getting that data.

Urghhhh, sf update is mixing multiple access patterns, it is by no means a good performance metric for evaluating performance of the write path.

What you would need to do here is perform long unaligned writes repeatedly (to eliminate outliers) and measure the improvement. And you'd have to make sure the erase cycle is not counted in.

I suspect the performance improvement would be negligible, but I'd be happy to be proven wrong. If it'd be negligible, then we should probably not complicate the code more and just drop this patch.

Signature · 2 lines
Best regards,
Marek Vasut
author
#10 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 5 lines · Marek Vasut
Quoted 4 lines · Jagan Teki
Quoted 3 lines · Marek Vasut
Quoted 2 lines · Jagan Teki
Quoted 1 line · Vignesh R

Hi,

...

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

You can probably pull this block from the else branch.

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Also try to get the 'sf update' data before and after and append it on commit message.

Why? Seems useless to me.

Since it's a performance improvement patch better to have that numbers, no harm getting that data.

Urghhhh, sf update is mixing multiple access patterns, it is by no means a good performance metric for evaluating performance of the write path.

Quoted 9 lines

What you would need to do here is perform long unaligned writes repeatedly (to eliminate outliers) and measure the improvement. And you'd have to make sure the erase cycle is not counted in.

I suspect the performance improvement would be negligible, but I'd be happy to be proven wrong. If it'd be negligible, then we should probably not complicate the code more and just drop this patch.

Today, I was performing unaligned writes of various sizes to get performance numbers and discovered that unaligned writes (i.e txbuf address is not word aligned or write_byte % 4 != 0) are sometimes failing on TI platforms with Cadence QSPI (with or w/o this patch) :( Reverting the patch "mtd: cqspi: Simplify indirect write code" seems to be helping. I don't see anything obviously wrong here. Let me debug whats causing the difference and get back.

Signature · 2 lines
Regards
Vignesh
#11 lore raw

PATCH 1/1 spi: cadence_qspi_apb: Improve indirect write transaction

Quoted 37 lines · Vignesh R
Quoted 5 lines · Marek Vasut
Quoted 4 lines · Jagan Teki
Quoted 3 lines · Marek Vasut
Quoted 2 lines · Jagan Teki
Quoted 1 line · Vignesh R

Hi,

...

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

You can probably pull this block from the else branch.

Yeah, I guess writesb() can handle zero byte write request I believe.

With above change, can I have your Acked-by/Reviewed-by?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Also try to get the 'sf update' data before and after and append it on commit message.

Why? Seems useless to me.

Since it's a performance improvement patch better to have that numbers, no harm getting that data.

Urghhhh, sf update is mixing multiple access patterns, it is by no means a good performance metric for evaluating performance of the write path.

Quoted 9 lines

What you would need to do here is perform long unaligned writes repeatedly (to eliminate outliers) and measure the improvement. And you'd have to make sure the erase cycle is not counted in.

I suspect the performance improvement would be negligible, but I'd be happy to be proven wrong. If it'd be negligible, then we should probably not complicate the code more and just drop this patch.

Quoted 7 lines

Today, I was performing unaligned writes of various sizes to get performance numbers and discovered that unaligned writes (i.e txbuf address is not word aligned or write_byte % 4 != 0) are sometimes failing on TI platforms with Cadence QSPI (with or w/o this patch) :( Reverting the patch "mtd: cqspi: Simplify indirect write code" seems to be helping. I don't see anything obviously wrong here. Let me debug whats causing the difference and get back.

Can you please drill into it ? I'd be happy to help testing.

Signature · 2 lines
Best regards,
Marek Vasut