diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 12:03:12 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 12:03:12 -0400 |
| commit | 2be508d847392e431759e370d21cea9412848758 (patch) | |
| tree | be5e00a4d7be4ef353ffe4d550fb80a251d321c3 /include/linux/mtd | |
| parent | 01e8ef11bc1a74e65678ed55795f59266d4add01 (diff) | |
| parent | 8a1a6272057e2ad90ab531a70330165888866e60 (diff) | |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (69 commits)
Revert "[MTD] m25p80.c code cleanup"
[MTD] [NAND] GPIO driver depends on ARM... for now.
[MTD] [NAND] sh_flctl: fix compile error
[MTD] [NOR] AT49BV6416 has swapped erase regions
[MTD] [NAND] GPIO NAND flash driver
[MTD] cmdlineparts documentation change - explain where mtd-id comes from
[MTD] cfi_cmdset_0002.c: Add Macronix CFI V1.0 TopBottom detection
[MTD] [NAND] Fix compilation warnings in drivers/mtd/nand/cs553x_nand.c
[JFFS2] Write buffer offset adjustment for NOR-ECC (Sibley) flash
[MTD] mtdoops: Fix a bug where block may not be erased
[MTD] mtdoops: Add a magic number to logged kernel oops
[MTD] mtdoops: Fix an off by one error
[JFFS2] Correct parameter names of jffs2_compress() in comments
[MTD] [NAND] sh_flctl: add support for Renesas SuperH FLCTL
[MTD] [NAND] Bug on atmel_nand HW ECC : OOB info not correctly written
[MTD] [MAPS] Remove unused variable after ROM API cleanup.
[MTD] m25p80.c extended jedec support (v2)
[MTD] remove unused mtd parameter in of_mtd_parse_partitions()
[MTD] [NAND] remove dead Kconfig associated with !CONFIG_PPC_MERGE
[MTD] [NAND] driver extension to support NAND on TQM85xx modules
...
Diffstat (limited to 'include/linux/mtd')
| -rw-r--r-- | include/linux/mtd/cfi.h | 9 | ||||
| -rw-r--r-- | include/linux/mtd/flashchip.h | 4 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 4 | ||||
| -rw-r--r-- | include/linux/mtd/nand-gpio.h | 19 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 1 | ||||
| -rw-r--r-- | include/linux/mtd/onenand_regs.h | 2 | ||||
| -rw-r--r-- | include/linux/mtd/partitions.h | 1 | ||||
| -rw-r--r-- | include/linux/mtd/sh_flctl.h | 125 |
8 files changed, 162 insertions, 3 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index d6fb115f5a07..ee5124ec319e 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/mtd/flashchip.h> | 12 | #include <linux/mtd/flashchip.h> |
| 13 | #include <linux/mtd/map.h> | 13 | #include <linux/mtd/map.h> |
| 14 | #include <linux/mtd/cfi_endian.h> | 14 | #include <linux/mtd/cfi_endian.h> |
| 15 | #include <linux/mtd/xip.h> | ||
| 15 | 16 | ||
| 16 | #ifdef CONFIG_MTD_CFI_I1 | 17 | #ifdef CONFIG_MTD_CFI_I1 |
| 17 | #define cfi_interleave(cfi) 1 | 18 | #define cfi_interleave(cfi) 1 |
| @@ -430,7 +431,6 @@ static inline uint32_t cfi_send_gen_cmd(u_char cmd, uint32_t cmd_addr, uint32_t | |||
| 430 | { | 431 | { |
| 431 | map_word val; | 432 | map_word val; |
| 432 | uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type); | 433 | uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type); |
| 433 | |||
| 434 | val = cfi_build_cmd(cmd, map, cfi); | 434 | val = cfi_build_cmd(cmd, map, cfi); |
| 435 | 435 | ||
| 436 | if (prev_val) | 436 | if (prev_val) |
| @@ -483,6 +483,13 @@ static inline void cfi_udelay(int us) | |||
| 483 | } | 483 | } |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | int __xipram cfi_qry_present(struct map_info *map, __u32 base, | ||
| 487 | struct cfi_private *cfi); | ||
| 488 | int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map, | ||
| 489 | struct cfi_private *cfi); | ||
| 490 | void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map, | ||
| 491 | struct cfi_private *cfi); | ||
| 492 | |||
| 486 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, | 493 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, |
| 487 | const char* name); | 494 | const char* name); |
| 488 | struct cfi_fixup { | 495 | struct cfi_fixup { |
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index 08dd131301c1..d4f38c5fd44e 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
| @@ -73,6 +73,10 @@ struct flchip { | |||
| 73 | int buffer_write_time; | 73 | int buffer_write_time; |
| 74 | int erase_time; | 74 | int erase_time; |
| 75 | 75 | ||
| 76 | int word_write_time_max; | ||
| 77 | int buffer_write_time_max; | ||
| 78 | int erase_time_max; | ||
| 79 | |||
| 76 | void *priv; | 80 | void *priv; |
| 77 | }; | 81 | }; |
| 78 | 82 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 922636548558..eae26bb6430a 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -25,8 +25,10 @@ | |||
| 25 | #define MTD_ERASE_DONE 0x08 | 25 | #define MTD_ERASE_DONE 0x08 |
| 26 | #define MTD_ERASE_FAILED 0x10 | 26 | #define MTD_ERASE_FAILED 0x10 |
| 27 | 27 | ||
| 28 | #define MTD_FAIL_ADDR_UNKNOWN 0xffffffff | ||
| 29 | |||
| 28 | /* If the erase fails, fail_addr might indicate exactly which block failed. If | 30 | /* If the erase fails, fail_addr might indicate exactly which block failed. If |
| 29 | fail_addr = 0xffffffff, the failure was not at the device level or was not | 31 | fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not |
| 30 | specific to any particular block. */ | 32 | specific to any particular block. */ |
| 31 | struct erase_info { | 33 | struct erase_info { |
| 32 | struct mtd_info *mtd; | 34 | struct mtd_info *mtd; |
diff --git a/include/linux/mtd/nand-gpio.h b/include/linux/mtd/nand-gpio.h new file mode 100644 index 000000000000..51534e50f7fc --- /dev/null +++ b/include/linux/mtd/nand-gpio.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #ifndef __LINUX_MTD_NAND_GPIO_H | ||
| 2 | #define __LINUX_MTD_NAND_GPIO_H | ||
| 3 | |||
| 4 | #include <linux/mtd/nand.h> | ||
| 5 | |||
| 6 | struct gpio_nand_platdata { | ||
| 7 | int gpio_nce; | ||
| 8 | int gpio_nwp; | ||
| 9 | int gpio_cle; | ||
| 10 | int gpio_ale; | ||
| 11 | int gpio_rdy; | ||
| 12 | void (*adjust_parts)(struct gpio_nand_platdata *, size_t); | ||
| 13 | struct mtd_partition *parts; | ||
| 14 | unsigned int num_parts; | ||
| 15 | unsigned int options; | ||
| 16 | int chip_delay; | ||
| 17 | }; | ||
| 18 | |||
| 19 | #endif | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 81774e5facf4..733d3f3b4eb8 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -248,6 +248,7 @@ struct nand_hw_control { | |||
| 248 | * @read_page_raw: function to read a raw page without ECC | 248 | * @read_page_raw: function to read a raw page without ECC |
| 249 | * @write_page_raw: function to write a raw page without ECC | 249 | * @write_page_raw: function to write a raw page without ECC |
| 250 | * @read_page: function to read a page according to the ecc generator requirements | 250 | * @read_page: function to read a page according to the ecc generator requirements |
| 251 | * @read_subpage: function to read parts of the page covered by ECC. | ||
| 251 | * @write_page: function to write a page according to the ecc generator requirements | 252 | * @write_page: function to write a page according to the ecc generator requirements |
| 252 | * @read_oob: function to read chip OOB data | 253 | * @read_oob: function to read chip OOB data |
| 253 | * @write_oob: function to write chip OOB data | 254 | * @write_oob: function to write chip OOB data |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index d1b310c92eb4..0c6bbe28f38c 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
| @@ -152,6 +152,8 @@ | |||
| 152 | #define ONENAND_SYS_CFG1_INT (1 << 6) | 152 | #define ONENAND_SYS_CFG1_INT (1 << 6) |
| 153 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) | 153 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) |
| 154 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) | 154 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) |
| 155 | #define ONENAND_SYS_CFG1_HF (1 << 2) | ||
| 156 | #define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) | ||
| 155 | 157 | ||
| 156 | /* | 158 | /* |
| 157 | * Controller Status Register F240h (R) | 159 | * Controller Status Register F240h (R) |
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index 5014f7a9f5df..c92b4d439609 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
| @@ -73,7 +73,6 @@ struct device; | |||
| 73 | struct device_node; | 73 | struct device_node; |
| 74 | 74 | ||
| 75 | int __devinit of_mtd_parse_partitions(struct device *dev, | 75 | int __devinit of_mtd_parse_partitions(struct device *dev, |
| 76 | struct mtd_info *mtd, | ||
| 77 | struct device_node *node, | 76 | struct device_node *node, |
| 78 | struct mtd_partition **pparts); | 77 | struct mtd_partition **pparts); |
| 79 | 78 | ||
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h new file mode 100644 index 000000000000..e77c1cea404d --- /dev/null +++ b/include/linux/mtd/sh_flctl.h | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* | ||
| 2 | * SuperH FLCTL nand controller | ||
| 3 | * | ||
| 4 | * Copyright © 2008 Renesas Solutions Corp. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __SH_FLCTL_H__ | ||
| 21 | #define __SH_FLCTL_H__ | ||
| 22 | |||
| 23 | #include <linux/mtd/mtd.h> | ||
| 24 | #include <linux/mtd/nand.h> | ||
| 25 | #include <linux/mtd/partitions.h> | ||
| 26 | |||
| 27 | /* FLCTL registers */ | ||
| 28 | #define FLCMNCR(f) (f->reg + 0x0) | ||
| 29 | #define FLCMDCR(f) (f->reg + 0x4) | ||
| 30 | #define FLCMCDR(f) (f->reg + 0x8) | ||
| 31 | #define FLADR(f) (f->reg + 0xC) | ||
| 32 | #define FLADR2(f) (f->reg + 0x3C) | ||
| 33 | #define FLDATAR(f) (f->reg + 0x10) | ||
| 34 | #define FLDTCNTR(f) (f->reg + 0x14) | ||
| 35 | #define FLINTDMACR(f) (f->reg + 0x18) | ||
| 36 | #define FLBSYTMR(f) (f->reg + 0x1C) | ||
| 37 | #define FLBSYCNT(f) (f->reg + 0x20) | ||
| 38 | #define FLDTFIFO(f) (f->reg + 0x24) | ||
| 39 | #define FLECFIFO(f) (f->reg + 0x28) | ||
| 40 | #define FLTRCR(f) (f->reg + 0x2C) | ||
| 41 | #define FL4ECCRESULT0(f) (f->reg + 0x80) | ||
| 42 | #define FL4ECCRESULT1(f) (f->reg + 0x84) | ||
| 43 | #define FL4ECCRESULT2(f) (f->reg + 0x88) | ||
| 44 | #define FL4ECCRESULT3(f) (f->reg + 0x8C) | ||
| 45 | #define FL4ECCCR(f) (f->reg + 0x90) | ||
| 46 | #define FL4ECCCNT(f) (f->reg + 0x94) | ||
| 47 | #define FLERRADR(f) (f->reg + 0x98) | ||
| 48 | |||
| 49 | /* FLCMNCR control bits */ | ||
| 50 | #define ECCPOS2 (0x1 << 25) | ||
| 51 | #define _4ECCCNTEN (0x1 << 24) | ||
| 52 | #define _4ECCEN (0x1 << 23) | ||
| 53 | #define _4ECCCORRECT (0x1 << 22) | ||
| 54 | #define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ | ||
| 55 | #define QTSEL_E (0x1 << 17) | ||
| 56 | #define ENDIAN (0x1 << 16) /* 1 = little endian */ | ||
| 57 | #define FCKSEL_E (0x1 << 15) | ||
| 58 | #define ECCPOS_00 (0x00 << 12) | ||
| 59 | #define ECCPOS_01 (0x01 << 12) | ||
| 60 | #define ECCPOS_02 (0x02 << 12) | ||
| 61 | #define ACM_SACCES_MODE (0x01 << 10) | ||
| 62 | #define NANWF_E (0x1 << 9) | ||
| 63 | #define SE_D (0x1 << 8) /* Spare area disable */ | ||
| 64 | #define CE1_ENABLE (0x1 << 4) /* Chip Enable 1 */ | ||
| 65 | #define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ | ||
| 66 | #define TYPESEL_SET (0x1 << 0) | ||
| 67 | |||
| 68 | /* FLCMDCR control bits */ | ||
| 69 | #define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ | ||
| 70 | #define ADRMD_E (0x1 << 26) /* Sector address access */ | ||
| 71 | #define CDSRC_E (0x1 << 25) /* Data buffer selection */ | ||
| 72 | #define DOSR_E (0x1 << 24) /* Status read check */ | ||
| 73 | #define SELRW (0x1 << 21) /* 0:read 1:write */ | ||
| 74 | #define DOADR_E (0x1 << 20) /* Address stage execute */ | ||
| 75 | #define ADRCNT_1 (0x00 << 18) /* Address data bytes: 1byte */ | ||
| 76 | #define ADRCNT_2 (0x01 << 18) /* Address data bytes: 2byte */ | ||
| 77 | #define ADRCNT_3 (0x02 << 18) /* Address data bytes: 3byte */ | ||
| 78 | #define ADRCNT_4 (0x03 << 18) /* Address data bytes: 4byte */ | ||
| 79 | #define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */ | ||
| 80 | #define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */ | ||
| 81 | |||
| 82 | /* FLTRCR control bits */ | ||
| 83 | #define TRSTRT (0x1 << 0) /* translation start */ | ||
| 84 | #define TREND (0x1 << 1) /* translation end */ | ||
| 85 | |||
| 86 | /* FL4ECCCR control bits */ | ||
| 87 | #define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ | ||
| 88 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ | ||
| 89 | #define _4ECCEXST (0x1 << 0) /* 4 symbols exist */ | ||
| 90 | |||
| 91 | #define INIT_FL4ECCRESULT_VAL 0x03FF03FF | ||
| 92 | #define LOOP_TIMEOUT_MAX 0x00010000 | ||
| 93 | |||
| 94 | #define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd) | ||
| 95 | |||
| 96 | struct sh_flctl { | ||
| 97 | struct mtd_info mtd; | ||
| 98 | struct nand_chip chip; | ||
| 99 | void __iomem *reg; | ||
| 100 | |||
| 101 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ | ||
| 102 | int read_bytes; | ||
| 103 | int index; | ||
| 104 | int seqin_column; /* column in SEQIN cmd */ | ||
| 105 | int seqin_page_addr; /* page_addr in SEQIN cmd */ | ||
| 106 | uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */ | ||
| 107 | int erase1_page_addr; /* page_addr in ERASE1 cmd */ | ||
| 108 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ | ||
| 109 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ | ||
| 110 | |||
| 111 | int hwecc_cant_correct[4]; | ||
| 112 | |||
| 113 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ | ||
| 114 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ | ||
| 115 | }; | ||
| 116 | |||
| 117 | struct sh_flctl_platform_data { | ||
| 118 | struct mtd_partition *parts; | ||
| 119 | int nr_parts; | ||
| 120 | unsigned long flcmncr_val; | ||
| 121 | |||
| 122 | unsigned has_hwecc:1; | ||
| 123 | }; | ||
| 124 | |||
| 125 | #endif /* __SH_FLCTL_H__ */ | ||
