1
0

mach-bhu-bxu2000n2-a.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * BHU BXU2000n-2 A1 board support
  3. *
  4. * Copyright (C) 2013 Terry Yang <yangbo@bhunetworks.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 <linux/gpio.h>
  11. #include <linux/platform_device.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-usb.h"
  20. #include "dev-wmac.h"
  21. #include "machtypes.h"
  22. #define BHU_BXU2000N2_A1_GPIO_LED_WLAN 13
  23. #define BHU_BXU2000N2_A1_GPIO_LED_WAN 19
  24. #define BHU_BXU2000N2_A1_GPIO_LED_LAN 21
  25. #define BHU_BXU2000N2_A1_GPIO_LED_SYSTEM 14
  26. #define BHU_BXU2000N2_A1_GPIO_BTN_RESET 17
  27. #define BHU_BXU2000N2_KEYS_POLL_INTERVAL 20 /* msecs */
  28. #define BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL \
  29. (3 * BHU_BXU2000N2_KEYS_POLL_INTERVAL)
  30. static const char *bhu_bxu2000n2_part_probes[] = {
  31. "cmdlinepart",
  32. NULL,
  33. };
  34. static struct flash_platform_data bhu_bxu2000n2_flash_data = {
  35. .part_probes = bhu_bxu2000n2_part_probes,
  36. };
  37. static struct gpio_led bhu_bxu2000n2_a1_leds_gpio[] __initdata = {
  38. {
  39. .name = "bhu:green:status",
  40. .gpio = BHU_BXU2000N2_A1_GPIO_LED_SYSTEM,
  41. .active_low = 1,
  42. }, {
  43. .name = "bhu:green:lan",
  44. .gpio = BHU_BXU2000N2_A1_GPIO_LED_LAN,
  45. .active_low = 1,
  46. }, {
  47. .name = "bhu:green:wan",
  48. .gpio = BHU_BXU2000N2_A1_GPIO_LED_WAN,
  49. .active_low = 1,
  50. }, {
  51. .name = "bhu:green:wlan",
  52. .gpio = BHU_BXU2000N2_A1_GPIO_LED_WLAN,
  53. .active_low = 1,
  54. },
  55. };
  56. static struct gpio_keys_button bhu_bxu2000n2_a1_gpio_keys[] __initdata = {
  57. {
  58. .desc = "Reset button",
  59. .type = EV_KEY,
  60. .code = KEY_RESTART,
  61. .debounce_interval = BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL,
  62. .gpio = BHU_BXU2000N2_A1_GPIO_BTN_RESET,
  63. .active_low = 1,
  64. }
  65. };
  66. static void __init bhu_ap123_setup(void)
  67. {
  68. u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
  69. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  70. ath79_register_m25p80(&bhu_bxu2000n2_flash_data);
  71. ath79_register_mdio(1, 0x0);
  72. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  73. ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
  74. /* GMAC0 is connected to the PHY4 of the internal switch */
  75. ath79_switch_data.phy4_mii_en = 1;
  76. ath79_switch_data.phy_poll_mask = BIT(4);
  77. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  78. ath79_eth0_data.phy_mask = BIT(4);
  79. ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
  80. ath79_register_eth(0);
  81. /* GMAC1 is connected to the internal switch. Only use PHY3 */
  82. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  83. ath79_eth1_data.phy_mask = BIT(3);
  84. ath79_register_eth(1);
  85. ath79_register_wmac(ee, ee+2);
  86. }
  87. static void __init bhu_bxu2000n2_a1_setup(void)
  88. {
  89. bhu_ap123_setup();
  90. ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxu2000n2_a1_leds_gpio),
  91. bhu_bxu2000n2_a1_leds_gpio);
  92. ath79_register_gpio_keys_polled(1, BHU_BXU2000N2_KEYS_POLL_INTERVAL,
  93. ARRAY_SIZE(bhu_bxu2000n2_a1_gpio_keys),
  94. bhu_bxu2000n2_a1_gpio_keys);
  95. }
  96. MIPS_MACHINE(ATH79_MACH_BHU_BXU2000N2_A1, "BXU2000n-2-A1",
  97. "BHU BXU2000n-2 rev. A1",
  98. bhu_bxu2000n2_a1_setup);