Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ezequiel Garcia and committed by
Tony Lindgren
75d3625e faf5d2ff

+88
+43
Documentation/devicetree/bindings/mtd/gpmc-onenand.txt
··· 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 + };
+45
arch/arm/mach-omap2/gpmc.c
··· 39 39 #include "omap_device.h" 40 40 #include "gpmc.h" 41 41 #include "gpmc-nand.h" 42 + #include "gpmc-onenand.h" 42 43 43 44 #define DEVICE_NAME "omap-gpmc" 44 45 ··· 1264 1263 } 1265 1264 #endif 1266 1265 1266 + #ifdef CONFIG_MTD_ONENAND 1267 + static int gpmc_probe_onenand_child(struct platform_device *pdev, 1268 + struct device_node *child) 1269 + { 1270 + u32 val; 1271 + struct omap_onenand_platform_data *gpmc_onenand_data; 1272 + 1273 + if (of_property_read_u32(child, "reg", &val) < 0) { 1274 + dev_err(&pdev->dev, "%s has no 'reg' property\n", 1275 + child->full_name); 1276 + return -ENODEV; 1277 + } 1278 + 1279 + gpmc_onenand_data = devm_kzalloc(&pdev->dev, sizeof(*gpmc_onenand_data), 1280 + GFP_KERNEL); 1281 + if (!gpmc_onenand_data) 1282 + return -ENOMEM; 1283 + 1284 + gpmc_onenand_data->cs = val; 1285 + gpmc_onenand_data->of_node = child; 1286 + gpmc_onenand_data->dma_channel = -1; 1287 + 1288 + if (!of_property_read_u32(child, "dma-channel", &val)) 1289 + gpmc_onenand_data->dma_channel = val; 1290 + 1291 + gpmc_onenand_init(gpmc_onenand_data); 1292 + 1293 + return 0; 1294 + } 1295 + #else 1296 + static int gpmc_probe_onenand_child(struct platform_device *pdev, 1297 + struct device_node *child) 1298 + { 1299 + return 0; 1300 + } 1301 + #endif 1302 + 1267 1303 static int gpmc_probe_dt(struct platform_device *pdev) 1268 1304 { 1269 1305 int ret; ··· 1319 1281 } 1320 1282 } 1321 1283 1284 + for_each_node_by_name(child, "onenand") { 1285 + ret = gpmc_probe_onenand_child(pdev, child); 1286 + if (ret < 0) { 1287 + of_node_put(child); 1288 + return ret; 1289 + } 1290 + } 1322 1291 return 0; 1323 1292 } 1324 1293 #else