board-wbd111.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 mtd_partition wbd111_partitions[] = {
  75. {
  76. .name = "RedBoot",
  77. .offset = 0,
  78. .size = 0x020000,
  79. .mask_flags = MTD_WRITEABLE,
  80. } , {
  81. .name = "kernel",
  82. .offset = 0x020000,
  83. .size = 0x100000,
  84. } , {
  85. .name = "rootfs",
  86. .offset = 0x120000,
  87. .size = 0x6a0000,
  88. } , {
  89. .name = "VCTL",
  90. .offset = 0x7c0000,
  91. .size = 0x010000,
  92. .mask_flags = MTD_WRITEABLE,
  93. } , {
  94. .name = "cfg",
  95. .offset = 0x7d0000,
  96. .size = 0x010000,
  97. .mask_flags = MTD_WRITEABLE,
  98. } , {
  99. .name = "FIS",
  100. .offset = 0x7e0000,
  101. .size = 0x010000,
  102. .mask_flags = MTD_WRITEABLE,
  103. }
  104. };
  105. #define wbd111_num_partitions ARRAY_SIZE(wbd111_partitions)
  106. static void __init wbd111_init(void)
  107. {
  108. gemini_gpio_init();
  109. platform_register_uart();
  110. platform_register_pflash(SZ_8M, wbd111_partitions,
  111. wbd111_num_partitions);
  112. platform_device_register(&wbd111_leds_device);
  113. platform_device_register(&wbd111_keys_device);
  114. platform_register_rtc();
  115. }
  116. MACHINE_START(WBD111, "Wiliboard WBD-111")
  117. .atag_offset = 0x100,
  118. .map_io = gemini_map_io,
  119. .init_irq = gemini_init_irq,
  120. .init_time = gemini_timer_init,
  121. .init_machine = wbd111_init,
  122. MACHINE_END