2 * GL_ar150 board support
4 * Copyright (C) 2011 dongyuqi <729650915@qq.com>
5 * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2013 alzhao <alzhao@gmail.com>
7 * Copyright (C) 2014 Michel Stempin <michel.stempin@wanadoo.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
14 #include <linux/gpio.h>
16 #include <asm/mach-ath79/ath79.h>
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
24 #include "machtypes.h"
26 #define GL_AR150_GPIO_LED_WLAN 0
27 #define GL_AR150_GPIO_LED_LAN 13
28 #define GL_AR150_GPIO_LED_WAN 15
30 #define GL_AR150_GPIO_BIN_USB 6
31 #define GL_AR150_GPIO_BTN_MANUAL 7
32 #define GL_AR150_GPIO_BTN_AUTO 8
33 #define GL_AR150_GPIO_BTN_RESET 11
35 #define GL_AR150_KEYS_POLL_INTERVAL 20 /* msecs */
36 #define GL_AR150_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR150_KEYS_POLL_INTERVAL)
38 #define GL_AR150_MAC0_OFFSET 0x0000
39 #define GL_AR150_MAC1_OFFSET 0x0000
40 #define GL_AR150_CALDATA_OFFSET 0x1000
41 #define GL_AR150_WMAC_MAC_OFFSET 0x0000
43 static struct gpio_led gl_ar150_leds_gpio
[] __initdata
= {
45 .name
= "gl_ar150:wlan",
46 .gpio
= GL_AR150_GPIO_LED_WLAN
,
50 .name
= "gl_ar150:lan",
51 .gpio
= GL_AR150_GPIO_LED_LAN
,
55 .name
= "gl_ar150:wan",
56 .gpio
= GL_AR150_GPIO_LED_WAN
,
62 static struct gpio_keys_button gl_ar150_gpio_keys
[] __initdata
= {
67 .debounce_interval
= GL_AR150_KEYS_DEBOUNCE_INTERVAL
,
68 .gpio
= GL_AR150_GPIO_BTN_MANUAL
,
75 .debounce_interval
= GL_AR150_KEYS_DEBOUNCE_INTERVAL
,
76 .gpio
= GL_AR150_GPIO_BTN_AUTO
,
83 .debounce_interval
= GL_AR150_KEYS_DEBOUNCE_INTERVAL
,
84 .gpio
= GL_AR150_GPIO_BTN_RESET
,
89 static void __init
gl_ar150_setup(void)
92 /* ART base address */
93 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
95 /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
96 ath79_setup_ar933x_phy4_switch(false, false);
99 ath79_register_m25p80(NULL
);
101 /* register gpio LEDs and keys */
102 ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar150_leds_gpio
),
104 ath79_register_gpio_keys_polled(-1, GL_AR150_KEYS_POLL_INTERVAL
,
105 ARRAY_SIZE(gl_ar150_gpio_keys
),
109 gpio_request_one(GL_AR150_GPIO_BIN_USB
,
110 GPIOF_OUT_INIT_HIGH
| GPIOF_EXPORT_DIR_FIXED
,
112 ath79_register_usb();
114 /* register eth0 as WAN, eth1 as LAN */
115 ath79_init_mac(ath79_eth0_data
.mac_addr
, art
+GL_AR150_MAC0_OFFSET
, 0);
116 ath79_init_mac(ath79_eth1_data
.mac_addr
, art
+GL_AR150_MAC1_OFFSET
, 0);
117 ath79_register_mdio(0, 0x0);
118 ath79_register_eth(0);
119 ath79_register_eth(1);
121 /* register wireless mac with cal data */
122 ath79_register_wmac(art
+ GL_AR150_CALDATA_OFFSET
, art
+ GL_AR150_WMAC_MAC_OFFSET
);
125 MIPS_MACHINE(ATH79_MACH_GL_AR150
, "GL-AR150", "GL AR150",gl_ar150_setup
);