Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / arm / mach-clps711x / devices.c
blob2001488a5ef24b4831889946309bcae16d684166
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("syscon", i + 1,
61 &clps711x_syscon_res[i], 1);
64 static const struct resource clps711x_uart1_res[] __initconst = {
65 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + UARTDR1, SZ_128),
66 DEFINE_RES_IRQ(IRQ_UTXINT1),
67 DEFINE_RES_IRQ(IRQ_URXINT1),
70 static const struct resource clps711x_uart2_res[] __initconst = {
71 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + UARTDR2, SZ_128),
72 DEFINE_RES_IRQ(IRQ_UTXINT2),
73 DEFINE_RES_IRQ(IRQ_URXINT2),
76 static void __init clps711x_add_uart(void)
78 platform_device_register_simple("clps711x-uart", 0, clps711x_uart1_res,
79 ARRAY_SIZE(clps711x_uart1_res));
80 platform_device_register_simple("clps711x-uart", 1, clps711x_uart2_res,
81 ARRAY_SIZE(clps711x_uart2_res));
84 void __init clps711x_devices_init(void)
86 clps711x_add_gpio();
87 clps711x_add_syscon();
88 clps711x_add_uart();