diff options
| -rw-r--r-- | drivers/mtd/nand/nand_base.c | 106 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 22 |
2 files changed, 64 insertions, 64 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 6ef1893996ce..afa77d1ed900 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -118,7 +118,7 @@ static struct nand_oobinfo nand_oob_64 = { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | /* This is used for padding purposes in nand_write_oob */ | 120 | /* This is used for padding purposes in nand_write_oob */ |
| 121 | static u_char ffchars[] = { | 121 | static uint8_t ffchars[] = { |
| 122 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 122 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 123 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 123 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 124 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 124 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| @@ -132,39 +132,39 @@ static u_char ffchars[] = { | |||
| 132 | /* | 132 | /* |
| 133 | * NAND low-level MTD interface functions | 133 | * NAND low-level MTD interface functions |
| 134 | */ | 134 | */ |
| 135 | static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len); | 135 | static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len); |
| 136 | static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len); | 136 | static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len); |
| 137 | static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len); | 137 | static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len); |
| 138 | 138 | ||
| 139 | static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, | 139 | static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, |
| 140 | size_t *retlen, u_char *buf); | 140 | size_t *retlen, uint8_t *buf); |
| 141 | static int nand_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | 141 | static int nand_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, |
| 142 | size_t *retlen, u_char *buf, u_char *eccbuf, | 142 | size_t *retlen, uint8_t *buf, uint8_t *eccbuf, |
| 143 | struct nand_oobinfo *oobsel); | 143 | struct nand_oobinfo *oobsel); |
| 144 | static int nand_read_oob(struct mtd_info *mtd, loff_t from, size_t len, | 144 | static int nand_read_oob(struct mtd_info *mtd, loff_t from, size_t len, |
| 145 | size_t *retlen, u_char *buf); | 145 | size_t *retlen, uint8_t *buf); |
| 146 | static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, | 146 | static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, |
| 147 | size_t *retlen, const u_char *buf); | 147 | size_t *retlen, const uint8_t *buf); |
| 148 | static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | 148 | static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, |
| 149 | size_t *retlen, const u_char *buf, u_char *eccbuf, | 149 | size_t *retlen, const uint8_t *buf, uint8_t *eccbuf, |
| 150 | struct nand_oobinfo *oobsel); | 150 | struct nand_oobinfo *oobsel); |
| 151 | static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | 151 | static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, |
| 152 | size_t *retlen, const u_char *buf); | 152 | size_t *retlen, const uint8_t *buf); |
| 153 | static int nand_writev(struct mtd_info *mtd, const struct kvec *vecs, | 153 | static int nand_writev(struct mtd_info *mtd, const struct kvec *vecs, |
| 154 | unsigned long count, loff_t to, size_t *retlen); | 154 | unsigned long count, loff_t to, size_t *retlen); |
| 155 | static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | 155 | static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, |
| 156 | unsigned long count, loff_t to, size_t *retlen, | 156 | unsigned long count, loff_t to, size_t *retlen, |
| 157 | u_char *eccbuf, struct nand_oobinfo *oobsel); | 157 | uint8_t *eccbuf, struct nand_oobinfo *oobsel); |
| 158 | static int nand_erase(struct mtd_info *mtd, struct erase_info *instr); | 158 | static int nand_erase(struct mtd_info *mtd, struct erase_info *instr); |
| 159 | static void nand_sync(struct mtd_info *mtd); | 159 | static void nand_sync(struct mtd_info *mtd); |
| 160 | 160 | ||
| 161 | /* Some internal functions */ | 161 | /* Some internal functions */ |
| 162 | static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, | 162 | static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, |
| 163 | int page, u_char * oob_buf, | 163 | int page, uint8_t * oob_buf, |
| 164 | struct nand_oobinfo *oobsel, int mode); | 164 | struct nand_oobinfo *oobsel, int mode); |
| 165 | #ifdef CONFIG_MTD_NAND_VERIFY_WRITE | 165 | #ifdef CONFIG_MTD_NAND_VERIFY_WRITE |
| 166 | static int nand_verify_pages(struct mtd_info *mtd, struct nand_chip *this, | 166 | static int nand_verify_pages(struct mtd_info *mtd, struct nand_chip *this, |
| 167 | int page, int numpages, u_char *oob_buf, | 167 | int page, int numpages, uint8_t *oob_buf, |
| 168 | struct nand_oobinfo *oobsel, int chipnr, | 168 | struct nand_oobinfo *oobsel, int chipnr, |
| 169 | int oobmode); | 169 | int oobmode); |
| 170 | #else | 170 | #else |
| @@ -201,7 +201,7 @@ static void nand_release_device(struct mtd_info *mtd) | |||
| 201 | * | 201 | * |
| 202 | * Default read function for 8bit buswith | 202 | * Default read function for 8bit buswith |
| 203 | */ | 203 | */ |
| 204 | static u_char nand_read_byte(struct mtd_info *mtd) | 204 | static uint8_t nand_read_byte(struct mtd_info *mtd) |
| 205 | { | 205 | { |
| 206 | struct nand_chip *this = mtd->priv; | 206 | struct nand_chip *this = mtd->priv; |
| 207 | return readb(this->IO_ADDR_R); | 207 | return readb(this->IO_ADDR_R); |
| @@ -214,7 +214,7 @@ static u_char nand_read_byte(struct mtd_info *mtd) | |||
| 214 | * | 214 | * |
| 215 | * Default write function for 8it buswith | 215 | * Default write function for 8it buswith |
| 216 | */ | 216 | */ |
| 217 | static void nand_write_byte(struct mtd_info *mtd, u_char byte) | 217 | static void nand_write_byte(struct mtd_info *mtd, uint8_t byte) |
| 218 | { | 218 | { |
| 219 | struct nand_chip *this = mtd->priv; | 219 | struct nand_chip *this = mtd->priv; |
| 220 | writeb(byte, this->IO_ADDR_W); | 220 | writeb(byte, this->IO_ADDR_W); |
| @@ -227,10 +227,10 @@ static void nand_write_byte(struct mtd_info *mtd, u_char byte) | |||
| 227 | * Default read function for 16bit buswith with | 227 | * Default read function for 16bit buswith with |
| 228 | * endianess conversion | 228 | * endianess conversion |
| 229 | */ | 229 | */ |
| 230 | static u_char nand_read_byte16(struct mtd_info *mtd) | 230 | static uint8_t nand_read_byte16(struct mtd_info *mtd) |
| 231 | { | 231 | { |
| 232 | struct nand_chip *this = mtd->priv; | 232 | struct nand_chip *this = mtd->priv; |
| 233 | return (u_char) cpu_to_le16(readw(this->IO_ADDR_R)); | 233 | return (uint8_t) cpu_to_le16(readw(this->IO_ADDR_R)); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | /** | 236 | /** |
| @@ -241,7 +241,7 @@ static u_char nand_read_byte16(struct mtd_info *mtd) | |||
| 241 | * Default write function for 16bit buswith with | 241 | * Default write function for 16bit buswith with |
| 242 | * endianess conversion | 242 | * endianess conversion |
| 243 | */ | 243 | */ |
| 244 | static void nand_write_byte16(struct mtd_info *mtd, u_char byte) | 244 | static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte) |
| 245 | { | 245 | { |
| 246 | struct nand_chip *this = mtd->priv; | 246 | struct nand_chip *this = mtd->priv; |
| 247 | writew(le16_to_cpu((u16) byte), this->IO_ADDR_W); | 247 | writew(le16_to_cpu((u16) byte), this->IO_ADDR_W); |
| @@ -305,7 +305,7 @@ static void nand_select_chip(struct mtd_info *mtd, int chip) | |||
| 305 | * | 305 | * |
| 306 | * Default write function for 8bit buswith | 306 | * Default write function for 8bit buswith |
| 307 | */ | 307 | */ |
| 308 | static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) | 308 | static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) |
| 309 | { | 309 | { |
| 310 | int i; | 310 | int i; |
| 311 | struct nand_chip *this = mtd->priv; | 311 | struct nand_chip *this = mtd->priv; |
| @@ -322,7 +322,7 @@ static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len) | |||
| 322 | * | 322 | * |
| 323 | * Default read function for 8bit buswith | 323 | * Default read function for 8bit buswith |
| 324 | */ | 324 | */ |
| 325 | static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) | 325 | static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) |
| 326 | { | 326 | { |
| 327 | int i; | 327 | int i; |
| 328 | struct nand_chip *this = mtd->priv; | 328 | struct nand_chip *this = mtd->priv; |
| @@ -339,7 +339,7 @@ static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) | |||
| 339 | * | 339 | * |
| 340 | * Default verify function for 8bit buswith | 340 | * Default verify function for 8bit buswith |
| 341 | */ | 341 | */ |
| 342 | static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len) | 342 | static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len) |
| 343 | { | 343 | { |
| 344 | int i; | 344 | int i; |
| 345 | struct nand_chip *this = mtd->priv; | 345 | struct nand_chip *this = mtd->priv; |
| @@ -359,7 +359,7 @@ static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len) | |||
| 359 | * | 359 | * |
| 360 | * Default write function for 16bit buswith | 360 | * Default write function for 16bit buswith |
| 361 | */ | 361 | */ |
| 362 | static void nand_write_buf16(struct mtd_info *mtd, const u_char *buf, int len) | 362 | static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len) |
| 363 | { | 363 | { |
| 364 | int i; | 364 | int i; |
| 365 | struct nand_chip *this = mtd->priv; | 365 | struct nand_chip *this = mtd->priv; |
| @@ -379,7 +379,7 @@ static void nand_write_buf16(struct mtd_info *mtd, const u_char *buf, int len) | |||
| 379 | * | 379 | * |
| 380 | * Default read function for 16bit buswith | 380 | * Default read function for 16bit buswith |
| 381 | */ | 381 | */ |
| 382 | static void nand_read_buf16(struct mtd_info *mtd, u_char *buf, int len) | 382 | static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len) |
| 383 | { | 383 | { |
| 384 | int i; | 384 | int i; |
| 385 | struct nand_chip *this = mtd->priv; | 385 | struct nand_chip *this = mtd->priv; |
| @@ -398,7 +398,7 @@ static void nand_read_buf16(struct mtd_info *mtd, u_char *buf, int len) | |||
| 398 | * | 398 | * |
| 399 | * Default verify function for 16bit buswith | 399 | * Default verify function for 16bit buswith |
| 400 | */ | 400 | */ |
| 401 | static int nand_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len) | 401 | static int nand_verify_buf16(struct mtd_info *mtd, const uint8_t *buf, int len) |
| 402 | { | 402 | { |
| 403 | int i; | 403 | int i; |
| 404 | struct nand_chip *this = mtd->priv; | 404 | struct nand_chip *this = mtd->priv; |
| @@ -472,7 +472,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) | |||
| 472 | static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) | 472 | static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) |
| 473 | { | 473 | { |
| 474 | struct nand_chip *this = mtd->priv; | 474 | struct nand_chip *this = mtd->priv; |
| 475 | u_char buf[2] = { 0, 0 }; | 475 | uint8_t buf[2] = { 0, 0 }; |
| 476 | size_t retlen; | 476 | size_t retlen; |
| 477 | int block; | 477 | int block; |
| 478 | 478 | ||
| @@ -600,11 +600,11 @@ static void nand_command(struct mtd_info *mtd, unsigned command, int column, | |||
| 600 | this->write_byte(mtd, column); | 600 | this->write_byte(mtd, column); |
| 601 | } | 601 | } |
| 602 | if (page_addr != -1) { | 602 | if (page_addr != -1) { |
| 603 | this->write_byte(mtd, (unsigned char)(page_addr & 0xff)); | 603 | this->write_byte(mtd, (uint8_t)(page_addr & 0xff)); |
| 604 | this->write_byte(mtd, (unsigned char)((page_addr >> 8) & 0xff)); | 604 | this->write_byte(mtd, (uint8_t)((page_addr >> 8) & 0xff)); |
| 605 | /* One more address cycle for devices > 32MiB */ | 605 | /* One more address cycle for devices > 32MiB */ |
| 606 | if (this->chipsize > (32 << 20)) | 606 | if (this->chipsize > (32 << 20)) |
| 607 | this->write_byte(mtd, (unsigned char)((page_addr >> 16) & 0x0f)); | 607 | this->write_byte(mtd, (uint8_t)((page_addr >> 16) & 0x0f)); |
| 608 | } | 608 | } |
| 609 | /* Latch in address */ | 609 | /* Latch in address */ |
| 610 | this->hwcontrol(mtd, NAND_CTL_CLRALE); | 610 | this->hwcontrol(mtd, NAND_CTL_CLRALE); |
| @@ -692,11 +692,11 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned command, int column, | |||
| 692 | this->write_byte(mtd, column >> 8); | 692 | this->write_byte(mtd, column >> 8); |
| 693 | } | 693 | } |
| 694 | if (page_addr != -1) { | 694 | if (page_addr != -1) { |
| 695 | this->write_byte(mtd, (unsigned char)(page_addr & 0xff)); | 695 | this->write_byte(mtd, (uint8_t)(page_addr & 0xff)); |
| 696 | this->write_byte(mtd, (unsigned char)((page_addr >> 8) & 0xff)); | 696 | this->write_byte(mtd, (uint8_t)((page_addr >> 8) & 0xff)); |
| 697 | /* One more address cycle for devices > 128MiB */ | 697 | /* One more address cycle for devices > 128MiB */ |
| 698 | if (this->chipsize > (128 << 20)) | 698 | if (this->chipsize > (128 << 20)) |
| 699 | this->write_byte(mtd, (unsigned char)((page_addr >> 16) & 0xff)); | 699 | this->write_byte(mtd, (uint8_t)((page_addr >> 16) & 0xff)); |
| 700 | } | 700 | } |
| 701 | /* Latch in address */ | 701 | /* Latch in address */ |
| 702 | this->hwcontrol(mtd, NAND_CTL_CLRALE); | 702 | this->hwcontrol(mtd, NAND_CTL_CLRALE); |
| @@ -874,10 +874,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state) | |||
| 874 | * Cached programming is not supported yet. | 874 | * Cached programming is not supported yet. |
| 875 | */ | 875 | */ |
| 876 | static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int page, | 876 | static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int page, |
| 877 | u_char *oob_buf, struct nand_oobinfo *oobsel, int cached) | 877 | uint8_t *oob_buf, struct nand_oobinfo *oobsel, int cached) |
| 878 | { | 878 | { |
| 879 | int i, status; | 879 | int i, status; |
| 880 | u_char ecc_code[32]; | 880 | uint8_t ecc_code[32]; |
| 881 | int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE; | 881 | int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE; |
| 882 | int *oob_config = oobsel->eccpos; | 882 | int *oob_config = oobsel->eccpos; |
| 883 | int datidx = 0, eccidx = 0, eccsteps = this->eccsteps; | 883 | int datidx = 0, eccidx = 0, eccsteps = this->eccsteps; |
| @@ -978,12 +978,12 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag | |||
| 978 | * it early in the page write stage. Better to write no data than invalid data. | 978 | * it early in the page write stage. Better to write no data than invalid data. |
| 979 | */ | 979 | */ |
| 980 | static int nand_verify_pages(struct mtd_info *mtd, struct nand_chip *this, int page, int numpages, | 980 | static int nand_verify_pages(struct mtd_info *mtd, struct nand_chip *this, int page, int numpages, |
| 981 | u_char *oob_buf, struct nand_oobinfo *oobsel, int chipnr, int oobmode) | 981 | uint8_t *oob_buf, struct nand_oobinfo *oobsel, int chipnr, int oobmode) |
| 982 | { | 982 | { |
| 983 | int i, j, datidx = 0, oobofs = 0, res = -EIO; | 983 | int i, j, datidx = 0, oobofs = 0, res = -EIO; |
| 984 | int eccsteps = this->eccsteps; | 984 | int eccsteps = this->eccsteps; |
| 985 | int hweccbytes; | 985 | int hweccbytes; |
| 986 | u_char oobdata[64]; | 986 | uint8_t oobdata[64]; |
| 987 | 987 | ||
| 988 | hweccbytes = (this->options & NAND_HWECC_SYNDROME) ? (oobsel->eccbytes / eccsteps) : 0; | 988 | hweccbytes = (this->options & NAND_HWECC_SYNDROME) ? (oobsel->eccbytes / eccsteps) : 0; |
| 989 | 989 | ||
| @@ -1078,7 +1078,7 @@ static int nand_verify_pages(struct mtd_info *mtd, struct nand_chip *this, int p | |||
| 1078 | * This function simply calls nand_do_read_ecc with oob buffer and oobsel = NULL | 1078 | * This function simply calls nand_do_read_ecc with oob buffer and oobsel = NULL |
| 1079 | * and flags = 0xff | 1079 | * and flags = 0xff |
| 1080 | */ | 1080 | */ |
| 1081 | static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) | 1081 | static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf) |
| 1082 | { | 1082 | { |
| 1083 | return nand_do_read_ecc(mtd, from, len, retlen, buf, NULL, &mtd->oobinfo, 0xff); | 1083 | return nand_do_read_ecc(mtd, from, len, retlen, buf, NULL, &mtd->oobinfo, 0xff); |
| 1084 | } | 1084 | } |
| @@ -1096,7 +1096,7 @@ static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retl | |||
| 1096 | * This function simply calls nand_do_read_ecc with flags = 0xff | 1096 | * This function simply calls nand_do_read_ecc with flags = 0xff |
| 1097 | */ | 1097 | */ |
| 1098 | static int nand_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | 1098 | static int nand_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, |
| 1099 | size_t *retlen, u_char *buf, u_char *oob_buf, struct nand_oobinfo *oobsel) | 1099 | size_t *retlen, uint8_t *buf, uint8_t *oob_buf, struct nand_oobinfo *oobsel) |
| 1100 | { | 1100 | { |
| 1101 | /* use userspace supplied oobinfo, if zero */ | 1101 | /* use userspace supplied oobinfo, if zero */ |
| 1102 | if (oobsel == NULL) | 1102 | if (oobsel == NULL) |
| @@ -1121,15 +1121,15 @@ static int nand_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1121 | * NAND read with ECC | 1121 | * NAND read with ECC |
| 1122 | */ | 1122 | */ |
| 1123 | int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | 1123 | int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, |
| 1124 | size_t *retlen, u_char *buf, u_char *oob_buf, struct nand_oobinfo *oobsel, int flags) | 1124 | size_t *retlen, uint8_t *buf, uint8_t *oob_buf, struct nand_oobinfo *oobsel, int flags) |
| 1125 | { | 1125 | { |
| 1126 | 1126 | ||
| 1127 | int i, j, col, realpage, page, end, ecc, chipnr, sndcmd = 1; | 1127 | int i, j, col, realpage, page, end, ecc, chipnr, sndcmd = 1; |
| 1128 | int read = 0, oob = 0, ecc_status = 0, ecc_failed = 0; | 1128 | int read = 0, oob = 0, ecc_status = 0, ecc_failed = 0; |
| 1129 | struct nand_chip *this = mtd->priv; | 1129 | struct nand_chip *this = mtd->priv; |
| 1130 | u_char *data_poi, *oob_data = oob_buf; | 1130 | uint8_t *data_poi, *oob_data = oob_buf; |
| 1131 | u_char ecc_calc[32]; | 1131 | uint8_t ecc_calc[32]; |
| 1132 | u_char ecc_code[32]; | 1132 | uint8_t ecc_code[32]; |
| 1133 | int eccmode, eccsteps; | 1133 | int eccmode, eccsteps; |
| 1134 | int *oob_config, datidx; | 1134 | int *oob_config, datidx; |
| 1135 | int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1; | 1135 | int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1; |
| @@ -1383,7 +1383,7 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1383 | * | 1383 | * |
| 1384 | * NAND read out-of-band data from the spare area | 1384 | * NAND read out-of-band data from the spare area |
| 1385 | */ | 1385 | */ |
| 1386 | static int nand_read_oob(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) | 1386 | static int nand_read_oob(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf) |
| 1387 | { | 1387 | { |
| 1388 | int i, col, page, chipnr; | 1388 | int i, col, page, chipnr; |
| 1389 | struct nand_chip *this = mtd->priv; | 1389 | struct nand_chip *this = mtd->priv; |
| @@ -1550,7 +1550,7 @@ int nand_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len, s | |||
| 1550 | * forces the 0xff fill before using the buffer again. | 1550 | * forces the 0xff fill before using the buffer again. |
| 1551 | * | 1551 | * |
| 1552 | */ | 1552 | */ |
| 1553 | static u_char *nand_prepare_oobbuf(struct mtd_info *mtd, u_char *fsbuf, struct nand_oobinfo *oobsel, | 1553 | static uint8_t *nand_prepare_oobbuf(struct mtd_info *mtd, uint8_t *fsbuf, struct nand_oobinfo *oobsel, |
| 1554 | int autoplace, int numpages) | 1554 | int autoplace, int numpages) |
| 1555 | { | 1555 | { |
| 1556 | struct nand_chip *this = mtd->priv; | 1556 | struct nand_chip *this = mtd->priv; |
| @@ -1599,7 +1599,7 @@ static u_char *nand_prepare_oobbuf(struct mtd_info *mtd, u_char *fsbuf, struct n | |||
| 1599 | * This function simply calls nand_write_ecc with oob buffer and oobsel = NULL | 1599 | * This function simply calls nand_write_ecc with oob buffer and oobsel = NULL |
| 1600 | * | 1600 | * |
| 1601 | */ | 1601 | */ |
| 1602 | static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) | 1602 | static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const uint8_t *buf) |
| 1603 | { | 1603 | { |
| 1604 | return (nand_write_ecc(mtd, to, len, retlen, buf, NULL, NULL)); | 1604 | return (nand_write_ecc(mtd, to, len, retlen, buf, NULL, NULL)); |
| 1605 | } | 1605 | } |
| @@ -1617,13 +1617,13 @@ static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retle | |||
| 1617 | * NAND write with ECC | 1617 | * NAND write with ECC |
| 1618 | */ | 1618 | */ |
| 1619 | static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | 1619 | static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, |
| 1620 | size_t *retlen, const u_char *buf, u_char *eccbuf, | 1620 | size_t *retlen, const uint8_t *buf, uint8_t *eccbuf, |
| 1621 | struct nand_oobinfo *oobsel) | 1621 | struct nand_oobinfo *oobsel) |
| 1622 | { | 1622 | { |
| 1623 | int startpage, page, ret = -EIO, oob = 0, written = 0, chipnr; | 1623 | int startpage, page, ret = -EIO, oob = 0, written = 0, chipnr; |
| 1624 | int autoplace = 0, numpages, totalpages; | 1624 | int autoplace = 0, numpages, totalpages; |
| 1625 | struct nand_chip *this = mtd->priv; | 1625 | struct nand_chip *this = mtd->priv; |
| 1626 | u_char *oobbuf, *bufstart; | 1626 | uint8_t *oobbuf, *bufstart; |
| 1627 | int ppblock = (1 << (this->phys_erase_shift - this->page_shift)); | 1627 | int ppblock = (1 << (this->phys_erase_shift - this->page_shift)); |
| 1628 | 1628 | ||
| 1629 | DEBUG(MTD_DEBUG_LEVEL3, "nand_write_ecc: to = 0x%08x, len = %i\n", (unsigned int)to, (int)len); | 1629 | DEBUG(MTD_DEBUG_LEVEL3, "nand_write_ecc: to = 0x%08x, len = %i\n", (unsigned int)to, (int)len); |
| @@ -1680,12 +1680,12 @@ static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 1680 | /* Calc number of pages we can write in one go */ | 1680 | /* Calc number of pages we can write in one go */ |
| 1681 | numpages = min(ppblock - (startpage & (ppblock - 1)), totalpages); | 1681 | numpages = min(ppblock - (startpage & (ppblock - 1)), totalpages); |
| 1682 | oobbuf = nand_prepare_oobbuf(mtd, eccbuf, oobsel, autoplace, numpages); | 1682 | oobbuf = nand_prepare_oobbuf(mtd, eccbuf, oobsel, autoplace, numpages); |
| 1683 | bufstart = (u_char *) buf; | 1683 | bufstart = (uint8_t *) buf; |
| 1684 | 1684 | ||
| 1685 | /* Loop until all data is written */ | 1685 | /* Loop until all data is written */ |
| 1686 | while (written < len) { | 1686 | while (written < len) { |
| 1687 | 1687 | ||
| 1688 | this->data_poi = (u_char *) &buf[written]; | 1688 | this->data_poi = (uint8_t *) &buf[written]; |
| 1689 | /* Write one page. If this is the last page to write | 1689 | /* Write one page. If this is the last page to write |
| 1690 | * or the last page in this block, then use the | 1690 | * or the last page in this block, then use the |
| 1691 | * real pageprogram command, else select cached programming | 1691 | * real pageprogram command, else select cached programming |
| @@ -1764,7 +1764,7 @@ static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 1764 | * | 1764 | * |
| 1765 | * NAND write out-of-band | 1765 | * NAND write out-of-band |
| 1766 | */ | 1766 | */ |
| 1767 | static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) | 1767 | static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const uint8_t *buf) |
| 1768 | { | 1768 | { |
| 1769 | int column, page, status, ret = -EIO, chipnr; | 1769 | int column, page, status, ret = -EIO, chipnr; |
| 1770 | struct nand_chip *this = mtd->priv; | 1770 | struct nand_chip *this = mtd->priv; |
| @@ -1884,13 +1884,13 @@ static int nand_writev(struct mtd_info *mtd, const struct kvec *vecs, unsigned l | |||
| 1884 | * NAND write with iovec with ecc | 1884 | * NAND write with iovec with ecc |
| 1885 | */ | 1885 | */ |
| 1886 | static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, | 1886 | static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, |
| 1887 | loff_t to, size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel) | 1887 | loff_t to, size_t *retlen, uint8_t *eccbuf, struct nand_oobinfo *oobsel) |
| 1888 | { | 1888 | { |
| 1889 | int i, page, len, total_len, ret = -EIO, written = 0, chipnr; | 1889 | int i, page, len, total_len, ret = -EIO, written = 0, chipnr; |
| 1890 | int oob, numpages, autoplace = 0, startpage; | 1890 | int oob, numpages, autoplace = 0, startpage; |
| 1891 | struct nand_chip *this = mtd->priv; | 1891 | struct nand_chip *this = mtd->priv; |
| 1892 | int ppblock = (1 << (this->phys_erase_shift - this->page_shift)); | 1892 | int ppblock = (1 << (this->phys_erase_shift - this->page_shift)); |
| 1893 | u_char *oobbuf, *bufstart; | 1893 | uint8_t *oobbuf, *bufstart; |
| 1894 | 1894 | ||
| 1895 | /* Preset written len for early exit */ | 1895 | /* Preset written len for early exit */ |
| 1896 | *retlen = 0; | 1896 | *retlen = 0; |
| @@ -1959,7 +1959,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign | |||
| 1959 | /* Do not cross block boundaries */ | 1959 | /* Do not cross block boundaries */ |
| 1960 | numpages = min(ppblock - (startpage & (ppblock - 1)), numpages); | 1960 | numpages = min(ppblock - (startpage & (ppblock - 1)), numpages); |
| 1961 | oobbuf = nand_prepare_oobbuf(mtd, NULL, oobsel, autoplace, numpages); | 1961 | oobbuf = nand_prepare_oobbuf(mtd, NULL, oobsel, autoplace, numpages); |
| 1962 | bufstart = (u_char *) vecs->iov_base; | 1962 | bufstart = (uint8_t *) vecs->iov_base; |
| 1963 | bufstart += len; | 1963 | bufstart += len; |
| 1964 | this->data_poi = bufstart; | 1964 | this->data_poi = bufstart; |
| 1965 | oob = 0; | 1965 | oob = 0; |
| @@ -1990,7 +1990,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign | |||
| 1990 | int cnt = 0; | 1990 | int cnt = 0; |
| 1991 | while (cnt < mtd->oobblock) { | 1991 | while (cnt < mtd->oobblock) { |
| 1992 | if (vecs->iov_base != NULL && vecs->iov_len) | 1992 | if (vecs->iov_base != NULL && vecs->iov_len) |
| 1993 | this->data_buf[cnt++] = ((u_char *) vecs->iov_base)[len++]; | 1993 | this->data_buf[cnt++] = ((uint8_t *) vecs->iov_base)[len++]; |
| 1994 | /* Check, if we have to switch to the next tuple */ | 1994 | /* Check, if we have to switch to the next tuple */ |
| 1995 | if (len >= (int)vecs->iov_len) { | 1995 | if (len >= (int)vecs->iov_len) { |
| 1996 | vecs++; | 1996 | vecs++; |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 014ceefbec0e..601c5c703a05 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -294,14 +294,14 @@ struct nand_chip { | |||
| 294 | void __iomem *IO_ADDR_R; | 294 | void __iomem *IO_ADDR_R; |
| 295 | void __iomem *IO_ADDR_W; | 295 | void __iomem *IO_ADDR_W; |
| 296 | 296 | ||
| 297 | u_char (*read_byte)(struct mtd_info *mtd); | 297 | uint8_t (*read_byte)(struct mtd_info *mtd); |
| 298 | void (*write_byte)(struct mtd_info *mtd, u_char byte); | 298 | void (*write_byte)(struct mtd_info *mtd, uint8_t byte); |
| 299 | u16 (*read_word)(struct mtd_info *mtd); | 299 | u16 (*read_word)(struct mtd_info *mtd); |
| 300 | void (*write_word)(struct mtd_info *mtd, u16 word); | 300 | void (*write_word)(struct mtd_info *mtd, u16 word); |
| 301 | 301 | ||
| 302 | void (*write_buf)(struct mtd_info *mtd, const u_char *buf, int len); | 302 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); |
| 303 | void (*read_buf)(struct mtd_info *mtd, u_char *buf, int len); | 303 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); |
| 304 | int (*verify_buf)(struct mtd_info *mtd, const u_char *buf, int len); | 304 | int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); |
| 305 | void (*select_chip)(struct mtd_info *mtd, int chip); | 305 | void (*select_chip)(struct mtd_info *mtd, int chip); |
| 306 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); | 306 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); |
| 307 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); | 307 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); |
| @@ -309,8 +309,8 @@ struct nand_chip { | |||
| 309 | int (*dev_ready)(struct mtd_info *mtd); | 309 | int (*dev_ready)(struct mtd_info *mtd); |
| 310 | void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); | 310 | void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); |
| 311 | int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state); | 311 | int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state); |
| 312 | int (*calculate_ecc)(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); | 312 | int (*calculate_ecc)(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code); |
| 313 | int (*correct_data)(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); | 313 | int (*correct_data)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc, uint8_t *calc_ecc); |
| 314 | void (*enable_hwecc)(struct mtd_info *mtd, int mode); | 314 | void (*enable_hwecc)(struct mtd_info *mtd, int mode); |
| 315 | void (*erase_cmd)(struct mtd_info *mtd, int page); | 315 | void (*erase_cmd)(struct mtd_info *mtd, int page); |
| 316 | int (*scan_bbt)(struct mtd_info *mtd); | 316 | int (*scan_bbt)(struct mtd_info *mtd); |
| @@ -325,10 +325,10 @@ struct nand_chip { | |||
| 325 | int phys_erase_shift; | 325 | int phys_erase_shift; |
| 326 | int bbt_erase_shift; | 326 | int bbt_erase_shift; |
| 327 | int chip_shift; | 327 | int chip_shift; |
| 328 | u_char *data_buf; | 328 | uint8_t *data_buf; |
| 329 | u_char *oob_buf; | 329 | uint8_t *oob_buf; |
| 330 | int oobdirty; | 330 | int oobdirty; |
| 331 | u_char *data_poi; | 331 | uint8_t *data_poi; |
| 332 | unsigned int options; | 332 | unsigned int options; |
| 333 | int badblockpos; | 333 | int badblockpos; |
| 334 | int numchips; | 334 | int numchips; |
| @@ -466,7 +466,7 @@ extern int nand_default_bbt (struct mtd_info *mtd); | |||
| 466 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); | 466 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); |
| 467 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); | 467 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); |
| 468 | extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | 468 | extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, |
| 469 | size_t * retlen, u_char * buf, u_char * oob_buf, | 469 | size_t * retlen, uint8_t * buf, uint8_t * oob_buf, |
| 470 | struct nand_oobinfo *oobsel, int flags); | 470 | struct nand_oobinfo *oobsel, int flags); |
| 471 | 471 | ||
| 472 | /* | 472 | /* |
