mach-wndap360.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Netgear WNDAP360 board support (proper leds / button support missing)
  3. *
  4. * Based on AP96
  5. * Copyright (C) 2013 Jacek Kikiewicz
  6. * Copyright (C) 2009 Marco Porsch
  7. * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
  8. * Copyright (C) 2010 Atheros Communications
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License version 2 as published
  12. * by the Free Software Foundation.
  13. */
  14. #include <linux/platform_device.h>
  15. #include <linux/delay.h>
  16. #include <asm/mach-ath79/ath79.h>
  17. #include "dev-ap9x-pci.h"
  18. #include "dev-eth.h"
  19. #include "dev-gpio-buttons.h"
  20. #include "dev-leds-gpio.h"
  21. #include "dev-m25p80.h"
  22. #include "machtypes.h"
  23. #define WNDAP360_GPIO_LED_POWER_ORANGE 0
  24. #define WNDAP360_GPIO_LED_POWER_GREEN 2
  25. /* Reset button - next to the power connector */
  26. #define WNDAP360_GPIO_BTN_RESET 8
  27. #define WNDAP360_KEYS_POLL_INTERVAL 20 /* msecs */
  28. #define WNDAP360_KEYS_DEBOUNCE_INTERVAL (3 * WNDAP360_KEYS_POLL_INTERVAL)
  29. #define WNDAP360_WMAC0_MAC_OFFSET 0x120c
  30. #define WNDAP360_WMAC1_MAC_OFFSET 0x520c
  31. #define WNDAP360_CALDATA0_OFFSET 0x1000
  32. #define WNDAP360_CALDATA1_OFFSET 0x5000
  33. /*
  34. * WNDAP360 this still uses leds definitions from AP96
  35. *
  36. */
  37. static struct gpio_led wndap360_leds_gpio[] __initdata = {
  38. {
  39. .name = "netgear:green:power",
  40. .gpio = WNDAP360_GPIO_LED_POWER_GREEN,
  41. .active_low = 1,
  42. }, {
  43. .name = "netgear:orange:power",
  44. .gpio = WNDAP360_GPIO_LED_POWER_ORANGE,
  45. .active_low = 1,
  46. }
  47. };
  48. static struct gpio_keys_button wndap360_gpio_keys[] __initdata = {
  49. {
  50. .desc = "reset",
  51. .type = EV_KEY,
  52. .code = KEY_RESTART,
  53. .debounce_interval = WNDAP360_KEYS_DEBOUNCE_INTERVAL,
  54. .gpio = WNDAP360_GPIO_BTN_RESET,
  55. .active_low = 1,
  56. }
  57. };
  58. #define WNDAP360_LAN_PHYMASK 0x0f
  59. static void __init wndap360_setup(void)
  60. {
  61. u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
  62. ath79_register_mdio(0, ~(WNDAP360_LAN_PHYMASK));
  63. /* Reusing wifi MAC with offset of 1 as eth0 MAC */
  64. ath79_init_mac(ath79_eth0_data.mac_addr,
  65. art + WNDAP360_WMAC0_MAC_OFFSET, 1);
  66. ath79_eth0_pll_data.pll_1000 = 0x11110000;
  67. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  68. ath79_eth0_data.phy_mask = WNDAP360_LAN_PHYMASK;
  69. ath79_eth0_data.speed = SPEED_1000;
  70. ath79_eth0_data.duplex = DUPLEX_FULL;
  71. ath79_register_eth(0);
  72. ath79_register_m25p80(NULL);
  73. ath79_register_leds_gpio(-1, ARRAY_SIZE(wndap360_leds_gpio),
  74. wndap360_leds_gpio);
  75. ath79_register_gpio_keys_polled(-1, WNDAP360_KEYS_POLL_INTERVAL,
  76. ARRAY_SIZE(wndap360_gpio_keys),
  77. wndap360_gpio_keys);
  78. ap9x_pci_setup_wmac_led_pin(0, 5);
  79. ap9x_pci_setup_wmac_led_pin(1, 5);
  80. ap94_pci_init(art + WNDAP360_CALDATA0_OFFSET,
  81. art + WNDAP360_WMAC0_MAC_OFFSET,
  82. art + WNDAP360_CALDATA1_OFFSET,
  83. art + WNDAP360_WMAC1_MAC_OFFSET);
  84. }
  85. MIPS_MACHINE(ATH79_MACH_WNDAP360, "WNDAP360", "Netgear WNDAP360", wndap360_setup);