2 * Atheros AP147 reference board support
4 * Copyright (C) 2014 Matthias Schiffer <mschiffer@universe-factory.net>
5 * Copyright (C) 2015 Sven Eckelmann <sven@open-mesh.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/platform_device.h>
13 #include <linux/ar8216_platform.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
16 #include <asm/mach-ath79/ath79.h>
19 #include "dev-ap9x-pci.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-m25p80.h"
26 #include "machtypes.h"
29 #define AP147_GPIO_LED_WAN 4
30 #define AP147_GPIO_LED_LAN1 16
31 #define AP147_GPIO_LED_LAN2 15
32 #define AP147_GPIO_LED_LAN3 14
33 #define AP147_GPIO_LED_LAN4 11
34 #define AP147_GPIO_LED_STATUS 13
35 #define AP147_GPIO_LED_WLAN_2G 12
37 #define AP147_GPIO_BTN_WPS 17
39 #define AP147_KEYS_POLL_INTERVAL 20 /* msecs */
40 #define AP147_KEYS_DEBOUNCE_INTERVAL (3 * AP147_KEYS_POLL_INTERVAL)
42 #define AP147_MAC0_OFFSET 0x1000
44 static struct gpio_led ap147_leds_gpio[] __initdata = {
46 .name = "ap147:green:status",
47 .gpio = AP147_GPIO_LED_STATUS,
50 .name = "ap147:green:wlan-2g",
51 .gpio = AP147_GPIO_LED_WLAN_2G,
54 .name = "ap147:green:lan1",
55 .gpio = AP147_GPIO_LED_LAN1,
58 .name = "ap147:green:lan2",
59 .gpio = AP147_GPIO_LED_LAN2,
62 .name = "ap147:green:lan3",
63 .gpio = AP147_GPIO_LED_LAN3,
66 .name = "ap147:green:lan4",
67 .gpio = AP147_GPIO_LED_LAN4,
70 .name = "ap147:green:wan",
71 .gpio = AP147_GPIO_LED_WAN,
76 static struct gpio_keys_button ap147_gpio_keys[] __initdata = {
80 .code = KEY_WPS_BUTTON,
81 .debounce_interval = AP147_KEYS_DEBOUNCE_INTERVAL,
82 .gpio = AP147_GPIO_BTN_WPS,
87 static void __init ap147_setup(void)
89 u8 *art = (u8 *)KSEG1ADDR(0x1fff0000);
91 ath79_register_m25p80(NULL);
92 ath79_register_leds_gpio(-1, ARRAY_SIZE(ap147_leds_gpio),
94 ath79_register_gpio_keys_polled(-1, AP147_KEYS_POLL_INTERVAL,
95 ARRAY_SIZE(ap147_gpio_keys),
100 ath79_register_pci();
102 ath79_register_wmac(art + AP147_MAC0_OFFSET, NULL);
104 ath79_setup_ar933x_phy4_switch(false, false);
106 ath79_register_mdio(0, 0x0);
109 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
110 ath79_eth1_data.duplex = DUPLEX_FULL;
111 ath79_switch_data.phy_poll_mask |= BIT(4);
112 ath79_init_mac(ath79_eth1_data.mac_addr, art, 0);
113 ath79_register_eth(1);
116 ath79_switch_data.phy4_mii_en = 1;
117 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
118 ath79_eth0_data.duplex = DUPLEX_FULL;
119 ath79_eth0_data.speed = SPEED_100;
120 ath79_eth0_data.phy_mask = BIT(4);
121 ath79_init_mac(ath79_eth0_data.mac_addr, art, 1);
122 ath79_register_eth(0);
125 MIPS_MACHINE(ATH79_MACH_AP147_010, "AP147-010", "Atheros AP147-010 reference board", ap147_setup);