]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/mach-clps711x/devices.c
Merge tag 'msm-cleanup-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / arch / arm / mach-clps711x / devices.c
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 #include <linux/sizes.h>
14
15 #include <mach/hardware.h>
16
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 },
23 };
24
25 static void __init clps711x_add_gpio(void)
26 {
27         unsigned i;
28         struct resource gpio_res[2];
29
30         memset(gpio_res, 0, sizeof(gpio_res));
31
32         gpio_res[0].flags = IORESOURCE_MEM;
33         gpio_res[1].flags = IORESOURCE_MEM;
34
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;
40
41                 platform_device_register_simple("clps711x-gpio", i,
42                                                 gpio_res, ARRAY_SIZE(gpio_res));
43         }
44 }
45
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),
53 };
54
55 static void __init clps711x_add_syscon(void)
56 {
57         unsigned i;
58
59         for (i = 0; i < ARRAY_SIZE(clps711x_syscon_res); i++)
60                 platform_device_register_simple("syscon", i + 1,
61                                                 &clps711x_syscon_res[i], 1);
62 }
63
64 void __init clps711x_devices_init(void)
65 {
66         clps711x_add_gpio();
67         clps711x_add_syscon();
68 }