ar71xx: enable QCA955x SGMII fixup on Rambutan
[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 .override_sgmii_aneg = 1,
50 .reset_gpio = 23,
51 };
52
53 static struct mdio_board_info rambutan_mdio1_info[] = {
54 {
55 .bus_id = "ag71xx-mdio.1",
56 .mdio_addr = 0,
57 .platform_data = &rambutan_ar8033_data,
58 },
59 };
60
61 static void __init rambutan_setup(void)
62 {
63 ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
64 ath79_register_nfc();
65 ath79_register_usb();
66 ath79_register_pci();
67 ath79_register_wmac_simple();
68
69 mdiobus_register_board_info(rambutan_mdio0_info,
70 ARRAY_SIZE(rambutan_mdio0_info));
71 mdiobus_register_board_info(rambutan_mdio1_info,
72 ARRAY_SIZE(rambutan_mdio1_info));
73 ath79_register_mdio(0, 0x0);
74 ath79_register_mdio(1, 0x0);
75
76 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
77 ath79_eth0_data.phy_mask = BIT(0);
78 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
79 ath79_register_eth(0);
80
81 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
82 ath79_eth1_data.phy_mask = BIT(0);
83 ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev;
84 ath79_eth1_data.enable_sgmii_fixup = 1;
85 ath79_eth1_pll_data.pll_1000 = 0x17000000;
86 ath79_eth1_pll_data.pll_10 = 0x1313;
87 ath79_register_eth(1);
88 }
89
90 MIPS_MACHINE(ATH79_MACH_RAMBUTAN, "RAMBUTAN", "8devices Rambutan board",
91 rambutan_setup);
92