xiaoxiang781216 commented on code in PR #13164:
URL: https://github.com/apache/nuttx/pull/13164#discussion_r2076879934


##########
drivers/mmcsd/mmcsd_sdio.c:
##########
@@ -493,6 +493,25 @@ static int mmcsd_recv_r6(FAR struct mmcsd_state_s *priv, 
uint32_t cmd)
 static int mmcsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 {
   int ret;
+#ifdef CONFIG_SDIO_DMA
+  bool drop = FALSE;
+#endif
+
+#if defined(CONFIG_SDIO_DMA) && defined(CONFIG_ARCH_HAVE_SDIO_PREFLIGHT)
+  /* If we think we are going to perform a DMA transfer, make sure that we
+   * will be able to before we commit the card to the operation.
+   */
+
+  if ((priv->caps & SDIO_CAPS_DMASUPPORTED) != 0)
+    {
+      ret = SDIO_DMAPREFLIGHT(priv->dev, (FAR uint8_t *)scr, 8);
+      if (ret != OK)
+        {
+          finfo("SDIO_DMAPREFLIGHT: error %d, drop to RECVSETUP\n", ret);
+          drop = TRUE;

Review Comment:
   ```suggestion
             drop = true;
   ```



##########
drivers/mmcsd/mmcsd_sdio.c:
##########
@@ -506,7 +525,22 @@ static int mmcsd_get_scr(FAR struct mmcsd_state_s *priv, 
uint32_t scr[2])
   /* Setup up to receive data with interrupt mode */
 
   SDIO_BLOCKSETUP(priv->dev, 8, 1);
-  SDIO_RECVSETUP(priv->dev, (FAR uint8_t *)scr, 8);
+#ifdef CONFIG_SDIO_DMA
+  if (!drop && (priv->caps & SDIO_CAPS_DMASUPPORTED) != 0)
+    {
+      ret = SDIO_DMARECVSETUP(priv->dev, (FAR uint8_t *)scr, 8);
+      if (ret != OK)
+        {
+          finfo("SDIO_DMARECVSETUP: error %d, drop to RECVSETUP\n", ret);
+          drop = TRUE;

Review Comment:
   ```suggestion
             drop = true;
   ```



##########
drivers/mmcsd/mmcsd_sdio.c:
##########
@@ -493,6 +493,25 @@ static int mmcsd_recv_r6(FAR struct mmcsd_state_s *priv, 
uint32_t cmd)
 static int mmcsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 {
   int ret;
+#ifdef CONFIG_SDIO_DMA
+  bool drop = FALSE;

Review Comment:
   ```suggestion
     bool drop = false;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to