2 * EW Balin board support
3 * (based on Atheros DB120 reference board support)
5 * Copyright (c) 2011 Qualcomm Atheros
6 * Copyright (c) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
7 * Copyright (C) 2017 Embedded Wireless GmbH www.80211.de
9 * Permission to use, copy, modify, and/or distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #include <linux/pci.h>
24 #include <linux/phy.h>
25 #include <linux/platform_device.h>
26 #include <linux/ath9k_platform.h>
27 #include <linux/ar8216_platform.h>
29 #include <asm/mach-ath79/ar71xx_regs.h>
32 #include "dev-ap9x-pci.h"
34 #include "dev-gpio-buttons.h"
35 #include "dev-leds-gpio.h"
36 #include "dev-m25p80.h"
40 #include "machtypes.h"
43 #define BALIN_GPIO_LED_STATUS 14
45 #define BALIN_GPIO_BTN_WPS 18
47 #define BALIN_KEYS_POLL_INTERVAL 20 /* msecs */
48 #define BALIN_KEYS_DEBOUNCE_INTERVAL (3 * BALIN_KEYS_POLL_INTERVAL)
50 #define BALIN_CALDATA_OFFSET 0x1000
51 #define BALIN_WMAC_MAC_OFFSET (BALIN_CALDATA_OFFSET + 0x02)
53 static struct gpio_led balin_leds_gpio
[] __initdata
= {
55 .name
= "balin:green:status",
56 .gpio
= BALIN_GPIO_LED_STATUS
,
61 static struct gpio_keys_button balin_gpio_keys
[] __initdata
= {
65 .code
= KEY_WPS_BUTTON
,
66 .debounce_interval
= BALIN_KEYS_DEBOUNCE_INTERVAL
,
67 .gpio
= BALIN_GPIO_BTN_WPS
,
73 static void __init
balin_setup(void)
75 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
78 ath79_register_m25p80(NULL
);
80 ath79_register_leds_gpio(-1, ARRAY_SIZE(balin_leds_gpio
),
83 ath79_register_gpio_keys_polled(-1, BALIN_KEYS_POLL_INTERVAL
,
84 ARRAY_SIZE(balin_gpio_keys
),
89 ath79_register_wmac(art
+ BALIN_CALDATA_OFFSET
, NULL
);
93 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
|
94 AR934X_ETH_CFG_SW_ONLY_MODE
);
96 ath79_register_mdio(1, 0x0);
98 /* GMAC1 is connected to the internal switch */
99 memcpy(mac
, art
+ BALIN_WMAC_MAC_OFFSET
, sizeof(mac
));
101 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 0);
102 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
103 ath79_eth1_data
.speed
= SPEED_1000
;
104 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
106 ath79_register_eth(1);
109 MIPS_MACHINE(ATH79_MACH_EW_BALIN
, "EW-BALIN", "EmbWir-Balin",