kernel: add support for linux 3.2.1
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.2 / 470-mtd_m25p80_add_pm25lv_flash_support.patch
1 --- a/drivers/mtd/devices/m25p80.c
2 +++ b/drivers/mtd/devices/m25p80.c
3 @@ -45,6 +45,7 @@
4 #define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
5 #define OPCODE_BE_32K 0x52 /* Erase 32KiB block */
6 #define OPCODE_CHIP_ERASE 0xc7 /* Erase whole flash chip */
7 +#define OPCODE_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips*/
8 #define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */
9 #define OPCODE_RDID 0x9f /* Read JEDEC ID */
10
11 @@ -625,6 +626,7 @@ struct flash_info {
12 u16 flags;
13 #define SECT_4K 0x01 /* OPCODE_BE_4K works uniformly */
14 #define M25P_NO_ERASE 0x02 /* No erase command needed */
15 +#define SECT_4K_PMC 0x04 /* OPCODE_BE_4K_PMC works uniformly */
16 };
17
18 #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
19 @@ -686,6 +688,10 @@ static const struct spi_device_id m25p_i
20 { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
21 { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
22
23 + /* PMC -- pm25x "blocks" are 32K, sectors are 4K */
24 + { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
25 + { "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },
26 +
27 /* Spansion -- single (large) sector size only, at least
28 * for the chips listed here (without boot sectors).
29 */
30 @@ -921,6 +927,9 @@ static int __devinit m25p_probe(struct s
31 if (info->flags & SECT_4K) {
32 flash->erase_opcode = OPCODE_BE_4K;
33 flash->mtd.erasesize = 4096;
34 + } else if (info->flags & SECT_4K_PMC) {
35 + flash->erase_opcode = OPCODE_BE_4K_PMC;
36 + flash->mtd.erasesize = 4096;
37 } else {
38 flash->erase_opcode = OPCODE_SE;
39 flash->mtd.erasesize = info->sector_size;