diff options
author | John Crispin <blogic@openwrt.org> | 2012-04-30 13:30:46 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-05-14 00:16:35 -0400 |
commit | a4f203512be974dbd7425f8f1d3d40720bf36997 (patch) | |
tree | 8e3d0305aa91c69337c1af7eebf4e3f604b55e18 | |
parent | bb08bc108628493fb45d02da81cd201b6a42391c (diff) |
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: John Crispin <blogic@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/nand/plat_nand.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c index 585639947f5d..fd2d2a1b78ba 100644 --- a/drivers/mtd/nand/plat_nand.c +++ b/drivers/mtd/nand/plat_nand.c | |||
@@ -31,6 +31,7 @@ static const char *part_probe_types[] = { "cmdlinepart", NULL }; | |||
31 | static int __devinit plat_nand_probe(struct platform_device *pdev) | 31 | static int __devinit plat_nand_probe(struct platform_device *pdev) |
32 | { | 32 | { |
33 | struct platform_nand_data *pdata = pdev->dev.platform_data; | 33 | struct platform_nand_data *pdata = pdev->dev.platform_data; |
34 | struct mtd_part_parser_data ppdata; | ||
34 | struct plat_nand_data *data; | 35 | struct plat_nand_data *data; |
35 | struct resource *res; | 36 | struct resource *res; |
36 | const char **part_types; | 37 | const char **part_types; |
@@ -103,7 +104,8 @@ static int __devinit plat_nand_probe(struct platform_device *pdev) | |||
103 | 104 | ||
104 | part_types = pdata->chip.part_probe_types ? : part_probe_types; | 105 | part_types = pdata->chip.part_probe_types ? : part_probe_types; |
105 | 106 | ||
106 | err = mtd_device_parse_register(&data->mtd, part_types, NULL, | 107 | ppdata.of_node = pdev->dev.of_node; |
108 | err = mtd_device_parse_register(&data->mtd, part_types, &ppdata, | ||
107 | pdata->chip.partitions, | 109 | pdata->chip.partitions, |
108 | pdata->chip.nr_partitions); | 110 | pdata->chip.nr_partitions); |
109 | 111 | ||
@@ -144,12 +146,19 @@ static int __devexit plat_nand_remove(struct platform_device *pdev) | |||
144 | return 0; | 146 | return 0; |
145 | } | 147 | } |
146 | 148 | ||
149 | static const struct of_device_id plat_nand_match[] = { | ||
150 | { .compatible = "gen_nand" }, | ||
151 | {}, | ||
152 | }; | ||
153 | MODULE_DEVICE_TABLE(of, plat_nand_match); | ||
154 | |||
147 | static struct platform_driver plat_nand_driver = { | 155 | static struct platform_driver plat_nand_driver = { |
148 | .probe = plat_nand_probe, | 156 | .probe = plat_nand_probe, |
149 | .remove = __devexit_p(plat_nand_remove), | 157 | .remove = __devexit_p(plat_nand_remove), |
150 | .driver = { | 158 | .driver = { |
151 | .name = "gen_nand", | 159 | .name = "gen_nand", |
152 | .owner = THIS_MODULE, | 160 | .owner = THIS_MODULE, |
161 | .of_match_table = plat_nand_match, | ||
153 | }, | 162 | }, |
154 | }; | 163 | }; |
155 | 164 | ||