Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 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> |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 17 | #include <linux/mv643xx_eth.h> |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 18 | #include <linux/gpio.h> |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 19 | #include "common.h" |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 20 | |
| 21 | static struct mv643xx_eth_platform_data dnskw_ge00_data = { |
| 22 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
| 23 | }; |
| 24 | |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 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 | { |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 39 | kirkwood_ge00_init(&dnskw_ge00_data); |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 40 | |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 41 | /* Set NAS to turn back on after a power failure */ |
| 42 | dnskw_gpio_register(37, "dnskw:power:recover", 1); |
| 43 | } |