From 26893da5a3dc13c01c65dd11d638b8a71ed0a97f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 23 Sep 2013 11:25:39 -0600 Subject: SAMA5 HSMCI DMA clean-up. There are still some issues --- nuttx/arch/arm/src/sama5/sam_dmac.c | 6 +++--- nuttx/arch/arm/src/sama5/sam_hsmci.c | 7 ++++--- nuttx/arch/arm/src/sama5/sam_udphs.c | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nuttx/arch/arm/src/sama5/sam_dmac.c b/nuttx/arch/arm/src/sama5/sam_dmac.c index 1149976fc..cfff7f1c2 100644 --- a/nuttx/arch/arm/src/sama5/sam_dmac.c +++ b/nuttx/arch/arm/src/sama5/sam_dmac.c @@ -192,10 +192,11 @@ static const uint32_t g_fifocfg[3] = * before each DMA transfer in order to map the peripheral IDs to the * correct channel. This must be done because the channel can change with * the direction of the transfer. - * - * DMA controller 0, RX DMA: */ +#ifdef CONFIG_SAMA5_DMAC0 +/* DMA controller 0, RX DMA: */ + static const struct sam_pidmap_s g_dmac0_rxchan[] = { { SAM_PID_HSMCI0, DMAC0_CH_HSMCI0 }, /* HSMCI0 Receive/transmit */ @@ -210,7 +211,6 @@ static const struct sam_pidmap_s g_dmac0_rxchan[] = }; #define NDMAC0_RXCHANNELS (sizeof(g_dmac0_rxchan) / sizeof(struct sam_pidmap_s)) -#ifdef CONFIG_SAMA5_DMAC0 /* DMA controller 0, TX DMA: */ static const struct sam_pidmap_s g_dmac0_txchan[] = diff --git a/nuttx/arch/arm/src/sama5/sam_hsmci.c b/nuttx/arch/arm/src/sama5/sam_hsmci.c index c4b47210f..e57ec0438 100644 --- a/nuttx/arch/arm/src/sama5/sam_hsmci.c +++ b/nuttx/arch/arm/src/sama5/sam_hsmci.c @@ -131,6 +131,8 @@ * REVISIT: Is memory always on IF0? */ +#define HSMCI_DMA_CHKSIZE HSMCI_DMA_CHKSIZE_1 + #define DMA_FLAGS(pid) \ (((pid) << DMACH_FLAG_PERIPHPID_SHIFT) | DMACH_FLAG_PERIPHAHB_AHB_IF2 | \ DMACH_FLAG_PERIPHH2SEL | DMACH_FLAG_PERIPHISPERIPH | \ @@ -1279,7 +1281,6 @@ static void sam_notransfer(struct sam_dev_s *priv) /* Clear the block size and count */ sam_putreg(priv, 0, SAM_HSMCI_BLKR_OFFSET); - } /**************************************************************************** @@ -2555,7 +2556,7 @@ static int sam_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, /* Enable DMA handshaking */ - sam_putreg(priv, HSMCI_DMA_DMAEN, SAM_HSMCI_DMA_OFFSET); + sam_putreg(priv, HSMCI_DMA_DMAEN | HSMCI_DMA_CHKSIZE, SAM_HSMCI_DMA_OFFSET); sam_xfrsample(priv, SAMPLENDX_BEFORE_ENABLE); /* Start the DMA */ @@ -2618,7 +2619,7 @@ static int sam_dmasendsetup(FAR struct sdio_dev_s *dev, /* Enable DMA handshaking */ - sam_putreg(priv, HSMCI_DMA_DMAEN, SAM_HSMCI_DMA_OFFSET); + sam_putreg(priv, HSMCI_DMA_DMAEN | HSMCI_DMA_CHKSIZE, SAM_HSMCI_DMA_OFFSET); sam_xfrsample(priv, SAMPLENDX_BEFORE_ENABLE); /* Start the DMA */ diff --git a/nuttx/arch/arm/src/sama5/sam_udphs.c b/nuttx/arch/arm/src/sama5/sam_udphs.c index b5215627c..ddbb97521 100644 --- a/nuttx/arch/arm/src/sama5/sam_udphs.c +++ b/nuttx/arch/arm/src/sama5/sam_udphs.c @@ -3683,7 +3683,7 @@ static int sam_ep_stall(struct usbdev_ep_s *ep, bool resume) /* Check that endpoint is in Idle state */ privep = (struct sam_ep_s *)ep; - DEBUGASSERT(privep->epstate == UDPHS_EPSTATE_IDLE && privep->dev); + DEBUGASSERT(/* privep->epstate == UDPHS_EPSTATE_IDLE && */ privep->dev); priv = (struct sam_usbdev_s *)privep->dev; epno = USB_EPNO(ep->eplog); -- cgit v1.2.3