Commit c0f3b864 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by David Woodhouse

mtd: nand: pxa3xx: Introduce 'marvell,armada370-nand' compatible string

This driver supports NFCv1 (as found in PXA SoC) and NFCv2 (as found in
Armada 370/XP SoC). As both controller has a few differences, a way of
distinguishing between the two is needed.

This commit introduces a new compatible string 'marvell,armada370-nand'
and assigns a compatible data of type enum pxa3xx_nand_variant to allow
such distinction.
Signed-off-by: default avatarEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: default avatarDaniel Mack <zonque@gmail.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 2febcdf8
...@@ -123,6 +123,11 @@ enum { ...@@ -123,6 +123,11 @@ enum {
STATE_READY, STATE_READY,
}; };
enum pxa3xx_nand_variant {
PXA3XX_NAND_VARIANT_PXA,
PXA3XX_NAND_VARIANT_ARMADA370,
};
struct pxa3xx_nand_host { struct pxa3xx_nand_host {
struct nand_chip chip; struct nand_chip chip;
struct pxa3xx_nand_cmdset *cmdset; struct pxa3xx_nand_cmdset *cmdset;
...@@ -171,6 +176,12 @@ struct pxa3xx_nand_info { ...@@ -171,6 +176,12 @@ struct pxa3xx_nand_info {
struct pxa3xx_nand_host *host[NUM_CHIP_SELECT]; struct pxa3xx_nand_host *host[NUM_CHIP_SELECT];
unsigned int state; unsigned int state;
/*
* This driver supports NFCv1 (as found in PXA SoC)
* and NFCv2 (as found in Armada 370/XP SoC).
*/
enum pxa3xx_nand_variant variant;
int cs; int cs;
int use_ecc; /* use HW ECC ? */ int use_ecc; /* use HW ECC ? */
int use_dma; /* use DMA ? */ int use_dma; /* use DMA ? */
...@@ -1192,11 +1203,28 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) ...@@ -1192,11 +1203,28 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
#ifdef CONFIG_OF #ifdef CONFIG_OF
static struct of_device_id pxa3xx_nand_dt_ids[] = { static struct of_device_id pxa3xx_nand_dt_ids[] = {
{ .compatible = "marvell,pxa3xx-nand" }, {
.compatible = "marvell,pxa3xx-nand",
.data = (void *)PXA3XX_NAND_VARIANT_PXA,
},
{
.compatible = "marvell,armada370-nand",
.data = (void *)PXA3XX_NAND_VARIANT_ARMADA370,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids); MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids);
static enum pxa3xx_nand_variant
pxa3xx_nand_get_variant(struct platform_device *pdev)
{
const struct of_device_id *of_id =
of_match_device(pxa3xx_nand_dt_ids, &pdev->dev);
if (!of_id)
return PXA3XX_NAND_VARIANT_PXA;
return (enum pxa3xx_nand_variant)of_id->data;
}
static int pxa3xx_nand_probe_dt(struct platform_device *pdev) static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
{ {
struct pxa3xx_nand_platform_data *pdata; struct pxa3xx_nand_platform_data *pdata;
...@@ -1252,6 +1280,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) ...@@ -1252,6 +1280,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
} }
info = platform_get_drvdata(pdev); info = platform_get_drvdata(pdev);
info->variant = pxa3xx_nand_get_variant(pdev);
probe_success = 0; probe_success = 0;
for (cs = 0; cs < pdata->num_cs; cs++) { for (cs = 0; cs < pdata->num_cs; cs++) {
info->cs = cs; info->cs = cs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment