board-ns2.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  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. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/mv643xx_eth.h>
  17. #include <linux/gpio.h>
  18. #include <linux/of.h>
  19. #include "common.h"
  20. static struct mv643xx_eth_platform_data ns2_ge00_data = {
  21. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  22. };
  23. #define NS2_GPIO_POWER_OFF 31
  24. static void ns2_power_off(void)
  25. {
  26. gpio_set_value(NS2_GPIO_POWER_OFF, 1);
  27. }
  28. void __init ns2_init(void)
  29. {
  30. /*
  31. * Basic setup. Needs to be called early.
  32. */
  33. if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
  34. of_machine_is_compatible("lacie,netspace_mini_v2"))
  35. ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
  36. kirkwood_ge00_init(&ns2_ge00_data);
  37. if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
  38. gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0)
  39. pm_power_off = ns2_power_off;
  40. else
  41. pr_err("ns2: failed to configure power-off GPIO\n");
  42. }