board-wbd222.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Support for Wiliboard WBD-222
  3. *
  4. * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/leds.h>
  15. #include <linux/input.h>
  16. #include <linux/skbuff.h>
  17. #include <linux/gpio_keys.h>
  18. #include <linux/mtd/mtd.h>
  19. #include <linux/mtd/partitions.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/time.h>
  23. #include "common.h"
  24. static struct gpio_keys_button wbd222_keys[] = {
  25. {
  26. .code = KEY_SETUP,
  27. .gpio = 5,
  28. .active_low = 1,
  29. .desc = "reset",
  30. .type = EV_KEY,
  31. },
  32. };
  33. static struct gpio_keys_platform_data wbd222_keys_data = {
  34. .buttons = wbd222_keys,
  35. .nbuttons = ARRAY_SIZE(wbd222_keys),
  36. };
  37. static struct platform_device wbd222_keys_device = {
  38. .name = "gpio-keys",
  39. .id = -1,
  40. .dev = {
  41. .platform_data = &wbd222_keys_data,
  42. },
  43. };
  44. static struct gpio_led wbd222_leds[] = {
  45. {
  46. .name = "L3red",
  47. .gpio = 1,
  48. },
  49. {
  50. .name = "L4green",
  51. .gpio = 2,
  52. },
  53. {
  54. .name = "L4red",
  55. .gpio = 3,
  56. },
  57. {
  58. .name = "L3green",
  59. .gpio = 5,
  60. },
  61. };
  62. static struct gpio_led_platform_data wbd222_leds_data = {
  63. .num_leds = ARRAY_SIZE(wbd222_leds),
  64. .leds = wbd222_leds,
  65. };
  66. static struct platform_device wbd222_leds_device = {
  67. .name = "leds-gpio",
  68. .id = -1,
  69. .dev = {
  70. .platform_data = &wbd222_leds_data,
  71. },
  72. };
  73. static struct mtd_partition wbd222_partitions[] = {
  74. {
  75. .name = "RedBoot",
  76. .offset = 0,
  77. .size = 0x020000,
  78. .mask_flags = MTD_WRITEABLE,
  79. } , {
  80. .name = "kernel",
  81. .offset = 0x020000,
  82. .size = 0x100000,
  83. } , {
  84. .name = "rootfs",
  85. .offset = 0x120000,
  86. .size = 0x6a0000,
  87. } , {
  88. .name = "VCTL",
  89. .offset = 0x7c0000,
  90. .size = 0x010000,
  91. .mask_flags = MTD_WRITEABLE,
  92. } , {
  93. .name = "cfg",
  94. .offset = 0x7d0000,
  95. .size = 0x010000,
  96. .mask_flags = MTD_WRITEABLE,
  97. } , {
  98. .name = "FIS",
  99. .offset = 0x7e0000,
  100. .size = 0x010000,
  101. .mask_flags = MTD_WRITEABLE,
  102. }
  103. };
  104. #define wbd222_num_partitions ARRAY_SIZE(wbd222_partitions)
  105. static void __init wbd222_init(void)
  106. {
  107. gemini_gpio_init();
  108. platform_register_uart();
  109. platform_register_pflash(SZ_8M, wbd222_partitions,
  110. wbd222_num_partitions);
  111. platform_device_register(&wbd222_leds_device);
  112. platform_device_register(&wbd222_keys_device);
  113. platform_register_rtc();
  114. }
  115. MACHINE_START(WBD222, "Wiliboard WBD-222")
  116. .atag_offset = 0x100,
  117. .map_io = gemini_map_io,
  118. .init_irq = gemini_init_irq,
  119. .init_time = gemini_timer_init,
  120. .init_machine = wbd222_init,
  121. .restart = gemini_restart,
  122. MACHINE_END