Commit baaadffe authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by Mark Brown

spi: spi-imx: spi_imx_buf_rx_swap_u32(): replace open coded swahw32s()

This patch replaces an open coded swahw32s().
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20220502175457.1977983-6-mkl@pengutronix.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent dae336d0
...@@ -290,17 +290,16 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi, ...@@ -290,17 +290,16 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
static void spi_imx_buf_rx_swap_u32(struct spi_imx_data *spi_imx) static void spi_imx_buf_rx_swap_u32(struct spi_imx_data *spi_imx)
{ {
unsigned int val = readl(spi_imx->base + MXC_CSPIRXDATA); unsigned int val = readl(spi_imx->base + MXC_CSPIRXDATA);
#ifdef __LITTLE_ENDIAN
unsigned int bytes_per_word;
#endif
if (spi_imx->rx_buf) { if (spi_imx->rx_buf) {
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
unsigned int bytes_per_word;
bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word); bytes_per_word = spi_imx_bytes_per_word(spi_imx->bits_per_word);
if (bytes_per_word == 1) if (bytes_per_word == 1)
swab32s(&val); swab32s(&val);
else if (bytes_per_word == 2) else if (bytes_per_word == 2)
val = (val << 16) | (val >> 16); swahw32s(&val);
#endif #endif
*(u32 *)spi_imx->rx_buf = val; *(u32 *)spi_imx->rx_buf = val;
spi_imx->rx_buf += sizeof(u32); spi_imx->rx_buf += sizeof(u32);
...@@ -356,7 +355,7 @@ static void spi_imx_buf_tx_swap_u32(struct spi_imx_data *spi_imx) ...@@ -356,7 +355,7 @@ static void spi_imx_buf_tx_swap_u32(struct spi_imx_data *spi_imx)
if (bytes_per_word == 1) if (bytes_per_word == 1)
swab32s(&val); swab32s(&val);
else if (bytes_per_word == 2) else if (bytes_per_word == 2)
val = (val << 16) | (val >> 16); swahw32s(&val);
#endif #endif
writel(val, spi_imx->base + MXC_CSPITXDATA); writel(val, spi_imx->base + MXC_CSPITXDATA);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment