bcmf: enable DMA for SDIO transfers

This commit is contained in:
Simon Piriou
2017-04-26 17:23:53 +02:00
parent 1c97025484
commit 6bb2db8c15
4 changed files with 50 additions and 12 deletions
+22 -2
View File
@@ -2721,7 +2721,17 @@ static int stm32_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
/* Then set up the SDIO data path */ /* Then set up the SDIO data path */
dblocksize = stm32_log2(buflen) << SDIO_DCTRL_DBLOCKSIZE_SHIFT; #ifdef CONFIG_SDIO_BLOCKSETUP
if (priv->block_size != STM32_SDIO_USE_DEFAULT_BLOCKSIZE)
{
dblocksize = priv->block_size << SDIO_DCTRL_DBLOCKSIZE_SHIFT;
}
else
#endif
{
dblocksize = stm32_log2(buflen) << SDIO_DCTRL_DBLOCKSIZE_SHIFT;
}
stm32_dataconfig(SDIO_DTIMER_DATATIMEOUT, buflen, dblocksize | SDIO_DCTRL_DTDIR); stm32_dataconfig(SDIO_DTIMER_DATATIMEOUT, buflen, dblocksize | SDIO_DCTRL_DTDIR);
/* Configure the RX DMA */ /* Configure the RX DMA */
@@ -2790,7 +2800,17 @@ static int stm32_dmasendsetup(FAR struct sdio_dev_s *dev,
/* Then set up the SDIO data path */ /* Then set up the SDIO data path */
dblocksize = stm32_log2(buflen) << SDIO_DCTRL_DBLOCKSIZE_SHIFT; #ifdef CONFIG_SDIO_BLOCKSETUP
if (priv->block_size != STM32_SDIO_USE_DEFAULT_BLOCKSIZE)
{
dblocksize = priv->block_size << SDIO_DCTRL_DBLOCKSIZE_SHIFT;
}
else
#endif
{
dblocksize = stm32_log2(buflen) << SDIO_DCTRL_DBLOCKSIZE_SHIFT;
}
stm32_dataconfig(SDIO_DTIMER_DATATIMEOUT, buflen, dblocksize); stm32_dataconfig(SDIO_DTIMER_DATATIMEOUT, buflen, dblocksize);
/* Configure the TX DMA */ /* Configure the TX DMA */
+11
View File
@@ -237,6 +237,17 @@
# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT) # define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
#endif #endif
/* DMA Channl/Stream Selections *****************************************************/
/* Stream selections are arbitrary for now but might become important in the future
* if we set aside more DMA channels/streams.
*
* SDIO DMA
* DMAMAP_SDIO_1 = Channel 4, Stream 3
* DMAMAP_SDIO_2 = Channel 4, Stream 6
*/
#define DMAMAP_SDIO DMAMAP_SDIO_1
/************************************************************************************ /************************************************************************************
* Public Data * Public Data
************************************************************************************/ ************************************************************************************/
+12 -8
View File
@@ -16,7 +16,7 @@ CONFIG_HOST_LINUX=y
# #
# Build Configuration # Build Configuration
# #
# CONFIG_APPS_DIR="../apps" CONFIG_APPS_DIR="../apps"
CONFIG_BUILD_FLAT=y CONFIG_BUILD_FLAT=y
# CONFIG_BUILD_2PASS is not set # CONFIG_BUILD_2PASS is not set
@@ -75,6 +75,7 @@ CONFIG_DEBUG_WIRELESS_INFO=y
# #
# OS Function Debug Options # OS Function Debug Options
# #
# CONFIG_DEBUG_DMA is not set
# CONFIG_DEBUG_IRQ is not set # CONFIG_DEBUG_IRQ is not set
# #
@@ -449,7 +450,7 @@ CONFIG_STM32_HAVE_SPI3=y
# CONFIG_STM32_CAN2 is not set # CONFIG_STM32_CAN2 is not set
# CONFIG_STM32_CRC is not set # CONFIG_STM32_CRC is not set
# CONFIG_STM32_DMA1 is not set # CONFIG_STM32_DMA1 is not set
# CONFIG_STM32_DMA2 is not set CONFIG_STM32_DMA2=y
# CONFIG_STM32_DAC1 is not set # CONFIG_STM32_DAC1 is not set
# CONFIG_STM32_DAC2 is not set # CONFIG_STM32_DAC2 is not set
# CONFIG_STM32_I2C1 is not set # CONFIG_STM32_I2C1 is not set
@@ -499,6 +500,7 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
# CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG is not set # CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG is not set
# CONFIG_STM32_FORCEPOWER is not set # CONFIG_STM32_FORCEPOWER is not set
# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set # CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
# CONFIG_STM32_DMACAPABLE is not set
# #
# Timer Configuration # Timer Configuration
@@ -529,6 +531,7 @@ CONFIG_STM32_SERIALDRIVER=y
CONFIG_STM32_USART1_SERIALDRIVER=y CONFIG_STM32_USART1_SERIALDRIVER=y
# CONFIG_STM32_USART1_1WIREDRIVER is not set # CONFIG_STM32_USART1_1WIREDRIVER is not set
# CONFIG_USART1_RS485 is not set # CONFIG_USART1_RS485 is not set
# CONFIG_USART1_RXDMA is not set
# #
# Serial Driver Configuration # Serial Driver Configuration
@@ -541,6 +544,7 @@ CONFIG_STM32_USART1_SERIALDRIVER=y
# #
# SDIO Configuration # SDIO Configuration
# #
CONFIG_STM32_SDIO_DMA=y
CONFIG_STM32_SDIO_DMAPRIO=0x00010000 CONFIG_STM32_SDIO_DMAPRIO=0x00010000
# CONFIG_STM32_SDIO_WIDTH_D1_ONLY is not set # CONFIG_STM32_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_STM32_HAVE_RTC_COUNTER is not set # CONFIG_STM32_HAVE_RTC_COUNTER is not set
@@ -567,7 +571,7 @@ CONFIG_STM32_SDIO_DMAPRIO=0x00010000
# #
# CONFIG_ARCH_NOINTC is not set # CONFIG_ARCH_NOINTC is not set
# CONFIG_ARCH_VECNOTIRQ is not set # CONFIG_ARCH_VECNOTIRQ is not set
# CONFIG_ARCH_DMA is not set CONFIG_ARCH_DMA=y
CONFIG_ARCH_HAVE_IRQPRIO=y CONFIG_ARCH_HAVE_IRQPRIO=y
# CONFIG_ARCH_L2CACHE is not set # CONFIG_ARCH_L2CACHE is not set
# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set # CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set
@@ -853,7 +857,7 @@ CONFIG_MMCSD_NSLOTS=1
# CONFIG_MMCSD_MMCSUPPORT is not set # CONFIG_MMCSD_MMCSUPPORT is not set
# CONFIG_MMCSD_HAVECARDDETECT is not set # CONFIG_MMCSD_HAVECARDDETECT is not set
CONFIG_ARCH_HAVE_SDIO=y CONFIG_ARCH_HAVE_SDIO=y
# CONFIG_SDIO_DMA is not set CONFIG_SDIO_DMA=y
CONFIG_ARCH_HAVE_SDIOWAIT_WRCOMPLETE=y CONFIG_ARCH_HAVE_SDIOWAIT_WRCOMPLETE=y
CONFIG_MMCSD_SDIO=y CONFIG_MMCSD_SDIO=y
CONFIG_SDIO_PREFLIGHT=y CONFIG_SDIO_PREFLIGHT=y
@@ -1280,6 +1284,10 @@ CONFIG_HAVE_CXXINITIALIZE=y
# Application Configuration # Application Configuration
# #
#
# NxWidgets/NxWM
#
# #
# Built-In Applications # Built-In Applications
# #
@@ -1514,10 +1522,6 @@ CONFIG_NSH_MAX_ROUNDTRIP=20
# CONFIG_NSH_LOGIN is not set # CONFIG_NSH_LOGIN is not set
# CONFIG_NSH_CONSOLE_LOGIN is not set # CONFIG_NSH_CONSOLE_LOGIN is not set
#
# NxWidgets/NxWM
#
# #
# Platform-specific Support # Platform-specific Support
# #
+5 -2
View File
@@ -78,6 +78,8 @@ int sdio_io_rw_direct(FAR struct sdio_dev_s *dev, bool write,
/* Setup CMD52 argument */ /* Setup CMD52 argument */
arg.value = 0;
if (write) if (write)
{ {
arg.cmd52.write_data = inb; arg.cmd52.write_data = inb;
@@ -135,6 +137,7 @@ int sdio_io_rw_extended(FAR struct sdio_dev_s *dev, bool write,
/* Setup CMD53 argument */ /* Setup CMD53 argument */
arg.value = 0;
arg.cmd53.register_address = address & 0x1ffff; arg.cmd53.register_address = address & 0x1ffff;
arg.cmd53.op_code = inc_addr; arg.cmd53.op_code = inc_addr;
arg.cmd53.function_number = function & 7; arg.cmd53.function_number = function & 7;
@@ -169,13 +172,13 @@ int sdio_io_rw_extended(FAR struct sdio_dev_s *dev, bool write,
sdio_sendcmdpoll(dev, SDIO_ACMD53, (uint32_t)arg.value); sdio_sendcmdpoll(dev, SDIO_ACMD53, (uint32_t)arg.value);
ret = SDIO_RECVR5(dev, SDIO_ACMD53, (uint32_t*)&resp); ret = SDIO_RECVR5(dev, SDIO_ACMD53, (uint32_t*)&resp);
SDIO_SENDSETUP(dev, buf, blocklen * nblocks); SDIO_DMASENDSETUP(dev, buf, blocklen * nblocks);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS); wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS);
} }
else else
{ {
// wlinfo("prep read %d\n", blocklen * nblocks); // wlinfo("prep read %d\n", blocklen * nblocks);
SDIO_RECVSETUP(dev, buf, blocklen * nblocks); SDIO_DMARECVSETUP(dev, buf, blocklen * nblocks);
SDIO_SENDCMD(dev, SDIO_ACMD53, (uint32_t)arg.value); SDIO_SENDCMD(dev, SDIO_ACMD53, (uint32_t)arg.value);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS); wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS);