blob: f4632a809f6895a0481ea1876e3e0fe25da36fe8 [file] [log] [blame]
Simon Guinotecee1e42012-10-17 12:09:04 +02001/*
2 * Copyright 2012 (C), Simon Guinot <simon.guinot@sequanux.org>
3 *
4 * arch/arm/mach-kirkwood/board-ns2.c
5 *
6 * LaCie Network Space v2 board (and parents) initialization for drivers
7 * not converted to 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>
Simon Guinotca7d9452012-10-17 12:09:05 +020019#include <linux/of.h>
Simon Guinotecee1e42012-10-17 12:09:04 +020020#include "common.h"
Simon Guinotecee1e42012-10-17 12:09:04 +020021
22static struct mv643xx_eth_platform_data ns2_ge00_data = {
23 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
24};
25
Simon Guinotecee1e42012-10-17 12:09:04 +020026#define NS2_GPIO_POWER_OFF 31
27
28static void ns2_power_off(void)
29{
30 gpio_set_value(NS2_GPIO_POWER_OFF, 1);
31}
32
33void __init ns2_init(void)
34{
35 /*
36 * Basic setup. Needs to be called early.
37 */
Simon Guinot7f9871d2012-10-17 12:09:06 +020038 if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
39 of_machine_is_compatible("lacie,netspace_mini_v2"))
Simon Guinotca7d9452012-10-17 12:09:05 +020040 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
Simon Guinotecee1e42012-10-17 12:09:04 +020041 kirkwood_ge00_init(&ns2_ge00_data);
42
43 if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
44 gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0)
45 pm_power_off = ns2_power_off;
46 else
47 pr_err("ns2: failed to configure power-off GPIO\n");
48}