spi: zynqmp_gqspi: Fix issue of reading more than 32bits length
authorAshok Reddy Soma <ashok.reddy.soma@amd.com>
Thu, 25 Aug 2022 12:59:04 +0000 (06:59 -0600)
committerMichal Simek <michal.simek@amd.com>
Tue, 13 Sep 2022 09:32:48 +0000 (11:32 +0200)
commita3d4bfb427fb6e8c9396a744879796231deabc3d
treea1d814014404a2ae2d9f6fa530b0a9316f4d4271
parentd91b0f4a1851f5c7c651c6f6204417035c074a0a
spi: zynqmp_gqspi: Fix issue of reading more than 32bits length

As the flash sizes are increasing day by day, QSPI can have devices of
size > 512MB. In qspi driver we are trying to read all the data at once
using DMA.

The DMA descriptor destination size is only 29bits long.

QSPIDMA_DST_SIZE 0xFF0F0804

BITS:  1:0      Reserved to keep word alignment
BITS: 28:2      Number of 4-byte words the DMA will transfer
BITS: 31:29     Reserved: Returns 0 when read, writes ignored

So we can only transfer data of 0x1FFFFFF0(512MB minus 4bytes) bytes.
Anything above will overflow this register and will ignore higher bits
above 29 bits.

Change the DMA functionality if the requested size is greater than or
equal to 512MB to read 256MB chunks.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20220825125906.11581-5-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/spi/zynqmp_gqspi.c