ar71xx: add a helper function for setting up ETH_CFG register on QCA955x
authorGabor Juhos <juhosg@openwrt.org>
Sun, 13 Jul 2014 19:43:56 +0000 (19:43 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 13 Jul 2014 19:43:56 +0000 (19:43 +0000)
Signed-off-by: Jon Suphammer <jon@suphammer.net>
Patchwork: http://patchwork.openwrt.org/patch/5839/
[juhosg: fix coding style]
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 41623

target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h

index d9c40e92c46e9191a1d6c83c423e6e7cf6e2e392..227f16e4c2ec45a010a8297695d4e9d7eb441143 100644 (file)
@@ -769,6 +769,24 @@ void __init ath79_setup_ar934x_eth_cfg(u32 mask)
        iounmap(base);
 }
 
+void __init ath79_setup_qca955x_eth_cfg(u32 mask)
+{
+       void __iomem *base;
+       u32 t;
+
+       base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
+
+       t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
+
+       t &= ~(QCA955X_ETH_CFG_RGMII_EN | QCA955X_ETH_CFG_GE0_SGMII);
+
+       t |= mask;
+
+       __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
+
+       iounmap(base);
+}
+
 static int ath79_eth_instance __initdata;
 void __init ath79_register_eth(unsigned int id)
 {
index ff26ec48519193a459466aa5ace66f3c2504b1b5..e1517b7a29478920231745860b850a74af87fd2f 100644 (file)
@@ -47,5 +47,6 @@ void ath79_register_mdio(unsigned int id, u32 phy_mask);
 
 void ath79_setup_ar933x_phy4_switch(bool mac, bool mdio);
 void ath79_setup_ar934x_eth_cfg(u32 mask);
+void ath79_setup_qca955x_eth_cfg(u32 mask);
 
 #endif /* _ATH79_DEV_ETH_H */