]> www.infradead.org Git - mtd-utils.git/commitdiff
Update header file to latest MTD ABI and fix mtd_debug to work properly
authorJosh Boyer <jwboyer@gmail.com>
Thu, 15 Mar 2007 13:05:07 +0000 (08:05 -0500)
committerJosh Boyer <jwboyer@gmail.com>
Thu, 15 Mar 2007 13:05:07 +0000 (08:05 -0500)
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
include/mtd/mtd-abi.h
mtd_debug.c

index 7ccadb1eaf7d77fc3779a3dead61ced7b52c4c70..aaae170763b8d0085f1c82d05c9724f2357ca4de 100644 (file)
@@ -7,11 +7,6 @@
 #ifndef __MTD_ABI_H__
 #define __MTD_ABI_H__
 
-#ifndef __KERNEL__ /* Urgh. The whole point of splitting this out into
-                   separate files was to avoid #ifdef __KERNEL__ */
-#define __user
-#endif
-
 struct erase_info_user {
        uint32_t start;
        uint32_t length;
@@ -20,18 +15,20 @@ struct erase_info_user {
 struct mtd_oob_buf {
        uint32_t start;
        uint32_t length;
-       unsigned char __user *ptr;
+       unsigned char *ptr;
 };
 
 #define MTD_ABSENT             0
+#define MTD_RAM                        1
+#define MTD_ROM                        2
 #define MTD_NORFLASH           3
 #define MTD_NANDFLASH          4
 #define MTD_DATAFLASH          6
-#define MTD_GENERIC_TYPE       7
 
 #define MTD_WRITEABLE          0x400   /* Device is writeable */
 #define MTD_BIT_WRITEABLE      0x800   /* Single bits can be flipped */
 #define MTD_NO_ERASE           0x1000  /* No erase necessary */
+#define MTD_STUPID_LOCK                0x2000  /* Always locked after reset */
 
 // Some common devices / combinations of capabilities
 #define MTD_CAP_ROM            0
@@ -39,12 +36,6 @@ struct mtd_oob_buf {
 #define MTD_CAP_NORFLASH       (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
 #define MTD_CAP_NANDFLASH      (MTD_WRITEABLE)
 
-
-// Types of automatic ECC/Checksum available
-#define MTD_ECC_NONE           0       // No automatic ECC available
-#define MTD_ECC_RS_DiskOnChip  1       // Automatic ECC on DiskOnChip
-#define MTD_ECC_SW             2       // SW ECC for Toshiba & Samsung devices
-
 /* ECC byte placement */
 #define MTD_NANDECC_OFF                0       // Switch off ECC (Not recommended)
 #define MTD_NANDECC_PLACE      1       // Use the given placement in the structure (YAFFS1 legacy mode)
@@ -64,6 +55,8 @@ struct mtd_info_user {
        uint32_t erasesize;
        uint32_t writesize;
        uint32_t oobsize;   // Amount of OOB data per block (e.g. 16)
+       /* The below two fields are obsolete and broken, do not use them
+        * (TODO: remove at some point) */
        uint32_t ecctype;
        uint32_t eccsize;
 };
@@ -131,7 +124,7 @@ struct nand_ecclayout {
 };
 
 /**
- * struct mtd_ecc_stats - error correction status
+ * struct mtd_ecc_stats - error correction stats
  *
  * @corrected: number of corrected bits
  * @failed:    number of uncorrectable errors
index e0cc7d721f9edafcd7ab2789a781b824f6c4a562..b44e9527fdd97561112256e6e31c1f9ba176000c 100644 (file)
@@ -3,8 +3,6 @@
  * Written by Abraham vd Merwe <abraham@2d3d.co.za>
  * All rights reserved.
  *
- * $Id: mtd_debug.c,v 1.5 2004/05/05 11:57:55 dwmw2 Exp $
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -259,14 +257,20 @@ int showinfo (int fd)
                case MTD_ABSENT:
                        printf ("MTD_ABSENT");
                        break;
+               case MTD_RAM:
+                       printf ("MTD_RAM");
+                       break;
+               case MTD_ROM:
+                       printf ("MTD_ROM");
+                       break;
                case MTD_NORFLASH:
                        printf ("MTD_NORFLASH");
                        break;
                case MTD_NANDFLASH:
                        printf ("MTD_NANDFLASH");
                        break;
-               case MTD_GENERIC_TYPE:
-                       printf ("MTD_GENERIC_TYPE");
+               case MTD_DATAFLASH:
+                       printf ("MTD_DATAFLASH");
                        break;
                default:
                        printf ("(unknown type - new MTD API maybe?)");
@@ -320,22 +324,6 @@ int showinfo (int fd)
        printf ("\nmtd.oobsize = ");
        printsize (mtd.oobsize);
 
-       printf ("\nmtd.ecctype = ");
-       switch (mtd.ecctype)
-       {
-               case MTD_ECC_NONE:
-                       printf ("MTD_ECC_NONE");
-                       break;
-               case MTD_ECC_RS_DiskOnChip:
-                       printf ("MTD_ECC_RS_DiskOnChip");
-                       break;
-               case MTD_ECC_SW:
-                       printf ("MTD_ECC_SW");
-                       break;
-               default:
-                       printf ("(unknown ECC type - new MTD API maybe?)");
-       }
-
        printf ("\n"
                        "regions = %d\n"
                        "\n",