2 * arch/arm/mach-orion5x/ls_hgl-setup.c
4 * Maintainer: Zhu Qingsen <zhuqs@cn.fujitsu.com>
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.
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/input.h>
19 #include <linux/i2c.h>
20 #include <linux/ata_platform.h>
21 #include <linux/gpio.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/system.h>
25 #include <mach/orion5x.h>
29 /*****************************************************************************
30 * Linkstation LS-HGL Info
31 ****************************************************************************/
34 * 256K NOR flash Device bus boot chip select
37 #define LS_HGL_NOR_BOOT_BASE 0xf4000000
38 #define LS_HGL_NOR_BOOT_SIZE SZ_256K
40 /*****************************************************************************
41 * 256KB NOR Flash on BOOT Device
42 ****************************************************************************/
44 static struct physmap_flash_data ls_hgl_nor_flash_data
= {
48 static 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,
54 static struct platform_device ls_hgl_nor_flash
= {
55 .name
= "physmap-flash",
58 .platform_data
= &ls_hgl_nor_flash_data
,
61 .resource
= &ls_hgl_nor_flash_resource
,
64 /*****************************************************************************
66 ****************************************************************************/
68 static struct mv643xx_eth_platform_data ls_hgl_eth_data
= {
72 /*****************************************************************************
73 * RTC 5C372a on I2C bus
74 ****************************************************************************/
76 static struct i2c_board_info __initdata ls_hgl_i2c_rtc
= {
77 I2C_BOARD_INFO("rs5c372a", 0x32),
80 /*****************************************************************************
81 * LEDs attached to GPIO
82 ****************************************************************************/
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
90 static struct gpio_led ls_hgl_led_pins
[] = {
93 .gpio
= LS_HGL_GPIO_LED_ALARM
,
97 .gpio
= LS_HGL_GPIO_LED_INFO
,
100 .name
= "func:blue:top",
101 .gpio
= LS_HGL_GPIO_LED_FUNC
,
104 .name
= "power:blue:bottom",
105 .gpio
= LS_HGL_GPIO_LED_PWR
,
109 static struct gpio_led_platform_data ls_hgl_led_data
= {
110 .leds
= ls_hgl_led_pins
,
111 .num_leds
= ARRAY_SIZE(ls_hgl_led_pins
),
114 static struct platform_device ls_hgl_leds
= {
118 .platform_data
= &ls_hgl_led_data
,
122 /****************************************************************************
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
129 #define LS_HGL_SW_POWER 0x00
130 #define LS_HGL_SW_AUTOPOWER 0x01
132 static struct gpio_keys_button ls_hgl_buttons
[] = {
135 .gpio
= LS_HGL_GPIO_KEY_FUNC
,
136 .desc
= "Function Button",
140 .code
= LS_HGL_SW_POWER
,
141 .gpio
= LS_HGL_GPIO_KEY_POWER
,
142 .desc
= "Power-on Switch",
146 .code
= LS_HGL_SW_AUTOPOWER
,
147 .gpio
= LS_HGL_GPIO_KEY_AUTOPOWER
,
148 .desc
= "Power-auto Switch",
153 static struct gpio_keys_platform_data ls_hgl_button_data
= {
154 .buttons
= ls_hgl_buttons
,
155 .nbuttons
= ARRAY_SIZE(ls_hgl_buttons
),
158 static struct platform_device ls_hgl_button_device
= {
163 .platform_data
= &ls_hgl_button_data
,
168 /*****************************************************************************
170 ****************************************************************************/
171 static struct mv_sata_platform_data ls_hgl_sata_data
= {
176 /*****************************************************************************
177 * Linkstation LS-HGL specific power off method: reboot
178 ****************************************************************************/
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
187 static void ls_hgl_power_off(void)
189 arm_machine_restart('h', NULL
);
193 /*****************************************************************************
195 ****************************************************************************/
197 #define LS_HGL_GPIO_USB_POWER 9
198 #define LS_HGL_GPIO_AUTO_POWER 10
199 #define LS_HGL_GPIO_POWER 8
201 #define LS_HGL_GPIO_HDD_POWER 1
203 static unsigned int ls_hgl_mpp_modes
[] __initdata
= {
204 MPP0_GPIO
, /* LED_PWR */
205 MPP1_GPIO
, /* HDD_PWR */
206 MPP2_GPIO
, /* LED_ALARM */
207 MPP3_GPIO
, /* LED_INFO */
210 MPP6_GPIO
, /* FAN_LCK */
211 MPP7_GPIO
, /* INIT */
212 MPP8_GPIO
, /* POWER */
213 MPP9_GPIO
, /* USB_PWR */
214 MPP10_GPIO
, /* AUTO_POWER */
215 MPP11_UNUSED
, /* LED_ETH (dummy) */
219 MPP15_GPIO
, /* FUNC */
221 MPP17_GPIO
, /* LED_FUNC */
227 static void __init
ls_hgl_init(void)
230 * Setup basic Orion functions. Need to be called early.
234 orion5x_mpp_conf(ls_hgl_mpp_modes
);
237 * Configure peripherals.
239 orion5x_ehci0_init();
240 orion5x_ehci1_init();
241 orion5x_eth_init(&ls_hgl_eth_data
);
243 orion5x_sata_init(&ls_hgl_sata_data
);
244 orion5x_uart0_init();
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
);
251 platform_device_register(&ls_hgl_button_device
);
253 platform_device_register(&ls_hgl_leds
);
255 i2c_register_board_info(0, &ls_hgl_i2c_rtc
, 1);
257 /* enable USB power */
258 gpio_set_value(LS_HGL_GPIO_USB_POWER
, 1);
260 /* register power-off method */
261 pm_power_off
= ls_hgl_power_off
;
263 pr_info("%s: finished\n", __func__
);
266 MACHINE_START(LINKSTATION_LS_HGL
, "Buffalo Linkstation LS-HGL")
267 /* Maintainer: Zhu Qingsen <zhuqs@cn.fujistu.com> */
268 .boot_params
= 0x00000100,
269 .init_machine
= ls_hgl_init
,
270 .map_io
= orion5x_map_io
,
271 .init_early
= orion5x_init_early
,
272 .init_irq
= orion5x_init_irq
,
273 .timer
= &orion5x_timer
,
274 .fixup
= tag_fixup_mem32
,