Commit | Line | Data |
---|---|---|
e328b880 AS |
1 | /* |
2 | * CLPS711X common devices definitions | |
3 | * | |
4 | * Author: Alexander Shiyan <shc_work@mail.ru>, 2013 | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #include <linux/platform_device.h> | |
13 | ||
14 | #include <mach/hardware.h> | |
15 | ||
16 | static const phys_addr_t clps711x_gpios[][2] __initconst = { | |
17 | { PADR, PADDR }, | |
18 | { PBDR, PBDDR }, | |
19 | { PCDR, PCDDR }, | |
20 | { PDDR, PDDDR }, | |
21 | { PEDR, PEDDR }, | |
22 | }; | |
23 | ||
24 | static void __init clps711x_add_gpio(void) | |
25 | { | |
26 | unsigned i; | |
27 | struct resource gpio_res[2]; | |
28 | ||
29 | memset(gpio_res, 0, sizeof(gpio_res)); | |
30 | ||
31 | gpio_res[0].flags = IORESOURCE_MEM; | |
32 | gpio_res[1].flags = IORESOURCE_MEM; | |
33 | ||
34 | for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) { | |
35 | gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0]; | |
36 | gpio_res[0].end = gpio_res[0].start; | |
37 | gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1]; | |
38 | gpio_res[1].end = gpio_res[1].start; | |
39 | ||
40 | platform_device_register_simple("clps711x-gpio", i, | |
41 | gpio_res, ARRAY_SIZE(gpio_res)); | |
42 | } | |
43 | } | |
44 | ||
45 | void __init clps711x_devices_init(void) | |
46 | { | |
47 | clps711x_add_gpio(); | |
48 | } |