kinetis:spi remove ttype & do cache ops

This commit is contained in:
David Sidrane 2022-06-08 12:28:02 -07:00 committed by Xiang Xiao
parent 22580584d2
commit 050ce3e0d3

View File

@ -1222,13 +1222,16 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE; config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.ttype = EDMA_PERIPH2MEM;
config.nbytes = adjust; config.nbytes = adjust;
#ifdef CONFIG_KINETIS_EDMA_ELINK #ifdef CONFIG_KINETIS_EDMA_ELINK
config.linkch = NULL; config.linkch = NULL;
#endif #endif
kinetis_dmach_xfrsetup(priv->rxdma, &config); kinetis_dmach_xfrsetup(priv->rxdma, &config);
up_invalidate_dcache((uintptr_t)config.daddr,
(uintptr_t)config.daddr +
config.iter * config.nbytes);
config.saddr = (uint32_t) (txbuffer ? txbuffer : &txdummy); config.saddr = (uint32_t) (txbuffer ? txbuffer : &txdummy);
config.daddr = priv->spibase + KINETIS_SPI_PUSHR_OFFSET; config.daddr = priv->spibase + KINETIS_SPI_PUSHR_OFFSET;
config.soff = txbuffer ? adjust : 0; config.soff = txbuffer ? adjust : 0;
@ -1237,11 +1240,14 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE; config.flags = EDMA_CONFIG_LINKTYPE_LINKNONE;
config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; config.ssize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT; config.dsize = adjust == 1 ? EDMA_8BIT : EDMA_16BIT;
config.ttype = EDMA_MEM2PERIPH;
config.nbytes = adjust; config.nbytes = adjust;
#ifdef CONFIG_KINETIS_EDMA_ELINK #ifdef CONFIG_KINETIS_EDMA_ELINK
config.linkch = NULL; config.linkch = NULL;
#endif #endif
up_clean_dcache((uintptr_t)config.saddr,
(uintptr_t)config.saddr + nbytes * adjust);
kinetis_dmach_xfrsetup(priv->txdma, &config); kinetis_dmach_xfrsetup(priv->txdma, &config);
spi_modifyreg(priv, KINETIS_SPI_RSER_OFFSET, 0 , spi_modifyreg(priv, KINETIS_SPI_RSER_OFFSET, 0 ,