diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-08-06 12:36:56 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-08-06 12:36:56 -0600 |
commit | d337863e6e7c89fac3891c5a63b09720f07c6aea (patch) | |
tree | 74f231f91f9d736bbe0fe5b23a27f8580b60d71b | |
parent | 069400647b14eaa42b6f4d48b50f27133fe54c40 (diff) | |
download | nuttx-d337863e6e7c89fac3891c5a63b09720f07c6aea.tar.gz nuttx-d337863e6e7c89fac3891c5a63b09720f07c6aea.tar.bz2 nuttx-d337863e6e7c89fac3891c5a63b09720f07c6aea.zip |
SAM3,4,A5: Fix some masked status checks that can generate false error reports
-rw-r--r-- | nuttx/ChangeLog | 6 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sam34/sam_hsmci.c | 13 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_hsmci.c | 13 |
3 files changed, 21 insertions, 11 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 26a91bed6..e297eee09 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -5314,5 +5314,9 @@ files sam_gpio.* to sam_pio.* (2013-8-6). * arch/arm/src/sama5/sam_pioirq.c: Add support for SAMA5 PIO interrupts (2013-8-6). - * confgs/sama5d3x-ek/src/sam_hsmci.c: Add support for SD slot card + * configs/sama5d3x-ek/src/sam_hsmci.c: Add support for SD slot card detection PIO interrupts (2013-8-6). + * arch/arm/src/sam34/sam_hsmci.c and sama5/sam_hsmci.c: Fix handling + of some masked status conditions that can cause false-alarm errors + (2013-8-6). + diff --git a/nuttx/arch/arm/src/sam34/sam_hsmci.c b/nuttx/arch/arm/src/sam34/sam_hsmci.c index 9db04d129..ae71b4a33 100644 --- a/nuttx/arch/arm/src/sam34/sam_hsmci.c +++ b/nuttx/arch/arm/src/sam34/sam_hsmci.c @@ -1159,7 +1159,7 @@ static int sam_interrupt(int irq, void *context) { /* Yes.. Was the error some kind of timeout? */ - fllvdbg("ERROR:events: %08x SR: %08x\n", + fllvdbg("ERROR: events: %08x SR: %08x\n", priv->cmdrmask, enabled); if ((pending & HSMCI_RESPONSE_TIMEOUT_ERRORS) != 0) @@ -1687,6 +1687,7 @@ static int sam_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd) { struct sam_dev_s *priv = (struct sam_dev_s*)dev; uint32_t sr; + uint32_t pending; int32_t timeout; switch (cmd & MMCSD_RESPONSE_MASK) @@ -1718,22 +1719,24 @@ static int sam_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd) { /* Did a Command-Response sequence termination evernt occur? */ - sr = getreg32(SAM_HSMCI_SR); - if ((sr & priv->cmdrmask) != 0) + sr = getreg32(SAM_HSMCI_SR); + pending = sr & priv->cmdrmask; + + if (pending != 0) { sam_cmdsample2(SAMPLENDX_AT_WAKEUP, sr); sam_cmddump(); /* Yes.. Did the Command-Response sequence end with an error? */ - if ((sr & HSMCI_RESPONSE_ERRORS) != 0) + if ((pending & HSMCI_RESPONSE_ERRORS) != 0) { /* Yes.. Was the error some kind of timeout? */ fdbg("ERROR: cmd: %08x events: %08x SR: %08x\n", cmd, priv->cmdrmask, sr); - if ((sr & HSMCI_RESPONSE_TIMEOUT_ERRORS) != 0) + if ((pending & HSMCI_RESPONSE_TIMEOUT_ERRORS) != 0) { /* Yes.. return a timeout error */ diff --git a/nuttx/arch/arm/src/sama5/sam_hsmci.c b/nuttx/arch/arm/src/sama5/sam_hsmci.c index 71a2d0b4b..f9bf9e3e1 100644 --- a/nuttx/arch/arm/src/sama5/sam_hsmci.c +++ b/nuttx/arch/arm/src/sama5/sam_hsmci.c @@ -1390,7 +1390,7 @@ static int sam_hsmci_interrupt(struct sam_dev_s *priv) { /* Yes.. Was the error some kind of timeout? */ - fllvdbg("ERROR:events: %08x SR: %08x\n", + fllvdbg("ERROR: events: %08x SR: %08x\n", priv->cmdrmask, enabled); if ((pending & HSMCI_RESPONSE_TIMEOUT_ERRORS) != 0) @@ -1984,6 +1984,7 @@ static int sam_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd) { struct sam_dev_s *priv = (struct sam_dev_s*)dev; uint32_t sr; + uint32_t pending; int32_t timeout; switch (cmd & MMCSD_RESPONSE_MASK) @@ -2015,22 +2016,24 @@ static int sam_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd) { /* Did a Command-Response sequence termination evernt occur? */ - sr = sam_getreg(priv, SAM_HSMCI_SR_OFFSET); - if ((sr & priv->cmdrmask) != 0) + sr = sam_getreg(priv, SAM_HSMCI_SR_OFFSET); + pending = sr & priv->cmdrmask; + + if (pending != 0) { sam_cmdsample2(priv, SAMPLENDX_AT_WAKEUP, sr); sam_cmddump(priv); /* Yes.. Did the Command-Response sequence end with an error? */ - if ((sr & HSMCI_RESPONSE_ERRORS) != 0) + if ((pending & HSMCI_RESPONSE_ERRORS) != 0) { /* Yes.. Was the error some kind of timeout? */ fdbg("ERROR: cmd: %08x events: %08x SR: %08x\n", cmd, priv->cmdrmask, sr); - if ((sr & HSMCI_RESPONSE_TIMEOUT_ERRORS) != 0) + if ((pending & HSMCI_RESPONSE_TIMEOUT_ERRORS) != 0) { /* Yes.. return a timeout error */ |