mach-wpe72.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Compex WPE72 board support
  3. *
  4. * Copyright (C) 2012 Johnathan Boyce<jon.boyce@globalreach.eu.com>
  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-gpio-buttons.h"
  13. #include "dev-leds-gpio.h"
  14. #include "dev-m25p80.h"
  15. #include "dev-usb.h"
  16. #include "machtypes.h"
  17. #include "pci.h"
  18. #define WPE72_GPIO_RESET 12
  19. #define WPE72_GPIO_LED_DIAG 13
  20. #define WPE72_GPIO_LED_1 14
  21. #define WPE72_GPIO_LED_2 15
  22. #define WPE72_GPIO_LED_3 16
  23. #define WPE72_GPIO_LED_4 17
  24. #define WPE72_KEYS_POLL_INTERVAL 20 /* msecs */
  25. #define WPE72_KEYS_DEBOUNCE_INTERVAL (3 * WPE72_KEYS_POLL_INTERVAL)
  26. static struct gpio_led wpe72_leds_gpio[] __initdata = {
  27. {
  28. .name = "wpe72:green:led1",
  29. .gpio = WPE72_GPIO_LED_1,
  30. .active_low = 1,
  31. }, {
  32. .name = "wpe72:green:led2",
  33. .gpio = WPE72_GPIO_LED_2,
  34. .active_low = 1,
  35. }, {
  36. .name = "wpe72:green:led3",
  37. .gpio = WPE72_GPIO_LED_3,
  38. .active_low = 1,
  39. }, {
  40. .name = "wpe72:green:led4",
  41. .gpio = WPE72_GPIO_LED_4,
  42. .active_low = 1,
  43. }, {
  44. .name = "wpe72:green:diag",
  45. .gpio = WPE72_GPIO_LED_DIAG,
  46. .active_low = 1,
  47. }
  48. };
  49. static struct gpio_keys_button wpe72_gpio_keys[] __initdata = {
  50. {
  51. .desc = "reset",
  52. .type = EV_KEY,
  53. .code = KEY_RESTART,
  54. .debounce_interval = WPE72_KEYS_DEBOUNCE_INTERVAL,
  55. .gpio = WPE72_GPIO_RESET,
  56. .active_low = 1,
  57. }
  58. };
  59. static const char *wpe72_part_probes[] = {
  60. "MyLoader",
  61. NULL,
  62. };
  63. static struct flash_platform_data wpe72_flash_data = {
  64. .part_probes = wpe72_part_probes,
  65. };
  66. static void __init wpe72_setup(void)
  67. {
  68. ath79_register_m25p80(&wpe72_flash_data);
  69. ath79_register_mdio(0, 0x0);
  70. ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
  71. ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
  72. ath79_register_eth(0);
  73. ath79_register_eth(1);
  74. ath79_register_usb();
  75. ath79_register_pci();
  76. ath79_register_leds_gpio(-1, ARRAY_SIZE(wpe72_leds_gpio),
  77. wpe72_leds_gpio);
  78. ath79_register_gpio_keys_polled(-1, WPE72_KEYS_POLL_INTERVAL,
  79. ARRAY_SIZE(wpe72_gpio_keys),
  80. wpe72_gpio_keys);
  81. }
  82. MIPS_MACHINE(ATH79_MACH_WPE72, "WPE72", "Compex WPE72", wpe72_setup);