board-wbd222.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/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 wbd222_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 wbd222_keys_data = {
  35. .buttons = wbd222_keys,
  36. .nbuttons = ARRAY_SIZE(wbd222_keys),
  37. };
  38. static struct platform_device wbd222_keys_device = {
  39. .name = "gpio-keys",
  40. .id = -1,
  41. .dev = {
  42. .platform_data = &wbd222_keys_data,
  43. },
  44. };
  45. static struct gpio_led wbd222_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 wbd222_leds_data = {
  64. .num_leds = ARRAY_SIZE(wbd222_leds),
  65. .leds = wbd222_leds,
  66. };
  67. static struct platform_device wbd222_leds_device = {
  68. .name = "leds-gpio",
  69. .id = -1,
  70. .dev = {
  71. .platform_data = &wbd222_leds_data,
  72. },
  73. };
  74. static struct sys_timer wbd222_timer = {
  75. .init = gemini_timer_init,
  76. };
  77. #ifdef CONFIG_MTD_PARTITIONS
  78. static struct mtd_partition wbd222_partitions[] = {
  79. {
  80. .name = "RedBoot",
  81. .offset = 0,
  82. .size = 0x020000,
  83. .mask_flags = MTD_WRITEABLE,
  84. } , {
  85. .name = "kernel",
  86. .offset = 0x020000,
  87. .size = 0x100000,
  88. } , {
  89. .name = "rootfs",
  90. .offset = 0x120000,
  91. .size = 0x6a0000,
  92. } , {
  93. .name = "VCTL",
  94. .offset = 0x7c0000,
  95. .size = 0x010000,
  96. .mask_flags = MTD_WRITEABLE,
  97. } , {
  98. .name = "cfg",
  99. .offset = 0x7d0000,
  100. .size = 0x010000,
  101. .mask_flags = MTD_WRITEABLE,
  102. } , {
  103. .name = "FIS",
  104. .offset = 0x7e0000,
  105. .size = 0x010000,
  106. .mask_flags = MTD_WRITEABLE,
  107. }
  108. };
  109. #define wbd222_num_partitions ARRAY_SIZE(wbd222_partitions)
  110. #else
  111. #define wbd222_partitions NULL
  112. #define wbd222_num_partitions 0
  113. #endif /* CONFIG_MTD_PARTITIONS */
  114. static void __init wbd222_init(void)
  115. {
  116. gemini_gpio_init();
  117. platform_register_uart();
  118. platform_register_pflash(SZ_8M, wbd222_partitions,
  119. wbd222_num_partitions);
  120. platform_device_register(&wbd222_leds_device);
  121. platform_device_register(&wbd222_keys_device);
  122. }
  123. MACHINE_START(WBD222, "Wiliboard WBD-222")
  124. .phys_io = 0x7fffc000,
  125. .io_pg_offst = ((0xffffc000) >> 18) & 0xfffc,
  126. .boot_params = 0x100,
  127. .map_io = gemini_map_io,
  128. .init_irq = gemini_init_irq,
  129. .timer = &wbd222_timer,
  130. .init_machine = wbd222_init,
  131. MACHINE_END