aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x
diff options
context:
space:
mode:
authorZhu Qingsen <zhuqs@cn.fujitsu.com>2010-02-04 22:33:27 -0500
committerNicolas Pitre <nico@fluxnic.net>2010-02-05 00:27:06 -0500
commit2d18638ec010a2ed1daa08b4774ed12108647a53 (patch)
tree80a1a2e9237cb45764ad81361cc9b60c1449c730 /arch/arm/mach-orion5x
parentb2fdb5660fccc060e47658baad8911a963397ced (diff)
[ARM] Orion: Add Buffalo Linkstation LS-HGL support
Signed-off-by: Zhu Qingsen <zhuqs@cn.fujitsu.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r--arch/arm/mach-orion5x/Kconfig7
-rw-r--r--arch/arm/mach-orion5x/Makefile1
-rw-r--r--arch/arm/mach-orion5x/ls_hgl-setup.c276
3 files changed, 284 insertions, 0 deletions
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index c3d513cad5ac..905719a677ae 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -57,6 +57,13 @@ config MACH_LINKSTATION_MINI
57 Say 'Y' here if you want your kernel to support the 57 Say 'Y' here if you want your kernel to support the
58 Buffalo Linkstation Mini platform. 58 Buffalo Linkstation Mini platform.
59 59
60config MACH_LINKSTATION_LS_HGL
61 bool "Buffalo Linkstation LS-HGL"
62 select I2C_BOARDINFO
63 help
64 Say 'Y' here if you want your kernel to support the
65 Buffalo Linkstation LS-HGL platform.
66
60config MACH_TS409 67config MACH_TS409
61 bool "QNAP TS-409" 68 bool "QNAP TS-409"
62 help 69 help
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 89772fcd65c7..eb6eabcb41e4 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o
5obj-$(CONFIG_MACH_TERASTATION_PRO2) += terastation_pro2-setup.o 5obj-$(CONFIG_MACH_TERASTATION_PRO2) += terastation_pro2-setup.o
6obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o 6obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o
7obj-$(CONFIG_MACH_LINKSTATION_MINI) += lsmini-setup.o 7obj-$(CONFIG_MACH_LINKSTATION_MINI) += lsmini-setup.o
8obj-$(CONFIG_MACH_LINKSTATION_LS_HGL) += ls_hgl-setup.o
8obj-$(CONFIG_MACH_DNS323) += dns323-setup.o 9obj-$(CONFIG_MACH_DNS323) += dns323-setup.o
9obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o 10obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o
10obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o 11obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
new file mode 100644
index 000000000000..b9acd6bb382b
--- /dev/null
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -0,0 +1,276 @@
1/*
2 * arch/arm/mach-orion5x/ls_hgl-setup.c
3 *
4 * Maintainer: Zhu Qingsen <zhuqs@cn.fujitsu.com>
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/pci.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/leds.h>
18#include <linux/gpio_keys.h>
19#include <linux/input.h>
20#include <linux/i2c.h>
21#include <linux/ata_platform.h>
22#include <asm/mach-types.h>
23#include <linux/gpio.h>
24#include <asm/mach/arch.h>
25#include "common.h"
26#include "mpp.h"
27#include "include/mach/system.h"
28
29/*****************************************************************************
30 * Linkstation LS-HGL Info
31 ****************************************************************************/
32
33/*
34 * 256K NOR flash Device bus boot chip select
35 */
36
37#define LS_HGL_NOR_BOOT_BASE 0xf4000000
38#define LS_HGL_NOR_BOOT_SIZE SZ_256K
39
40/*****************************************************************************
41 * 256KB NOR Flash on BOOT Device
42 ****************************************************************************/
43
44static struct physmap_flash_data ls_hgl_nor_flash_data = {
45 .width = 1,
46};
47
48static struct resource ls_hgl_nor_flash_resource = {
49 .flags = IORESOURCE_MEM,
50 .start = LS_HGL_NOR_BOOT_BASE,
51 .end = LS_HGL_NOR_BOOT_BASE + LS_HGL_NOR_BOOT_SIZE - 1,
52};
53
54static struct platform_device ls_hgl_nor_flash = {
55 .name = "physmap-flash",
56 .id = 0,
57 .dev = {
58 .platform_data = &ls_hgl_nor_flash_data,
59 },
60 .num_resources = 1,
61 .resource = &ls_hgl_nor_flash_resource,
62};
63
64/*****************************************************************************
65 * Ethernet
66 ****************************************************************************/
67
68static struct mv643xx_eth_platform_data ls_hgl_eth_data = {
69 .phy_addr = 8,
70};
71
72/*****************************************************************************
73 * RTC 5C372a on I2C bus
74 ****************************************************************************/
75
76static struct i2c_board_info __initdata ls_hgl_i2c_rtc = {
77 I2C_BOARD_INFO("rs5c372a", 0x32),
78};
79
80/*****************************************************************************
81 * LEDs attached to GPIO
82 ****************************************************************************/
83
84#define LS_HGL_GPIO_LED_ALARM 2
85#define LS_HGL_GPIO_LED_INFO 3
86#define LS_HGL_GPIO_LED_FUNC 17
87#define LS_HGL_GPIO_LED_PWR 0
88
89
90static struct gpio_led ls_hgl_led_pins[] = {
91 {
92 .name = "alarm:red",
93 .gpio = LS_HGL_GPIO_LED_ALARM,
94 .active_low = 1,
95 }, {
96 .name = "info:amber",
97 .gpio = LS_HGL_GPIO_LED_INFO,
98 .active_low = 1,
99 }, {
100 .name = "func:blue:top",
101 .gpio = LS_HGL_GPIO_LED_FUNC,
102 .active_low = 1,
103 }, {
104 .name = "power:blue:bottom",
105 .gpio = LS_HGL_GPIO_LED_PWR,
106 },
107};
108
109static struct gpio_led_platform_data ls_hgl_led_data = {
110 .leds = ls_hgl_led_pins,
111 .num_leds = ARRAY_SIZE(ls_hgl_led_pins),
112};
113
114static struct platform_device ls_hgl_leds = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &ls_hgl_led_data,
119 },
120};
121
122/****************************************************************************
123 * GPIO Attached Keys
124 ****************************************************************************/
125#define LS_HGL_GPIO_KEY_FUNC 15
126#define LS_HGL_GPIO_KEY_POWER 8
127#define LS_HGL_GPIO_KEY_AUTOPOWER 10
128
129#define LS_HGL_SW_POWER 0x00
130#define LS_HGL_SW_AUTOPOWER 0x01
131
132static struct gpio_keys_button ls_hgl_buttons[] = {
133 {
134 .code = KEY_OPTION,
135 .gpio = LS_HGL_GPIO_KEY_FUNC,
136 .desc = "Function Button",
137 .active_low = 1,
138 }, {
139 .type = EV_SW,
140 .code = LS_HGL_SW_POWER,
141 .gpio = LS_HGL_GPIO_KEY_POWER,
142 .desc = "Power-on Switch",
143 .active_low = 1,
144 }, {
145 .type = EV_SW,
146 .code = LS_HGL_SW_AUTOPOWER,
147 .gpio = LS_HGL_GPIO_KEY_AUTOPOWER,
148 .desc = "Power-auto Switch",
149 .active_low = 1,
150 },
151};
152
153static struct gpio_keys_platform_data ls_hgl_button_data = {
154 .buttons = ls_hgl_buttons,
155 .nbuttons = ARRAY_SIZE(ls_hgl_buttons),
156};
157
158static struct platform_device ls_hgl_button_device = {
159 .name = "gpio-keys",
160 .id = -1,
161 .num_resources = 0,
162 .dev = {
163 .platform_data = &ls_hgl_button_data,
164 },
165};
166
167
168/*****************************************************************************
169 * SATA
170 ****************************************************************************/
171static struct mv_sata_platform_data ls_hgl_sata_data = {
172 .n_ports = 2,
173};
174
175
176/*****************************************************************************
177 * Linkstation LS-HGL specific power off method: reboot
178 ****************************************************************************/
179/*
180 * On the Linkstation LS-HGL, the shutdown process is following:
181 * - Userland monitors key events until the power switch goes to off position
182 * - The board reboots
183 * - U-boot starts and goes into an idle mode waiting for the user
184 * to move the switch to ON position
185 */
186
187static void ls_hgl_power_off(void)
188{
189 arch_reset(0, NULL);
190}
191
192
193/*****************************************************************************
194 * General Setup
195 ****************************************************************************/
196
197#define LS_HGL_GPIO_USB_POWER 9
198#define LS_HGL_GPIO_AUTO_POWER 10
199#define LS_HGL_GPIO_POWER 8
200
201#define LS_HGL_GPIO_HDD_POWER 1
202
203static struct orion5x_mpp_mode ls_hgl_mpp_modes[] __initdata = {
204 { 0, MPP_GPIO }, /* LED_PWR */
205 { 1, MPP_GPIO }, /* HDD_PWR */
206 { 2, MPP_GPIO }, /* LED_ALARM */
207 { 3, MPP_GPIO }, /* LED_INFO */
208 { 4, MPP_UNUSED },
209 { 5, MPP_UNUSED },
210 { 6, MPP_GPIO }, /* FAN_LCK */
211 { 7, MPP_GPIO }, /* INIT */
212 { 8, MPP_GPIO }, /* POWER */
213 { 9, MPP_GPIO }, /* USB_PWR */
214 { 10, MPP_GPIO }, /* AUTO_POWER */
215 { 11, MPP_UNUSED }, /* LED_ETH (dummy) */
216 { 12, MPP_UNUSED },
217 { 13, MPP_UNUSED },
218 { 14, MPP_UNUSED },
219 { 15, MPP_GPIO }, /* FUNC */
220 { 16, MPP_UNUSED },
221 { 17, MPP_GPIO }, /* LED_FUNC */
222 { 18, MPP_UNUSED },
223 { 19, MPP_UNUSED },
224 { -1 },
225};
226
227static void __init ls_hgl_init(void)
228{
229 /*
230 * Setup basic Orion functions. Need to be called early.
231 */
232 orion5x_init();
233
234 orion5x_mpp_conf(ls_hgl_mpp_modes);
235
236 /*
237 * Configure peripherals.
238 */
239 orion5x_ehci0_init();
240 orion5x_ehci1_init();
241 orion5x_eth_init(&ls_hgl_eth_data);
242 orion5x_i2c_init();
243 orion5x_sata_init(&ls_hgl_sata_data);
244 orion5x_uart0_init();
245 orion5x_xor_init();
246
247 orion5x_setup_dev_boot_win(LS_HGL_NOR_BOOT_BASE,
248 LS_HGL_NOR_BOOT_SIZE);
249 platform_device_register(&ls_hgl_nor_flash);
250
251 platform_device_register(&ls_hgl_button_device);
252
253 platform_device_register(&ls_hgl_leds);
254
255 i2c_register_board_info(0, &ls_hgl_i2c_rtc, 1);
256
257 /* enable USB power */
258 gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
259
260 /* register power-off method */
261 pm_power_off = ls_hgl_power_off;
262
263 pr_info("%s: finished\n", __func__);
264}
265
266MACHINE_START(LINKSTATION_LS_HGL, "Buffalo Linkstation LS-HGL")
267 /* Maintainer: Zhu Qingsen <zhuqs@cn.fujistu.com> */
268 .phys_io = ORION5X_REGS_PHYS_BASE,
269 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
270 .boot_params = 0x00000100,
271 .init_machine = ls_hgl_init,
272 .map_io = orion5x_map_io,
273 .init_irq = orion5x_init_irq,
274 .timer = &orion5x_timer,
275 .fixup = tag_fixup_mem32,
276MACHINE_END