Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / arch / arm / mach-kirkwood / board-lsxl.c
blob83d8975592f8b40028a48a1d50dfde1e3dc430b1
1 /*
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/mtd/partitions.h>
18 #include <linux/ata_platform.h>
19 #include <linux/spi/flash.h>
20 #include <linux/spi/spi.h>
21 #include <linux/mv643xx_eth.h>
22 #include <linux/gpio.h>
23 #include <linux/gpio-fan.h>
24 #include <linux/input.h>
25 #include <asm/mach-types.h>
26 #include <asm/mach/arch.h>
27 #include <mach/kirkwood.h>
28 #include "common.h"
29 #include "mpp.h"
31 static struct mv643xx_eth_platform_data lsxl_ge00_data = {
32 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
35 static struct mv643xx_eth_platform_data lsxl_ge01_data = {
36 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
39 static unsigned int lsxl_mpp_config[] __initdata = {
40 MPP10_GPO, /* HDD Power Enable */
41 MPP11_GPIO, /* USB Vbus Enable */
42 MPP18_GPO, /* FAN High Enable# */
43 MPP19_GPO, /* FAN Low Enable# */
44 MPP36_GPIO, /* Function Blue LED */
45 MPP37_GPIO, /* Alarm LED */
46 MPP38_GPIO, /* Info LED */
47 MPP39_GPIO, /* Power LED */
48 MPP40_GPIO, /* Fan Lock */
49 MPP41_GPIO, /* Function Button */
50 MPP42_GPIO, /* Power Switch */
51 MPP43_GPIO, /* Power Auto Switch */
52 MPP48_GPIO, /* Function Red LED */
56 #define LSXL_GPIO_FAN_HIGH 18
57 #define LSXL_GPIO_FAN_LOW 19
58 #define LSXL_GPIO_FAN_LOCK 40
60 static struct gpio_fan_alarm lsxl_alarm = {
61 .gpio = LSXL_GPIO_FAN_LOCK,
64 static struct gpio_fan_speed lsxl_speeds[] = {
66 .rpm = 0,
67 .ctrl_val = 3,
68 }, {
69 .rpm = 1500,
70 .ctrl_val = 1,
71 }, {
72 .rpm = 3250,
73 .ctrl_val = 2,
74 }, {
75 .rpm = 5000,
76 .ctrl_val = 0,
80 static int lsxl_gpio_list[] = {
81 LSXL_GPIO_FAN_HIGH, LSXL_GPIO_FAN_LOW,
84 static struct gpio_fan_platform_data lsxl_fan_data = {
85 .num_ctrl = ARRAY_SIZE(lsxl_gpio_list),
86 .ctrl = lsxl_gpio_list,
87 .alarm = &lsxl_alarm,
88 .num_speed = ARRAY_SIZE(lsxl_speeds),
89 .speed = lsxl_speeds,
92 static struct platform_device lsxl_fan_device = {
93 .name = "gpio-fan",
94 .id = -1,
95 .num_resources = 0,
96 .dev = {
97 .platform_data = &lsxl_fan_data,
102 * On the LS-XHL/LS-CHLv2, the shutdown process is following:
103 * - Userland monitors key events until the power switch goes to off position
104 * - The board reboots
105 * - U-boot starts and goes into an idle mode waiting for the user
106 * to move the switch to ON position
109 static void lsxl_power_off(void)
111 kirkwood_restart('h', NULL);
114 #define LSXL_GPIO_HDD_POWER 10
115 #define LSXL_GPIO_USB_POWER 11
117 void __init lsxl_init(void)
120 * Basic setup. Needs to be called early.
122 kirkwood_mpp_conf(lsxl_mpp_config);
124 /* usb and sata power on */
125 gpio_set_value(LSXL_GPIO_USB_POWER, 1);
126 gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
128 kirkwood_ehci_init();
129 kirkwood_ge00_init(&lsxl_ge00_data);
130 kirkwood_ge01_init(&lsxl_ge01_data);
131 platform_device_register(&lsxl_fan_device);
133 /* register power-off method */
134 pm_power_off = lsxl_power_off;