1
0

mach-aw-nr580.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * AzureWave AW-NR580 board support
  3. *
  4. * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2008 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 <asm/mach-ath79/ath79.h>
  12. #include "dev-eth.h"
  13. #include "dev-m25p80.h"
  14. #include "dev-gpio-buttons.h"
  15. #include "dev-leds-gpio.h"
  16. #include "machtypes.h"
  17. #include "pci.h"
  18. #define AW_NR580_GPIO_LED_READY_RED 0
  19. #define AW_NR580_GPIO_LED_WLAN 1
  20. #define AW_NR580_GPIO_LED_READY_GREEN 2
  21. #define AW_NR580_GPIO_LED_WPS_GREEN 4
  22. #define AW_NR580_GPIO_LED_WPS_AMBER 5
  23. #define AW_NR580_GPIO_BTN_WPS 3
  24. #define AW_NR580_GPIO_BTN_RESET 11
  25. #define AW_NR580_KEYS_POLL_INTERVAL 20 /* msecs */
  26. #define AW_NR580_KEYS_DEBOUNCE_INTERVAL (3 * AW_NR580_KEYS_POLL_INTERVAL)
  27. static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
  28. {
  29. .name = "aw-nr580:red:ready",
  30. .gpio = AW_NR580_GPIO_LED_READY_RED,
  31. .active_low = 0,
  32. }, {
  33. .name = "aw-nr580:green:ready",
  34. .gpio = AW_NR580_GPIO_LED_READY_GREEN,
  35. .active_low = 0,
  36. }, {
  37. .name = "aw-nr580:green:wps",
  38. .gpio = AW_NR580_GPIO_LED_WPS_GREEN,
  39. .active_low = 0,
  40. }, {
  41. .name = "aw-nr580:amber:wps",
  42. .gpio = AW_NR580_GPIO_LED_WPS_AMBER,
  43. .active_low = 0,
  44. }, {
  45. .name = "aw-nr580:green:wlan",
  46. .gpio = AW_NR580_GPIO_LED_WLAN,
  47. .active_low = 0,
  48. }
  49. };
  50. static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = {
  51. {
  52. .desc = "reset",
  53. .type = EV_KEY,
  54. .code = KEY_RESTART,
  55. .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
  56. .gpio = AW_NR580_GPIO_BTN_RESET,
  57. .active_low = 1,
  58. }, {
  59. .desc = "wps",
  60. .type = EV_KEY,
  61. .code = KEY_WPS_BUTTON,
  62. .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL,
  63. .gpio = AW_NR580_GPIO_BTN_WPS,
  64. .active_low = 1,
  65. }
  66. };
  67. static const char *aw_nr580_part_probes[] = {
  68. "RedBoot",
  69. NULL,
  70. };
  71. static struct flash_platform_data aw_nr580_flash_data = {
  72. .part_probes = aw_nr580_part_probes,
  73. };
  74. static void __init aw_nr580_setup(void)
  75. {
  76. ath79_register_mdio(0, 0x0);
  77. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  78. ath79_eth0_data.speed = SPEED_100;
  79. ath79_eth0_data.duplex = DUPLEX_FULL;
  80. ath79_register_eth(0);
  81. ath79_register_pci();
  82. ath79_register_m25p80(&aw_nr580_flash_data);
  83. ath79_register_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio),
  84. aw_nr580_leds_gpio);
  85. ath79_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL,
  86. ARRAY_SIZE(aw_nr580_gpio_keys),
  87. aw_nr580_gpio_keys);
  88. }
  89. MIPS_MACHINE(ATH79_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580",
  90. aw_nr580_setup);