2 * MikroTik RouterBOARD 2011 support
4 * Copyright (C) 2012 Stijn Tintel <stijn@linux-ipv6.be>
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/phy.h>
12 #include <linux/platform_device.h>
13 #include <linux/ar8216_platform.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include "dev-m25p80.h"
20 #include "machtypes.h"
22 static struct ar8327_pad_cfg rb2011_ar8327_pad0_cfg = {
23 .mode = AR8327_PAD_MAC_RGMII,
24 .txclk_delay_en = true,
25 .rxclk_delay_en = true,
26 .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
27 .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
30 static struct ar8327_platform_data rb2011_ar8327_data = {
31 .pad0_cfg = &rb2011_ar8327_pad0_cfg,
34 .speed = AR8327_PORT_SPEED_1000,
41 static struct mdio_board_info rb2011_mdio0_info[] = {
43 .bus_id = "ag71xx-mdio.0",
45 .platform_data = &rb2011_ar8327_data,
49 static void __init rb2011_gmac_setup(void)
54 base = ioremap(AR934X_GMAC_BASE, AR934X_GMAC_SIZE);
56 t = __raw_readl(base + AR934X_GMAC_REG_ETH_CFG);
57 t &= ~(AR934X_ETH_CFG_RGMII_GMAC0 | AR934X_ETH_CFG_MII_GMAC0 |
58 AR934X_ETH_CFG_GMII_GMAC0 | AR934X_ETH_CFG_SW_ONLY_MODE);
59 t |= AR934X_ETH_CFG_RGMII_GMAC0 | AR934X_ETH_CFG_SW_ONLY_MODE;
61 __raw_writel(t, base + AR934X_GMAC_REG_ETH_CFG);
66 static void __init rb2011_setup(void)
68 ath79_register_m25p80(NULL);
72 ath79_register_mdio(1, 0x0);
73 ath79_register_mdio(0, 0x0);
75 mdiobus_register_board_info(rb2011_mdio0_info,
76 ARRAY_SIZE(rb2011_mdio0_info));
78 /* GMAC0 is connected to an ar8327 switch */
79 ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
80 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
81 ath79_eth0_data.phy_mask = BIT(0);
82 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
83 ath79_eth0_pll_data.pll_1000 = 0x06000000;
85 ath79_register_eth(0);
87 /* GMAC1 is connected to the internal switch */
88 ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 5);
89 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
90 ath79_eth1_data.speed = SPEED_1000;
91 ath79_eth1_data.duplex = DUPLEX_FULL;
93 ath79_register_eth(1);
96 MIPS_MACHINE(ATH79_MACH_RB_2011L, "2011L", "MikroTik RouterBOARD 2011L",