2 * Senao CAP4200AG board support
4 * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/pci.h>
12 #include <linux/phy.h>
13 #include <linux/platform_device.h>
14 #include <linux/ath9k_platform.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include "dev-ap9x-pci.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-m25p80.h"
27 #include "machtypes.h"
29 #define CAP4200AG_GPIO_LED_PWR_GREEN 12
30 #define CAP4200AG_GPIO_LED_PWR_AMBER 13
31 #define CAP4200AG_GPIO_LED_LAN_GREEN 14
32 #define CAP4200AG_GPIO_LED_LAN_AMBER 15
33 #define CAP4200AG_GPIO_LED_WLAN_GREEN 18
34 #define CAP4200AG_GPIO_LED_WLAN_AMBER 19
36 #define CAP4200AG_GPIO_BTN_RESET 17
38 #define CAP4200AG_KEYS_POLL_INTERVAL 20 /* msecs */
39 #define CAP4200AG_KEYS_DEBOUNCE_INTERVAL (3 * CAP4200AG_KEYS_POLL_INTERVAL)
41 #define CAP4200AG_MAC_OFFSET 0
42 #define CAP4200AG_WMAC_CALDATA_OFFSET 0x1000
43 #define CAP4200AG_PCIE_CALDATA_OFFSET 0x5000
45 static struct gpio_led cap4200ag_leds_gpio
[] __initdata
= {
47 .name
= "senao:green:pwr",
48 .gpio
= CAP4200AG_GPIO_LED_PWR_GREEN
,
52 .name
= "senao:amber:pwr",
53 .gpio
= CAP4200AG_GPIO_LED_PWR_AMBER
,
57 .name
= "senao:green:lan",
58 .gpio
= CAP4200AG_GPIO_LED_LAN_GREEN
,
62 .name
= "senao:amber:lan",
63 .gpio
= CAP4200AG_GPIO_LED_LAN_AMBER
,
67 .name
= "senao:green:wlan",
68 .gpio
= CAP4200AG_GPIO_LED_WLAN_GREEN
,
72 .name
= "senao:amber:wlan",
73 .gpio
= CAP4200AG_GPIO_LED_WLAN_AMBER
,
78 static struct gpio_keys_button cap4200ag_gpio_keys
[] __initdata
= {
80 .desc
= "Reset button",
83 .debounce_interval
= CAP4200AG_KEYS_DEBOUNCE_INTERVAL
,
84 .gpio
= CAP4200AG_GPIO_BTN_RESET
,
89 static void __init
cap4200ag_setup(void)
91 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
94 ath79_gpio_output_select(CAP4200AG_GPIO_LED_LAN_GREEN
,
95 AR934X_GPIO_OUT_GPIO
);
96 ath79_gpio_output_select(CAP4200AG_GPIO_LED_LAN_AMBER
,
97 AR934X_GPIO_OUT_GPIO
);
99 ath79_register_m25p80(NULL
);
101 ath79_register_leds_gpio(-1, ARRAY_SIZE(cap4200ag_leds_gpio
),
102 cap4200ag_leds_gpio
);
103 ath79_register_gpio_keys_polled(-1, CAP4200AG_KEYS_POLL_INTERVAL
,
104 ARRAY_SIZE(cap4200ag_gpio_keys
),
105 cap4200ag_gpio_keys
);
107 ath79_init_mac(mac
, art
+ CAP4200AG_MAC_OFFSET
, -1);
108 ath79_wmac_disable_2ghz();
109 ath79_register_wmac(art
+ CAP4200AG_WMAC_CALDATA_OFFSET
, mac
);
111 ath79_init_mac(mac
, art
+ CAP4200AG_MAC_OFFSET
, -2);
112 ap91_pci_init(art
+ CAP4200AG_PCIE_CALDATA_OFFSET
, mac
);
114 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
|
115 AR934X_ETH_CFG_SW_ONLY_MODE
);
117 ath79_register_mdio(0, 0x0);
119 ath79_init_mac(ath79_eth0_data
.mac_addr
,
120 art
+ CAP4200AG_MAC_OFFSET
, -2);
122 /* GMAC0 is connected to an external PHY */
123 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
124 ath79_eth0_data
.phy_mask
= BIT(0);
125 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
126 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
127 ath79_register_eth(0);
130 MIPS_MACHINE(ATH79_MACH_CAP4200AG
, "CAP4200AG", "Senao CAP4200AG",