mach-ap121.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Atheros AP121 board support
  3. *
  4. * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation.
  9. */
  10. #include "machtypes.h"
  11. #include "dev-gpio-buttons.h"
  12. #include "dev-leds-gpio.h"
  13. #include "dev-spi.h"
  14. #include "dev-usb.h"
  15. #include "dev-wmac.h"
  16. #define AP121_GPIO_LED_WLAN 0
  17. #define AP121_GPIO_LED_USB 1
  18. #define AP121_GPIO_BTN_JUMPSTART 11
  19. #define AP121_GPIO_BTN_RESET 12
  20. #define AP121_KEYS_POLL_INTERVAL 20 /* msecs */
  21. #define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL)
  22. #define AP121_CAL_DATA_ADDR 0x1fff1000
  23. static struct gpio_led ap121_leds_gpio[] __initdata = {
  24. {
  25. .name = "ap121:green:usb",
  26. .gpio = AP121_GPIO_LED_USB,
  27. .active_low = 0,
  28. },
  29. {
  30. .name = "ap121:green:wlan",
  31. .gpio = AP121_GPIO_LED_WLAN,
  32. .active_low = 0,
  33. },
  34. };
  35. static struct gpio_keys_button ap121_gpio_keys[] __initdata = {
  36. {
  37. .desc = "jumpstart button",
  38. .type = EV_KEY,
  39. .code = KEY_WPS_BUTTON,
  40. .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
  41. .gpio = AP121_GPIO_BTN_JUMPSTART,
  42. .active_low = 1,
  43. },
  44. {
  45. .desc = "reset button",
  46. .type = EV_KEY,
  47. .code = KEY_RESTART,
  48. .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL,
  49. .gpio = AP121_GPIO_BTN_RESET,
  50. .active_low = 1,
  51. }
  52. };
  53. static struct spi_board_info ap121_spi_info[] = {
  54. {
  55. .bus_num = 0,
  56. .chip_select = 0,
  57. .max_speed_hz = 25000000,
  58. .modalias = "mx25l1606e",
  59. }
  60. };
  61. static struct ath79_spi_platform_data ap121_spi_data = {
  62. .bus_num = 0,
  63. .num_chipselect = 1,
  64. };
  65. static void __init ap121_setup(void)
  66. {
  67. u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR);
  68. ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio),
  69. ap121_leds_gpio);
  70. ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL,
  71. ARRAY_SIZE(ap121_gpio_keys),
  72. ap121_gpio_keys);
  73. ath79_register_spi(&ap121_spi_data, ap121_spi_info,
  74. ARRAY_SIZE(ap121_spi_info));
  75. ath79_register_usb();
  76. ath79_register_wmac(cal_data);
  77. }
  78. MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
  79. ap121_setup);