mach-ap81.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Atheros AP81 board support
  3. *
  4. * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include "machtypes.h"
  12. #include "dev-gpio-buttons.h"
  13. #include "dev-leds-gpio.h"
  14. #include "dev-spi.h"
  15. #define AP81_GPIO_LED_STATUS 1
  16. #define AP81_GPIO_LED_AOSS 3
  17. #define AP81_GPIO_LED_WLAN 6
  18. #define AP81_GPIO_LED_POWER 14
  19. #define AP81_GPIO_BTN_SW4 12
  20. #define AP81_GPIO_BTN_SW1 21
  21. #define AP81_KEYS_POLL_INTERVAL 20 /* msecs */
  22. #define AP81_KEYS_DEBOUNCE_INTERVAL (3 * AP81_KEYS_POLL_INTERVAL)
  23. static struct gpio_led ap81_leds_gpio[] __initdata = {
  24. {
  25. .name = "ap81:green:status",
  26. .gpio = AP81_GPIO_LED_STATUS,
  27. .active_low = 1,
  28. }, {
  29. .name = "ap81:amber:aoss",
  30. .gpio = AP81_GPIO_LED_AOSS,
  31. .active_low = 1,
  32. }, {
  33. .name = "ap81:green:wlan",
  34. .gpio = AP81_GPIO_LED_WLAN,
  35. .active_low = 1,
  36. }, {
  37. .name = "ap81:green:power",
  38. .gpio = AP81_GPIO_LED_POWER,
  39. .active_low = 1,
  40. }
  41. };
  42. static struct gpio_keys_button ap81_gpio_keys[] __initdata = {
  43. {
  44. .desc = "sw1",
  45. .type = EV_KEY,
  46. .code = BTN_0,
  47. .debounce_interval = AP81_KEYS_DEBOUNCE_INTERVAL,
  48. .gpio = AP81_GPIO_BTN_SW1,
  49. .active_low = 1,
  50. } , {
  51. .desc = "sw4",
  52. .type = EV_KEY,
  53. .code = BTN_1,
  54. .debounce_interval = AP81_KEYS_DEBOUNCE_INTERVAL,
  55. .gpio = AP81_GPIO_BTN_SW4,
  56. .active_low = 1,
  57. }
  58. };
  59. static struct spi_board_info ap81_spi_info[] = {
  60. {
  61. .bus_num = 0,
  62. .chip_select = 0,
  63. .max_speed_hz = 25000000,
  64. .modalias = "m25p64",
  65. }
  66. };
  67. static struct ath79_spi_platform_data ap81_spi_data = {
  68. .bus_num = 0,
  69. .num_chipselect = 1,
  70. };
  71. static void __init ap81_setup(void)
  72. {
  73. ath79_register_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio),
  74. ap81_leds_gpio);
  75. ath79_register_gpio_keys_polled(-1, AP81_KEYS_POLL_INTERVAL,
  76. ARRAY_SIZE(ap81_gpio_keys),
  77. ap81_gpio_keys);
  78. ath79_register_spi(&ap81_spi_data, ap81_spi_info,
  79. ARRAY_SIZE(ap81_spi_info));
  80. }
  81. MIPS_MACHINE(ATH79_MACH_AP81, "AP81", "Atheros AP81 reference board",
  82. ap81_setup);