s32ke3xx:EDMA Usage Clean up

This commit is contained in:
David Sidrane 2022-12-14 05:47:15 -08:00 committed by Xiang Xiao
parent df4eb4896d
commit 89f99dceed
3 changed files with 14 additions and 8 deletions

View File

@ -180,7 +180,6 @@ struct s32k3xx_edma_xfrconfig_s
uint8_t flags; /* See EDMA_CONFIG_* definitions */
uint8_t ssize; /* Source data transfer size (see TCD_ATTR_SIZE_* definitions in rdware/. */
uint8_t dsize; /* Destination data transfer size. */
uint8_t ttype; /* Transfer type (see enum s32k3xx_edma_xfrtype_e). */
#ifdef CONFIG_S32K3XX_EDMA_EMLIM
uint16_t nbytes; /* Bytes to transfer in a minor loop */
#else

View File

@ -1752,6 +1752,17 @@ static void s32k3xx_lpspi_exchange(struct spi_dev_s *dev,
s32k3xx_lpspi_putreg32(priv, S32K3XX_LPSPI_DER_OFFSET, 0);
if (txbuffer)
{
up_clean_dcache((uintptr_t)txbuffer, (uintptr_t)txbuffer + nbytes);
}
if (rxbuffer)
{
up_invalidate_dcache((uintptr_t)rxbuffer,
(uintptr_t)rxbuffer + nbytes);
}
/* Set up the DMA */
adjust = (priv->nbits > 8) ? 2 : 1;
@ -1766,7 +1777,6 @@ static void s32k3xx_lpspi_exchange(struct spi_dev_s *dev,
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.ttype = EDMA_PERIPH2MEM;
config.nbytes = adjust;
#ifdef CONFIG_KINETIS_EDMA_ELINK
config.linkch = NULL;
@ -1781,7 +1791,6 @@ static void s32k3xx_lpspi_exchange(struct spi_dev_s *dev,
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.ttype = EDMA_MEM2PERIPH;
config.nbytes = adjust;
#ifdef CONFIG_KINETIS_EDMA_ELINK
config.linkch = NULL;
@ -1816,9 +1825,6 @@ static void s32k3xx_lpspi_exchange(struct spi_dev_s *dev,
/* Disable DMA */
s32k3xx_lpspi_putreg32(priv, S32K3XX_LPSPI_DER_OFFSET, 0);
up_invalidate_dcache((uintptr_t)rxbuffer,
(uintptr_t)rxbuffer + nbytes);
}
#endif /* CONFIG_S32K3XX_SPI_DMA */

View File

@ -803,7 +803,6 @@ static int qspi_receive(struct s32k3xx_qspidev_s *priv,
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = EDMA_16BYTE;
config.dsize = EDMA_16BYTE;
config.ttype = EDMA_PERIPH2MEM;
config.nbytes = 16;
#ifdef CONFIG_KINETIS_EDMA_ELINK
config.linkch = NULL;
@ -1029,6 +1028,9 @@ static int qspi_transmit(struct s32k3xx_qspidev_s *priv,
putreg32(QSPI_AMBA_BASE + meminfo->addr, S32K3XX_QSPI_SFAR);
up_clean_dcache((uintptr_t)meminfo->buffer,
(uintptr_t)meminfo->buffer + meminfo->buflen);
/* Set up the DMA */
uint32_t adjust = 1;
@ -1043,7 +1045,6 @@ static int qspi_transmit(struct s32k3xx_qspidev_s *priv,
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = EDMA_32BIT;
config.dsize = EDMA_32BIT;
config.ttype = EDMA_MEM2PERIPH;
config.nbytes = 4;
#ifdef CONFIG_KINETIS_EDMA_ELINK
config.linkch = NULL;