Merge branch 'v1.4' into v1.5
[librecmc/librecmc.git] / target / linux / ar71xx / patches-4.4 / 912-ar300m-add-FW-PM-spinand.patch
1 --- a/drivers/mtd/nand/ath79_spinand.c
2 +++ b/drivers/mtd/nand/ath79_spinand.c
3 @@ -441,6 +441,9 @@ static int ath79_spinand_read_from_cache
4  
5         cmd.cmd = ATH79_SPINAND_CMD_READ_RDM;
6         cmd.n_addr = 3;
7 +       cmd.addr[0] = 0;
8 +       cmd.addr[1] = (u8)(offset >> 8);
9 +       cmd.addr[2] = (u8)(offset >> 0);
10         cmd.n_dummy = 0;
11         cmd.n_rx = len;
12         cmd.rx_buf = rbuf;
13 @@ -776,9 +779,9 @@ static void ath79_spinand_cmdfunc(struct
14                                         state->buf);
15                 break;
16         case NAND_CMD_READOOB:
17 -               state->buf_ptr = 0;
18 -               ath79_spinand_read_page(info->spi, page, mtd->writesize,
19 -                                       mtd->oobsize, state->buf);
20 +               state->buf_ptr = mtd->writesize;
21 +               ath79_spinand_read_page(info->spi, page, 0x0,
22 +                                       mtd->writesize + mtd->oobsize, state->buf);
23                 break;
24         case NAND_CMD_RNDOUT:
25                 state->buf_ptr = column;
26 @@ -1005,6 +1008,21 @@ static struct ath79_spinand_priv ath79_s
27                 0x07,                                   /* ecc error code */
28                 SZ_512,                                 /* ecc size */
29                 16,                                     /* ecc bytes */
30 +               1,                                      /* ecc strength */
31 +               &ath79_spinand_oob_128_gd,              /* ecc layout */
32 +               &ath79_badblock_pattern_default,        /* bad block pattern */
33 +               ath79_spinand_eccsr_gd,                 /* get ecc status */
34 +               ath79_spinand_read_rdm_addr_gd,         /* wrap address for 03h command */
35 +               ath79_spinand_program_load_gd,          /* program load data to cache */
36 +               ath79_spinand_erase_block_erase_common, /* erase block */
37 +               ath79_spinand_page_read_to_cache_common,/* page read to cache */
38 +               ath79_spinand_program_execute_common,   /* program execute */
39 +       },
40 +       { /* FW PN Device */
41 +               NAND_MFR_FWDEVICE,                      /* manufacturer */
42 +               0x07,                                   /* ecc error code */
43 +               SZ_512,                                 /* ecc size */
44 +               16,                                     /* ecc bytes */
45                 1,                                      /* ecc strength */
46                 &ath79_spinand_oob_128_gd,              /* ecc layout */
47                 &ath79_badblock_pattern_default,        /* bad block pattern */
48 --- a/drivers/mtd/nand/nand_ids.c
49 +++ b/drivers/mtd/nand/nand_ids.c
50 @@ -55,6 +55,9 @@ struct nand_flash_dev nand_flash_ids[] =
51         {"GD5F1GQ4U 1G 3.3V 8-bit",
52                 { .id = {0xc8, 0xb1} },
53                   SZ_2K, SZ_128, SZ_128K, 0, 2, 128, NAND_ECC_INFO(4, SZ_512) },
54 +       {"PN256GO1  1G 3.3V 8-bit",
55 +               { .id = {0xa1, 0xe1} },
56 +                 SZ_2K, SZ_128, SZ_128K, 0, 2, 128, NAND_ECC_INFO(4, SZ_512) },
57         {"GD5F2GQ4U 2G 3.3V 8-bit",
58                 { .id = {0xc8, 0xb2} },
59                   SZ_2K, SZ_256, SZ_128K, 0, 2, 128, NAND_ECC_INFO(4, SZ_512) },
60 @@ -128,6 +131,7 @@ struct nand_flash_dev nand_flash_ids[] =
61         EXTENDED_ID_NAND("NAND 128MiB 3,3V 8-bit",  0xF1, 128, LP_OPTIONS),
62         EXTENDED_ID_NAND("NAND 128MiB 3,3V 8-bit",  0xD1, 128, LP_OPTIONS),
63         EXTENDED_ID_NAND("NAND 128MiB 1,8V 16-bit", 0xB1, 128, LP_OPTIONS16),
64 +       EXTENDED_ID_NAND("NAND 128MiB 3,3V 16-bit", 0xE1, 128, LP_OPTIONS16),
65         EXTENDED_ID_NAND("NAND 128MiB 3,3V 16-bit", 0xC1, 128, LP_OPTIONS16),
66         EXTENDED_ID_NAND("NAND 128MiB 1,8V 16-bit", 0xAD, 128, LP_OPTIONS16),
67  
68 @@ -207,6 +211,7 @@ struct nand_manufacturers nand_manuf_ids
69         {NAND_MFR_GIGADEVICE, "Giga Device"},
70         {NAND_MFR_WINBOND, "Winbond"},
71         {NAND_MFR_HEYANGTEK, "HeYang Tek"},
72 +       {NAND_MFR_FWDEVICE, "FW Device"},
73         {0x0, "Unknown"}
74  };
75  
76 --- a/include/linux/mtd/nand.h
77 +++ b/include/linux/mtd/nand.h
78 @@ -735,6 +735,7 @@ struct nand_chip {
79  #define NAND_MFR_GIGADEVICE    0xc8
80  #define NAND_MFR_WINBOND       0xef
81  #define NAND_MFR_HEYANGTEK     0xc9
82 +#define NAND_MFR_FWDEVICE      0xA1
83  #define NAND_MFR_EON           0x92
84  #define NAND_MFR_SANDISK       0x45
85  #define NAND_MFR_INTEL         0x89