board-ib62x0.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2012 (C), Simon Baatz <gmbnomis@gmail.com>
  3. *
  4. * arch/arm/mach-kirkwood/board-ib62x0.c
  5. *
  6. * RaidSonic ICY BOX IB-NAS6210 & IB-NAS6220 init for drivers not
  7. * 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/mv643xx_eth.h>
  16. #include <linux/gpio.h>
  17. #include <linux/input.h>
  18. #include "common.h"
  19. #include "mpp.h"
  20. #define IB62X0_GPIO_POWER_OFF 24
  21. static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
  22. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  23. };
  24. static unsigned int ib62x0_mpp_config[] __initdata = {
  25. MPP0_NF_IO2,
  26. MPP1_NF_IO3,
  27. MPP2_NF_IO4,
  28. MPP3_NF_IO5,
  29. MPP4_NF_IO6,
  30. MPP5_NF_IO7,
  31. MPP18_NF_IO0,
  32. MPP19_NF_IO1,
  33. MPP22_GPIO, /* OS LED red */
  34. MPP24_GPIO, /* Power off device */
  35. MPP25_GPIO, /* OS LED green */
  36. MPP27_GPIO, /* USB transfer LED */
  37. MPP28_GPIO, /* Reset button */
  38. MPP29_GPIO, /* USB Copy button */
  39. 0
  40. };
  41. static void ib62x0_power_off(void)
  42. {
  43. gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
  44. }
  45. void __init ib62x0_init(void)
  46. {
  47. /*
  48. * Basic setup. Needs to be called early.
  49. */
  50. kirkwood_mpp_conf(ib62x0_mpp_config);
  51. kirkwood_ehci_init();
  52. kirkwood_ge00_init(&ib62x0_ge00_data);
  53. if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
  54. gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
  55. pm_power_off = ib62x0_power_off;
  56. else
  57. pr_err("board-ib62x0: failed to configure power-off GPIO\n");
  58. }