aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsh Hughes <ashley.hughes@blueyonder.co.uk>2010-11-30 16:53:09 -0500
committerNicolas Pitre <nico@fluxnic.net>2010-12-07 13:50:04 -0500
commit4bba1c34e0a70d0db2506e1b68f69d7edc8afd78 (patch)
tree7cc1cd5d20dfaa51f0371aaeaf716bd3ce2aefc4
parent7f51439a3c078393e7618a636fea403afa35948c (diff)
[ARM] Orion: added Buffalo LS-CHL support
Adds support for Buffalo Linkstation Live v3 (LS-CHL) NAS drives. Signed-off-by: Ash Hughes <ashley.hughes@blueyonder.co.uk> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
-rw-r--r--arch/arm/mach-orion5x/Kconfig7
-rw-r--r--arch/arm/mach-orion5x/Makefile1
-rw-r--r--arch/arm/mach-orion5x/ls-chl-setup.c327
3 files changed, 335 insertions, 0 deletions
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index c897e03e413d..6604fc6ca58a 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -51,6 +51,13 @@ config MACH_LINKSTATION_PRO
51 Buffalo Linkstation Pro/Live platform. Both v1 and 51 Buffalo Linkstation Pro/Live platform. Both v1 and
52 v2 devices are supported. 52 v2 devices are supported.
53 53
54config MACH_LINKSTATION_LSCHL
55 bool "Buffalo Linkstation Live v3 (LS-CHL)"
56 select I2C_BOARDINFO
57 help
58 Say 'Y' here if you want your kernel to support the
59 Buffalo Linkstation Live v3 (LS-CHL) platform.
60
54config MACH_LINKSTATION_MINI 61config MACH_LINKSTATION_MINI
55 bool "Buffalo Linkstation Mini" 62 bool "Buffalo Linkstation Mini"
56 select I2C_BOARDINFO 63 select I2C_BOARDINFO
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index eb6eabcb41e4..7f18cdacd487 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
21obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o 21obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
22obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o 22obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
23obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o 23obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o
24obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o
diff --git a/arch/arm/mach-orion5x/ls-chl-setup.c b/arch/arm/mach-orion5x/ls-chl-setup.c
new file mode 100644
index 000000000000..20a9b66cbafa
--- /dev/null
+++ b/arch/arm/mach-orion5x/ls-chl-setup.c
@@ -0,0 +1,327 @@
1/*
2 * arch/arm/mach-orion5x/ls-chl-setup.c
3 *
4 * Maintainer: Ash Hughes <ashley.hughes@blueyonder.co.uk>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/mv643xx_eth.h>
16#include <linux/leds.h>
17#include <linux/gpio_keys.h>
18#include <linux/gpio-fan.h>
19#include <linux/input.h>
20#include <linux/i2c.h>
21#include <linux/ata_platform.h>
22#include <linux/gpio.h>
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <asm/system.h>
26#include <mach/orion5x.h>
27#include "common.h"
28#include "mpp.h"
29
30/*****************************************************************************
31 * Linkstation LS-CHL Info
32 ****************************************************************************/
33
34/*
35 * 256K NOR flash Device bus boot chip select
36 */
37
38#define LSCHL_NOR_BOOT_BASE 0xf4000000
39#define LSCHL_NOR_BOOT_SIZE SZ_256K
40
41/*****************************************************************************
42 * 256KB NOR Flash on BOOT Device
43 ****************************************************************************/
44
45static struct physmap_flash_data lschl_nor_flash_data = {
46 .width = 1,
47};
48
49static struct resource lschl_nor_flash_resource = {
50 .flags = IORESOURCE_MEM,
51 .start = LSCHL_NOR_BOOT_BASE,
52 .end = LSCHL_NOR_BOOT_BASE + LSCHL_NOR_BOOT_SIZE - 1,
53};
54
55static struct platform_device lschl_nor_flash = {
56 .name = "physmap-flash",
57 .id = 0,
58 .dev = {
59 .platform_data = &lschl_nor_flash_data,
60 },
61 .num_resources = 1,
62 .resource = &lschl_nor_flash_resource,
63};
64
65/*****************************************************************************
66 * Ethernet
67 ****************************************************************************/
68
69static struct mv643xx_eth_platform_data lschl_eth_data = {
70 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
71};
72
73/*****************************************************************************
74 * RTC 5C372a on I2C bus
75 ****************************************************************************/
76
77static struct i2c_board_info __initdata lschl_i2c_rtc = {
78 I2C_BOARD_INFO("rs5c372a", 0x32),
79};
80
81/*****************************************************************************
82 * LEDs attached to GPIO
83 ****************************************************************************/
84
85#define LSCHL_GPIO_LED_ALARM 2
86#define LSCHL_GPIO_LED_INFO 3
87#define LSCHL_GPIO_LED_FUNC 17
88#define LSCHL_GPIO_LED_PWR 0
89
90static struct gpio_led lschl_led_pins[] = {
91 {
92 .name = "alarm:red",
93 .gpio = LSCHL_GPIO_LED_ALARM,
94 .active_low = 1,
95 }, {
96 .name = "info:amber",
97 .gpio = LSCHL_GPIO_LED_INFO,
98 .active_low = 1,
99 }, {
100 .name = "func:blue:top",
101 .gpio = LSCHL_GPIO_LED_FUNC,
102 .active_low = 1,
103 }, {
104 .name = "power:blue:bottom",
105 .gpio = LSCHL_GPIO_LED_PWR,
106 },
107};
108
109static struct gpio_led_platform_data lschl_led_data = {
110 .leds = lschl_led_pins,
111 .num_leds = ARRAY_SIZE(lschl_led_pins),
112};
113
114static struct platform_device lschl_leds = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &lschl_led_data,
119 },
120};
121
122/*****************************************************************************
123 * SATA
124 ****************************************************************************/
125static struct mv_sata_platform_data lschl_sata_data = {
126 .n_ports = 2,
127};
128
129/*****************************************************************************
130 * LS-CHL specific power off method: reboot
131 ****************************************************************************/
132/*
133 * On the LS-CHL, the shutdown process is following:
134 * - Userland monitors key events until the power switch goes to off position
135 * - The board reboots
136 * - U-boot starts and goes into an idle mode waiting for the user
137 * to move the switch to ON position
138 *
139 */
140
141static void lschl_power_off(void)
142{
143 arm_machine_restart('h', NULL);
144}
145
146/*****************************************************************************
147 * General Setup
148 ****************************************************************************/
149#define LSCHL_GPIO_USB_POWER 9
150#define LSCHL_GPIO_AUTO_POWER 17
151#define LSCHL_GPIO_POWER 18
152
153/****************************************************************************
154 * GPIO Attached Keys
155 ****************************************************************************/
156#define LSCHL_GPIO_KEY_FUNC 15
157#define LSCHL_GPIO_KEY_POWER 8
158#define LSCHL_GPIO_KEY_AUTOPOWER 10
159#define LSCHL_SW_POWER 0x00
160#define LSCHL_SW_AUTOPOWER 0x01
161#define LSCHL_SW_FUNC 0x02
162
163static struct gpio_keys_button lschl_buttons[] = {
164 {
165 .type = EV_SW,
166 .code = LSCHL_SW_POWER,
167 .gpio = LSCHL_GPIO_KEY_POWER,
168 .desc = "Power-on Switch",
169 .active_low = 1,
170 }, {
171 .type = EV_SW,
172 .code = LSCHL_SW_AUTOPOWER,
173 .gpio = LSCHL_GPIO_KEY_AUTOPOWER,
174 .desc = "Power-auto Switch",
175 .active_low = 1,
176 }, {
177 .type = EV_SW,
178 .code = LSCHL_SW_FUNC,
179 .gpio = LSCHL_GPIO_KEY_FUNC,
180 .desc = "Function Switch",
181 .active_low = 1,
182 },
183};
184
185static struct gpio_keys_platform_data lschl_button_data = {
186 .buttons = lschl_buttons,
187 .nbuttons = ARRAY_SIZE(lschl_buttons),
188};
189
190static struct platform_device lschl_button_device = {
191 .name = "gpio-keys",
192 .id = -1,
193 .num_resources = 0,
194 .dev = {
195 .platform_data = &lschl_button_data,
196 },
197};
198
199#define LSCHL_GPIO_HDD_POWER 1
200
201/****************************************************************************
202 * GPIO Fan
203 ****************************************************************************/
204
205#define LSCHL_GPIO_FAN_LOW 16
206#define LSCHL_GPIO_FAN_HIGH 14
207#define LSCHL_GPIO_FAN_LOCK 6
208
209static struct gpio_fan_alarm lschl_alarm = {
210 .gpio = LSCHL_GPIO_FAN_LOCK,
211};
212
213static struct gpio_fan_speed lschl_speeds[] = {
214 {
215 .rpm = 0,
216 .ctrl_val = 3,
217 }, {
218 .rpm = 1500,
219 .ctrl_val = 2,
220 }, {
221 .rpm = 3250,
222 .ctrl_val = 1,
223 }, {
224 .rpm = 5000,
225 .ctrl_val = 0,
226 },
227};
228
229static int lschl_gpio_list[] = {
230 LSCHL_GPIO_FAN_HIGH, LSCHL_GPIO_FAN_LOW,
231};
232
233static struct gpio_fan_platform_data lschl_fan_data = {
234 .num_ctrl = ARRAY_SIZE(lschl_gpio_list),
235 .ctrl = lschl_gpio_list,
236 .alarm = &lschl_alarm,
237 .num_speed = ARRAY_SIZE(lschl_speeds),
238 .speed = lschl_speeds,
239};
240
241static struct platform_device lschl_fan_device = {
242 .name = "gpio-fan",
243 .id = -1,
244 .num_resources = 0,
245 .dev = {
246 .platform_data = &lschl_fan_data,
247 },
248};
249
250/****************************************************************************
251 * GPIO Data
252 ****************************************************************************/
253
254static struct orion5x_mpp_mode lschl_mpp_modes[] __initdata = {
255 { 0, MPP_GPIO }, /* LED POWER */
256 { 1, MPP_GPIO }, /* HDD POWER */
257 { 2, MPP_GPIO }, /* LED ALARM */
258 { 3, MPP_GPIO }, /* LED INFO */
259 { 4, MPP_UNUSED },
260 { 5, MPP_UNUSED },
261 { 6, MPP_GPIO }, /* FAN LOCK */
262 { 7, MPP_GPIO }, /* SW INIT */
263 { 8, MPP_GPIO }, /* SW POWER */
264 { 9, MPP_GPIO }, /* USB POWER */
265 { 10, MPP_GPIO }, /* SW AUTO POWER */
266 { 11, MPP_UNUSED },
267 { 12, MPP_UNUSED },
268 { 13, MPP_UNUSED },
269 { 14, MPP_GPIO }, /* FAN HIGH */
270 { 15, MPP_GPIO }, /* SW FUNC */
271 { 16, MPP_GPIO }, /* FAN LOW */
272 { 17, MPP_GPIO }, /* LED FUNC */
273 { 18, MPP_UNUSED },
274 { 19, MPP_UNUSED },
275 { -1 },
276};
277
278static void __init lschl_init(void)
279{
280 /*
281 * Setup basic Orion functions. Needs to be called early.
282 */
283 orion5x_init();
284
285 orion5x_mpp_conf(lschl_mpp_modes);
286
287 /*
288 * Configure peripherals.
289 */
290 orion5x_ehci0_init();
291 orion5x_ehci1_init();
292 orion5x_eth_init(&lschl_eth_data);
293 orion5x_i2c_init();
294 orion5x_sata_init(&lschl_sata_data);
295 orion5x_uart0_init();
296 orion5x_xor_init();
297
298 orion5x_setup_dev_boot_win(LSCHL_NOR_BOOT_BASE,
299 LSCHL_NOR_BOOT_SIZE);
300 platform_device_register(&lschl_nor_flash);
301
302 platform_device_register(&lschl_leds);
303
304 platform_device_register(&lschl_button_device);
305
306 platform_device_register(&lschl_fan_device);
307
308 i2c_register_board_info(0, &lschl_i2c_rtc, 1);
309
310 /* usb power on */
311 gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
312
313 /* register power-off method */
314 pm_power_off = lschl_power_off;
315
316 pr_info("%s: finished\n", __func__);
317}
318
319MACHINE_START(LINKSTATION_LSCHL, "Buffalo Linkstation LiveV3 (LS-CHL)")
320 /* Maintainer: Ash Hughes <ashley.hughes@blueyonder.co.uk> */
321 .boot_params = 0x00000100,
322 .init_machine = lschl_init,
323 .map_io = orion5x_map_io,
324 .init_irq = orion5x_init_irq,
325 .timer = &orion5x_timer,
326 .fixup = tag_fixup_mem32,
327MACHINE_END