mach-rw2458n.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Redwave RW2458N support
  3. *
  4. * Copyright (C) 2011-2013 Cezary Jackiewicz <cezary@eko.one.pl>
  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 <asm/mach-ath79/ath79.h>
  11. #include "dev-eth.h"
  12. #include "dev-ap9x-pci.h"
  13. #include "dev-gpio-buttons.h"
  14. #include "dev-leds-gpio.h"
  15. #include "dev-m25p80.h"
  16. #include "dev-usb.h"
  17. #include "machtypes.h"
  18. #include "pci.h"
  19. #define RW2458N_GPIO_LED_D3 1
  20. #define RW2458N_GPIO_LED_D4 0
  21. #define RW2458N_GPIO_LED_D5 11
  22. #define RW2458N_GPIO_LED_D6 7
  23. #define RW2458N_GPIO_BTN_RESET 12
  24. #define RW2458N_KEYS_POLL_INTERVAL 20 /* msecs */
  25. #define RW2458N_KEYS_DEBOUNCE_INTERVAL (3 * RW2458N_KEYS_POLL_INTERVAL)
  26. static struct gpio_keys_button rw2458n_gpio_keys[] __initdata = {
  27. {
  28. .desc = "reset",
  29. .type = EV_KEY,
  30. .code = KEY_RESTART,
  31. .debounce_interval = RW2458N_KEYS_DEBOUNCE_INTERVAL,
  32. .gpio = RW2458N_GPIO_BTN_RESET,
  33. .active_low = 1,
  34. }
  35. };
  36. #define RW2458N_WAN_PHYMASK BIT(4)
  37. static struct gpio_led rw2458n_leds_gpio[] __initdata = {
  38. {
  39. .name = "rw2458n:green:d3",
  40. .gpio = RW2458N_GPIO_LED_D3,
  41. .active_low = 1,
  42. }, {
  43. .name = "rw2458n:green:d4",
  44. .gpio = RW2458N_GPIO_LED_D4,
  45. .active_low = 1,
  46. }, {
  47. .name = "rw2458n:green:d5",
  48. .gpio = RW2458N_GPIO_LED_D5,
  49. .active_low = 1,
  50. }, {
  51. .name = "rw2458n:green:d6",
  52. .gpio = RW2458N_GPIO_LED_D6,
  53. .active_low = 1,
  54. }
  55. };
  56. static void __init rw2458n_setup(void)
  57. {
  58. u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
  59. u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
  60. ath79_register_m25p80(NULL);
  61. ath79_register_mdio(0, ~RW2458N_WAN_PHYMASK);
  62. ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  63. ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
  64. ath79_register_eth(0);
  65. ath79_register_eth(1);
  66. ath79_register_leds_gpio(-1, ARRAY_SIZE(rw2458n_leds_gpio),
  67. rw2458n_leds_gpio);
  68. ath79_register_gpio_keys_polled(-1, RW2458N_KEYS_POLL_INTERVAL,
  69. ARRAY_SIZE(rw2458n_gpio_keys),
  70. rw2458n_gpio_keys);
  71. ath79_register_usb();
  72. ath79_register_pci();
  73. }
  74. MIPS_MACHINE(ATH79_MACH_RW2458N, "RW2458N", "Redwave RW2458N",
  75. rw2458n_setup);