2 * Rockeetech AP531B0 11ng wireless AP board support
4 * Copyright (C) 2013 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2016 Shuanglin Liu <roboidler@gmail.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/ath9k_platform.h>
14 #include <linux/ar8216_platform.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
20 #include "dev-gpio-buttons.h"
21 #include "dev-leds-gpio.h"
22 #include "dev-m25p80.h"
26 #include "machtypes.h"
28 #include "dev-ap9x-pci.h"
30 #define AP531B0_GPIO_LED_WLAN 12
31 #define AP531B0_GPIO_LED_STATUS 11
33 #define AP531B0_GPIO_RST_BTN 17
35 #define AP531B0_KEYS_POLL_INTERVAL 20 /* msecs */
36 #define AP531B0_KEYS_DEBOUNCE_INTERVAL (3 * AP531B0_KEYS_POLL_INTERVAL)
38 #define AP531B0_WMAC_CALDATA_OFFSET 0x1000
41 static struct gpio_led ap531b0_leds_gpio
[] __initdata
= {
43 .name
= "ap531b0:green:status",
44 .gpio
= AP531B0_GPIO_LED_STATUS
,
48 .name
= "ap531b0:green:wlan",
49 .gpio
= AP531B0_GPIO_LED_WLAN
,
54 static struct gpio_keys_button ap531b0_gpio_keys
[] __initdata
= {
59 .debounce_interval
= AP531B0_KEYS_DEBOUNCE_INTERVAL
,
60 .gpio
= AP531B0_GPIO_RST_BTN
,
66 static void __init
ap531b0_gpio_led_setup(void)
69 ath79_register_leds_gpio(-1, ARRAY_SIZE(ap531b0_leds_gpio
),
72 ath79_register_gpio_keys_polled(-1, AP531B0_KEYS_POLL_INTERVAL
,
73 ARRAY_SIZE(ap531b0_gpio_keys
),
77 static void __init
ap531b0_setup(void)
79 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
82 ath79_register_m25p80(NULL
);
83 ap531b0_gpio_led_setup();
87 ath79_register_mdio(0, 0x0);
89 pmac
= art
+ AP531B0_WMAC_CALDATA_OFFSET
+ 2;
90 ath79_init_mac(ath79_eth0_data
.mac_addr
, pmac
, 1);
91 ath79_init_mac(ath79_eth1_data
.mac_addr
, pmac
, 2);
93 ath79_register_wmac(art
+ AP531B0_WMAC_CALDATA_OFFSET
, pmac
);
96 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
97 ath79_eth0_data
.speed
= SPEED_100
;
98 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
99 ath79_eth0_data
.phy_mask
= BIT(4);
100 ath79_register_eth(0);
103 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
104 ath79_eth1_data
.speed
= SPEED_1000
;
105 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
106 ath79_switch_data
.phy_poll_mask
|= BIT(4);
107 ath79_switch_data
.phy4_mii_en
= 1;
108 ath79_register_eth(1);
111 MIPS_MACHINE(ATH79_MACH_AP531B0
, "AP531B0", "Rockeetech AP531B0",