]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: zynq_qspi: Read only one byte at a time from txbuf
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Mon, 31 Jan 2022 05:22:38 +0000 (22:22 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 4 Feb 2022 12:20:12 +0000 (13:20 +0100)
Read only one byte at a time from txbuf as txbuf may not be
aligned and accessing more than a byte at a time may cause
alignment issues. This fixes the issue of data abort exception
while writing to flash device.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220131052240.23403-3-ashok.reddy.soma@xilinx.com
drivers/spi/zynq_qspi.c

index 34d39d66fb1bfb297278563e6e68ba5743ce5d26..aa060d7940aae30efe59e01893f760d8f50f320e 100644 (file)
@@ -276,13 +276,17 @@ static void zynq_qspi_write_data(struct  zynq_qspi_priv *priv,
                        *data |= 0xFFFFFF00;
                        break;
                case 2:
-                       *data = *((u16 *)priv->tx_buf);
-                       priv->tx_buf += 2;
+                       *data = *((u8 *)priv->tx_buf);
+                       priv->tx_buf += 1;
+                       *data |= (*((u8 *)priv->tx_buf) << 8);
+                       priv->tx_buf += 1;
                        *data |= 0xFFFF0000;
                        break;
                case 3:
-                       *data = *((u16 *)priv->tx_buf);
-                       priv->tx_buf += 2;
+                       *data = *((u8 *)priv->tx_buf);
+                       priv->tx_buf += 1;
+                       *data |= (*((u8 *)priv->tx_buf) << 8);
+                       priv->tx_buf += 1;
                        *data |= (*((u8 *)priv->tx_buf) << 16);
                        priv->tx_buf += 1;
                        *data |= 0xFF000000;