2 * Copyright 2012 (C), Michael Walle <michael@walle.cc>
4 * arch/arm/mach-kirkwood/board-lsxl.c
6 * Buffalo Linkstation LS-XHL and LS-CHLv2 init for drivers not
7 * converted to flattened device tree yet.
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/mv643xx_eth.h>
18 #include <linux/gpio.h>
19 #include <linux/gpio-fan.h>
23 static struct mv643xx_eth_platform_data lsxl_ge00_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
27 static struct mv643xx_eth_platform_data lsxl_ge01_data = {
28 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
31 static unsigned int lsxl_mpp_config[] __initdata = {
32 MPP10_GPO, /* HDD Power Enable */
33 MPP11_GPIO, /* USB Vbus Enable */
34 MPP18_GPO, /* FAN High Enable# */
35 MPP19_GPO, /* FAN Low Enable# */
36 MPP36_GPIO, /* Function Blue LED */
37 MPP37_GPIO, /* Alarm LED */
38 MPP38_GPIO, /* Info LED */
39 MPP39_GPIO, /* Power LED */
40 MPP40_GPIO, /* Fan Lock */
41 MPP41_GPIO, /* Function Button */
42 MPP42_GPIO, /* Power Switch */
43 MPP43_GPIO, /* Power Auto Switch */
44 MPP48_GPIO, /* Function Red LED */
48 #define LSXL_GPIO_FAN_HIGH 18
49 #define LSXL_GPIO_FAN_LOW 19
50 #define LSXL_GPIO_FAN_LOCK 40
52 static struct gpio_fan_alarm lsxl_alarm = {
53 .gpio = LSXL_GPIO_FAN_LOCK,
56 static struct gpio_fan_speed lsxl_speeds[] = {
72 static int lsxl_gpio_list[] = {
73 LSXL_GPIO_FAN_HIGH, LSXL_GPIO_FAN_LOW,
76 static struct gpio_fan_platform_data lsxl_fan_data = {
77 .num_ctrl = ARRAY_SIZE(lsxl_gpio_list),
78 .ctrl = lsxl_gpio_list,
80 .num_speed = ARRAY_SIZE(lsxl_speeds),
84 static struct platform_device lsxl_fan_device = {
89 .platform_data = &lsxl_fan_data,
94 * On the LS-XHL/LS-CHLv2, the shutdown process is following:
95 * - Userland monitors key events until the power switch goes to off position
97 * - U-boot starts and goes into an idle mode waiting for the user
98 * to move the switch to ON position
101 static void lsxl_power_off(void)
103 kirkwood_restart('h', NULL);
106 #define LSXL_GPIO_HDD_POWER 10
107 #define LSXL_GPIO_USB_POWER 11
109 void __init lsxl_init(void)
112 * Basic setup. Needs to be called early.
114 kirkwood_mpp_conf(lsxl_mpp_config);
116 /* usb and sata power on */
117 gpio_set_value(LSXL_GPIO_USB_POWER, 1);
118 gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
120 kirkwood_ehci_init();
121 kirkwood_ge00_init(&lsxl_ge00_data);
122 kirkwood_ge01_init(&lsxl_ge01_data);
123 platform_device_register(&lsxl_fan_device);
125 /* register power-off method */
126 pm_power_off = lsxl_power_off;