2 * Compex WPJ563 board support
4 * Copyright (c) 2015 Qualcomm Atheros
5 * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 #include <linux/platform_device.h>
22 #include <linux/ath9k_platform.h>
23 #include <linux/ar8216_platform.h>
24 #include <asm/mach-ath79/ar71xx_regs.h>
27 #include "dev-m25p80.h"
28 #include "machtypes.h"
31 #include "dev-gpio-buttons.h"
32 #include "dev-leds-gpio.h"
37 #define WPJ563_GPIO_LED_SIG1 1
38 #define WPJ563_GPIO_LED_SIG2 5
39 #define WPJ563_GPIO_LED_SIG3 6
40 #define WPJ563_GPIO_LED_SIG4 7
41 #define WPJ563_GPIO_BUZZER 19
43 #define WPJ563_GPIO_BTN_RESET 2
44 #define WPJ563_KEYS_POLL_INTERVAL 20 /* msecs */
45 #define WPJ563_KEYS_DEBOUNCE_INTERVAL (3 * WPJ563_KEYS_POLL_INTERVAL)
47 #define WPJ563_MAC0_OFFSET 0x10
48 #define WPJ563_MAC1_OFFSET 0x18
49 #define WPJ563_WMAC_CALDATA_OFFSET 0x1000
51 static struct gpio_led WPJ563_leds_gpio[] __initdata = {
53 .name = "wpj563:green:sig1",
54 .gpio = WPJ563_GPIO_LED_SIG1,
58 .name = "wpj563:green:sig2",
59 .gpio = WPJ563_GPIO_LED_SIG2,
63 .name = "wpj563:green:sig3",
64 .gpio = WPJ563_GPIO_LED_SIG3,
68 .name = "wpj563:green:sig4",
69 .gpio = WPJ563_GPIO_LED_SIG4,
73 .name = "wpj563:buzzer",
74 .gpio = WPJ563_GPIO_BUZZER,
79 static struct gpio_keys_button WPJ563_gpio_keys[] __initdata = {
81 .desc = "Reset button",
84 .debounce_interval = WPJ563_KEYS_DEBOUNCE_INTERVAL,
85 .gpio = WPJ563_GPIO_BTN_RESET,
90 static struct ar8327_pad_cfg WPJ563_ar8337_pad0_cfg = {
91 .mode = AR8327_PAD_MAC_SGMII,
92 .sgmii_delay_en = true,
95 static struct ar8327_platform_data WPJ563_ar8337_data = {
96 .pad0_cfg = &WPJ563_ar8337_pad0_cfg,
99 .speed = AR8327_PORT_SPEED_1000,
106 static struct mdio_board_info WPJ563_mdio0_info[] = {
108 .bus_id = "ag71xx-mdio.0",
110 .platform_data = &WPJ563_ar8337_data,
114 static void __init WPJ563_setup(void)
116 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
117 u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000);
119 ath79_register_m25p80(NULL);
121 ath79_register_leds_gpio(-1, ARRAY_SIZE(WPJ563_leds_gpio),
123 ath79_register_gpio_keys_polled(-1, WPJ563_KEYS_POLL_INTERVAL,
124 ARRAY_SIZE(WPJ563_gpio_keys),
127 ath79_register_usb();
129 ath79_register_wmac(art + WPJ563_WMAC_CALDATA_OFFSET, NULL);
131 ath79_register_pci();
133 mdiobus_register_board_info(WPJ563_mdio0_info,
134 ARRAY_SIZE(WPJ563_mdio0_info));
135 ath79_register_mdio(0, 0x0);
137 ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ563_MAC0_OFFSET, 0);
138 ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ563_MAC1_OFFSET, 0);
140 /* GMAC0 is connected to an QCA8334 switch */
141 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
142 ath79_eth0_data.speed = SPEED_1000;
143 ath79_eth0_data.duplex = DUPLEX_FULL;
144 ath79_eth0_data.phy_mask = BIT(0);
145 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
147 ath79_register_eth(0);
150 MIPS_MACHINE(ATH79_MACH_WPJ563, "WPJ563", "Compex WPJ563", WPJ563_setup);