mach-gs-oolite.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Oolite board support
  3. *
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published
  7. * by the Free Software Foundation.
  8. */
  9. #include <linux/gpio.h>
  10. #include <asm/mach-ath79/ath79.h>
  11. #include <asm/mach-ath79/ar71xx_regs.h>
  12. #include "common.h"
  13. #include "dev-eth.h"
  14. #include "dev-gpio-buttons.h"
  15. #include "dev-leds-gpio.h"
  16. #include "dev-m25p80.h"
  17. #include "dev-wmac.h"
  18. #include "machtypes.h"
  19. #include "dev-usb.h"
  20. #define GS_OOLITE_GPIO_BTN6 6
  21. #define GS_OOLITE_GPIO_BTN7 7
  22. #define GS_OOLITE_GPIO_BTN_RESET 11
  23. #define GS_OOLITE_GPIO_LED_SYSTEM 27
  24. #define GS_OOLITE_KEYS_POLL_INTERVAL 20 /* msecs */
  25. #define GS_OOLITE_KEYS_DEBOUNCE_INTERVAL (3 * GS_OOLITE_KEYS_POLL_INTERVAL)
  26. static const char *gs_oolite_part_probes[] = {
  27. "tp-link",
  28. NULL,
  29. };
  30. static struct flash_platform_data gs_oolite_flash_data = {
  31. .part_probes = gs_oolite_part_probes,
  32. };
  33. static struct gpio_led gs_oolite_leds_gpio[] __initdata = {
  34. {
  35. .name = "oolite:red:system",
  36. .gpio = GS_OOLITE_GPIO_LED_SYSTEM,
  37. .active_low = 1,
  38. },
  39. };
  40. static struct gpio_keys_button gs_oolite_gpio_keys[] __initdata = {
  41. {
  42. .desc = "reset",
  43. .type = EV_KEY,
  44. .code = KEY_RESTART,
  45. .debounce_interval = GS_OOLITE_KEYS_DEBOUNCE_INTERVAL,
  46. .gpio = GS_OOLITE_GPIO_BTN_RESET,
  47. .active_low = 0,
  48. },
  49. {
  50. .desc = "BTN_6",
  51. .type = EV_KEY,
  52. .code = BTN_6,
  53. .debounce_interval = GS_OOLITE_KEYS_DEBOUNCE_INTERVAL,
  54. .gpio = GS_OOLITE_GPIO_BTN6,
  55. .active_low = 0,
  56. },
  57. {
  58. .desc = "BTN_7",
  59. .type = EV_KEY,
  60. .code = BTN_7,
  61. .debounce_interval = GS_OOLITE_KEYS_DEBOUNCE_INTERVAL,
  62. .gpio = GS_OOLITE_GPIO_BTN7,
  63. .active_low = 0,
  64. },
  65. };
  66. static void __init gs_oolite_setup(void)
  67. {
  68. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  69. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  70. ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_oolite_leds_gpio),
  71. gs_oolite_leds_gpio);
  72. ath79_register_gpio_keys_polled(-1, GS_OOLITE_KEYS_POLL_INTERVAL,
  73. ARRAY_SIZE(gs_oolite_gpio_keys),
  74. gs_oolite_gpio_keys);
  75. ath79_register_usb();
  76. ath79_register_m25p80(&gs_oolite_flash_data);
  77. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
  78. ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
  79. ath79_register_mdio(0, 0x0);
  80. ath79_register_eth(1);
  81. ath79_register_eth(0);
  82. ath79_register_wmac(ee, mac);
  83. }
  84. MIPS_MACHINE(ATH79_MACH_GS_OOLITE, "GS-OOLITE",
  85. "Oolite V1.0", gs_oolite_setup);