summaryrefslogtreecommitdiff
path: root/nuttx/drivers/mmcsd
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-08-22 15:42:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-08-22 15:42:10 +0000
commitfd891fceaf3c9852a361c70705d44e1ba7c4a38e (patch)
tree77b99409525c8dff5bb51edd1135042485f2fa74 /nuttx/drivers/mmcsd
parent75ae6a7cb1ffba04cd6c697cbc8679c0fc80b943 (diff)
downloadpx4-nuttx-fd891fceaf3c9852a361c70705d44e1ba7c4a38e.tar.gz
px4-nuttx-fd891fceaf3c9852a361c70705d44e1ba7c4a38e.tar.bz2
px4-nuttx-fd891fceaf3c9852a361c70705d44e1ba7c4a38e.zip
Progress with Kinetis SDHC driver (more to to)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3904 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/mmcsd')
-rw-r--r--nuttx/drivers/mmcsd/mmcsd_sdio.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.c b/nuttx/drivers/mmcsd/mmcsd_sdio.c
index 27232983e..a7d2bee0f 100644
--- a/nuttx/drivers/mmcsd/mmcsd_sdio.c
+++ b/nuttx/drivers/mmcsd/mmcsd_sdio.c
@@ -318,20 +318,22 @@ static int mmcsd_sendcmdpoll(FAR struct mmcsd_state_s *priv, uint32_t cmd,
/* Send the command */
- SDIO_SENDCMD(priv->dev, cmd, arg);
-
- /* Then poll-wait until the response is available */
-
- ret = SDIO_WAITRESPONSE(priv->dev, cmd);
- if (ret != OK)
+ ret = SDIO_SENDCMD(priv->dev, cmd, arg);
+ if (ret == OK)
{
- fdbg("ERROR: Wait for response to cmd: %08x failed: %d\n", cmd, ret);
+ /* Then poll-wait until the response is available */
+
+ ret = SDIO_WAITRESPONSE(priv->dev, cmd);
+ if (ret != OK)
+ {
+ fdbg("ERROR: Wait for response to cmd: %08x failed: %d\n", cmd, ret);
+ }
}
return ret;
}
/****************************************************************************
- * Name: mmcsd_sendcmdpoll
+ * Name: mmcsd_sendcmd4
*
* Description:
* Set the Driver Stage Register (DSR) if (1) a CONFIG_MMCSD_DSR has been
@@ -2475,8 +2477,16 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
* CMD8 Response: R7
*/
- mmcsd_sendcmdpoll(priv, SD_CMD8, MMCSD_CMD8CHECKPATTERN|MMCSD_CMD8VOLTAGE_27);
- ret = SDIO_RECVR7(priv->dev, SD_CMD8, &response);
+ ret = mmcsd_sendcmdpoll(priv, SD_CMD8, MMCSD_CMD8CHECKPATTERN|MMCSD_CMD8VOLTAGE_27);
+ if (ret == OK)
+ {
+ /* CMD8 was sent successfully... Get the R7 response */
+
+ ret = SDIO_RECVR7(priv->dev, SD_CMD8, &response);
+ }
+
+ /* Were both the command sent and response received correctly? */
+
if (ret == OK)
{
/* CMD8 succeeded this is probably a SDHC card. Verify the operating