nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerpe...@apache.org
Subject [incubator-nuttx] 02/03: boards: cxd56xx: Add SPI DMA support to cxd56_gs2200m.c
Date Wed, 13 May 2020 11:11:20 GMT
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 65b3accc5170336e8a5df6ce47f3236f84445723
Author: Masayuki Ishikawa <masayuki.ishikawa@gmail.com>
AuthorDate: Tue May 5 11:23:04 2020 +0900

    boards: cxd56xx: Add SPI DMA support to cxd56_gs2200m.c
    
    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
---
 boards/arm/cxd56xx/common/src/cxd56_gs2200m.c | 30 ++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c b/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c
index 211a411..846f8a0 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c
@@ -51,9 +51,17 @@
 
 #include "cxd56_pinconfig.h"
 #include "cxd56_spi.h"
+#include "cxd56_dmac.h"
 #include "cxd56_gpio.h"
 #include "cxd56_gpioint.h"
 
+#define DMA_TXCH       (CONFIG_CXD56_DMAC_SPI5_TX_CH)
+#define DMA_RXCH       (CONFIG_CXD56_DMAC_SPI5_RX_CH)
+#define DMA_TXCH_CFG   (CXD56_DMA_PERIPHERAL_SPI5_TX)
+#define DMA_RXCH_CFG   (CXD56_DMA_PERIPHERAL_SPI5_RX)
+#define SPI_TX_MAXSIZE (CONFIG_CXD56_DMAC_SPI5_TX_MAXSIZE)
+#define SPI_RX_MAXSIZE (CONFIG_CXD56_DMAC_SPI5_RX_MAXSIZE)
+
 /****************************************************************************
  * Private Function Prototypes
  ****************************************************************************/
@@ -224,6 +232,8 @@ static void spi_pincontrol(int bus, bool on)
 int board_gs2200m_initialize(FAR const char *devpath, int bus)
 {
   FAR struct spi_dev_s *spi;
+  DMA_HANDLE    hdl;
+  dma_config_t  conf;
 
   wlinfo("Initializing GS2200M..\n");
 
@@ -245,9 +255,27 @@ int board_gs2200m_initialize(FAR const char *devpath, int bus)
           return -ENODEV;
         }
 
+      hdl = cxd56_dmachannel(DMA_TXCH, SPI_TX_MAXSIZE);
+      if (hdl)
+        {
+          conf.channel_cfg = DMA_TXCH_CFG;
+          conf.dest_width  = CXD56_DMAC_WIDTH8;
+          conf.src_width   = CXD56_DMAC_WIDTH8;
+          cxd56_spi_dmaconfig(bus, CXD56_SPI_DMAC_CHTYPE_TX, hdl, &conf);
+        }
+
+      hdl = cxd56_dmachannel(DMA_RXCH, SPI_RX_MAXSIZE);
+      if (hdl)
+        {
+          conf.channel_cfg = DMA_RXCH_CFG;
+          conf.dest_width  = CXD56_DMAC_WIDTH8;
+          conf.src_width   = CXD56_DMAC_WIDTH8;
+          cxd56_spi_dmaconfig(bus, CXD56_SPI_DMAC_CHTYPE_RX, hdl, &conf);
+        }
+
       /* Enable SPI5 */
 
-      spi_pincontrol(5, true);
+      spi_pincontrol(bus, true);
 
       g_devhandle = gs2200m_register(devpath, spi, &g_wifi_lower);
 


Mime
View raw message