s32k1xx:Apply style changes from code review

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
David Sidrane 2022-12-15 07:22:32 -05:00 committed by Xiang Xiao
parent 75baa5b932
commit 707ac4b8f6

View File

@ -79,8 +79,8 @@
#include "s32k1xx_lpspi.h" #include "s32k1xx_lpspi.h"
#ifdef CONFIG_S32K1XX_LPSPI_DMA #ifdef CONFIG_S32K1XX_LPSPI_DMA
#include "hardware/s32k1xx_dmamux.h" # include "hardware/s32k1xx_dmamux.h"
#include "s32k1xx_edma.h" # include "s32k1xx_edma.h"
#endif #endif
#include <arch/board/board.h> #include <arch/board/board.h>
@ -1000,8 +1000,8 @@ static uint32_t s32k1xx_lpspi_setfrequency(struct spi_dev_s *dev,
/* Write the best values in the CCR register */ /* Write the best values in the CCR register */
s32k1xx_lpspi_modifyreg32(priv, S32K1XX_LPSPI_TCR_OFFSET, s32k1xx_lpspi_modifyreg32(priv, S32K1XX_LPSPI_TCR_OFFSET,
LPSPI_TCR_PRESCALE_MASK, LPSPI_TCR_PRESCALE_MASK,
LPSPI_TCR_PRESCALE(best_prescaler)); LPSPI_TCR_PRESCALE(best_prescaler));
priv->frequency = frequency; priv->frequency = frequency;
priv->actual = best_frequency; priv->actual = best_frequency;
@ -1011,7 +1011,7 @@ static uint32_t s32k1xx_lpspi_setfrequency(struct spi_dev_s *dev,
s32k1xx_lpspi_set_delays(priv, 1000000000 / best_frequency, s32k1xx_lpspi_set_delays(priv, 1000000000 / best_frequency,
LPSPI_LAST_SCK_TO_PCS); LPSPI_LAST_SCK_TO_PCS);
s32k1xx_lpspi_set_delays(priv, 1000000000 / best_frequency, s32k1xx_lpspi_set_delays(priv, 1000000000 / best_frequency,
LPSPI_BETWEEN_TRANSFER); LPSPI_BETWEEN_TRANSFER);
s32k1xx_lpspi_modifyreg32(priv, S32K1XX_LPSPI_CCR_OFFSET, s32k1xx_lpspi_modifyreg32(priv, S32K1XX_LPSPI_CCR_OFFSET,
LPSPI_CCR_SCKDIV_MASK, LPSPI_CCR_SCKDIV_MASK,
@ -1646,12 +1646,12 @@ static void s32k1xx_lpspi_exchange(struct spi_dev_s *dev,
const void *txbuffer, void *rxbuffer, const void *txbuffer, void *rxbuffer,
size_t nwords) size_t nwords)
{ {
int ret; int ret;
size_t adjust; size_t adjust;
ssize_t nbytes; ssize_t nbytes;
static uint8_t rxdummy[4] aligned_data(4); static uint8_t rxdummy[4] aligned_data(4);
static const uint16_t txdummy = 0xffff; static const uint16_t txdummy = 0xffff;
uint32_t regval; uint32_t regval;
struct s32k1xx_lpspidev_s *priv = (struct s32k1xx_lpspidev_s *)dev; struct s32k1xx_lpspidev_s *priv = (struct s32k1xx_lpspidev_s *)dev;
DEBUGASSERT(priv != NULL); DEBUGASSERT(priv != NULL);
@ -1703,7 +1703,7 @@ static void s32k1xx_lpspi_exchange(struct spi_dev_s *dev,
struct s32k1xx_edma_xfrconfig_s config; struct s32k1xx_edma_xfrconfig_s config;
config.saddr = priv->spibase + S32K1XX_LPSPI_RDR_OFFSET; config.saddr = priv->spibase + S32K1XX_LPSPI_RDR_OFFSET;
config.daddr = (uint32_t) (rxbuffer ? rxbuffer : rxdummy); config.daddr = (uint32_t)(rxbuffer ? rxbuffer : rxdummy);
config.soff = 0; config.soff = 0;
config.doff = rxbuffer ? adjust : 0; config.doff = rxbuffer ? adjust : 0;
config.iter = nbytes; config.iter = nbytes;
@ -1716,7 +1716,7 @@ static void s32k1xx_lpspi_exchange(struct spi_dev_s *dev,
#endif #endif
s32k1xx_dmach_xfrsetup(priv->rxdma, &config); s32k1xx_dmach_xfrsetup(priv->rxdma, &config);
config.saddr = (uint32_t) (txbuffer ? txbuffer : &txdummy); config.saddr = (uint32_t)(txbuffer ? txbuffer : &txdummy);
config.daddr = priv->spibase + S32K1XX_LPSPI_TDR_OFFSET; config.daddr = priv->spibase + S32K1XX_LPSPI_TDR_OFFSET;
config.soff = txbuffer ? adjust : 0; config.soff = txbuffer ? adjust : 0;
config.doff = 0; config.doff = 0;
@ -1760,7 +1760,7 @@ static void s32k1xx_lpspi_exchange(struct spi_dev_s *dev,
s32k1xx_lpspi_putreg32(priv, S32K1XX_LPSPI_DER_OFFSET, 0); s32k1xx_lpspi_putreg32(priv, S32K1XX_LPSPI_DER_OFFSET, 0);
up_invalidate_dcache((uintptr_t)rxbuffer, up_invalidate_dcache((uintptr_t)rxbuffer,
(uintptr_t)rxbuffer + nbytes); (uintptr_t)rxbuffer + nbytes);
} }
#endif /* CONFIG_S32K1XX_SPI_DMA */ #endif /* CONFIG_S32K1XX_SPI_DMA */