Re: [PATCH v11 4/9] spi: cadence: Add Marvell SDMA operations

From: Geert Uytterhoeven
Date: Tue Jul 30 2024 - 04:33:20 EST


Hi Witold,

On Wed, Jul 24, 2024 at 5:48 PM Witold Sadowski <wsadowski@xxxxxxxxxxx> wrote:
> In Marvell xSPI implementation any access to SDMA register will result
> in 8 byte SPI data transfer. Reading less data(eg. 1B) will result in
> losing remaining bytes. To avoid that read/write 8 bytes into temporary
> buffer, and read/write whole temporary buffer into SDMA.
>
> Signed-off-by: Witold Sadowski <wsadowski@xxxxxxxxxxx>

Thanks for your patch, which is now commit 75128e2a14a9f443
("spi: cadence: Add Marvell SDMA operations") in linux-next/master
next-20240730 spi/for-next

> --- a/drivers/spi/spi-cadence-xspi.c
> +++ b/drivers/spi/spi-cadence-xspi.c
> @@ -310,6 +310,7 @@ struct cdns_xspi_dev {
> u8 hw_num_banks;
>
> const struct cdns_xspi_driver_data *driver_data;
> + void (*sdma_handler)(struct cdns_xspi_dev *cdns_xspi);
> };
>
> static void cdns_xspi_reset_dll(struct cdns_xspi_dev *cdns_xspi)
> @@ -515,6 +516,78 @@ static void cdns_xspi_sdma_handle(struct cdns_xspi_dev *cdns_xspi)
> }
> }
>
> +static void m_ioreadq(void __iomem *addr, void *buf, int len)
> +{
> + if (IS_ALIGNED((long)buf, 8) && len >= 8) {
> + u64 full_ops = len / 8;
> + u64 *buffer = buf;
> +
> + len -= full_ops * 8;
> + buf += full_ops * 8;
> +
> + do {
> + u64 b = readq(addr);

noreply@xxxxxxxxxxxxxx reports build failures on 32-bit (e.g. [1]):

drivers/spi/spi-cadence-xspi.c:612:33: error: implicit declaration of
function 'readq'; did you mean 'readb'?
[-Werror=implicit-function-declaration]
drivers/spi/spi-cadence-xspi.c:638:25: error: implicit declaration of
function 'writeq'; did you mean 'writel'?
[-Werror=implicit-function-declaration]


readq() and writeq() are not available on 32-bit platforms, so this
driver has to
depend on 64BIT (for compile-testing).

> + *buffer++ = b;
> + } while (--full_ops);
> + }

[1] http://kisskb.ellerman.id.au/kisskb/buildresult/15210014/

Gr{oetje,eeting}s,

Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds