mach-wp543.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Compex WP543/WPJ543 board support
  3. *
  4. * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include <asm/mach-ath79/ar71xx_regs.h>
  12. #include <asm/mach-ath79/ath79.h>
  13. #include "dev-eth.h"
  14. #include "dev-gpio-buttons.h"
  15. #include "dev-leds-gpio.h"
  16. #include "dev-m25p80.h"
  17. #include "dev-usb.h"
  18. #include "machtypes.h"
  19. #include "pci.h"
  20. #define WP543_GPIO_SW6 2
  21. #define WP543_GPIO_LED_1 3
  22. #define WP543_GPIO_LED_2 4
  23. #define WP543_GPIO_LED_WLAN 5
  24. #define WP543_GPIO_LED_CONN 6
  25. #define WP543_GPIO_LED_DIAG 7
  26. #define WP543_GPIO_SW4 8
  27. #define WP543_KEYS_POLL_INTERVAL 20 /* msecs */
  28. #define WP543_KEYS_DEBOUNCE_INTERVAL (3 * WP543_KEYS_POLL_INTERVAL)
  29. static struct gpio_led wp543_leds_gpio[] __initdata = {
  30. {
  31. .name = "wp543:green:led1",
  32. .gpio = WP543_GPIO_LED_1,
  33. .active_low = 1,
  34. }, {
  35. .name = "wp543:green:led2",
  36. .gpio = WP543_GPIO_LED_2,
  37. .active_low = 1,
  38. }, {
  39. .name = "wp543:green:wlan",
  40. .gpio = WP543_GPIO_LED_WLAN,
  41. .active_low = 1,
  42. }, {
  43. .name = "wp543:green:conn",
  44. .gpio = WP543_GPIO_LED_CONN,
  45. .active_low = 1,
  46. }, {
  47. .name = "wp543:green:diag",
  48. .gpio = WP543_GPIO_LED_DIAG,
  49. .active_low = 1,
  50. }
  51. };
  52. static struct gpio_keys_button wp543_gpio_keys[] __initdata = {
  53. {
  54. .desc = "sw6",
  55. .type = EV_KEY,
  56. .code = BTN_0,
  57. .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
  58. .gpio = WP543_GPIO_SW6,
  59. .active_low = 1,
  60. }, {
  61. .desc = "sw4",
  62. .type = EV_KEY,
  63. .code = KEY_RESTART,
  64. .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
  65. .gpio = WP543_GPIO_SW4,
  66. .active_low = 1,
  67. }
  68. };
  69. static const char *wp543_part_probes[] = {
  70. "MyLoader",
  71. NULL,
  72. };
  73. static struct flash_platform_data wp543_flash_data = {
  74. .part_probes = wp543_part_probes,
  75. };
  76. static void __init wp543_setup(void)
  77. {
  78. ath79_register_m25p80(&wp543_flash_data);
  79. ath79_register_mdio(0, 0xfffffff0);
  80. ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  81. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  82. ath79_eth0_data.phy_mask = 0x0f;
  83. ath79_eth0_data.reset_bit = AR71XX_RESET_GE0_MAC |
  84. AR71XX_RESET_GE0_PHY;
  85. ath79_register_eth(0);
  86. ath79_register_usb();
  87. ath79_register_pci();
  88. ath79_register_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
  89. wp543_leds_gpio);
  90. ath79_register_gpio_keys_polled(-1, WP543_KEYS_POLL_INTERVAL,
  91. ARRAY_SIZE(wp543_gpio_keys),
  92. wp543_gpio_keys);
  93. }
  94. MIPS_MACHINE(ATH79_MACH_WP543, "WP543", "Compex WP543", wp543_setup);