base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0114-mtd-nand-pxa3xx-Introduce-marvell-armada370-nand-com.patch
1 From 259e46e4327a9937761fd3f7bc07e208b1fa50e6 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Sat, 10 Aug 2013 16:34:52 -0300
4 Subject: [PATCH 114/203] mtd: nand: pxa3xx: Introduce 'marvell,armada370-nand'
5  compatible string
6
7 This driver supports NFCv1 (as found in PXA SoC) and NFCv2 (as found in
8 Armada 370/XP SoC). As both controller has a few differences, a way of
9 distinguishing between the two is needed.
10
11 This commit introduces a new compatible string 'marvell,armada370-nand'
12 and assigns a compatible data of type enum pxa3xx_nand_variant to allow
13 such distinction.
14
15 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
16 Tested-by: Daniel Mack <zonque@gmail.com>
17 Cc: devicetree@vger.kernel.org
18 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
19 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
20 ---
21  drivers/mtd/nand/pxa3xx_nand.c | 31 ++++++++++++++++++++++++++++++-
22  1 file changed, 30 insertions(+), 1 deletion(-)
23
24 --- a/drivers/mtd/nand/pxa3xx_nand.c
25 +++ b/drivers/mtd/nand/pxa3xx_nand.c
26 @@ -123,6 +123,11 @@ enum {
27         STATE_READY,
28  };
29  
30 +enum pxa3xx_nand_variant {
31 +       PXA3XX_NAND_VARIANT_PXA,
32 +       PXA3XX_NAND_VARIANT_ARMADA370,
33 +};
34 +
35  struct pxa3xx_nand_host {
36         struct nand_chip        chip;
37         struct pxa3xx_nand_cmdset *cmdset;
38 @@ -171,6 +176,12 @@ struct pxa3xx_nand_info {
39         struct pxa3xx_nand_host *host[NUM_CHIP_SELECT];
40         unsigned int            state;
41  
42 +       /*
43 +        * This driver supports NFCv1 (as found in PXA SoC)
44 +        * and NFCv2 (as found in Armada 370/XP SoC).
45 +        */
46 +       enum pxa3xx_nand_variant variant;
47 +
48         int                     cs;
49         int                     use_ecc;        /* use HW ECC ? */
50         int                     use_dma;        /* use DMA ? */
51 @@ -1192,11 +1203,28 @@ static int pxa3xx_nand_remove(struct pla
52  
53  #ifdef CONFIG_OF
54  static struct of_device_id pxa3xx_nand_dt_ids[] = {
55 -       { .compatible = "marvell,pxa3xx-nand" },
56 +       {
57 +               .compatible = "marvell,pxa3xx-nand",
58 +               .data       = (void *)PXA3XX_NAND_VARIANT_PXA,
59 +       },
60 +       {
61 +               .compatible = "marvell,armada370-nand",
62 +               .data       = (void *)PXA3XX_NAND_VARIANT_ARMADA370,
63 +       },
64         {}
65  };
66  MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids);
67  
68 +static enum pxa3xx_nand_variant
69 +pxa3xx_nand_get_variant(struct platform_device *pdev)
70 +{
71 +       const struct of_device_id *of_id =
72 +                       of_match_device(pxa3xx_nand_dt_ids, &pdev->dev);
73 +       if (!of_id)
74 +               return PXA3XX_NAND_VARIANT_PXA;
75 +       return (enum pxa3xx_nand_variant)of_id->data;
76 +}
77 +
78  static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
79  {
80         struct pxa3xx_nand_platform_data *pdata;
81 @@ -1252,6 +1280,7 @@ static int pxa3xx_nand_probe(struct plat
82         }
83  
84         info = platform_get_drvdata(pdev);
85 +       info->variant = pxa3xx_nand_get_variant(pdev);
86         probe_success = 0;
87         for (cs = 0; cs < pdata->num_cs; cs++) {
88                 info->cs = cs;