Commit a4f20351 authored by John Crispin's avatar John Crispin Committed by David Woodhouse

OF: MTD: make plat_nand loadable from DT

This patch sets the of_match_table field inside plat_nand's platform_driver.
We also add a struct mtd_part_parser_data pointer to make sure of_part parsing
works.

If an arch wants to support plat_nand via DT it needs to setup the
platform_nand_data and hook it into the platform_device.
Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent bb08bc10
...@@ -31,6 +31,7 @@ static const char *part_probe_types[] = { "cmdlinepart", NULL }; ...@@ -31,6 +31,7 @@ static const char *part_probe_types[] = { "cmdlinepart", NULL };
static int __devinit plat_nand_probe(struct platform_device *pdev) static int __devinit plat_nand_probe(struct platform_device *pdev)
{ {
struct platform_nand_data *pdata = pdev->dev.platform_data; struct platform_nand_data *pdata = pdev->dev.platform_data;
struct mtd_part_parser_data ppdata;
struct plat_nand_data *data; struct plat_nand_data *data;
struct resource *res; struct resource *res;
const char **part_types; const char **part_types;
...@@ -103,7 +104,8 @@ static int __devinit plat_nand_probe(struct platform_device *pdev) ...@@ -103,7 +104,8 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
part_types = pdata->chip.part_probe_types ? : part_probe_types; part_types = pdata->chip.part_probe_types ? : part_probe_types;
err = mtd_device_parse_register(&data->mtd, part_types, NULL, ppdata.of_node = pdev->dev.of_node;
err = mtd_device_parse_register(&data->mtd, part_types, &ppdata,
pdata->chip.partitions, pdata->chip.partitions,
pdata->chip.nr_partitions); pdata->chip.nr_partitions);
...@@ -144,12 +146,19 @@ static int __devexit plat_nand_remove(struct platform_device *pdev) ...@@ -144,12 +146,19 @@ static int __devexit plat_nand_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id plat_nand_match[] = {
{ .compatible = "gen_nand" },
{},
};
MODULE_DEVICE_TABLE(of, plat_nand_match);
static struct platform_driver plat_nand_driver = { static struct platform_driver plat_nand_driver = {
.probe = plat_nand_probe, .probe = plat_nand_probe,
.remove = __devexit_p(plat_nand_remove), .remove = __devexit_p(plat_nand_remove),
.driver = { .driver = {
.name = "gen_nand", .name = "gen_nand",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = plat_nand_match,
}, },
}; };
......
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