aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/gpmc.c
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>2013-01-25 07:23:11 -0500
committerTony Lindgren <tony@atomide.com>2013-02-01 17:31:56 -0500
commit75d3625e0e86b2d8d77b4e9c6f685fd7ea0d5a96 (patch)
tree890a1375e84f94041b09ae06e5610958886433d1 /arch/arm/mach-omap2/gpmc.c
parentfaf5d2ff82154b3e2d30c9bfdab2ea4e089b24d5 (diff)
ARM: OMAP2+: gpmc: add DT bindings for OneNAND
This patch adds device tree bindings for OMAP OneNAND devices. Tested on an OMAP3 3430 IGEPv2 board. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/gpmc.c')
-rw-r--r--arch/arm/mach-omap2/gpmc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 0cf239231d36..1adb2d4496f6 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -39,6 +39,7 @@
39#include "omap_device.h" 39#include "omap_device.h"
40#include "gpmc.h" 40#include "gpmc.h"
41#include "gpmc-nand.h" 41#include "gpmc-nand.h"
42#include "gpmc-onenand.h"
42 43
43#define DEVICE_NAME "omap-gpmc" 44#define DEVICE_NAME "omap-gpmc"
44 45
@@ -1263,6 +1264,43 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
1263} 1264}
1264#endif 1265#endif
1265 1266
1267#ifdef CONFIG_MTD_ONENAND
1268static int gpmc_probe_onenand_child(struct platform_device *pdev,
1269 struct device_node *child)
1270{
1271 u32 val;
1272 struct omap_onenand_platform_data *gpmc_onenand_data;
1273
1274 if (of_property_read_u32(child, "reg", &val) < 0) {
1275 dev_err(&pdev->dev, "%s has no 'reg' property\n",
1276 child->full_name);
1277 return -ENODEV;
1278 }
1279
1280 gpmc_onenand_data = devm_kzalloc(&pdev->dev, sizeof(*gpmc_onenand_data),
1281 GFP_KERNEL);
1282 if (!gpmc_onenand_data)
1283 return -ENOMEM;
1284
1285 gpmc_onenand_data->cs = val;
1286 gpmc_onenand_data->of_node = child;
1287 gpmc_onenand_data->dma_channel = -1;
1288
1289 if (!of_property_read_u32(child, "dma-channel", &val))
1290 gpmc_onenand_data->dma_channel = val;
1291
1292 gpmc_onenand_init(gpmc_onenand_data);
1293
1294 return 0;
1295}
1296#else
1297static int gpmc_probe_onenand_child(struct platform_device *pdev,
1298 struct device_node *child)
1299{
1300 return 0;
1301}
1302#endif
1303
1266static int gpmc_probe_dt(struct platform_device *pdev) 1304static int gpmc_probe_dt(struct platform_device *pdev)
1267{ 1305{
1268 int ret; 1306 int ret;
@@ -1281,6 +1319,13 @@ static int gpmc_probe_dt(struct platform_device *pdev)
1281 } 1319 }
1282 } 1320 }
1283 1321
1322 for_each_node_by_name(child, "onenand") {
1323 ret = gpmc_probe_onenand_child(pdev, child);
1324 if (ret < 0) {
1325 of_node_put(child);
1326 return ret;
1327 }
1328 }
1284 return 0; 1329 return 0;
1285} 1330}
1286#else 1331#else