diff options
-rw-r--r-- | nuttx/ChangeLog | 1 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 1 | ||||
-rw-r--r-- | nuttx/TODO | 6 | ||||
-rw-r--r-- | nuttx/drivers/mmcsd/mmcsd_sdio.c | 24 | ||||
-rw-r--r-- | nuttx/drivers/mmcsd/mmcsd_sdio.h | 2 |
5 files changed, 27 insertions, 7 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index b4fba6ab7..5cc86cc55 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1518,4 +1518,5 @@ the internals of the memory manager as does mm/mm_test.c, but it has the advantage that it runs in the actual NuttX tasking environment (the mm/mm_test.c only runs in a PC simulation environment). + * drivers/mmcsd_sdio.c/h -- Several corrections submitted by Uros Platise. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index ea00922fd..3e46d58e8 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -2120,6 +2120,7 @@ nuttx-5.19 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> the internals of the memory manager as does mm/mm_test.c, but it has the advantage that it runs in the actual NuttX tasking environment (the mm/mm_test.c only runs in a PC simulation environment). + * drivers/mmcsd_sdio.c/h -- Several corrections submitted by Uros Platise. pascal-2.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/TODO b/nuttx/TODO index 5fb772cd6..f7878bf87 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,5 +1,5 @@ -NuttX TODO List (Last updated February 28, 2011) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +NuttX TODO List (Last updated March 4, 2011) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (5) Task/Scheduler (sched/) (1) On-demand paging (sched/) @@ -896,6 +896,8 @@ o ARM/STM32 (arch/arm/src/stm32/) the STM3210E-EVAL board. The card reports that it is a SDV1.x card with a 1Kb block size, but the CMD16 to set the block length to 1024 fails. + Update: Part of the fix appears to be to ignore the reported block + size and to force the block size to 512. Status: Open Priority: Uncertain. I don't this is a bug, I think I just don't understand how to work with this type of SD card. diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.c b/nuttx/drivers/mmcsd/mmcsd_sdio.c index 2503685e1..e4994000a 100644 --- a/nuttx/drivers/mmcsd/mmcsd_sdio.c +++ b/nuttx/drivers/mmcsd/mmcsd_sdio.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_sdio.c * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -596,7 +596,9 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4]) if (IS_BLOCK(priv->type)) { - /* C_SIZE: 69:64 from Word 2 and 63:48 from Word 3 + /* Block addressed SD: + * + * C_SIZE: 69:64 from Word 2 and 63:48 from Word 3 * * 512 = (1 << 9) * 1024 = (1 << 10) @@ -618,15 +620,29 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4]) } else { - /* C_SIZE: 73:64 from Word 2 and 63:62 from Word 3 */ + /* Byte addressed SD: + * + * C_SIZE: 73:64 from Word 2 and 63:62 from Word 3 + */ uint16_t csize = ((csd[1] & 0x03ff) << 2) | ((csd[2] >> 30) & 3); uint8_t csizemult = (csd[2] >> 15) & 7; priv->nblocks = ((uint32_t)csize + 1) * (1 << (csizemult + 2)); + priv->capacity = (priv->nblocks << readbllen); + + /* Force the block size to 512 bytes in any event. Some devices, such + * as 2Gb report blocksizes larger than 512 bytes but still expect to be + * accessed with a 512 byte blocksize. + */ + +#if 0 priv->blockshift = readbllen; priv->blocksize = (1 << readbllen); - priv->capacity = (priv->nblocks << readbllen); +#else + priv->blockshift = 9; + priv->blocksize = (1 << 9); +#endif #if defined(CONFIG_DEBUG) && defined (CONFIG_DEBUG_VERBOSE) && defined(CONFIG_DEBUG_FS) if (IS_SD(priv->type)) diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.h b/nuttx/drivers/mmcsd/mmcsd_sdio.h index e4eb02b3c..75f09aae0 100644 --- a/nuttx/drivers/mmcsd/mmcsd_sdio.h +++ b/nuttx/drivers/mmcsd/mmcsd_sdio.h @@ -169,7 +169,7 @@ # define MMCSD_R6_STATE_RCV ((uint32_t)6 << MMCSD_R6_STATE_SHIFT) /* 6=Receiving data state */
# define MMCSD_R6_STATE_PRG ((uint32_t)7 << MMCSD_R6_STATE_SHIFT) /* 7=Programming state */
# define MMCSD_R6_STATE_DIS ((uint32_t) << MMCSD_R6_STATE_SHIFT) /* 8=Disconnect state */
-#define MMCSD_R6_ERRORMASK ((uint32_t)0x0000e00) /* Error mask */
+#define MMCSD_R6_ERRORMASK ((uint32_t)0x0000e000) /* Error mask */
/* SD Configuration Register (SCR) encoding */
|