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 struct resource clps711x_cpuidle_res __initconst =
18 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128);
20 static void __init clps711x_add_cpuidle(void)
22 platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE,
23 &clps711x_cpuidle_res, 1);
26 static const phys_addr_t clps711x_gpios[][2] __initconst = {
34 static void __init clps711x_add_gpio(void)
37 struct resource gpio_res[2];
39 memset(gpio_res, 0, sizeof(gpio_res));
41 gpio_res[0].flags = IORESOURCE_MEM;
42 gpio_res[1].flags = IORESOURCE_MEM;
44 for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) {
45 gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0];
46 gpio_res[0].end = gpio_res[0].start;
47 gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1];
48 gpio_res[1].end = gpio_res[1].start;
50 platform_device_register_simple("clps711x-gpio", i,
51 gpio_res, ARRAY_SIZE(gpio_res));
55 const struct resource clps711x_syscon_res[] __initconst = {
56 /* SYSCON1, SYSFLG1 */
57 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON1, SZ_128),
58 /* SYSCON2, SYSFLG2 */
59 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON2, SZ_128),
61 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON3, SZ_64),
64 static void __init clps711x_add_syscon(void)
68 for (i = 0; i < ARRAY_SIZE(clps711x_syscon_res); i++)
69 platform_device_register_simple("syscon", i + 1,
70 &clps711x_syscon_res[i], 1);
73 static const struct resource clps711x_uart1_res[] __initconst = {
74 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + UARTDR1, SZ_128),
75 DEFINE_RES_IRQ(IRQ_UTXINT1),
76 DEFINE_RES_IRQ(IRQ_URXINT1),
79 static const struct resource clps711x_uart2_res[] __initconst = {
80 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + UARTDR2, SZ_128),
81 DEFINE_RES_IRQ(IRQ_UTXINT2),
82 DEFINE_RES_IRQ(IRQ_URXINT2),
85 static void __init clps711x_add_uart(void)
87 platform_device_register_simple("clps711x-uart", 0, clps711x_uart1_res,
88 ARRAY_SIZE(clps711x_uart1_res));
89 platform_device_register_simple("clps711x-uart", 1, clps711x_uart2_res,
90 ARRAY_SIZE(clps711x_uart2_res));
93 void __init clps711x_devices_init(void)
95 clps711x_add_cpuidle();
97 clps711x_add_syscon();