2
* arch/arm/mach-orion5x/ls-chl-setup.c
4
* Maintainer: Ash Hughes <ashley.hughes@blueyonder.co.uk>
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/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>
30
/*****************************************************************************
31
* Linkstation LS-CHL Info
32
****************************************************************************/
35
* 256K NOR flash Device bus boot chip select
38
#define LSCHL_NOR_BOOT_BASE 0xf4000000
39
#define LSCHL_NOR_BOOT_SIZE SZ_256K
41
/*****************************************************************************
42
* 256KB NOR Flash on BOOT Device
43
****************************************************************************/
45
static struct physmap_flash_data lschl_nor_flash_data = {
49
static 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,
55
static struct platform_device lschl_nor_flash = {
56
.name = "physmap-flash",
59
.platform_data = &lschl_nor_flash_data,
62
.resource = &lschl_nor_flash_resource,
65
/*****************************************************************************
67
****************************************************************************/
69
static struct mv643xx_eth_platform_data lschl_eth_data = {
70
.phy_addr = MV643XX_ETH_PHY_ADDR(8),
73
/*****************************************************************************
74
* RTC 5C372a on I2C bus
75
****************************************************************************/
77
static struct i2c_board_info __initdata lschl_i2c_rtc = {
78
I2C_BOARD_INFO("rs5c372a", 0x32),
81
/*****************************************************************************
82
* LEDs attached to GPIO
83
****************************************************************************/
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
90
static struct gpio_led lschl_led_pins[] = {
93
.gpio = LSCHL_GPIO_LED_ALARM,
97
.gpio = LSCHL_GPIO_LED_INFO,
100
.name = "func:blue:top",
101
.gpio = LSCHL_GPIO_LED_FUNC,
104
.name = "power:blue:bottom",
105
.gpio = LSCHL_GPIO_LED_PWR,
109
static struct gpio_led_platform_data lschl_led_data = {
110
.leds = lschl_led_pins,
111
.num_leds = ARRAY_SIZE(lschl_led_pins),
114
static struct platform_device lschl_leds = {
118
.platform_data = &lschl_led_data,
122
/*****************************************************************************
124
****************************************************************************/
125
static struct mv_sata_platform_data lschl_sata_data = {
129
/*****************************************************************************
130
* LS-CHL specific power off method: reboot
131
****************************************************************************/
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
141
static void lschl_power_off(void)
143
arm_machine_restart('h', NULL);
146
/*****************************************************************************
148
****************************************************************************/
149
#define LSCHL_GPIO_USB_POWER 9
150
#define LSCHL_GPIO_AUTO_POWER 17
151
#define LSCHL_GPIO_POWER 18
153
/****************************************************************************
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
163
static struct gpio_keys_button lschl_buttons[] = {
166
.code = LSCHL_SW_POWER,
167
.gpio = LSCHL_GPIO_KEY_POWER,
168
.desc = "Power-on Switch",
172
.code = LSCHL_SW_AUTOPOWER,
173
.gpio = LSCHL_GPIO_KEY_AUTOPOWER,
174
.desc = "Power-auto Switch",
178
.code = LSCHL_SW_FUNC,
179
.gpio = LSCHL_GPIO_KEY_FUNC,
180
.desc = "Function Switch",
185
static struct gpio_keys_platform_data lschl_button_data = {
186
.buttons = lschl_buttons,
187
.nbuttons = ARRAY_SIZE(lschl_buttons),
190
static struct platform_device lschl_button_device = {
195
.platform_data = &lschl_button_data,
199
#define LSCHL_GPIO_HDD_POWER 1
201
/****************************************************************************
203
****************************************************************************/
205
#define LSCHL_GPIO_FAN_LOW 16
206
#define LSCHL_GPIO_FAN_HIGH 14
207
#define LSCHL_GPIO_FAN_LOCK 6
209
static struct gpio_fan_alarm lschl_alarm = {
210
.gpio = LSCHL_GPIO_FAN_LOCK,
213
static struct gpio_fan_speed lschl_speeds[] = {
229
static int lschl_gpio_list[] = {
230
LSCHL_GPIO_FAN_HIGH, LSCHL_GPIO_FAN_LOW,
233
static 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,
241
static struct platform_device lschl_fan_device = {
246
.platform_data = &lschl_fan_data,
250
/****************************************************************************
252
****************************************************************************/
254
static unsigned int lschl_mpp_modes[] __initdata = {
255
MPP0_GPIO, /* LED POWER */
256
MPP1_GPIO, /* HDD POWER */
257
MPP2_GPIO, /* LED ALARM */
258
MPP3_GPIO, /* LED INFO */
261
MPP6_GPIO, /* FAN LOCK */
262
MPP7_GPIO, /* SW INIT */
263
MPP8_GPIO, /* SW POWER */
264
MPP9_GPIO, /* USB POWER */
265
MPP10_GPIO, /* SW AUTO POWER */
269
MPP14_GPIO, /* FAN HIGH */
270
MPP15_GPIO, /* SW FUNC */
271
MPP16_GPIO, /* FAN LOW */
272
MPP17_GPIO, /* LED FUNC */
278
static void __init lschl_init(void)
281
* Setup basic Orion functions. Needs to be called early.
285
orion5x_mpp_conf(lschl_mpp_modes);
288
* Configure peripherals.
290
orion5x_ehci0_init();
291
orion5x_ehci1_init();
292
orion5x_eth_init(&lschl_eth_data);
294
orion5x_sata_init(&lschl_sata_data);
295
orion5x_uart0_init();
298
orion5x_setup_dev_boot_win(LSCHL_NOR_BOOT_BASE,
299
LSCHL_NOR_BOOT_SIZE);
300
platform_device_register(&lschl_nor_flash);
302
platform_device_register(&lschl_leds);
304
platform_device_register(&lschl_button_device);
306
platform_device_register(&lschl_fan_device);
308
i2c_register_board_info(0, &lschl_i2c_rtc, 1);
311
gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
313
/* register power-off method */
314
pm_power_off = lschl_power_off;
316
pr_info("%s: finished\n", __func__);
319
MACHINE_START(LINKSTATION_LSCHL, "Buffalo Linkstation LiveV3 (LS-CHL)")
320
/* Maintainer: Ash Hughes <ashley.hughes@blueyonder.co.uk> */
321
.atag_offset = 0x100,
322
.init_machine = lschl_init,
323
.map_io = orion5x_map_io,
324
.init_early = orion5x_init_early,
325
.init_irq = orion5x_init_irq,
326
.timer = &orion5x_timer,
327
.fixup = tag_fixup_mem32,