mach-el-m150.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Easy-Link EL-M150 board support
  3. *
  4. * Copyright (C) 2012 huangfc <huangfangcheng@163.com>
  5. * Copyright (C) 2012 HYS <550663898@qq.com>
  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 <asm/mach-ath79/ar71xx_regs.h>
  14. #include "common.h"
  15. #include "dev-eth.h"
  16. #include "dev-gpio-buttons.h"
  17. #include "dev-leds-gpio.h"
  18. #include "dev-m25p80.h"
  19. #include "dev-wmac.h"
  20. #include "machtypes.h"
  21. #include "dev-usb.h"
  22. #define EL_M150_GPIO_BTN6 6
  23. #define EL_M150_GPIO_BTN7 7
  24. #define EL_M150_GPIO_BTN_RESET 11
  25. #define EL_M150_GPIO_LED_SYSTEM 27
  26. #define EL_M150_GPIO_USB_POWER 8
  27. #define EL_M150_KEYS_POLL_INTERVAL 20 /* msecs */
  28. #define EL_M150_KEYS_DEBOUNCE_INTERVAL (3 * EL_M150_KEYS_POLL_INTERVAL)
  29. static const char *EL_M150_part_probes[] = {
  30. "tp-link",
  31. NULL,
  32. };
  33. static struct flash_platform_data EL_M150_flash_data = {
  34. .part_probes = EL_M150_part_probes,
  35. };
  36. static struct gpio_led EL_M150_leds_gpio[] __initdata = {
  37. {
  38. .name = "easylink:green:system",
  39. .gpio = EL_M150_GPIO_LED_SYSTEM,
  40. .active_low = 1,
  41. },
  42. };
  43. static struct gpio_keys_button EL_M150_gpio_keys[] __initdata = {
  44. {
  45. .desc = "reset",
  46. .type = EV_KEY,
  47. .code = KEY_RESTART,
  48. .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL,
  49. .gpio = EL_M150_GPIO_BTN_RESET,
  50. .active_low = 0,
  51. },
  52. {
  53. .desc = "BTN_6",
  54. .type = EV_KEY,
  55. .code = BTN_6,
  56. .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL,
  57. .gpio = EL_M150_GPIO_BTN6,
  58. .active_low = 1,
  59. },
  60. {
  61. .desc = "BTN_7",
  62. .type = EV_KEY,
  63. .code = BTN_7,
  64. .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL,
  65. .gpio = EL_M150_GPIO_BTN7,
  66. .active_low = 1,
  67. },
  68. };
  69. static void __init el_m150_setup(void)
  70. {
  71. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  72. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  73. /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
  74. ath79_setup_ar933x_phy4_switch(false, false);
  75. ath79_register_leds_gpio(-1, ARRAY_SIZE(EL_M150_leds_gpio),
  76. EL_M150_leds_gpio);
  77. ath79_register_gpio_keys_polled(-1, EL_M150_KEYS_POLL_INTERVAL,
  78. ARRAY_SIZE(EL_M150_gpio_keys),
  79. EL_M150_gpio_keys);
  80. gpio_request_one(EL_M150_GPIO_USB_POWER,
  81. GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
  82. "USB power");
  83. ath79_register_usb();
  84. ath79_register_m25p80(&EL_M150_flash_data);
  85. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
  86. ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
  87. ath79_register_mdio(0, 0x0);
  88. ath79_register_eth(0);
  89. ath79_register_eth(1);
  90. ath79_register_wmac(ee, mac);
  91. }
  92. MIPS_MACHINE(ATH79_MACH_EL_M150, "EL-M150",
  93. "EasyLink EL-M150", el_m150_setup);