board-wbd111.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Support for Wiliboard WBD-111
  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/mdio-gpio.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/partitions.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/time.h>
  24. #include "common.h"
  25. static struct gpio_keys_button wbd111_keys[] = {
  26. {
  27. .code = KEY_SETUP,
  28. .gpio = 5,
  29. .active_low = 1,
  30. .desc = "reset",
  31. .type = EV_KEY,
  32. },
  33. };
  34. static struct gpio_keys_platform_data wbd111_keys_data = {
  35. .buttons = wbd111_keys,
  36. .nbuttons = ARRAY_SIZE(wbd111_keys),
  37. };
  38. static struct platform_device wbd111_keys_device = {
  39. .name = "gpio-keys",
  40. .id = -1,
  41. .dev = {
  42. .platform_data = &wbd111_keys_data,
  43. },
  44. };
  45. static struct gpio_led wbd111_leds[] = {
  46. {
  47. .name = "L3red",
  48. .gpio = 1,
  49. },
  50. {
  51. .name = "L4green",
  52. .gpio = 2,
  53. },
  54. {
  55. .name = "L4red",
  56. .gpio = 3,
  57. },
  58. {
  59. .name = "L3green",
  60. .gpio = 5,
  61. },
  62. };
  63. static struct gpio_led_platform_data wbd111_leds_data = {
  64. .num_leds = ARRAY_SIZE(wbd111_leds),
  65. .leds = wbd111_leds,
  66. };
  67. static struct platform_device wbd111_leds_device = {
  68. .name = "leds-gpio",
  69. .id = -1,
  70. .dev = {
  71. .platform_data = &wbd111_leds_data,
  72. },
  73. };
  74. static struct sys_timer wbd111_timer = {
  75. .init = gemini_timer_init,
  76. };
  77. static struct mtd_partition wbd111_partitions[] = {
  78. {
  79. .name = "RedBoot",
  80. .offset = 0,
  81. .size = 0x020000,
  82. .mask_flags = MTD_WRITEABLE,
  83. } , {
  84. .name = "kernel",
  85. .offset = 0x020000,
  86. .size = 0x100000,
  87. } , {
  88. .name = "rootfs",
  89. .offset = 0x120000,
  90. .size = 0x6a0000,
  91. } , {
  92. .name = "VCTL",
  93. .offset = 0x7c0000,
  94. .size = 0x010000,
  95. .mask_flags = MTD_WRITEABLE,
  96. } , {
  97. .name = "cfg",
  98. .offset = 0x7d0000,
  99. .size = 0x010000,
  100. .mask_flags = MTD_WRITEABLE,
  101. } , {
  102. .name = "FIS",
  103. .offset = 0x7e0000,
  104. .size = 0x010000,
  105. .mask_flags = MTD_WRITEABLE,
  106. }
  107. };
  108. #define wbd111_num_partitions ARRAY_SIZE(wbd111_partitions)
  109. static void __init wbd111_init(void)
  110. {
  111. gemini_gpio_init();
  112. platform_register_uart();
  113. platform_register_pflash(SZ_8M, wbd111_partitions,
  114. wbd111_num_partitions);
  115. platform_device_register(&wbd111_leds_device);
  116. platform_device_register(&wbd111_keys_device);
  117. platform_register_rtc();
  118. }
  119. MACHINE_START(WBD111, "Wiliboard WBD-111")
  120. .atag_offset = 0x100,
  121. .map_io = gemini_map_io,
  122. .init_irq = gemini_init_irq,
  123. .timer = &wbd111_timer,
  124. .init_machine = wbd111_init,
  125. MACHINE_END