2 * EnGenius EAP300 v2 board support
4 * Copyright (C) 2014 Gabor Juhos <juhosg@openwrt.org>
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/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14 #include <linux/platform_device.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
17 #include <asm/mach-ath79/ath79.h>
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-m25p80.h"
25 #include "machtypes.h"
27 #define EAP300V2_GPIO_LED_POWER 0
28 #define EAP300V2_GPIO_LED_LAN 16
29 #define EAP300V2_GPIO_LED_WLAN 17
31 #define EAP300V2_GPIO_BTN_RESET 1
33 #define EAP300V2_KEYS_POLL_INTERVAL 20 /* msecs */
34 #define EAP300V2_KEYS_DEBOUNCE_INTERVAL (3 * EAP300V2_KEYS_POLL_INTERVAL)
36 static struct gpio_led eap300v2_leds_gpio
[] __initdata
= {
38 .name
= "engenius:blue:power",
39 .gpio
= EAP300V2_GPIO_LED_POWER
,
42 .name
= "engenius:blue:lan",
43 .gpio
= EAP300V2_GPIO_LED_LAN
,
46 .name
= "engenius:blue:wlan",
47 .gpio
= EAP300V2_GPIO_LED_WLAN
,
52 static struct gpio_keys_button eap300v2_gpio_keys
[] __initdata
= {
57 .debounce_interval
= EAP300V2_KEYS_DEBOUNCE_INTERVAL
,
58 .gpio
= EAP300V2_GPIO_BTN_RESET
,
63 #define EAP300V2_ART_MAC_OFFSET 2
65 #define EAP300V2_LAN_PHYMASK BIT(0)
67 static void __init
eap300v2_setup(void)
69 u8
*art
= (u8
*)KSEG1ADDR(0x1fff1000);
71 ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE
);
73 ath79_gpio_output_select(EAP300V2_GPIO_LED_POWER
, AR934X_GPIO_OUT_GPIO
);
74 ath79_gpio_output_select(EAP300V2_GPIO_LED_LAN
, AR934X_GPIO_OUT_GPIO
);
75 ath79_gpio_output_select(EAP300V2_GPIO_LED_WLAN
, AR934X_GPIO_OUT_GPIO
);
77 ath79_register_leds_gpio(-1, ARRAY_SIZE(eap300v2_leds_gpio
),
79 ath79_register_gpio_keys_polled(-1, EAP300V2_KEYS_POLL_INTERVAL
,
80 ARRAY_SIZE(eap300v2_gpio_keys
),
83 ath79_register_m25p80(NULL
);
84 ath79_register_wmac(art
, NULL
);
85 ath79_register_mdio(1, 0x0);
87 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP
);
89 ath79_init_mac(ath79_eth0_data
.mac_addr
,
90 art
+ EAP300V2_ART_MAC_OFFSET
, 0);
92 ath79_switch_data
.phy4_mii_en
= 1;
93 ath79_switch_data
.phy_poll_mask
= EAP300V2_LAN_PHYMASK
;
94 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
95 ath79_eth0_data
.phy_mask
= EAP300V2_LAN_PHYMASK
;
96 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
97 ath79_register_eth(0);
100 MIPS_MACHINE(ATH79_MACH_EAP300V2
, "EAP300V2", "EnGenius EAP300 v2",