board-ns2.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 "common.h"
  19. #include "mpp.h"
  20. static struct mv643xx_eth_platform_data ns2_ge00_data = {
  21. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  22. };
  23. static unsigned int ns2_mpp_config[] __initdata = {
  24. MPP0_SPI_SCn,
  25. MPP1_SPI_MOSI,
  26. MPP2_SPI_SCK,
  27. MPP3_SPI_MISO,
  28. MPP4_NF_IO6,
  29. MPP5_NF_IO7,
  30. MPP6_SYSRST_OUTn,
  31. MPP7_GPO, /* Fan speed (bit 1) */
  32. MPP8_TW0_SDA,
  33. MPP9_TW0_SCK,
  34. MPP10_UART0_TXD,
  35. MPP11_UART0_RXD,
  36. MPP12_GPO, /* Red led */
  37. MPP14_GPIO, /* USB fuse */
  38. MPP16_GPIO, /* SATA 0 power */
  39. MPP17_GPIO, /* SATA 1 power */
  40. MPP18_NF_IO0,
  41. MPP19_NF_IO1,
  42. MPP20_SATA1_ACTn,
  43. MPP21_SATA0_ACTn,
  44. MPP22_GPIO, /* Fan speed (bit 0) */
  45. MPP23_GPIO, /* Fan power */
  46. MPP24_GPIO, /* USB mode select */
  47. MPP25_GPIO, /* Fan rotation fail */
  48. MPP26_GPIO, /* USB device vbus */
  49. MPP28_GPIO, /* USB enable host vbus */
  50. MPP29_GPIO, /* Blue led (slow register) */
  51. MPP30_GPIO, /* Blue led (command register) */
  52. MPP31_GPIO, /* Board power off */
  53. MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
  54. MPP33_GPO, /* Fan speed (bit 2) */
  55. 0
  56. };
  57. #define NS2_GPIO_POWER_OFF 31
  58. static void ns2_power_off(void)
  59. {
  60. gpio_set_value(NS2_GPIO_POWER_OFF, 1);
  61. }
  62. void __init ns2_init(void)
  63. {
  64. /*
  65. * Basic setup. Needs to be called early.
  66. */
  67. kirkwood_mpp_conf(ns2_mpp_config);
  68. kirkwood_ehci_init();
  69. kirkwood_ge00_init(&ns2_ge00_data);
  70. if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
  71. gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0)
  72. pm_power_off = ns2_power_off;
  73. else
  74. pr_err("ns2: failed to configure power-off GPIO\n");
  75. }