Author: br
Date: Sat Nov  9 18:46:11 2013
New Revision: 257892
URL: http://svnweb.freebsd.org/changeset/base/257892

Log:
  o Add ONFI signature check.
  o Add Micron chip found in Freescale Vybrid Family
    Phytec COSMIC board.
  
  Approved by:  cognet (mentor)

Modified:
  head/sys/dev/nand/nand.h
  head/sys/dev/nand/nand_generic.c
  head/sys/dev/nand/nand_id.c

Modified: head/sys/dev/nand/nand.h
==============================================================================
--- head/sys/dev/nand/nand.h    Sat Nov  9 16:20:42 2013        (r257891)
+++ head/sys/dev/nand/nand.h    Sat Nov  9 18:46:11 2013        (r257892)
@@ -122,7 +122,8 @@ MALLOC_DECLARE(M_NAND);
 
 #define NAND_MAN_SAMSUNG               0xec
 #define NAND_MAN_HYNIX                 0xad
-#define        NAND_MAN_STMICRO                0x20
+#define NAND_MAN_STMICRO               0x20
+#define NAND_MAN_MICRON                        0x2c
 
 struct nand_id {
        uint8_t man_id;

Modified: head/sys/dev/nand/nand_generic.c
==============================================================================
--- head/sys/dev/nand/nand_generic.c    Sat Nov  9 16:20:42 2013        
(r257891)
+++ head/sys/dev/nand/nand_generic.c    Sat Nov  9 18:46:11 2013        
(r257892)
@@ -341,8 +341,12 @@ onfi_read_parameter(struct nand_chip *ch
 
        NANDBUS_READ_BUFFER(nandbus, params, sizeof(struct onfi_params));
 
+       if (memcmp(params->signature, "ONFI", sizeof(params->signature))) {
+               device_printf(chip->dev, "Error: bad signature\n");
+               return (ENXIO);
+       }
+
        /* TODO */
-       /* Check for signature */
        /* Check CRC */
        /* Use redundant page if necessary */
 

Modified: head/sys/dev/nand/nand_id.c
==============================================================================
--- head/sys/dev/nand/nand_id.c Sat Nov  9 16:20:42 2013        (r257891)
+++ head/sys/dev/nand/nand_id.c Sat Nov  9 18:46:11 2013        (r257892)
@@ -47,6 +47,8 @@ struct nand_params nand_ids[] = {
            0x80, 0x200, 0x10, 0x20, 0 },
        { { NAND_MAN_STMICRO, 0xf1 }, "STMicro 128MB 3,3V 8-bit",
            0x80, 2048, 64, 0x40, 0 },
+       { { NAND_MAN_MICRON, 0xcc }, "Micron NAND 512MiB 3,3V 16-bit",
+           0x200, 2048, 64, 0x40, 0 },
 };
 
 struct nand_params *nand_get_params(struct nand_id *id)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to