ramips: fix for kernel 4.0 napi repoll need return budgets number
[lede.git] / target / linux / sunxi / patches-4.1 / 116-mtd-add-vendor-specific-initcode-infra.patch
1 From 95430662a26332474f4a03a7f8f44fd8d80890b3 Mon Sep 17 00:00:00 2001
2 From: Boris BREZILLON <b.brezillon.dev@gmail.com>
3 Date: Mon, 24 Feb 2014 16:28:32 +0100
4 Subject: [PATCH] mtd: nand: Add manufacturer specific init code infrastructure
5
6 Add new fields in nand_manufacturers and nand_chip struct to provide
7 manufacturer specific handling like read retries.
8
9 Signed-off-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
10 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
11 ---
12  drivers/mtd/nand/nand_base.c | 7 +++++++
13  include/linux/mtd/nand.h     | 4 ++++
14  2 files changed, 11 insertions(+)
15
16 --- a/drivers/mtd/nand/nand_base.c
17 +++ b/drivers/mtd/nand/nand_base.c
18 @@ -4382,6 +4382,13 @@ ident_done:
19         if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
20                 chip->cmdfunc = nand_command_lp;
21  
22 +       if (nand_manuf_ids[maf_idx].init) {
23 +               int err;
24 +               err = nand_manuf_ids[maf_idx].init(mtd, id_data);
25 +               if (err)
26 +                       return ERR_PTR(err);
27 +       }
28 +
29         pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n",
30                 *maf_id, *dev_id);
31  
32 --- a/include/linux/mtd/nand.h
33 +++ b/include/linux/mtd/nand.h
34 @@ -748,6 +748,9 @@ struct nand_chip {
35         int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
36                         int feature_addr, uint8_t *subfeature_para);
37         int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode);
38 +       void (*manuf_cleanup)(struct mtd_info *mtd);
39 +
40 +       void *manuf_priv;
41  
42         int chip_delay;
43         unsigned int options;
44 @@ -950,6 +953,7 @@ struct nand_flash_dev {
45  struct nand_manufacturers {
46         int id;
47         char *name;
48 +       int (*init)(struct mtd_info *mtd, const uint8_t *id);
49  };
50  
51  extern struct nand_flash_dev nand_flash_ids[];