More Kinetis SDHC fixes

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3907 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-08-23 14:58:15 +00:00
parent c2aa7d046c
commit 01232ab6c7
4 changed files with 22 additions and 45 deletions

8
TODO
View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated August 8, 2011)
NuttX TODO List (Last updated August 22, 2011)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nuttx/
@ -13,7 +13,7 @@ nuttx/
(16) Network (net/, drivers/net)
(2) USB (drivers/usbdev, drivers/usbhost)
(6) Libraries (lib/)
(10) File system/Generic drivers (fs/, drivers/)
(9) File system/Generic drivers (fs/, drivers/)
(2) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
(1) Documentation (Documentation/)
@ -413,10 +413,6 @@ o File system / Generic drivers (fs/, drivers/)
Status: Open
Priority: Low
Description: The CAN driver is untested. Add a test for the CAN driver.
Status: Open
Priority: Medium
Description: At present, the CAN driver does not support the poll() method.
Status: Open
Priority: Low

View File

@ -1182,12 +1182,10 @@ static int kinetis_interrupt(int irq, void *context)
}
}
/* Handle data end events */
/* Handle transfer complete events */
if ((pending & SDHC_INT_TC) != 0)
{
/* Handle any data remaining the RX buffer */
/* Was this transfer performed in DMA mode? */
#ifdef CONFIG_SDIO_DMA
@ -1924,10 +1922,9 @@ static int kinetis_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t ar
putreg32(arg, KINETIS_SDHC_CMDARG);
/* Enable appropriate interrupts and write the SDHC CMD */
/* Clear interrupt status and write the SDHC CMD */
putreg32(SDHC_RESPDONE_INTS, KINETIS_SDHC_IRQSTAT);
putreg32(SDHC_RESPDONE_INTS|SDHC_INT_CINT, KINETIS_SDHC_IRQSIGEN);
putreg32(regval, KINETIS_SDHC_XFERTYP);
return OK;
}
@ -2262,9 +2259,11 @@ static int kinetis_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32
}
}
/* Clear all pending message completion events and return the R1/R6 response */
/* Return the R1/R1b/R6 response. These responses are returned in
* CDMRSP0. NOTE: This is not true for R1b (Auto CMD12 response) which
* is returned in CMDRSP3.
*/
putreg32(SDHC_RESPDONE_INTS, KINETIS_SDHC_IRQSTAT);
*rshort = getreg32(KINETIS_SDHC_CMDRSP0);
return ret;
}
@ -2309,18 +2308,14 @@ static int kinetis_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t r
}
}
/* Disable interrupts and return the long response */
regval = getreg32(KINETIS_SDHC_IRQSIGEN);
regval &= ~SDHC_RESPDONE_INTS;
putreg32(regval, KINETIS_SDHC_IRQSIGEN);
/* Return the long response in CMDRSP3..0*/
if (rlong)
{
rlong[0] = getreg32(KINETIS_SDHC_CMDRSP0);
rlong[1] = getreg32(KINETIS_SDHC_CMDRSP1);
rlong[2] = getreg32(KINETIS_SDHC_CMDRSP2);
rlong[3] = getreg32(KINETIS_SDHC_CMDRSP3);
rlong[0] = getreg32(KINETIS_SDHC_CMDRSP3);
rlong[1] = getreg32(KINETIS_SDHC_CMDRSP2);
rlong[2] = getreg32(KINETIS_SDHC_CMDRSP1);
rlong[3] = getreg32(KINETIS_SDHC_CMDRSP0);
}
return ret;
}
@ -2361,20 +2356,15 @@ static int kinetis_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t
fdbg("ERROR: Timeout IRQSTAT: %08x\n", regval);
ret = -ETIMEDOUT;
}
/* Return the short response */
}
/* Disable interrupts and return the short response */
regval = getreg32(KINETIS_SDHC_IRQSIGEN);
regval &= ~SDHC_RESPDONE_INTS;
putreg32(regval, KINETIS_SDHC_IRQSIGEN);
/* Return the short response in CMDRSP0 */
if (rshort)
{
*rshort = getreg32(KINETIS_SDHC_CMDRSP0);
}
return ret;
}
@ -2384,11 +2374,7 @@ static int kinetis_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_
{
uint32_t regval;
/* Disable interrupts and return an error */
regval = getreg32(KINETIS_SDHC_IRQSIGEN);
regval &= ~SDHC_RESPDONE_INTS;
putreg32(regval, KINETIS_SDHC_IRQSIGEN);
/* Just return an error */
return -ENOSYS;
}
@ -2422,7 +2408,6 @@ static void kinetis_waitenable(FAR struct sdio_dev_s *dev,
{
struct kinetis_dev_s *priv = (struct kinetis_dev_s*)dev;
uint32_t waitints;
uint32_t regval;
DEBUGASSERT(priv != NULL);
@ -2447,10 +2432,6 @@ static void kinetis_waitenable(FAR struct sdio_dev_s *dev,
/* Enable event-related interrupts */
regval = getreg32(KINETIS_SDHC_IRQSIGEN);
regval &= ~(SDHC_WAITALL_INTS);
putreg32(regval, KINETIS_SDHC_IRQSIGEN);
kinetis_configwaitints(priv, waitints, eventset, 0);
}
@ -3059,6 +3040,7 @@ void sdhc_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect)
{
priv->cdstatus &= ~SDIO_STATUS_WRPROTECTED;
}
fvdbg("cdstatus: %02x\n", priv->cdstatus);
irqrestore(flags);
}

View File

@ -2054,8 +2054,6 @@ static int stm32_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *r
fdbg("ERROR: Timeout STA: %08x\n", regval);
ret = -ETIMEDOUT;
}
/* Return the short response */
}
putreg32(SDIO_RESPDONE_ICR|SDIO_CMDDONE_ICR, STM32_SDIO_ICR);

View File

@ -174,12 +174,13 @@ static void kinetis_mediachange(void)
sdhc_mediachange(g_nsh.sdhc, inserted);
/* If the card has been inserted, then check if it is write protected
* aw well.
* as well. The pin is pulled up, but apparently logic high means
* write protected.
*/
if (inserted)
{
sdhc_wrprotect(g_nsh.sdhc, !kinetis_gpioread(GPIO_SD_WRPROTECT));
sdhc_wrprotect(g_nsh.sdhc, kinetis_gpioread(GPIO_SD_WRPROTECT));
}
}
}