diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cpuidle.h | 52 | ||||
| -rw-r--r-- | include/linux/ethtool.h | 2 | ||||
| -rw-r--r-- | include/linux/jump_label.h | 23 | ||||
| -rw-r--r-- | include/linux/mtd/bbm.h | 39 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 82 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 92 | ||||
| -rw-r--r-- | include/linux/mtd/onenand.h | 4 | ||||
| -rw-r--r-- | include/linux/mtd/partitions.h | 46 | ||||
| -rw-r--r-- | include/linux/mtd/physmap.h | 17 |
9 files changed, 170 insertions, 187 deletions
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 583baf22cad2..7408af843b8a 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
| @@ -23,57 +23,62 @@ | |||
| 23 | struct module; | 23 | struct module; |
| 24 | 24 | ||
| 25 | struct cpuidle_device; | 25 | struct cpuidle_device; |
| 26 | struct cpuidle_driver; | ||
| 26 | 27 | ||
| 27 | 28 | ||
| 28 | /**************************** | 29 | /**************************** |
| 29 | * CPUIDLE DEVICE INTERFACE * | 30 | * CPUIDLE DEVICE INTERFACE * |
| 30 | ****************************/ | 31 | ****************************/ |
| 31 | 32 | ||
| 33 | struct cpuidle_state_usage { | ||
| 34 | void *driver_data; | ||
| 35 | |||
| 36 | unsigned long long usage; | ||
| 37 | unsigned long long time; /* in US */ | ||
| 38 | }; | ||
| 39 | |||
| 32 | struct cpuidle_state { | 40 | struct cpuidle_state { |
| 33 | char name[CPUIDLE_NAME_LEN]; | 41 | char name[CPUIDLE_NAME_LEN]; |
| 34 | char desc[CPUIDLE_DESC_LEN]; | 42 | char desc[CPUIDLE_DESC_LEN]; |
| 35 | void *driver_data; | ||
| 36 | 43 | ||
| 37 | unsigned int flags; | 44 | unsigned int flags; |
| 38 | unsigned int exit_latency; /* in US */ | 45 | unsigned int exit_latency; /* in US */ |
| 39 | unsigned int power_usage; /* in mW */ | 46 | unsigned int power_usage; /* in mW */ |
| 40 | unsigned int target_residency; /* in US */ | 47 | unsigned int target_residency; /* in US */ |
| 41 | 48 | ||
| 42 | unsigned long long usage; | ||
| 43 | unsigned long long time; /* in US */ | ||
| 44 | |||
| 45 | int (*enter) (struct cpuidle_device *dev, | 49 | int (*enter) (struct cpuidle_device *dev, |
| 46 | struct cpuidle_state *state); | 50 | struct cpuidle_driver *drv, |
| 51 | int index); | ||
| 47 | }; | 52 | }; |
| 48 | 53 | ||
| 49 | /* Idle State Flags */ | 54 | /* Idle State Flags */ |
| 50 | #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ | 55 | #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ |
| 51 | #define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */ | ||
| 52 | 56 | ||
| 53 | #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) | 57 | #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) |
| 54 | 58 | ||
| 55 | /** | 59 | /** |
| 56 | * cpuidle_get_statedata - retrieves private driver state data | 60 | * cpuidle_get_statedata - retrieves private driver state data |
| 57 | * @state: the state | 61 | * @st_usage: the state usage statistics |
| 58 | */ | 62 | */ |
| 59 | static inline void * cpuidle_get_statedata(struct cpuidle_state *state) | 63 | static inline void *cpuidle_get_statedata(struct cpuidle_state_usage *st_usage) |
| 60 | { | 64 | { |
| 61 | return state->driver_data; | 65 | return st_usage->driver_data; |
| 62 | } | 66 | } |
| 63 | 67 | ||
| 64 | /** | 68 | /** |
| 65 | * cpuidle_set_statedata - stores private driver state data | 69 | * cpuidle_set_statedata - stores private driver state data |
| 66 | * @state: the state | 70 | * @st_usage: the state usage statistics |
| 67 | * @data: the private data | 71 | * @data: the private data |
| 68 | */ | 72 | */ |
| 69 | static inline void | 73 | static inline void |
| 70 | cpuidle_set_statedata(struct cpuidle_state *state, void *data) | 74 | cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data) |
| 71 | { | 75 | { |
| 72 | state->driver_data = data; | 76 | st_usage->driver_data = data; |
| 73 | } | 77 | } |
| 74 | 78 | ||
| 75 | struct cpuidle_state_kobj { | 79 | struct cpuidle_state_kobj { |
| 76 | struct cpuidle_state *state; | 80 | struct cpuidle_state *state; |
| 81 | struct cpuidle_state_usage *state_usage; | ||
| 77 | struct completion kobj_unregister; | 82 | struct completion kobj_unregister; |
| 78 | struct kobject kobj; | 83 | struct kobject kobj; |
| 79 | }; | 84 | }; |
| @@ -81,22 +86,17 @@ struct cpuidle_state_kobj { | |||
| 81 | struct cpuidle_device { | 86 | struct cpuidle_device { |
| 82 | unsigned int registered:1; | 87 | unsigned int registered:1; |
| 83 | unsigned int enabled:1; | 88 | unsigned int enabled:1; |
| 84 | unsigned int power_specified:1; | ||
| 85 | unsigned int cpu; | 89 | unsigned int cpu; |
| 86 | 90 | ||
| 87 | int last_residency; | 91 | int last_residency; |
| 88 | int state_count; | 92 | int state_count; |
| 89 | struct cpuidle_state states[CPUIDLE_STATE_MAX]; | 93 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; |
| 90 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; | 94 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; |
| 91 | struct cpuidle_state *last_state; | ||
| 92 | 95 | ||
| 93 | struct list_head device_list; | 96 | struct list_head device_list; |
| 94 | struct kobject kobj; | 97 | struct kobject kobj; |
| 95 | struct completion kobj_unregister; | 98 | struct completion kobj_unregister; |
| 96 | void *governor_data; | 99 | void *governor_data; |
| 97 | struct cpuidle_state *safe_state; | ||
| 98 | |||
| 99 | int (*prepare) (struct cpuidle_device *dev); | ||
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); | 102 | DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); |
| @@ -120,6 +120,11 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) | |||
| 120 | struct cpuidle_driver { | 120 | struct cpuidle_driver { |
| 121 | char name[CPUIDLE_NAME_LEN]; | 121 | char name[CPUIDLE_NAME_LEN]; |
| 122 | struct module *owner; | 122 | struct module *owner; |
| 123 | |||
| 124 | unsigned int power_specified:1; | ||
| 125 | struct cpuidle_state states[CPUIDLE_STATE_MAX]; | ||
| 126 | int state_count; | ||
| 127 | int safe_state_index; | ||
| 123 | }; | 128 | }; |
| 124 | 129 | ||
| 125 | #ifdef CONFIG_CPU_IDLE | 130 | #ifdef CONFIG_CPU_IDLE |
| @@ -166,11 +171,14 @@ struct cpuidle_governor { | |||
| 166 | struct list_head governor_list; | 171 | struct list_head governor_list; |
| 167 | unsigned int rating; | 172 | unsigned int rating; |
| 168 | 173 | ||
| 169 | int (*enable) (struct cpuidle_device *dev); | 174 | int (*enable) (struct cpuidle_driver *drv, |
| 170 | void (*disable) (struct cpuidle_device *dev); | 175 | struct cpuidle_device *dev); |
| 176 | void (*disable) (struct cpuidle_driver *drv, | ||
| 177 | struct cpuidle_device *dev); | ||
| 171 | 178 | ||
| 172 | int (*select) (struct cpuidle_device *dev); | 179 | int (*select) (struct cpuidle_driver *drv, |
| 173 | void (*reflect) (struct cpuidle_device *dev); | 180 | struct cpuidle_device *dev); |
| 181 | void (*reflect) (struct cpuidle_device *dev, int index); | ||
| 174 | 182 | ||
| 175 | struct module *owner; | 183 | struct module *owner; |
| 176 | }; | 184 | }; |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 45f00b61c096..de33de1e2052 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -1097,10 +1097,12 @@ struct ethtool_ops { | |||
| 1097 | #define SPEED_1000 1000 | 1097 | #define SPEED_1000 1000 |
| 1098 | #define SPEED_2500 2500 | 1098 | #define SPEED_2500 2500 |
| 1099 | #define SPEED_10000 10000 | 1099 | #define SPEED_10000 10000 |
| 1100 | #define SPEED_UNKNOWN -1 | ||
| 1100 | 1101 | ||
| 1101 | /* Duplex, half or full. */ | 1102 | /* Duplex, half or full. */ |
| 1102 | #define DUPLEX_HALF 0x00 | 1103 | #define DUPLEX_HALF 0x00 |
| 1103 | #define DUPLEX_FULL 0x01 | 1104 | #define DUPLEX_FULL 0x01 |
| 1105 | #define DUPLEX_UNKNOWN 0xff | ||
| 1104 | 1106 | ||
| 1105 | /* Which connector port. */ | 1107 | /* Which connector port. */ |
| 1106 | #define PORT_TP 0x00 | 1108 | #define PORT_TP 0x00 |
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 66f23dc5e76a..388b0d425b50 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
| @@ -16,7 +16,7 @@ struct jump_label_key { | |||
| 16 | 16 | ||
| 17 | # include <asm/jump_label.h> | 17 | # include <asm/jump_label.h> |
| 18 | # define HAVE_JUMP_LABEL | 18 | # define HAVE_JUMP_LABEL |
| 19 | #endif | 19 | #endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ |
| 20 | 20 | ||
| 21 | enum jump_label_type { | 21 | enum jump_label_type { |
| 22 | JUMP_LABEL_DISABLE = 0, | 22 | JUMP_LABEL_DISABLE = 0, |
| @@ -28,9 +28,9 @@ struct module; | |||
| 28 | #ifdef HAVE_JUMP_LABEL | 28 | #ifdef HAVE_JUMP_LABEL |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_MODULES | 30 | #ifdef CONFIG_MODULES |
| 31 | #define JUMP_LABEL_INIT {{ 0 }, NULL, NULL} | 31 | #define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL, NULL} |
| 32 | #else | 32 | #else |
| 33 | #define JUMP_LABEL_INIT {{ 0 }, NULL} | 33 | #define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL} |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | static __always_inline bool static_branch(struct jump_label_key *key) | 36 | static __always_inline bool static_branch(struct jump_label_key *key) |
| @@ -41,18 +41,20 @@ static __always_inline bool static_branch(struct jump_label_key *key) | |||
| 41 | extern struct jump_entry __start___jump_table[]; | 41 | extern struct jump_entry __start___jump_table[]; |
| 42 | extern struct jump_entry __stop___jump_table[]; | 42 | extern struct jump_entry __stop___jump_table[]; |
| 43 | 43 | ||
| 44 | extern void jump_label_init(void); | ||
| 44 | extern void jump_label_lock(void); | 45 | extern void jump_label_lock(void); |
| 45 | extern void jump_label_unlock(void); | 46 | extern void jump_label_unlock(void); |
| 46 | extern void arch_jump_label_transform(struct jump_entry *entry, | 47 | extern void arch_jump_label_transform(struct jump_entry *entry, |
| 47 | enum jump_label_type type); | 48 | enum jump_label_type type); |
| 48 | extern void arch_jump_label_text_poke_early(jump_label_t addr); | 49 | extern void arch_jump_label_transform_static(struct jump_entry *entry, |
| 50 | enum jump_label_type type); | ||
| 49 | extern int jump_label_text_reserved(void *start, void *end); | 51 | extern int jump_label_text_reserved(void *start, void *end); |
| 50 | extern void jump_label_inc(struct jump_label_key *key); | 52 | extern void jump_label_inc(struct jump_label_key *key); |
| 51 | extern void jump_label_dec(struct jump_label_key *key); | 53 | extern void jump_label_dec(struct jump_label_key *key); |
| 52 | extern bool jump_label_enabled(struct jump_label_key *key); | 54 | extern bool jump_label_enabled(struct jump_label_key *key); |
| 53 | extern void jump_label_apply_nops(struct module *mod); | 55 | extern void jump_label_apply_nops(struct module *mod); |
| 54 | 56 | ||
| 55 | #else | 57 | #else /* !HAVE_JUMP_LABEL */ |
| 56 | 58 | ||
| 57 | #include <linux/atomic.h> | 59 | #include <linux/atomic.h> |
| 58 | 60 | ||
| @@ -62,6 +64,10 @@ struct jump_label_key { | |||
| 62 | atomic_t enabled; | 64 | atomic_t enabled; |
| 63 | }; | 65 | }; |
| 64 | 66 | ||
| 67 | static __always_inline void jump_label_init(void) | ||
| 68 | { | ||
| 69 | } | ||
| 70 | |||
| 65 | static __always_inline bool static_branch(struct jump_label_key *key) | 71 | static __always_inline bool static_branch(struct jump_label_key *key) |
| 66 | { | 72 | { |
| 67 | if (unlikely(atomic_read(&key->enabled))) | 73 | if (unlikely(atomic_read(&key->enabled))) |
| @@ -96,7 +102,6 @@ static inline int jump_label_apply_nops(struct module *mod) | |||
| 96 | { | 102 | { |
| 97 | return 0; | 103 | return 0; |
| 98 | } | 104 | } |
| 105 | #endif /* HAVE_JUMP_LABEL */ | ||
| 99 | 106 | ||
| 100 | #endif | 107 | #endif /* _LINUX_JUMP_LABEL_H */ |
| 101 | |||
| 102 | #endif | ||
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 57cc0e63714f..c4eec228eef9 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
| @@ -86,24 +86,39 @@ struct nand_bbt_descr { | |||
| 86 | #define NAND_BBT_VERSION 0x00000100 | 86 | #define NAND_BBT_VERSION 0x00000100 |
| 87 | /* Create a bbt if none exists */ | 87 | /* Create a bbt if none exists */ |
| 88 | #define NAND_BBT_CREATE 0x00000200 | 88 | #define NAND_BBT_CREATE 0x00000200 |
| 89 | /* | ||
| 90 | * Create an empty BBT with no vendor information. Vendor's information may be | ||
| 91 | * unavailable, for example, if the NAND controller has a different data and OOB | ||
| 92 | * layout or if this information is already purged. Must be used in conjunction | ||
| 93 | * with NAND_BBT_CREATE. | ||
| 94 | */ | ||
| 95 | #define NAND_BBT_CREATE_EMPTY 0x00000400 | ||
| 89 | /* Search good / bad pattern through all pages of a block */ | 96 | /* Search good / bad pattern through all pages of a block */ |
| 90 | #define NAND_BBT_SCANALLPAGES 0x00000400 | 97 | #define NAND_BBT_SCANALLPAGES 0x00000800 |
| 91 | /* Scan block empty during good / bad block scan */ | 98 | /* Scan block empty during good / bad block scan */ |
| 92 | #define NAND_BBT_SCANEMPTY 0x00000800 | 99 | #define NAND_BBT_SCANEMPTY 0x00001000 |
| 93 | /* Write bbt if neccecary */ | 100 | /* Write bbt if neccecary */ |
| 94 | #define NAND_BBT_WRITE 0x00001000 | 101 | #define NAND_BBT_WRITE 0x00002000 |
| 95 | /* Read and write back block contents when writing bbt */ | 102 | /* Read and write back block contents when writing bbt */ |
| 96 | #define NAND_BBT_SAVECONTENT 0x00002000 | 103 | #define NAND_BBT_SAVECONTENT 0x00004000 |
| 97 | /* Search good / bad pattern on the first and the second page */ | 104 | /* Search good / bad pattern on the first and the second page */ |
| 98 | #define NAND_BBT_SCAN2NDPAGE 0x00004000 | 105 | #define NAND_BBT_SCAN2NDPAGE 0x00008000 |
| 99 | /* Search good / bad pattern on the last page of the eraseblock */ | 106 | /* Search good / bad pattern on the last page of the eraseblock */ |
| 100 | #define NAND_BBT_SCANLASTPAGE 0x00008000 | 107 | #define NAND_BBT_SCANLASTPAGE 0x00010000 |
| 101 | /* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */ | 108 | /* |
| 102 | #define NAND_BBT_SCANBYTE1AND6 0x00100000 | 109 | * Use a flash based bad block table. By default, OOB identifier is saved in |
| 103 | /* The nand_bbt_descr was created dynamicaly and must be freed */ | 110 | * OOB area. This option is passed to the default bad block table function. |
| 104 | #define NAND_BBT_DYNAMICSTRUCT 0x00200000 | 111 | */ |
| 105 | /* The bad block table does not OOB for marker */ | 112 | #define NAND_BBT_USE_FLASH 0x00020000 |
| 106 | #define NAND_BBT_NO_OOB 0x00400000 | 113 | /* Do not store flash based bad block table in OOB area; store it in-band */ |
| 114 | #define NAND_BBT_NO_OOB 0x00040000 | ||
| 115 | |||
| 116 | /* | ||
| 117 | * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr | ||
| 118 | * was allocated dynamicaly and must be freed in nand_release(). Has no meaning | ||
| 119 | * in nand_chip.bbt_options. | ||
| 120 | */ | ||
| 121 | #define NAND_BBT_DYNAMICSTRUCT 0x80000000 | ||
| 107 | 122 | ||
| 108 | /* The maximum number of blocks to scan for a bbt */ | 123 | /* The maximum number of blocks to scan for a bbt */ |
| 109 | #define NAND_BBT_SCAN_MAXBLOCKS 4 | 124 | #define NAND_BBT_SCAN_MAXBLOCKS 4 |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 37be05bbfbc8..9f5b312af783 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -32,17 +32,19 @@ | |||
| 32 | #define MTD_CHAR_MAJOR 90 | 32 | #define MTD_CHAR_MAJOR 90 |
| 33 | #define MTD_BLOCK_MAJOR 31 | 33 | #define MTD_BLOCK_MAJOR 31 |
| 34 | 34 | ||
| 35 | #define MTD_ERASE_PENDING 0x01 | 35 | #define MTD_ERASE_PENDING 0x01 |
| 36 | #define MTD_ERASING 0x02 | 36 | #define MTD_ERASING 0x02 |
| 37 | #define MTD_ERASE_SUSPEND 0x04 | 37 | #define MTD_ERASE_SUSPEND 0x04 |
| 38 | #define MTD_ERASE_DONE 0x08 | 38 | #define MTD_ERASE_DONE 0x08 |
| 39 | #define MTD_ERASE_FAILED 0x10 | 39 | #define MTD_ERASE_FAILED 0x10 |
| 40 | 40 | ||
| 41 | #define MTD_FAIL_ADDR_UNKNOWN -1LL | 41 | #define MTD_FAIL_ADDR_UNKNOWN -1LL |
| 42 | 42 | ||
| 43 | /* If the erase fails, fail_addr might indicate exactly which block failed. If | 43 | /* |
| 44 | fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not | 44 | * If the erase fails, fail_addr might indicate exactly which block failed. If |
| 45 | specific to any particular block. */ | 45 | * fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level |
| 46 | * or was not specific to any particular block. | ||
| 47 | */ | ||
| 46 | struct erase_info { | 48 | struct erase_info { |
| 47 | struct mtd_info *mtd; | 49 | struct mtd_info *mtd; |
| 48 | uint64_t addr; | 50 | uint64_t addr; |
| @@ -59,26 +61,12 @@ struct erase_info { | |||
| 59 | }; | 61 | }; |
| 60 | 62 | ||
| 61 | struct mtd_erase_region_info { | 63 | struct mtd_erase_region_info { |
| 62 | uint64_t offset; /* At which this region starts, from the beginning of the MTD */ | 64 | uint64_t offset; /* At which this region starts, from the beginning of the MTD */ |
| 63 | uint32_t erasesize; /* For this region */ | 65 | uint32_t erasesize; /* For this region */ |
| 64 | uint32_t numblocks; /* Number of blocks of erasesize in this region */ | 66 | uint32_t numblocks; /* Number of blocks of erasesize in this region */ |
| 65 | unsigned long *lockmap; /* If keeping bitmap of locks */ | 67 | unsigned long *lockmap; /* If keeping bitmap of locks */ |
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | /* | ||
| 69 | * oob operation modes | ||
| 70 | * | ||
| 71 | * MTD_OOB_PLACE: oob data are placed at the given offset | ||
| 72 | * MTD_OOB_AUTO: oob data are automatically placed at the free areas | ||
| 73 | * which are defined by the ecclayout | ||
| 74 | * MTD_OOB_RAW: mode to read oob and data without doing ECC checking | ||
| 75 | */ | ||
| 76 | typedef enum { | ||
| 77 | MTD_OOB_PLACE, | ||
| 78 | MTD_OOB_AUTO, | ||
| 79 | MTD_OOB_RAW, | ||
| 80 | } mtd_oob_mode_t; | ||
| 81 | |||
| 82 | /** | 70 | /** |
| 83 | * struct mtd_oob_ops - oob operation operands | 71 | * struct mtd_oob_ops - oob operation operands |
| 84 | * @mode: operation mode | 72 | * @mode: operation mode |
| @@ -90,7 +78,7 @@ typedef enum { | |||
| 90 | * @ooblen: number of oob bytes to write/read | 78 | * @ooblen: number of oob bytes to write/read |
| 91 | * @oobretlen: number of oob bytes written/read | 79 | * @oobretlen: number of oob bytes written/read |
| 92 | * @ooboffs: offset of oob data in the oob area (only relevant when | 80 | * @ooboffs: offset of oob data in the oob area (only relevant when |
| 93 | * mode = MTD_OOB_PLACE) | 81 | * mode = MTD_OPS_PLACE_OOB or MTD_OPS_RAW) |
| 94 | * @datbuf: data buffer - if NULL only oob data are read/written | 82 | * @datbuf: data buffer - if NULL only oob data are read/written |
| 95 | * @oobbuf: oob data buffer | 83 | * @oobbuf: oob data buffer |
| 96 | * | 84 | * |
| @@ -99,7 +87,7 @@ typedef enum { | |||
| 99 | * OOB area. | 87 | * OOB area. |
| 100 | */ | 88 | */ |
| 101 | struct mtd_oob_ops { | 89 | struct mtd_oob_ops { |
| 102 | mtd_oob_mode_t mode; | 90 | unsigned int mode; |
| 103 | size_t len; | 91 | size_t len; |
| 104 | size_t retlen; | 92 | size_t retlen; |
| 105 | size_t ooblen; | 93 | size_t ooblen; |
| @@ -173,7 +161,7 @@ struct mtd_info { | |||
| 173 | const char *name; | 161 | const char *name; |
| 174 | int index; | 162 | int index; |
| 175 | 163 | ||
| 176 | /* ecc layout structure pointer - read only ! */ | 164 | /* ECC layout structure pointer - read only! */ |
| 177 | struct nand_ecclayout *ecclayout; | 165 | struct nand_ecclayout *ecclayout; |
| 178 | 166 | ||
| 179 | /* Data for variable erase regions. If numeraseregions is zero, | 167 | /* Data for variable erase regions. If numeraseregions is zero, |
| @@ -324,10 +312,15 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) | |||
| 324 | /* Kernel-side ioctl definitions */ | 312 | /* Kernel-side ioctl definitions */ |
| 325 | 313 | ||
| 326 | struct mtd_partition; | 314 | struct mtd_partition; |
| 327 | 315 | struct mtd_part_parser_data; | |
| 328 | extern int mtd_device_register(struct mtd_info *master, | 316 | |
| 329 | const struct mtd_partition *parts, | 317 | extern int mtd_device_parse_register(struct mtd_info *mtd, |
| 330 | int nr_parts); | 318 | const char **part_probe_types, |
| 319 | struct mtd_part_parser_data *parser_data, | ||
| 320 | const struct mtd_partition *defparts, | ||
| 321 | int defnr_parts); | ||
| 322 | #define mtd_device_register(master, parts, nr_parts) \ | ||
| 323 | mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) | ||
| 331 | extern int mtd_device_unregister(struct mtd_info *master); | 324 | extern int mtd_device_unregister(struct mtd_info *master); |
| 332 | extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); | 325 | extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); |
| 333 | extern int __get_mtd_device(struct mtd_info *mtd); | 326 | extern int __get_mtd_device(struct mtd_info *mtd); |
| @@ -356,27 +349,16 @@ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); | |||
| 356 | 349 | ||
| 357 | void mtd_erase_callback(struct erase_info *instr); | 350 | void mtd_erase_callback(struct erase_info *instr); |
| 358 | 351 | ||
| 359 | /* | 352 | static inline int mtd_is_bitflip(int err) { |
| 360 | * Debugging macro and defines | 353 | return err == -EUCLEAN; |
| 361 | */ | 354 | } |
| 362 | #define MTD_DEBUG_LEVEL0 (0) /* Quiet */ | 355 | |
| 363 | #define MTD_DEBUG_LEVEL1 (1) /* Audible */ | 356 | static inline int mtd_is_eccerr(int err) { |
| 364 | #define MTD_DEBUG_LEVEL2 (2) /* Loud */ | 357 | return err == -EBADMSG; |
| 365 | #define MTD_DEBUG_LEVEL3 (3) /* Noisy */ | 358 | } |
| 366 | 359 | ||
| 367 | #ifdef CONFIG_MTD_DEBUG | 360 | static inline int mtd_is_bitflip_or_eccerr(int err) { |
| 368 | #define DEBUG(n, args...) \ | 361 | return mtd_is_bitflip(err) || mtd_is_eccerr(err); |
| 369 | do { \ | 362 | } |
| 370 | if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ | ||
| 371 | printk(KERN_INFO args); \ | ||
| 372 | } while(0) | ||
| 373 | #else /* CONFIG_MTD_DEBUG */ | ||
| 374 | #define DEBUG(n, args...) \ | ||
| 375 | do { \ | ||
| 376 | if (0) \ | ||
| 377 | printk(KERN_INFO args); \ | ||
| 378 | } while(0) | ||
| 379 | |||
| 380 | #endif /* CONFIG_MTD_DEBUG */ | ||
| 381 | 363 | ||
| 382 | #endif /* __MTD_MTD_H__ */ | 364 | #endif /* __MTD_MTD_H__ */ |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index c2b9ac4fbc4a..904131bab501 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -42,10 +42,10 @@ extern void nand_release(struct mtd_info *mtd); | |||
| 42 | /* Internal helper for board drivers which need to override command function */ | 42 | /* Internal helper for board drivers which need to override command function */ |
| 43 | extern void nand_wait_ready(struct mtd_info *mtd); | 43 | extern void nand_wait_ready(struct mtd_info *mtd); |
| 44 | 44 | ||
| 45 | /* locks all blockes present in the device */ | 45 | /* locks all blocks present in the device */ |
| 46 | extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | 46 | extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
| 47 | 47 | ||
| 48 | /* unlocks specified locked blockes */ | 48 | /* unlocks specified locked blocks */ |
| 49 | extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | 49 | extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
| 50 | 50 | ||
| 51 | /* The maximum number of NAND chips in an array */ | 51 | /* The maximum number of NAND chips in an array */ |
| @@ -150,7 +150,7 @@ typedef enum { | |||
| 150 | #define NAND_ECC_READ 0 | 150 | #define NAND_ECC_READ 0 |
| 151 | /* Reset Hardware ECC for write */ | 151 | /* Reset Hardware ECC for write */ |
| 152 | #define NAND_ECC_WRITE 1 | 152 | #define NAND_ECC_WRITE 1 |
| 153 | /* Enable Hardware ECC before syndrom is read back from flash */ | 153 | /* Enable Hardware ECC before syndrome is read back from flash */ |
| 154 | #define NAND_ECC_READSYN 2 | 154 | #define NAND_ECC_READSYN 2 |
| 155 | 155 | ||
| 156 | /* Bit mask for flags passed to do_nand_read_ecc */ | 156 | /* Bit mask for flags passed to do_nand_read_ecc */ |
| @@ -163,7 +163,7 @@ typedef enum { | |||
| 163 | */ | 163 | */ |
| 164 | /* Chip can not auto increment pages */ | 164 | /* Chip can not auto increment pages */ |
| 165 | #define NAND_NO_AUTOINCR 0x00000001 | 165 | #define NAND_NO_AUTOINCR 0x00000001 |
| 166 | /* Buswitdh is 16 bit */ | 166 | /* Buswidth is 16 bit */ |
| 167 | #define NAND_BUSWIDTH_16 0x00000002 | 167 | #define NAND_BUSWIDTH_16 0x00000002 |
| 168 | /* Device supports partial programming without padding */ | 168 | /* Device supports partial programming without padding */ |
| 169 | #define NAND_NO_PADDING 0x00000004 | 169 | #define NAND_NO_PADDING 0x00000004 |
| @@ -219,27 +219,15 @@ typedef enum { | |||
| 219 | #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) | 219 | #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) |
| 220 | 220 | ||
| 221 | /* Non chip related options */ | 221 | /* Non chip related options */ |
| 222 | /* | ||
| 223 | * Use a flash based bad block table. OOB identifier is saved in OOB area. | ||
| 224 | * This option is passed to the default bad block table function. | ||
| 225 | */ | ||
| 226 | #define NAND_USE_FLASH_BBT 0x00010000 | ||
| 227 | /* This option skips the bbt scan during initialization. */ | 222 | /* This option skips the bbt scan during initialization. */ |
| 228 | #define NAND_SKIP_BBTSCAN 0x00020000 | 223 | #define NAND_SKIP_BBTSCAN 0x00010000 |
| 229 | /* | 224 | /* |
| 230 | * This option is defined if the board driver allocates its own buffers | 225 | * This option is defined if the board driver allocates its own buffers |
| 231 | * (e.g. because it needs them DMA-coherent). | 226 | * (e.g. because it needs them DMA-coherent). |
| 232 | */ | 227 | */ |
| 233 | #define NAND_OWN_BUFFERS 0x00040000 | 228 | #define NAND_OWN_BUFFERS 0x00020000 |
| 234 | /* Chip may not exist, so silence any errors in scan */ | 229 | /* Chip may not exist, so silence any errors in scan */ |
| 235 | #define NAND_SCAN_SILENT_NODEV 0x00080000 | 230 | #define NAND_SCAN_SILENT_NODEV 0x00040000 |
| 236 | /* | ||
| 237 | * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch | ||
| 238 | * the OOB area. | ||
| 239 | */ | ||
| 240 | #define NAND_USE_FLASH_BBT_NO_OOB 0x00800000 | ||
| 241 | /* Create an empty BBT with no vendor information if the BBT is available */ | ||
| 242 | #define NAND_CREATE_EMPTY_BBT 0x01000000 | ||
| 243 | 231 | ||
| 244 | /* Options set by nand scan */ | 232 | /* Options set by nand scan */ |
| 245 | /* Nand scan has allocated controller struct */ | 233 | /* Nand scan has allocated controller struct */ |
| @@ -331,27 +319,29 @@ struct nand_hw_control { | |||
| 331 | }; | 319 | }; |
| 332 | 320 | ||
| 333 | /** | 321 | /** |
| 334 | * struct nand_ecc_ctrl - Control structure for ecc | 322 | * struct nand_ecc_ctrl - Control structure for ECC |
| 335 | * @mode: ecc mode | 323 | * @mode: ECC mode |
| 336 | * @steps: number of ecc steps per page | 324 | * @steps: number of ECC steps per page |
| 337 | * @size: data bytes per ecc step | 325 | * @size: data bytes per ECC step |
| 338 | * @bytes: ecc bytes per step | 326 | * @bytes: ECC bytes per step |
| 339 | * @total: total number of ecc bytes per page | 327 | * @total: total number of ECC bytes per page |
| 340 | * @prepad: padding information for syndrome based ecc generators | 328 | * @prepad: padding information for syndrome based ECC generators |
| 341 | * @postpad: padding information for syndrome based ecc generators | 329 | * @postpad: padding information for syndrome based ECC generators |
| 342 | * @layout: ECC layout control struct pointer | 330 | * @layout: ECC layout control struct pointer |
| 343 | * @priv: pointer to private ecc control data | 331 | * @priv: pointer to private ECC control data |
| 344 | * @hwctl: function to control hardware ecc generator. Must only | 332 | * @hwctl: function to control hardware ECC generator. Must only |
| 345 | * be provided if an hardware ECC is available | 333 | * be provided if an hardware ECC is available |
| 346 | * @calculate: function for ecc calculation or readback from ecc hardware | 334 | * @calculate: function for ECC calculation or readback from ECC hardware |
| 347 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) | 335 | * @correct: function for ECC correction, matching to ECC generator (sw/hw) |
| 348 | * @read_page_raw: function to read a raw page without ECC | 336 | * @read_page_raw: function to read a raw page without ECC |
| 349 | * @write_page_raw: function to write a raw page without ECC | 337 | * @write_page_raw: function to write a raw page without ECC |
| 350 | * @read_page: function to read a page according to the ecc generator | 338 | * @read_page: function to read a page according to the ECC generator |
| 351 | * requirements. | 339 | * requirements. |
| 352 | * @read_subpage: function to read parts of the page covered by ECC. | 340 | * @read_subpage: function to read parts of the page covered by ECC. |
| 353 | * @write_page: function to write a page according to the ecc generator | 341 | * @write_page: function to write a page according to the ECC generator |
| 354 | * requirements. | 342 | * requirements. |
| 343 | * @write_oob_raw: function to write chip OOB data without ECC | ||
| 344 | * @read_oob_raw: function to read chip OOB data without ECC | ||
| 355 | * @read_oob: function to read chip OOB data | 345 | * @read_oob: function to read chip OOB data |
| 356 | * @write_oob: function to write chip OOB data | 346 | * @write_oob: function to write chip OOB data |
| 357 | */ | 347 | */ |
| @@ -380,6 +370,10 @@ struct nand_ecc_ctrl { | |||
| 380 | uint32_t offs, uint32_t len, uint8_t *buf); | 370 | uint32_t offs, uint32_t len, uint8_t *buf); |
| 381 | void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | 371 | void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, |
| 382 | const uint8_t *buf); | 372 | const uint8_t *buf); |
| 373 | int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 374 | int page); | ||
| 375 | int (*read_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 376 | int page, int sndcmd); | ||
| 383 | int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page, | 377 | int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page, |
| 384 | int sndcmd); | 378 | int sndcmd); |
| 385 | int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip, | 379 | int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip, |
| @@ -388,8 +382,8 @@ struct nand_ecc_ctrl { | |||
| 388 | 382 | ||
| 389 | /** | 383 | /** |
| 390 | * struct nand_buffers - buffer structure for read/write | 384 | * struct nand_buffers - buffer structure for read/write |
| 391 | * @ecccalc: buffer for calculated ecc | 385 | * @ecccalc: buffer for calculated ECC |
| 392 | * @ecccode: buffer for ecc read from flash | 386 | * @ecccode: buffer for ECC read from flash |
| 393 | * @databuf: buffer for data - dynamically sized | 387 | * @databuf: buffer for data - dynamically sized |
| 394 | * | 388 | * |
| 395 | * Do not change the order of buffers. databuf and oobrbuf must be in | 389 | * Do not change the order of buffers. databuf and oobrbuf must be in |
| @@ -422,7 +416,7 @@ struct nand_buffers { | |||
| 422 | * mtd->oobsize, mtd->writesize and so on. | 416 | * mtd->oobsize, mtd->writesize and so on. |
| 423 | * @id_data contains the 8 bytes values of NAND_CMD_READID. | 417 | * @id_data contains the 8 bytes values of NAND_CMD_READID. |
| 424 | * Return with the bus width. | 418 | * Return with the bus width. |
| 425 | * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing | 419 | * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accessing |
| 426 | * device ready/busy line. If set to NULL no access to | 420 | * device ready/busy line. If set to NULL no access to |
| 427 | * ready/busy is available and the ready/busy information | 421 | * ready/busy is available and the ready/busy information |
| 428 | * is read from the chip status register. | 422 | * is read from the chip status register. |
| @@ -430,17 +424,17 @@ struct nand_buffers { | |||
| 430 | * commands to the chip. | 424 | * commands to the chip. |
| 431 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on | 425 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on |
| 432 | * ready. | 426 | * ready. |
| 433 | * @ecc: [BOARDSPECIFIC] ecc control ctructure | 427 | * @ecc: [BOARDSPECIFIC] ECC control structure |
| 434 | * @buffers: buffer structure for read/write | 428 | * @buffers: buffer structure for read/write |
| 435 | * @hwcontrol: platform-specific hardware control structure | 429 | * @hwcontrol: platform-specific hardware control structure |
| 436 | * @ops: oob operation operands | ||
| 437 | * @erase_cmd: [INTERN] erase command write function, selectable due | 430 | * @erase_cmd: [INTERN] erase command write function, selectable due |
| 438 | * to AND support. | 431 | * to AND support. |
| 439 | * @scan_bbt: [REPLACEABLE] function to scan bad block table | 432 | * @scan_bbt: [REPLACEABLE] function to scan bad block table |
| 440 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring | 433 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring |
| 441 | * data from array to read regs (tR). | 434 | * data from array to read regs (tR). |
| 442 | * @state: [INTERN] the current state of the NAND device | 435 | * @state: [INTERN] the current state of the NAND device |
| 443 | * @oob_poi: poison value buffer | 436 | * @oob_poi: "poison value buffer," used for laying out OOB data |
| 437 | * before writing | ||
| 444 | * @page_shift: [INTERN] number of address bits in a page (column | 438 | * @page_shift: [INTERN] number of address bits in a page (column |
| 445 | * address bits). | 439 | * address bits). |
| 446 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock | 440 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock |
| @@ -449,6 +443,9 @@ struct nand_buffers { | |||
| 449 | * @options: [BOARDSPECIFIC] various chip options. They can partly | 443 | * @options: [BOARDSPECIFIC] various chip options. They can partly |
| 450 | * be set to inform nand_scan about special functionality. | 444 | * be set to inform nand_scan about special functionality. |
| 451 | * See the defines for further explanation. | 445 | * See the defines for further explanation. |
| 446 | * @bbt_options: [INTERN] bad block specific options. All options used | ||
| 447 | * here must come from bbm.h. By default, these options | ||
| 448 | * will be copied to the appropriate nand_bbt_descr's. | ||
| 452 | * @badblockpos: [INTERN] position of the bad block marker in the oob | 449 | * @badblockpos: [INTERN] position of the bad block marker in the oob |
| 453 | * area. | 450 | * area. |
| 454 | * @badblockbits: [INTERN] number of bits to left-shift the bad block | 451 | * @badblockbits: [INTERN] number of bits to left-shift the bad block |
| @@ -464,7 +461,7 @@ struct nand_buffers { | |||
| 464 | * non 0 if ONFI supported. | 461 | * non 0 if ONFI supported. |
| 465 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is | 462 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is |
| 466 | * supported, 0 otherwise. | 463 | * supported, 0 otherwise. |
| 467 | * @ecclayout: [REPLACEABLE] the default ecc placement scheme | 464 | * @ecclayout: [REPLACEABLE] the default ECC placement scheme |
| 468 | * @bbt: [INTERN] bad block table pointer | 465 | * @bbt: [INTERN] bad block table pointer |
| 469 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash | 466 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash |
| 470 | * lookup. | 467 | * lookup. |
| @@ -472,9 +469,9 @@ struct nand_buffers { | |||
| 472 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial | 469 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial |
| 473 | * bad block scan. | 470 | * bad block scan. |
| 474 | * @controller: [REPLACEABLE] a pointer to a hardware controller | 471 | * @controller: [REPLACEABLE] a pointer to a hardware controller |
| 475 | * structure which is shared among multiple independend | 472 | * structure which is shared among multiple independent |
| 476 | * devices. | 473 | * devices. |
| 477 | * @priv: [OPTIONAL] pointer to private chip date | 474 | * @priv: [OPTIONAL] pointer to private chip data |
| 478 | * @errstat: [OPTIONAL] hardware specific function to perform | 475 | * @errstat: [OPTIONAL] hardware specific function to perform |
| 479 | * additional error status checks (determine if errors are | 476 | * additional error status checks (determine if errors are |
| 480 | * correctable). | 477 | * correctable). |
| @@ -509,6 +506,7 @@ struct nand_chip { | |||
| 509 | 506 | ||
| 510 | int chip_delay; | 507 | int chip_delay; |
| 511 | unsigned int options; | 508 | unsigned int options; |
| 509 | unsigned int bbt_options; | ||
| 512 | 510 | ||
| 513 | int page_shift; | 511 | int page_shift; |
| 514 | int phys_erase_shift; | 512 | int phys_erase_shift; |
| @@ -536,8 +534,6 @@ struct nand_chip { | |||
| 536 | struct nand_buffers *buffers; | 534 | struct nand_buffers *buffers; |
| 537 | struct nand_hw_control hwcontrol; | 535 | struct nand_hw_control hwcontrol; |
| 538 | 536 | ||
| 539 | struct mtd_oob_ops ops; | ||
| 540 | |||
| 541 | uint8_t *bbt; | 537 | uint8_t *bbt; |
| 542 | struct nand_bbt_descr *bbt_td; | 538 | struct nand_bbt_descr *bbt_td; |
| 543 | struct nand_bbt_descr *bbt_md; | 539 | struct nand_bbt_descr *bbt_md; |
| @@ -611,10 +607,9 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 611 | * @partitions: mtd partition list | 607 | * @partitions: mtd partition list |
| 612 | * @chip_delay: R/B delay value in us | 608 | * @chip_delay: R/B delay value in us |
| 613 | * @options: Option flags, e.g. 16bit buswidth | 609 | * @options: Option flags, e.g. 16bit buswidth |
| 614 | * @ecclayout: ecc layout info structure | 610 | * @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH |
| 611 | * @ecclayout: ECC layout info structure | ||
| 615 | * @part_probe_types: NULL-terminated array of probe types | 612 | * @part_probe_types: NULL-terminated array of probe types |
| 616 | * @set_parts: platform specific function to set partitions | ||
| 617 | * @priv: hardware controller specific settings | ||
| 618 | */ | 613 | */ |
| 619 | struct platform_nand_chip { | 614 | struct platform_nand_chip { |
| 620 | int nr_chips; | 615 | int nr_chips; |
| @@ -624,9 +619,8 @@ struct platform_nand_chip { | |||
| 624 | struct nand_ecclayout *ecclayout; | 619 | struct nand_ecclayout *ecclayout; |
| 625 | int chip_delay; | 620 | int chip_delay; |
| 626 | unsigned int options; | 621 | unsigned int options; |
| 622 | unsigned int bbt_options; | ||
| 627 | const char **part_probe_types; | 623 | const char **part_probe_types; |
| 628 | void (*set_parts)(uint64_t size, struct platform_nand_chip *chip); | ||
| 629 | void *priv; | ||
| 630 | }; | 624 | }; |
| 631 | 625 | ||
| 632 | /* Keep gcc happy */ | 626 | /* Keep gcc happy */ |
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 52b6f187bf49..4596503c9da9 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
| @@ -184,6 +184,9 @@ struct onenand_chip { | |||
| 184 | #define ONENAND_IS_CACHE_PROGRAM(this) \ | 184 | #define ONENAND_IS_CACHE_PROGRAM(this) \ |
| 185 | (this->options & ONENAND_HAS_CACHE_PROGRAM) | 185 | (this->options & ONENAND_HAS_CACHE_PROGRAM) |
| 186 | 186 | ||
| 187 | #define ONENAND_IS_NOP_1(this) \ | ||
| 188 | (this->options & ONENAND_HAS_NOP_1) | ||
| 189 | |||
| 187 | /* Check byte access in OneNAND */ | 190 | /* Check byte access in OneNAND */ |
| 188 | #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) | 191 | #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) |
| 189 | 192 | ||
| @@ -195,6 +198,7 @@ struct onenand_chip { | |||
| 195 | #define ONENAND_HAS_2PLANE (0x0004) | 198 | #define ONENAND_HAS_2PLANE (0x0004) |
| 196 | #define ONENAND_HAS_4KB_PAGE (0x0008) | 199 | #define ONENAND_HAS_4KB_PAGE (0x0008) |
| 197 | #define ONENAND_HAS_CACHE_PROGRAM (0x0010) | 200 | #define ONENAND_HAS_CACHE_PROGRAM (0x0010) |
| 201 | #define ONENAND_HAS_NOP_1 (0x0020) | ||
| 198 | #define ONENAND_SKIP_UNLOCK_CHECK (0x0100) | 202 | #define ONENAND_SKIP_UNLOCK_CHECK (0x0100) |
| 199 | #define ONENAND_PAGEBUF_ALLOC (0x1000) | 203 | #define ONENAND_PAGEBUF_ALLOC (0x1000) |
| 200 | #define ONENAND_OOBBUF_ALLOC (0x2000) | 204 | #define ONENAND_OOBBUF_ALLOC (0x2000) |
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index 3a6f0372fc96..2475228c1158 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
| @@ -24,7 +24,9 @@ | |||
| 24 | * will extend to the end of the master MTD device. | 24 | * will extend to the end of the master MTD device. |
| 25 | * offset: absolute starting position within the master MTD device; if | 25 | * offset: absolute starting position within the master MTD device; if |
| 26 | * defined as MTDPART_OFS_APPEND, the partition will start where the | 26 | * defined as MTDPART_OFS_APPEND, the partition will start where the |
| 27 | * previous one ended; if MTDPART_OFS_NXTBLK, at the next erase block. | 27 | * previous one ended; if MTDPART_OFS_NXTBLK, at the next erase block; |
| 28 | * if MTDPART_OFS_RETAIN, consume as much as possible, leaving size | ||
| 29 | * after the end of partition. | ||
| 28 | * mask_flags: contains flags that have to be masked (removed) from the | 30 | * mask_flags: contains flags that have to be masked (removed) from the |
| 29 | * master MTD flag set for the corresponding MTD partition. | 31 | * master MTD flag set for the corresponding MTD partition. |
| 30 | * For example, to force a read-only partition, simply adding | 32 | * For example, to force a read-only partition, simply adding |
| @@ -42,12 +44,25 @@ struct mtd_partition { | |||
| 42 | struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */ | 44 | struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */ |
| 43 | }; | 45 | }; |
| 44 | 46 | ||
| 47 | #define MTDPART_OFS_RETAIN (-3) | ||
| 45 | #define MTDPART_OFS_NXTBLK (-2) | 48 | #define MTDPART_OFS_NXTBLK (-2) |
| 46 | #define MTDPART_OFS_APPEND (-1) | 49 | #define MTDPART_OFS_APPEND (-1) |
| 47 | #define MTDPART_SIZ_FULL (0) | 50 | #define MTDPART_SIZ_FULL (0) |
| 48 | 51 | ||
| 49 | 52 | ||
| 50 | struct mtd_info; | 53 | struct mtd_info; |
| 54 | struct device_node; | ||
| 55 | |||
| 56 | /** | ||
| 57 | * struct mtd_part_parser_data - used to pass data to MTD partition parsers. | ||
| 58 | * @origin: for RedBoot, start address of MTD device | ||
| 59 | * @of_node: for OF parsers, device node containing partitioning information | ||
| 60 | */ | ||
| 61 | struct mtd_part_parser_data { | ||
| 62 | unsigned long origin; | ||
| 63 | struct device_node *of_node; | ||
| 64 | }; | ||
| 65 | |||
| 51 | 66 | ||
| 52 | /* | 67 | /* |
| 53 | * Functions dealing with the various ways of partitioning the space | 68 | * Functions dealing with the various ways of partitioning the space |
| @@ -57,37 +72,12 @@ struct mtd_part_parser { | |||
| 57 | struct list_head list; | 72 | struct list_head list; |
| 58 | struct module *owner; | 73 | struct module *owner; |
| 59 | const char *name; | 74 | const char *name; |
| 60 | int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long); | 75 | int (*parse_fn)(struct mtd_info *, struct mtd_partition **, |
| 76 | struct mtd_part_parser_data *); | ||
| 61 | }; | 77 | }; |
| 62 | 78 | ||
| 63 | extern int register_mtd_parser(struct mtd_part_parser *parser); | 79 | extern int register_mtd_parser(struct mtd_part_parser *parser); |
| 64 | extern int deregister_mtd_parser(struct mtd_part_parser *parser); | 80 | extern int deregister_mtd_parser(struct mtd_part_parser *parser); |
| 65 | extern int parse_mtd_partitions(struct mtd_info *master, const char **types, | ||
| 66 | struct mtd_partition **pparts, unsigned long origin); | ||
| 67 | |||
| 68 | #define put_partition_parser(p) do { module_put((p)->owner); } while(0) | ||
| 69 | |||
| 70 | struct device; | ||
| 71 | struct device_node; | ||
| 72 | |||
| 73 | #ifdef CONFIG_MTD_OF_PARTS | ||
| 74 | int __devinit of_mtd_parse_partitions(struct device *dev, | ||
| 75 | struct device_node *node, | ||
| 76 | struct mtd_partition **pparts); | ||
| 77 | #else | ||
| 78 | static inline int of_mtd_parse_partitions(struct device *dev, | ||
| 79 | struct device_node *node, | ||
| 80 | struct mtd_partition **pparts) | ||
| 81 | { | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #ifdef CONFIG_MTD_CMDLINE_PARTS | ||
| 87 | static inline int mtd_has_cmdlinepart(void) { return 1; } | ||
| 88 | #else | ||
| 89 | static inline int mtd_has_cmdlinepart(void) { return 0; } | ||
| 90 | #endif | ||
| 91 | 81 | ||
| 92 | int mtd_is_partition(struct mtd_info *mtd); | 82 | int mtd_is_partition(struct mtd_info *mtd); |
| 93 | int mtd_add_partition(struct mtd_info *master, char *name, | 83 | int mtd_add_partition(struct mtd_info *master, char *name, |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index e5f21d293c70..04e018160e2b 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
| @@ -32,21 +32,4 @@ struct physmap_flash_data { | |||
| 32 | struct mtd_partition *parts; | 32 | struct mtd_partition *parts; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | /* | ||
| 36 | * Board needs to specify the exact mapping during their setup time. | ||
| 37 | */ | ||
| 38 | void physmap_configure(unsigned long addr, unsigned long size, | ||
| 39 | int bankwidth, void (*set_vpp)(struct map_info *, int) ); | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Machines that wish to do flash partition may want to call this function in | ||
| 43 | * their setup routine. | ||
| 44 | * | ||
| 45 | * physmap_set_partitions(mypartitions, num_parts); | ||
| 46 | * | ||
| 47 | * Note that one can always override this hard-coded partition with | ||
| 48 | * command line partition (you need to enable CONFIG_MTD_CMDLINE_PARTS). | ||
| 49 | */ | ||
| 50 | void physmap_set_partitions(struct mtd_partition *parts, int num_parts); | ||
| 51 | |||
| 52 | #endif /* __LINUX_MTD_PHYSMAP__ */ | 35 | #endif /* __LINUX_MTD_PHYSMAP__ */ |
