From 12d798a29a9a376ef495f527b1785317e3ae3d37 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Thu, 15 Mar 2007 08:05:07 -0500 Subject: Update header file to latest MTD ABI and fix mtd_debug to work properly Signed-off-by: Josh Boyer --- include/mtd/mtd-abi.h | 21 +++++++-------------- mtd_debug.c | 28 ++++++++-------------------- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 7ccadb1..aaae170 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -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 diff --git a/mtd_debug.c b/mtd_debug.c index e0cc7d7..b44e952 100644 --- a/mtd_debug.c +++ b/mtd_debug.c @@ -3,8 +3,6 @@ * Written by Abraham vd Merwe * 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", -- cgit v1.2.3