board-nas4220b.c 2.4 KB

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