mach-ap113.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Atheros AP113 board support
  3. *
  4. * Copyright (C) 2011 Florian Fainelli <florian@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 "dev-eth.h"
  11. #include "dev-gpio-buttons.h"
  12. #include "dev-leds-gpio.h"
  13. #include "dev-m25p80.h"
  14. #include "pci.h"
  15. #include "dev-usb.h"
  16. #include "machtypes.h"
  17. #define AP113_GPIO_LED_USB 0
  18. #define AP113_GPIO_LED_STATUS 1
  19. #define AP113_GPIO_LED_ST 11
  20. #define AP113_GPIO_BTN_JUMPSTART 12
  21. #define AP113_KEYS_POLL_INTERVAL 20 /* msecs */
  22. #define AP113_KEYS_DEBOUNCE_INTERVAL (3 * AP113_KEYS_POLL_INTERVAL)
  23. static struct gpio_led ap113_leds_gpio[] __initdata = {
  24. {
  25. .name = "ap113:green:usb",
  26. .gpio = AP113_GPIO_LED_USB,
  27. .active_low = 1,
  28. },
  29. {
  30. .name = "ap113:green:status",
  31. .gpio = AP113_GPIO_LED_STATUS,
  32. .active_low = 1,
  33. },
  34. {
  35. .name = "ap113:green:st",
  36. .gpio = AP113_GPIO_LED_ST,
  37. .active_low = 1,
  38. }
  39. };
  40. static struct gpio_keys_button ap113_gpio_keys[] __initdata = {
  41. {
  42. .desc = "jumpstart button",
  43. .type = EV_KEY,
  44. .code = KEY_WPS_BUTTON,
  45. .debounce_interval = AP113_KEYS_DEBOUNCE_INTERVAL,
  46. .gpio = AP113_GPIO_BTN_JUMPSTART,
  47. .active_low = 1,
  48. },
  49. };
  50. static void __init ap113_setup(void)
  51. {
  52. u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
  53. ath79_register_m25p80(NULL);
  54. ath79_register_mdio(0, ~BIT(0));
  55. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  56. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  57. ath79_eth0_data.speed = SPEED_1000;
  58. ath79_eth0_data.duplex = DUPLEX_FULL;
  59. ath79_eth0_data.phy_mask = BIT(0);
  60. ath79_register_eth(0);
  61. ath79_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL,
  62. ARRAY_SIZE(ap113_gpio_keys),
  63. ap113_gpio_keys);
  64. ath79_register_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio),
  65. ap113_leds_gpio);
  66. ath79_register_pci();
  67. ath79_register_usb();
  68. }
  69. MIPS_MACHINE(ATH79_MACH_AP113, "AP113", "Atheros AP113",
  70. ap113_setup);