diff --git a/ChangeLog b/ChangeLog index 26a91bed61f..e297eee09a8 100644 --- a/ChangeLog +++ b/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/arch/arm/src/sam34/sam_hsmci.c b/arch/arm/src/sam34/sam_hsmci.c index 9db04d12973..ae71b4a33ab 100644 --- a/arch/arm/src/sam34/sam_hsmci.c +++ b/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/arch/arm/src/sama5/sam_hsmci.c b/arch/arm/src/sama5/sam_hsmci.c index 71a2d0b4b9c..f9bf9e3e118 100644 --- a/arch/arm/src/sama5/sam_hsmci.c +++ b/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 */