mach-wnr2000.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * NETGEAR WNR2000 board support
  3. *
  4. * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  6. * Copyright (C) 2008-2009 Andy Boyett <agb@openwrt.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published
  10. * by the Free Software Foundation.
  11. */
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/partitions.h>
  14. #include <asm/mach-ath79/ath79.h>
  15. #include "dev-eth.h"
  16. #include "dev-gpio-buttons.h"
  17. #include "dev-leds-gpio.h"
  18. #include "dev-m25p80.h"
  19. #include "dev-wmac.h"
  20. #include "machtypes.h"
  21. #define WNR2000_GPIO_LED_PWR_GREEN 14
  22. #define WNR2000_GPIO_LED_PWR_AMBER 7
  23. #define WNR2000_GPIO_LED_WPS 4
  24. #define WNR2000_GPIO_LED_WLAN 6
  25. #define WNR2000_GPIO_BTN_RESET 21
  26. #define WNR2000_GPIO_BTN_WPS 8
  27. #define WNR2000_KEYS_POLL_INTERVAL 20 /* msecs */
  28. #define WNR2000_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000_KEYS_POLL_INTERVAL)
  29. static struct gpio_led wnr2000_leds_gpio[] __initdata = {
  30. {
  31. .name = "netgear:green:power",
  32. .gpio = WNR2000_GPIO_LED_PWR_GREEN,
  33. .active_low = 1,
  34. }, {
  35. .name = "netgear:amber:power",
  36. .gpio = WNR2000_GPIO_LED_PWR_AMBER,
  37. .active_low = 1,
  38. }, {
  39. .name = "netgear:green:wps",
  40. .gpio = WNR2000_GPIO_LED_WPS,
  41. .active_low = 1,
  42. }, {
  43. .name = "netgear:blue:wlan",
  44. .gpio = WNR2000_GPIO_LED_WLAN,
  45. .active_low = 1,
  46. }
  47. };
  48. static struct gpio_keys_button wnr2000_gpio_keys[] __initdata = {
  49. {
  50. .desc = "reset",
  51. .type = EV_KEY,
  52. .code = KEY_RESTART,
  53. .debounce_interval = WNR2000_KEYS_DEBOUNCE_INTERVAL,
  54. .gpio = WNR2000_GPIO_BTN_RESET,
  55. }, {
  56. .desc = "wps",
  57. .type = EV_KEY,
  58. .code = KEY_WPS_BUTTON,
  59. .debounce_interval = WNR2000_KEYS_DEBOUNCE_INTERVAL,
  60. .gpio = WNR2000_GPIO_BTN_WPS,
  61. }
  62. };
  63. static void __init wnr2000_setup(void)
  64. {
  65. u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
  66. ath79_register_mdio(0, 0x0);
  67. ath79_init_mac(ath79_eth0_data.mac_addr, eeprom, 0);
  68. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  69. ath79_eth0_data.speed = SPEED_100;
  70. ath79_eth0_data.duplex = DUPLEX_FULL;
  71. ath79_eth0_data.has_ar8216 = 1;
  72. ath79_init_mac(ath79_eth1_data.mac_addr, eeprom, 1);
  73. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
  74. ath79_eth1_data.phy_mask = 0x10;
  75. ath79_register_eth(0);
  76. ath79_register_eth(1);
  77. ath79_register_m25p80(NULL);
  78. ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000_leds_gpio),
  79. wnr2000_leds_gpio);
  80. ath79_register_gpio_keys_polled(-1, WNR2000_KEYS_POLL_INTERVAL,
  81. ARRAY_SIZE(wnr2000_gpio_keys),
  82. wnr2000_gpio_keys);
  83. ath79_register_wmac(eeprom, NULL);
  84. }
  85. MIPS_MACHINE(ATH79_MACH_WNR2000, "WNR2000", "NETGEAR WNR2000", wnr2000_setup);