ar71xx: add missing include for checking kernel version
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-rambutan.c
1 /*
2 * 8devices Rambutan board support
3 *
4 * Copyright (C) 2017 Mantas Pucka <mantas@8devices.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/pci.h>
12 #include <linux/phy.h>
13 #include <linux/gpio.h>
14 #include <linux/platform_device.h>
15 #include <linux/ath9k_platform.h>
16
17 #include <asm/mach-ath79/ath79.h>
18 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include <linux/platform/ar934x_nfc.h>
20 #include <linux/ar8216_platform.h>
21 #include <linux/platform_data/phy-at803x.h>
22 #include "common.h"
23 #include "dev-eth.h"
24 #include "dev-gpio-buttons.h"
25 #include "dev-leds-gpio.h"
26 #include "dev-m25p80.h"
27 #include "dev-spi.h"
28 #include "dev-nfc.h"
29 #include "dev-usb.h"
30 #include "dev-wmac.h"
31 #include "machtypes.h"
32 #include "pci.h"
33
34 static struct at803x_platform_data rambutan_ar8032_data = {
35 .has_reset_gpio = 1,
36 .reset_gpio = 17,
37 };
38
39 static struct mdio_board_info rambutan_mdio0_info[] = {
40 {
41 .bus_id = "ag71xx-mdio.0",
42 .mdio_addr = 0,
43 .platform_data = &rambutan_ar8032_data,
44 },
45 };
46
47 static struct at803x_platform_data rambutan_ar8033_data = {
48 .has_reset_gpio = 1,
49 .reset_gpio = 23,
50 };
51
52 static struct mdio_board_info rambutan_mdio1_info[] = {
53 {
54 .bus_id = "ag71xx-mdio.1",
55 .mdio_addr = 0,
56 .platform_data = &rambutan_ar8033_data,
57 },
58 };
59
60 static void __init rambutan_setup(void)
61 {
62 ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
63 ath79_register_nfc();
64 ath79_register_usb();
65 ath79_register_pci();
66 ath79_register_wmac_simple();
67
68 mdiobus_register_board_info(rambutan_mdio0_info,
69 ARRAY_SIZE(rambutan_mdio0_info));
70 mdiobus_register_board_info(rambutan_mdio1_info,
71 ARRAY_SIZE(rambutan_mdio1_info));
72 ath79_register_mdio(0, 0x0);
73 ath79_register_mdio(1, 0x0);
74
75 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
76 ath79_eth0_data.phy_mask = BIT(0);
77 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
78 ath79_register_eth(0);
79
80 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
81 ath79_eth1_data.phy_mask = BIT(0);
82 ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev;
83 ath79_eth1_pll_data.pll_1000 = 0x17000000;
84 ath79_eth1_pll_data.pll_10 = 0x1313;
85 ath79_register_eth(1);
86 }
87
88 MIPS_MACHINE(ATH79_MACH_RAMBUTAN, "RAMBUTAN", "8devices Rambutan board",
89 rambutan_setup);
90