ARM: Kirkwood: Convert dnskw to pinctrl
[cascardo/linux.git] / arch / arm / mach-kirkwood / board-dnskw.c
1 /*
2  * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
3  *
4  * arch/arm/mach-kirkwood/board-dnskw.c
5  *
6  * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
7  * flattened device tree yet.
8  *
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.
12  */
13
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"
20
21 static struct mv643xx_eth_platform_data dnskw_ge00_data = {
22         .phy_addr       = MV643XX_ETH_PHY_ADDR(8),
23 };
24
25 /* Register any GPIO for output and set the value */
26 static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
27 {
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);
35 }
36
37 void __init dnskw_init(void)
38 {
39         kirkwood_ge00_init(&dnskw_ge00_data);
40
41         /* Set NAS to turn back on after a power failure */
42         dnskw_gpio_register(37, "dnskw:power:recover", 1);
43 }