Commit | Line | Data |
---|---|---|
bd0f9a3f HUK |
1 | /* |
2 | * Support for Wiliboard WBD-111 | |
3 | * | |
4 | * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org> | |
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 | #include <linux/kernel.h> | |
12 | #include <linux/init.h> | |
13 | #include <linux/platform_device.h> | |
14 | #include <linux/leds.h> | |
15 | #include <linux/input.h> | |
16 | #include <linux/skbuff.h> | |
17 | #include <linux/gpio_keys.h> | |
18 | #include <linux/mdio-gpio.h> | |
19 | #include <linux/mtd/mtd.h> | |
20 | #include <linux/mtd/partitions.h> | |
21 | #include <asm/mach-types.h> | |
22 | #include <asm/mach/arch.h> | |
23 | #include <asm/mach/time.h> | |
24 | ||
25 | ||
26 | #include "common.h" | |
27 | ||
28 | static struct gpio_keys_button wbd111_keys[] = { | |
29 | { | |
30 | .code = KEY_SETUP, | |
31 | .gpio = 5, | |
32 | .active_low = 1, | |
33 | .desc = "reset", | |
34 | .type = EV_KEY, | |
35 | }, | |
36 | }; | |
37 | ||
38 | static struct gpio_keys_platform_data wbd111_keys_data = { | |
39 | .buttons = wbd111_keys, | |
40 | .nbuttons = ARRAY_SIZE(wbd111_keys), | |
41 | }; | |
42 | ||
43 | static struct platform_device wbd111_keys_device = { | |
44 | .name = "gpio-keys", | |
45 | .id = -1, | |
46 | .dev = { | |
47 | .platform_data = &wbd111_keys_data, | |
48 | }, | |
49 | }; | |
50 | ||
51 | static struct gpio_led wbd111_leds[] = { | |
52 | { | |
53 | .name = "L3red", | |
54 | .gpio = 1, | |
55 | }, | |
56 | { | |
57 | .name = "L4green", | |
58 | .gpio = 2, | |
59 | }, | |
60 | { | |
61 | .name = "L4red", | |
62 | .gpio = 3, | |
63 | }, | |
64 | { | |
65 | .name = "L3green", | |
66 | .gpio = 5, | |
67 | }, | |
68 | }; | |
69 | ||
70 | static struct gpio_led_platform_data wbd111_leds_data = { | |
71 | .num_leds = ARRAY_SIZE(wbd111_leds), | |
72 | .leds = wbd111_leds, | |
73 | }; | |
74 | ||
75 | static struct platform_device wbd111_leds_device = { | |
76 | .name = "leds-gpio", | |
77 | .id = -1, | |
78 | .dev = { | |
79 | .platform_data = &wbd111_leds_data, | |
80 | }, | |
81 | }; | |
82 | ||
83 | static struct sys_timer wbd111_timer = { | |
84 | .init = gemini_timer_init, | |
85 | }; | |
86 | ||
bd0f9a3f HUK |
87 | static struct mtd_partition wbd111_partitions[] = { |
88 | { | |
89 | .name = "RedBoot", | |
90 | .offset = 0, | |
91 | .size = 0x020000, | |
92 | .mask_flags = MTD_WRITEABLE, | |
93 | } , { | |
94 | .name = "kernel", | |
95 | .offset = 0x020000, | |
96 | .size = 0x100000, | |
97 | } , { | |
98 | .name = "rootfs", | |
99 | .offset = 0x120000, | |
100 | .size = 0x6a0000, | |
101 | } , { | |
102 | .name = "VCTL", | |
103 | .offset = 0x7c0000, | |
104 | .size = 0x010000, | |
105 | .mask_flags = MTD_WRITEABLE, | |
106 | } , { | |
107 | .name = "cfg", | |
108 | .offset = 0x7d0000, | |
109 | .size = 0x010000, | |
110 | .mask_flags = MTD_WRITEABLE, | |
111 | } , { | |
112 | .name = "FIS", | |
113 | .offset = 0x7e0000, | |
114 | .size = 0x010000, | |
115 | .mask_flags = MTD_WRITEABLE, | |
116 | } | |
117 | }; | |
c06addd3 | 118 | #define wbd111_num_partitions ARRAY_SIZE(wbd111_partitions) |
bd0f9a3f HUK |
119 | |
120 | static void __init wbd111_init(void) | |
121 | { | |
122 | gemini_gpio_init(); | |
123 | platform_register_uart(); | |
124 | platform_register_pflash(SZ_8M, wbd111_partitions, | |
125 | wbd111_num_partitions); | |
126 | platform_device_register(&wbd111_leds_device); | |
127 | platform_device_register(&wbd111_keys_device); | |
f512626f | 128 | platform_register_rtc(); |
bd0f9a3f HUK |
129 | } |
130 | ||
131 | MACHINE_START(WBD111, "Wiliboard WBD-111") | |
2b078cdd | 132 | .atag_offset = 0x100, |
bd0f9a3f HUK |
133 | .map_io = gemini_map_io, |
134 | .init_irq = gemini_init_irq, | |
135 | .timer = &wbd111_timer, | |
136 | .init_machine = wbd111_init, | |
137 | MACHINE_END |