mach-tl-mr11u.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * TP-LINK TL-MR11U board support
  3. *
  4. * Copyright (C) 2011 dongyuqi <[email protected]>
  5. * Copyright (C) 2011-2012 Gabor Juhos <[email protected]>
  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 <linux/gpio.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 "dev-wmac.h"
  19. #include "machtypes.h"
  20. #define TL_MR11U_GPIO_LED_3G 27
  21. #define TL_MR11U_GPIO_LED_WLAN 26
  22. #define TL_MR11U_GPIO_LED_LAN 17
  23. #define TL_MR11U_GPIO_BTN_WPS 20
  24. #define TL_MR11U_GPIO_BTN_RESET 11
  25. #define TL_MR11U_GPIO_USB_POWER 8
  26. #define TL_MR11U_KEYS_POLL_INTERVAL 20 /* msecs */
  27. #define TL_MR11U_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR11U_KEYS_POLL_INTERVAL)
  28. static const char *tl_mr11u_part_probes[] = {
  29. "tp-link",
  30. NULL,
  31. };
  32. static struct flash_platform_data tl_mr11u_flash_data = {
  33. .part_probes = tl_mr11u_part_probes,
  34. };
  35. static struct gpio_led tl_mr11u_leds_gpio[] __initdata = {
  36. {
  37. .name = "tp-link:green:3g",
  38. .gpio = TL_MR11U_GPIO_LED_3G,
  39. .active_low = 1,
  40. },
  41. {
  42. .name = "tp-link:green:wlan",
  43. .gpio = TL_MR11U_GPIO_LED_WLAN,
  44. .active_low = 1,
  45. },
  46. {
  47. .name = "tp-link:green:lan",
  48. .gpio = TL_MR11U_GPIO_LED_LAN,
  49. .active_low = 1,
  50. }
  51. };
  52. static struct gpio_keys_button tl_mr11u_gpio_keys[] __initdata = {
  53. {
  54. .desc = "wps",
  55. .type = EV_KEY,
  56. .code = KEY_WPS_BUTTON,
  57. .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL,
  58. .gpio = TL_MR11U_GPIO_BTN_WPS,
  59. .active_low = 0,
  60. },
  61. {
  62. .desc = "reset",
  63. .type = EV_KEY,
  64. .code = KEY_RESTART,
  65. .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL,
  66. .gpio = TL_MR11U_GPIO_BTN_RESET,
  67. .active_low = 0,
  68. }
  69. };
  70. static void __init tl_mr11u_setup(void)
  71. {
  72. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  73. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  74. ath79_register_m25p80(&tl_mr11u_flash_data);
  75. ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr11u_leds_gpio),
  76. tl_mr11u_leds_gpio);
  77. ath79_register_gpio_keys_polled(-1, TL_MR11U_KEYS_POLL_INTERVAL,
  78. ARRAY_SIZE(tl_mr11u_gpio_keys),
  79. tl_mr11u_gpio_keys);
  80. gpio_request(TL_MR11U_GPIO_USB_POWER, "USB power");
  81. gpio_direction_output(TL_MR11U_GPIO_USB_POWER, 1);
  82. ath79_register_usb();
  83. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  84. ath79_register_mdio(0, 0x0);
  85. ath79_register_eth(0);
  86. ath79_register_wmac(ee, mac);
  87. }
  88. MIPS_MACHINE(ATH79_MACH_TL_MR11U, "TL-MR11U", "TP-LINK TL-MR11U",
  89. tl_mr11u_setup);