board-nas4220b.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Support for Raidsonic NAS-4220-B
  3. *
  4. * Copyright (C) 2009 Janos Laube <janos.dev@gmail.com>
  5. *
  6. * based on rut1xx.c
  7. * Copyright (C) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/leds.h>
  18. #include <linux/input.h>
  19. #include <linux/gpio_keys.h>
  20. #include <linux/mdio-gpio.h>
  21. #include <linux/io.h>
  22. #include <asm/setup.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/time.h>
  26. #include <mach/hardware.h>
  27. #include <mach/global_reg.h>
  28. #include "common.h"
  29. static struct gpio_led ib4220b_leds[] = {
  30. {
  31. .name = "nas4220b:orange:hdd",
  32. .default_trigger = "none",
  33. .gpio = 60,
  34. },
  35. {
  36. .name = "nas4220b:green:os",
  37. .default_trigger = "heartbeat",
  38. .gpio = 62,
  39. },
  40. };
  41. static struct gpio_led_platform_data ib4220b_leds_data = {
  42. .num_leds = ARRAY_SIZE(ib4220b_leds),
  43. .leds = ib4220b_leds,
  44. };
  45. static struct platform_device ib4220b_led_device = {
  46. .name = "leds-gpio",
  47. .id = -1,
  48. .dev = {
  49. .platform_data = &ib4220b_leds_data,
  50. },
  51. };
  52. static struct gpio_keys_button ib4220b_keys[] = {
  53. {
  54. .code = KEY_SETUP,
  55. .gpio = 61,
  56. .active_low = 1,
  57. .desc = "Backup Button",
  58. .type = EV_KEY,
  59. },
  60. {
  61. .code = KEY_RESTART,
  62. .gpio = 63,
  63. .active_low = 1,
  64. .desc = "Softreset Button",
  65. .type = EV_KEY,
  66. },
  67. };
  68. static struct gpio_keys_platform_data ib4220b_keys_data = {
  69. .buttons = ib4220b_keys,
  70. .nbuttons = ARRAY_SIZE(ib4220b_keys),
  71. };
  72. static struct platform_device ib4220b_key_device = {
  73. .name = "gpio-keys",
  74. .id = -1,
  75. .dev = {
  76. .platform_data = &ib4220b_keys_data,
  77. },
  78. };
  79. static void __init ib4220b_init(void)
  80. {
  81. gemini_gpio_init();
  82. platform_register_uart();
  83. platform_register_pflash(SZ_16M, NULL, 0);
  84. platform_device_register(&ib4220b_led_device);
  85. platform_device_register(&ib4220b_key_device);
  86. platform_register_rtc();
  87. }
  88. MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
  89. .atag_offset = 0x100,
  90. .map_io = gemini_map_io,
  91. .init_irq = gemini_init_irq,
  92. .init_time = gemini_timer_init,
  93. .init_machine = ib4220b_init,
  94. MACHINE_END