2 * Atheros GS_MINIBOX_V3.2 reference board support
4 * Copyright (c) 2018 OpenWRT.org
5 * Copyright (c) 2013 The Linux Foundation. All rights reserved.
6 * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 #include <linux/pci.h>
23 #include <linux/platform_device.h>
24 #include <linux/ath9k_platform.h>
25 #include <linux/ar8216_platform.h>
27 #include <asm/mach-ath79/ar71xx_regs.h>
31 #include "dev-ap9x-pci.h"
32 #include "dev-gpio-buttons.h"
33 #include "dev-leds-gpio.h"
34 #include "dev-m25p80.h"
38 #include "machtypes.h"
41 #define GS_MINIBOX_V3_GPIO_LED_STATUS 14
42 #define GS_MINIBOX_V3_GPIO_BTN_RST 17
43 #define GS_MINIBOX_V3_KEYS_POLL_INTERVAL 20 /* msecs */
44 #define GS_MINIBOX_V3_KEYS_DEBOUNCE_INTERVAL (3 * GS_MINIBOX_V3_KEYS_POLL_INTERVAL)
45 #define GS_MINIBOX_V3_MAC0_OFFSET 0
46 #define GS_MINIBOX_V3_MAC1_OFFSET 6
47 #define GS_MINIBOX_V3_WMAC_CALDATA_OFFSET 0x1000
49 static const char *gs_minibox_v3_part_probes
[] = {
54 static struct flash_platform_data gs_minibox_v3_flash_data
= {
55 .part_probes
= gs_minibox_v3_part_probes
,
58 static struct gpio_led gs_minibox_v3_leds_gpio
[] __initdata
= {
60 .name
= "minibox_v3.2:green:system",
61 .gpio
= GS_MINIBOX_V3_GPIO_LED_STATUS
,
66 static struct gpio_keys_button gs_minibox_v3_gpio_keys
[] __initdata
= {
68 .desc
= "reset button",
71 .debounce_interval
= GS_MINIBOX_V3_KEYS_DEBOUNCE_INTERVAL
,
72 .gpio
= GS_MINIBOX_V3_GPIO_BTN_RST
,
77 static void __init
gs_minibox_v3_gpio_led_setup(void)
79 ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_minibox_v3_leds_gpio
),
80 gs_minibox_v3_leds_gpio
);
81 ath79_register_gpio_keys_polled(-1, GS_MINIBOX_V3_KEYS_POLL_INTERVAL
,
82 ARRAY_SIZE(gs_minibox_v3_gpio_keys
),
83 gs_minibox_v3_gpio_keys
);
86 static void __init
gs_minibox_v3_setup(void)
88 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
90 ath79_register_m25p80(&gs_minibox_v3_flash_data
);
91 gs_minibox_v3_gpio_led_setup();
95 ath79_register_wmac(art
+ GS_MINIBOX_V3_WMAC_CALDATA_OFFSET
, NULL
);
96 ath79_register_mdio(0, 0x0);
97 ath79_register_mdio(1, 0x0);
99 ath79_init_mac(ath79_eth0_data
.mac_addr
, art
+ GS_MINIBOX_V3_MAC0_OFFSET
, 0);
100 ath79_init_mac(ath79_eth1_data
.mac_addr
, art
+ GS_MINIBOX_V3_MAC1_OFFSET
, 0);
103 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
104 ath79_eth0_data
.speed
= SPEED_100
;
105 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
106 ath79_eth0_data
.phy_mask
= BIT(4);
107 ath79_register_eth(0);
110 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
111 ath79_eth1_data
.speed
= SPEED_1000
;
112 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
113 ath79_switch_data
.phy_poll_mask
|= BIT(4);
114 ath79_switch_data
.phy4_mii_en
= 1;
115 ath79_register_eth(1);
117 ath79_register_pci();
120 MIPS_MACHINE(ATH79_MACH_GS_MINIBOX_V32
, "MINIBOX-V3.2", "Minibox V3.2",
121 gs_minibox_v3_setup
);