ar71xx: wpa8630: change board name to tl-wpa8630
[openwrt/staging/wigyori.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-omy-x1.c
1 /*
2 * OMYlink OMY-X1 board support
3 *
4 * Copyright (C) 2016 L. D. Pinney <ldpinney@gmail.com>
5 *
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.
9 */
10
11 #include <linux/gpio.h>
12 #include <linux/platform_device.h>
13
14 #include <asm/mach-ath79/ath79.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
16
17 #include "common.h"
18 #include "dev-eth.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
22 #include "dev-wmac.h"
23 #include "machtypes.h"
24
25
26
27 #define OMY_X1_GPIO_LED_POWER 19
28 #define OMY_X1_GPIO_LED_WAN 22
29
30 #define OMY_X1_GPIO_BTN_RESET 17
31
32 #define OMY_X1_KEYS_POLL_INTERVAL 20 /* msecs */
33 #define OMY_X1_KEYS_DEBOUNCE_INTERVAL (3 * OMY_X1_KEYS_POLL_INTERVAL)
34
35 static const char *omy_x1_part_probes[] = {
36 "tp-link",
37 NULL,
38 };
39
40 static struct flash_platform_data omy_x1_flash_data = {
41 .part_probes = omy_x1_part_probes,
42 };
43
44 static struct gpio_led omy_x1_leds_gpio[] __initdata = {
45 {
46 .name = "omy:green:wan",
47 .gpio = OMY_X1_GPIO_LED_WAN,
48 .active_low = 1,
49 }, {
50 .name = "omy:green:power",
51 .gpio = OMY_X1_GPIO_LED_POWER,
52 .active_low = 1,
53 },
54 };
55
56 static struct gpio_keys_button omy_x1_gpio_keys[] __initdata = {
57 {
58 .desc = "Reset button",
59 .type = EV_KEY,
60 .code = KEY_RESTART,
61 .debounce_interval = OMY_X1_KEYS_DEBOUNCE_INTERVAL,
62 .gpio = OMY_X1_GPIO_BTN_RESET,
63 .active_low = 1,
64 }
65 };
66
67 static void __init omy_x1_setup(void)
68 {
69 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
70 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
71
72 ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
73 AR934X_GPIO_FUNC_CLK_OBS4_EN);
74
75 ath79_register_m25p80(&omy_x1_flash_data);
76
77 ath79_register_leds_gpio(-1, ARRAY_SIZE(omy_x1_leds_gpio),
78 omy_x1_leds_gpio);
79
80 ath79_register_gpio_keys_polled(1, OMY_X1_KEYS_POLL_INTERVAL,
81 ARRAY_SIZE(omy_x1_gpio_keys),
82 omy_x1_gpio_keys);
83
84 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
85
86 ath79_register_mdio(1, 0x0);
87
88 ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1);
89 ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
90
91 ath79_switch_data.phy4_mii_en = 1;
92 ath79_switch_data.phy_poll_mask = BIT(0);
93 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
94 ath79_eth0_data.phy_mask = BIT(0);
95 ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
96 ath79_register_eth(0);
97
98 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
99 ath79_register_eth(1);
100
101 ath79_register_wmac(ee, mac);
102
103 }
104
105 MIPS_MACHINE(ATH79_MACH_OMY_X1, "OMY-X1", "OMYlink OMY-X1",
106 omy_x1_setup);