Linux 3.11-rc3
[cris-mirror.git] / arch / arm / mach-kirkwood / board-dnskw.c
bloba1aa87f09180f91215a3d2c95c3c6153f82f87f2
1 /*
2 * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
4 * arch/arm/mach-kirkwood/board-dnskw.c
6 * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
7 * 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 "common.h"
21 static struct mv643xx_eth_platform_data dnskw_ge00_data = {
22 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
25 /* Register any GPIO for output and set the value */
26 static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
28 if (gpio_request(gpio, name) == 0 &&
29 gpio_direction_output(gpio, 0) == 0) {
30 gpio_set_value(gpio, def);
31 if (gpio_export(gpio, 0) != 0)
32 pr_err("dnskw: Failed to export GPIO %s\n", name);
33 } else
34 pr_err("dnskw: Failed to register %s\n", name);
37 void __init dnskw_init(void)
39 kirkwood_ge00_init(&dnskw_ge00_data);
41 /* Set NAS to turn back on after a power failure */
42 dnskw_gpio_register(37, "dnskw:power:recover", 1);