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'
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.
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
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>
21 drivers/mtd/nand/pxa3xx_nand.c | 31 ++++++++++++++++++++++++++++++-
22 1 file changed, 30 insertions(+), 1 deletion(-)
24 --- a/drivers/mtd/nand/pxa3xx_nand.c
25 +++ b/drivers/mtd/nand/pxa3xx_nand.c
26 @@ -123,6 +123,11 @@ enum {
30 +enum pxa3xx_nand_variant {
31 + PXA3XX_NAND_VARIANT_PXA,
32 + PXA3XX_NAND_VARIANT_ARMADA370,
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];
43 + * This driver supports NFCv1 (as found in PXA SoC)
44 + * and NFCv2 (as found in Armada 370/XP SoC).
46 + enum pxa3xx_nand_variant variant;
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
54 static struct of_device_id pxa3xx_nand_dt_ids[] = {
55 - { .compatible = "marvell,pxa3xx-nand" },
57 + .compatible = "marvell,pxa3xx-nand",
58 + .data = (void *)PXA3XX_NAND_VARIANT_PXA,
61 + .compatible = "marvell,armada370-nand",
62 + .data = (void *)PXA3XX_NAND_VARIANT_ARMADA370,
66 MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids);
68 +static enum pxa3xx_nand_variant
69 +pxa3xx_nand_get_variant(struct platform_device *pdev)
71 + const struct of_device_id *of_id =
72 + of_match_device(pxa3xx_nand_dt_ids, &pdev->dev);
74 + return PXA3XX_NAND_VARIANT_PXA;
75 + return (enum pxa3xx_nand_variant)of_id->data;
78 static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
80 struct pxa3xx_nand_platform_data *pdata;
81 @@ -1252,6 +1280,7 @@ static int pxa3xx_nand_probe(struct plat
84 info = platform_get_drvdata(pdev);
85 + info->variant = pxa3xx_nand_get_variant(pdev);
87 for (cs = 0; cs < pdata->num_cs; cs++) {