Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: imx: add 16/32 bits per word support for target PIO mode

Enable 16/32 bits per word support for spi-imx target PIO mode.

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20251118065012.1418279-1-carlos.song@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Carlos Song and committed by
Mark Brown
4dbb5f6e f2fb3f7b

+19 -2
+19 -2
drivers/spi/spi-imx.c
··· 425 425 426 426 static void mx53_ecspi_rx_target(struct spi_imx_data *spi_imx) 427 427 { 428 - u32 val = ioread32be(spi_imx->base + MXC_CSPIRXDATA); 428 + u32 val = readl(spi_imx->base + MXC_CSPIRXDATA); 429 + #ifdef __LITTLE_ENDIAN 430 + unsigned int bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word); 429 431 432 + if (bytes_per_word == 1) 433 + swab32s(&val); 434 + else if (bytes_per_word == 2) 435 + swahw32s(&val); 436 + #endif 430 437 if (spi_imx->rx_buf) { 431 438 int n_bytes = spi_imx->target_burst % sizeof(val); 432 439 ··· 454 447 { 455 448 u32 val = 0; 456 449 int n_bytes = spi_imx->count % sizeof(val); 450 + #ifdef __LITTLE_ENDIAN 451 + unsigned int bytes_per_word; 452 + #endif 457 453 458 454 if (!n_bytes) 459 455 n_bytes = sizeof(val); ··· 469 459 470 460 spi_imx->count -= n_bytes; 471 461 472 - iowrite32be(val, spi_imx->base + MXC_CSPITXDATA); 462 + #ifdef __LITTLE_ENDIAN 463 + bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word); 464 + if (bytes_per_word == 1) 465 + swab32s(&val); 466 + else if (bytes_per_word == 2) 467 + swahw32s(&val); 468 + #endif 469 + writel(val, spi_imx->base + MXC_CSPITXDATA); 473 470 } 474 471 475 472 /* MX51 eCSPI */