mach-all0258n.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Allnet ALL0258N support
  3. *
  4. * Copyright (C) 2011 Daniel Golle <dgolle@allnet.de>
  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 "machtypes.h"
  17. /* found via /sys/gpio/... try and error */
  18. #define ALL0258N_GPIO_BTN_RESET 1
  19. #define ALL0258N_GPIO_LED_RSSIHIGH 13
  20. #define ALL0258N_GPIO_LED_RSSIMEDIUM 15
  21. #define ALL0258N_GPIO_LED_RSSILOW 14
  22. /* defaults taken from others machs */
  23. #define ALL0258N_KEYS_POLL_INTERVAL 20 /* msecs */
  24. #define ALL0258N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0258N_KEYS_POLL_INTERVAL)
  25. /* showed up in the original firmware's bootlog */
  26. #define ALL0258N_SEC_PHYMASK BIT(3)
  27. static struct gpio_led all0258n_leds_gpio[] __initdata = {
  28. {
  29. .name = "all0258n:green:rssihigh",
  30. .gpio = ALL0258N_GPIO_LED_RSSIHIGH,
  31. .active_low = 1,
  32. }, {
  33. .name = "all0258n:yellow:rssimedium",
  34. .gpio = ALL0258N_GPIO_LED_RSSIMEDIUM,
  35. .active_low = 1,
  36. }, {
  37. .name = "all0258n:red:rssilow",
  38. .gpio = ALL0258N_GPIO_LED_RSSILOW,
  39. .active_low = 1,
  40. }
  41. };
  42. static struct gpio_keys_button all0258n_gpio_keys[] __initdata = {
  43. {
  44. .desc = "reset",
  45. .type = EV_KEY,
  46. .code = KEY_RESTART,
  47. .debounce_interval = ALL0258N_KEYS_DEBOUNCE_INTERVAL,
  48. .gpio = ALL0258N_GPIO_BTN_RESET,
  49. .active_low = 1,
  50. }
  51. };
  52. static void __init all0258n_setup(void)
  53. {
  54. u8 *mac = (u8 *) KSEG1ADDR(0x1f7f0000);
  55. u8 *ee = (u8 *) KSEG1ADDR(0x1f7f1000);
  56. ath79_register_m25p80(NULL);
  57. ath79_register_leds_gpio(-1, ARRAY_SIZE(all0258n_leds_gpio),
  58. all0258n_leds_gpio);
  59. ath79_register_gpio_keys_polled(-1, ALL0258N_KEYS_POLL_INTERVAL,
  60. ARRAY_SIZE(all0258n_gpio_keys),
  61. all0258n_gpio_keys);
  62. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  63. ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
  64. ath79_eth1_data.phy_mask = ALL0258N_SEC_PHYMASK;
  65. ath79_register_mdio(0, 0x0);
  66. ath79_register_eth(0);
  67. ath79_register_eth(1);
  68. ap91_pci_init(ee, mac);
  69. }
  70. MIPS_MACHINE(ATH79_MACH_ALL0258N, "ALL0258N", "Allnet ALL0258N",
  71. all0258n_setup);