You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/11/17 05:22:51 UTC

[incubator-nuttx] branch master updated: driver/mtd: add support for mx25l16 serial flash

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a367ad59d driver/mtd: add support for mx25l16 serial flash
5a367ad59d is described below

commit 5a367ad59d858d91eaba6999b5dd25ada48c7074
Author: Hang Fan <fa...@xiaomi.com>
AuthorDate: Mon Nov 14 17:25:14 2022 +0800

    driver/mtd: add support for mx25l16 serial flash
    
    Signed-off-by: Hang Fan <fa...@xiaomi.com>
---
 drivers/mtd/mx25lx.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mx25lx.c b/drivers/mtd/mx25lx.c
index 21b4024c2a..9848ebfc80 100644
--- a/drivers/mtd/mx25lx.c
+++ b/drivers/mtd/mx25lx.c
@@ -64,6 +64,12 @@
 
 /* Chip Geometries **********************************************************/
 
+/* MX25L1606E capacity is 16Mbit  (2048Kbit x 8) =   2Mb (256kb x 8) */
+
+#define MX25L_MX25L1606E_SECTOR_SHIFT  12    /* Sector size 1 << 12 = 4Kb */
+#define MX25L_MX25L1606E_NSECTORS      512
+#define MX25L_MX25L1606E_PAGE_SHIFT    8     /* Page size 1 << 8 = 256 */
+
 /* MX25L3233F capacity is 32Mbit  (4096Kbit x 8) =   4Mb (512kb x 8) */
 
 #define MX25L_MX25L3233F_SECTOR_SHIFT  12    /* Sector size 1 << 12 = 4Kb */
@@ -177,6 +183,8 @@
 
 #define MX25L_JEDEC_MANUFACTURER         0xc2  /* Macronix manufacturer ID */
 #define MX25L_JEDEC_MEMORY_TYPE          0x20  /* MX25Lx  memory type */
+
+#define MX25L_JEDEC_MX25L1606E_CAPACITY  0x15  /* MX25L1606E memory capacity */
 #define MX25L_JEDEC_MX25L3233F_CAPACITY  0x16  /* MX25L3233F memory capacity */
 #define MX25L_JEDEC_MX25L6433F_CAPACITY  0x17  /* MX25L6433F memory capacity */
 #define MX25L_JEDEC_MX25L25635F_CAPACITY 0x19  /* MX25L25635F memory capacity */
@@ -368,7 +376,17 @@ static inline int mx25l_readid(FAR struct mx25l_dev_s *priv)
     {
       /* Okay.. is it a FLASH capacity that we understand? */
 
-      if (capacity == MX25L_JEDEC_MX25L3233F_CAPACITY)
+      if (capacity == MX25L_JEDEC_MX25L1606E_CAPACITY)
+        {
+          /* Save the FLASH geometry */
+
+          priv->sectorshift  = MX25L_MX25L1606E_SECTOR_SHIFT;
+          priv->nsectors     = MX25L_MX25L1606E_NSECTORS;
+          priv->pageshift    = MX25L_MX25L1606E_PAGE_SHIFT;
+          priv->addressbytes = MX25L_ADDRESSBYTES_3;
+          return OK;
+        }
+      else if (capacity == MX25L_JEDEC_MX25L3233F_CAPACITY)
         {
           /* Save the FLASH geometry */