summaryrefslogtreecommitdiff
path: root/nuttx/drivers/mtd
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-09-12 13:21:04 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-09-12 13:21:04 +0000
commitbe73bfff74eb5de6c7eaf8a911fd020b468db924 (patch)
treeda03f70b584549fc12815b57b7a5f3585eb9dada /nuttx/drivers/mtd
parent57cfc31e7ad31696b66773e606ab4ac4213b1ab9 (diff)
downloadpx4-nuttx-be73bfff74eb5de6c7eaf8a911fd020b468db924.tar.gz
px4-nuttx-be73bfff74eb5de6c7eaf8a911fd020b468db924.tar.bz2
px4-nuttx-be73bfff74eb5de6c7eaf8a911fd020b468db924.zip
Extend support to other chips in the family
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2941 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/mtd')
-rw-r--r--nuttx/drivers/mtd/at45db.c66
1 files changed, 50 insertions, 16 deletions
diff --git a/nuttx/drivers/mtd/at45db.c b/nuttx/drivers/mtd/at45db.c
index f84db48ad..c90dd4550 100644
--- a/nuttx/drivers/mtd/at45db.c
+++ b/nuttx/drivers/mtd/at45db.c
@@ -150,9 +150,15 @@
#define AT45DB_MANUFACTURER 0x1f /* Manufacturer ID: Atmel */
#define AT45DB_DEVID1_CAPMSK 0x1f /* Bits 0-4: Capacity */
-#define AT45DB_DEVID1_16MBIT 0x06 /* xxx0 0110 = 16Mbit */
+#define AT45DB_DEVID1_1MBIT 0x02 /* xxx0 0010 = 1Mbit AT45DB011 */
+#define AT45DB_DEVID1_2MBIT 0x03 /* xxx0 0012 = 2Mbit AT45DB021 */
+#define AT45DB_DEVID1_4MBIT 0x04 /* xxx0 0100 = 4Mbit AT45DB041 */
+#define AT45DB_DEVID1_8MBIT 0x05 /* xxx0 0101 = 8Mbit AT45DB081 */
+#define AT45DB_DEVID1_16MBIT 0x06 /* xxx0 0110 = 16Mbit AT45DB161 */
+#define AT45DB_DEVID1_32MBIT 0x07 /* xxx0 0111 = 32Mbit AT45DB321 */
#define AT45DB_DEVID1_FAMMSK 0xe0 /* Bits 5-7: Family */
#define AT45DB_DEVID1_DFLASH 0x20 /* 001x xxxx = Dataflash */
+#define AT45DB_DEVID1_AT26DF 0x40 /* 010x xxxx = AT26DFxxx series (Not supported) */
#define AT45DB_DEVID2_VERMSK 0x1f /* Bits 0-4: MLC mask */
#define AT45DB_DEVID2_MLCMSK 0xe0 /* Bits 5-7: MLC mask */
@@ -335,25 +341,53 @@ static inline int at45db_rdid(struct at45db_dev_s *priv)
/* Okay.. is it a FLASH capacity that we understand? */
capacity = devid1 & AT45DB_DEVID1_CAPMSK;
-
- if (capacity == AT45DB_DEVID1_16MBIT)
+ switch (capacity)
{
- /* Save the FLASH geometry for the 16Mbit AT45DB161 */
+ case AT45DB_DEVID1_1MBIT:
+ /* Save the FLASH geometry for the 16Mbit AT45DB011 */
- priv->pageshift = 9; /* Page size = 512 bytes */
- priv->npages = 4096; /* 4096 pages */
- return OK;
- }
-# if 0 /* Add support for other at45db FLASH parts here */
- else if (capacity == )
- {
- /* Save the FLASH geometry */
+ priv->pageshift = 8; /* Page size = 256 bytes */
+ priv->npages = 512; /* 512 pages */
+ return OK;
+
+ case AT45DB_DEVID1_2MBIT:
+ /* Save the FLASH geometry for the 16Mbit AT45DB021 */
+
+ priv->pageshift = 8; /* Page size = 256 bytes */
+ priv->npages = 1024; /* 1024 pages */
+ return OK;
+
+ case AT45DB_DEVID1_4MBIT:
+ /* Save the FLASH geometry for the 16Mbit AT45DB041 */
+
+ priv->pageshift = 8; /* Page size = 256 bytes */
+ priv->npages = 2048; /* 2048 pages */
+ return OK;
- priv->pageshift = ;
- priv->npages = ;
- return OK;
+ case AT45DB_DEVID1_8MBIT:
+ /* Save the FLASH geometry for the 16Mbit AT45DB081 */
+
+ priv->pageshift = 8; /* Page size = 256 bytes */
+ priv->npages = 4096; /* 4096 pages */
+ return OK;
+
+ case AT45DB_DEVID1_16MBIT:
+ /* Save the FLASH geometry for the 16Mbit AT45DB161 */
+
+ priv->pageshift = 9; /* Page size = 512 bytes */
+ priv->npages = 4096; /* 4096 pages */
+ return OK;
+
+ case AT45DB_DEVID1_32MBIT:
+ /* Save the FLASH geometry for the 16Mbit AT45DB321 */
+
+ priv->pageshift = 9; /* Page size = 512 bytes */
+ priv->npages = 8192; /* 8192 pages */
+ return OK;
+
+ default:
+ return -ENODEV;
}
-#endif
}
return -ENODEV;