board-nas4220b.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/io.h>
  21. #include <asm/setup.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/time.h>
  25. #include <mach/hardware.h>
  26. #include <mach/global_reg.h>
  27. #include "common.h"
  28. static struct gpio_led ib4220b_leds[] = {
  29. {
  30. .name = "nas4220b:orange:hdd",
  31. .default_trigger = "none",
  32. .gpio = 60,
  33. },
  34. {
  35. .name = "nas4220b:green:os",
  36. .default_trigger = "heartbeat",
  37. .gpio = 62,
  38. },
  39. };
  40. static struct gpio_led_platform_data ib4220b_leds_data = {
  41. .num_leds = ARRAY_SIZE(ib4220b_leds),
  42. .leds = ib4220b_leds,
  43. };
  44. static struct platform_device ib4220b_led_device = {
  45. .name = "leds-gpio",
  46. .id = -1,
  47. .dev = {
  48. .platform_data = &ib4220b_leds_data,
  49. },
  50. };
  51. static struct gpio_keys_button ib4220b_keys[] = {
  52. {
  53. .code = KEY_SETUP,
  54. .gpio = 61,
  55. .active_low = 1,
  56. .desc = "Backup Button",
  57. .type = EV_KEY,
  58. },
  59. {
  60. .code = KEY_RESTART,
  61. .gpio = 63,
  62. .active_low = 1,
  63. .desc = "Softreset Button",
  64. .type = EV_KEY,
  65. },
  66. };
  67. static struct gpio_keys_platform_data ib4220b_keys_data = {
  68. .buttons = ib4220b_keys,
  69. .nbuttons = ARRAY_SIZE(ib4220b_keys),
  70. };
  71. static struct platform_device ib4220b_key_device = {
  72. .name = "gpio-keys",
  73. .id = -1,
  74. .dev = {
  75. .platform_data = &ib4220b_keys_data,
  76. },
  77. };
  78. static void __init ib4220b_init(void)
  79. {
  80. gemini_gpio_init();
  81. platform_register_uart();
  82. platform_register_pflash(SZ_16M, NULL, 0);
  83. platform_device_register(&ib4220b_led_device);
  84. platform_device_register(&ib4220b_key_device);
  85. platform_register_rtc();
  86. }
  87. MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
  88. .atag_offset = 0x100,
  89. .map_io = gemini_map_io,
  90. .init_irq = gemini_init_irq,
  91. .init_time = gemini_timer_init,
  92. .init_machine = ib4220b_init,
  93. .restart = gemini_restart,
  94. MACHINE_END