Skip to content

Commit 75d3625

Browse files
ezequielgarciatmlind
authored andcommitted
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 <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent faf5d2f commit 75d3625

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Device tree bindings for GPMC connected OneNANDs
2+
3+
GPMC connected OneNAND (found on OMAP boards) are represented as child nodes of
4+
the GPMC controller with a name of "onenand".
5+
6+
All timing relevant properties as well as generic gpmc child properties are
7+
explained in a separate documents - please refer to
8+
Documentation/devicetree/bindings/bus/ti-gpmc.txt
9+
10+
Required properties:
11+
12+
- reg: The CS line the peripheral is connected to
13+
14+
Optional properties:
15+
16+
- dma-channel: DMA Channel index
17+
18+
For inline partiton table parsing (optional):
19+
20+
- #address-cells: should be set to 1
21+
- #size-cells: should be set to 1
22+
23+
Example for an OMAP3430 board:
24+
25+
gpmc: gpmc@6e000000 {
26+
compatible = "ti,omap3430-gpmc";
27+
ti,hwmods = "gpmc";
28+
reg = <0x6e000000 0x1000000>;
29+
interrupts = <20>;
30+
gpmc,num-cs = <8>;
31+
gpmc,num-waitpins = <4>;
32+
#address-cells = <2>;
33+
#size-cells = <1>;
34+
35+
onenand@0 {
36+
reg = <0 0 0>; /* CS0, offset 0 */
37+
38+
#address-cells = <1>;
39+
#size-cells = <1>;
40+
41+
/* partitions go here */
42+
};
43+
};

arch/arm/mach-omap2/gpmc.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "omap_device.h"
4040
#include "gpmc.h"
4141
#include "gpmc-nand.h"
42+
#include "gpmc-onenand.h"
4243

4344
#define DEVICE_NAME "omap-gpmc"
4445

@@ -1263,6 +1264,43 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
12631264
}
12641265
#endif
12651266

1267+
#ifdef CONFIG_MTD_ONENAND
1268+
static 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
1297+
static int gpmc_probe_onenand_child(struct platform_device *pdev,
1298+
struct device_node *child)
1299+
{
1300+
return 0;
1301+
}
1302+
#endif
1303+
12661304
static int gpmc_probe_dt(struct platform_device *pdev)
12671305
{
12681306
int ret;
@@ -1281,6 +1319,13 @@ static int gpmc_probe_dt(struct platform_device *pdev)
12811319
}
12821320
}
12831321

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+
}
12841329
return 0;
12851330
}
12861331
#else

0 commit comments

Comments
 (0)