k9f1g08r0a: add support for reading parameter page
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 22 Nov 2011 15:03:23 +0000 (17:03 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 27 Dec 2011 12:16:50 +0000 (14:16 +0200)
this allows to read full NAND model name, which is useful to
distinguish between POP parts that both have the same manufacturer/device
id, but different RAM.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
drivers/k9f1g08r0a.c
include/common.h

index b039b50..eeb17c1 100644 (file)
@@ -177,6 +177,35 @@ int nand_readid(int *mfr, int *id)
        return 0;
 }
 
+/* reads parameter page */
+int nand_read_param_page(unsigned char *data, unsigned int size)
+{
+       unsigned int i;
+
+       NAND_ENABLE_CE();
+
+       if (NanD_Command(NAND_CMD_RESET)) {
+               NAND_DISABLE_CE();
+               return 1;
+       }
+
+       if (NanD_Command(NAND_CMD_READPARAM)) {
+               NAND_DISABLE_CE();
+               return 1;
+       }
+
+       NanD_Address(ADDR_COLUMN, 0);
+       delay(10000);
+
+       for (i = 0; i < size; i++) {
+               data[i] = READ_NAND(NAND_ADDR);
+               delay(10);
+       }
+
+       NAND_DISABLE_CE();
+       return 0;
+}
+
 /* read chip mfr and id
  * return 0 if they match board config
  * return 1 if not
index a3c5092..9cf3f3a 100644 (file)
@@ -75,6 +75,7 @@ void  udelay (unsigned long usec);
 #define NAND_CMD_READOOB       0x50
 #define NAND_CMD_STATUS                0x70
 #define NAND_CMD_READID                0x90
+#define NAND_CMD_READPARAM     0xec
 #define NAND_CMD_RESET         0xff
 
 /* Extended Commands for Large page devices */
@@ -82,6 +83,8 @@ void  udelay (unsigned long usec);
 
 int    nand_chip(void);
 int    nand_read_block(uchar *buf, ulong block_addr);
+int    nand_readid(int *mfr, int *id);
+int    nand_read_param_page(unsigned char *data, unsigned int size);
 
 int    onenand_chip(void);
 int    onenand_read_block(unsigned char *buf, ulong block);