2 * BHU BXU2000n-2 A1 board support
4 * Copyright (C) 2013 Terry Yang <yangbo@bhunetworks.com>
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.
11 #include <linux/gpio.h>
12 #include <linux/platform_device.h>
14 #include <asm/mach-ath79/ath79.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
24 #include "machtypes.h"
26 #define BHU_BXU2000N2_A1_GPIO_LED_WLAN 13
27 #define BHU_BXU2000N2_A1_GPIO_LED_WAN 19
28 #define BHU_BXU2000N2_A1_GPIO_LED_LAN 21
29 #define BHU_BXU2000N2_A1_GPIO_LED_SYSTEM 14
31 #define BHU_BXU2000N2_A1_GPIO_BTN_RESET 17
33 #define BHU_BXU2000N2_KEYS_POLL_INTERVAL 20 /* msecs */
34 #define BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL \
35 (3 * BHU_BXU2000N2_KEYS_POLL_INTERVAL)
37 static const char *bhu_bxu2000n2_part_probes[] = {
42 static struct flash_platform_data bhu_bxu2000n2_flash_data = {
43 .part_probes = bhu_bxu2000n2_part_probes,
46 static struct gpio_led bhu_bxu2000n2_a1_leds_gpio[] __initdata = {
48 .name = "bhu:green:status",
49 .gpio = BHU_BXU2000N2_A1_GPIO_LED_SYSTEM,
52 .name = "bhu:green:lan",
53 .gpio = BHU_BXU2000N2_A1_GPIO_LED_LAN,
56 .name = "bhu:green:wan",
57 .gpio = BHU_BXU2000N2_A1_GPIO_LED_WAN,
60 .name = "bhu:green:wlan",
61 .gpio = BHU_BXU2000N2_A1_GPIO_LED_WLAN,
66 static struct gpio_keys_button bhu_bxu2000n2_a1_gpio_keys[] __initdata = {
68 .desc = "Reset button",
71 .debounce_interval = BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL,
72 .gpio = BHU_BXU2000N2_A1_GPIO_BTN_RESET,
77 static void __init bhu_ap123_setup(void)
79 u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
80 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
82 ath79_register_m25p80(&bhu_bxu2000n2_flash_data);
84 ath79_register_mdio(1, 0x0);
86 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
87 ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
89 /* GMAC0 is connected to the PHY4 of the internal switch */
90 ath79_switch_data.phy4_mii_en = 1;
91 ath79_switch_data.phy_poll_mask = BIT(4);
92 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
93 ath79_eth0_data.phy_mask = BIT(4);
94 ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
95 ath79_register_eth(0);
97 /* GMAC1 is connected to the internal switch. Only use PHY3 */
98 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
99 ath79_eth1_data.phy_mask = BIT(3);
100 ath79_register_eth(1);
102 ath79_register_wmac(ee, ee+2);
105 static void __init bhu_bxu2000n2_a1_setup(void)
109 ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxu2000n2_a1_leds_gpio),
110 bhu_bxu2000n2_a1_leds_gpio);
112 ath79_register_gpio_keys_polled(1, BHU_BXU2000N2_KEYS_POLL_INTERVAL,
113 ARRAY_SIZE(bhu_bxu2000n2_a1_gpio_keys),
114 bhu_bxu2000n2_a1_gpio_keys);
117 MIPS_MACHINE(ATH79_MACH_BHU_BXU2000N2_A1, "BXU2000n-2-A1",
118 "BHU BXU2000n-2 rev. A1",
119 bhu_bxu2000n2_a1_setup);