Merge tag 'gpio-for-v3.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6.git] / arch / arm / mach-clps711x / devices.c
blob856b81cf2f8a59f35654e2ea73a9193678938cb3
1 /*
2 * CLPS711X common devices definitions
4 * Author: Alexander Shiyan <shc_work@mail.ru>, 2013
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.
12 #include <linux/platform_device.h>
13 #include <linux/sizes.h>
15 #include <mach/hardware.h>
17 static const phys_addr_t clps711x_gpios[][2] __initconst = {
18 { PADR, PADDR },
19 { PBDR, PBDDR },
20 { PCDR, PCDDR },
21 { PDDR, PDDDR },
22 { PEDR, PEDDR },
25 static void __init clps711x_add_gpio(void)
27 unsigned i;
28 struct resource gpio_res[2];
30 memset(gpio_res, 0, sizeof(gpio_res));
32 gpio_res[0].flags = IORESOURCE_MEM;
33 gpio_res[1].flags = IORESOURCE_MEM;
35 for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) {
36 gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0];
37 gpio_res[0].end = gpio_res[0].start;
38 gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1];
39 gpio_res[1].end = gpio_res[1].start;
41 platform_device_register_simple("clps711x-gpio", i,
42 gpio_res, ARRAY_SIZE(gpio_res));
46 const struct resource clps711x_syscon_res[] __initconst = {
47 /* SYSCON1, SYSFLG1 */
48 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON1, SZ_128),
49 /* SYSCON2, SYSFLG2 */
50 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON2, SZ_128),
51 /* SYSCON3 */
52 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON3, SZ_64),
55 static void __init clps711x_add_syscon(void)
57 unsigned i;
59 for (i = 0; i < ARRAY_SIZE(clps711x_syscon_res); i++)
60 platform_device_register_simple("clps711x-syscon", i + 1,
61 &clps711x_syscon_res[i], 1);
64 void __init clps711x_devices_init(void)
66 clps711x_add_gpio();
67 clps711x_add_syscon();