aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-10-18 07:13:06 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-10-18 07:13:06 +0000
commitff0b61920129284b0595c56288738e2f05c06e3b (patch)
tree4479c535329aa64421fac64e5023791afb920bef /target/linux/ar71xx
parent5a0863162fb89d58f55f954208c1df4d3c15c276 (diff)
downloadupstream-ff0b61920129284b0595c56288738e2f05c06e3b.tar.gz
upstream-ff0b61920129284b0595c56288738e2f05c06e3b.tar.bz2
upstream-ff0b61920129284b0595c56288738e2f05c06e3b.zip
AA: ar71xx: add a helper function for setting up ETH_CFG register on AR934x
Backport of r33817. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33835 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c24
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
index 4487958bc7..5a0b950c1b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -691,6 +691,30 @@ void __init ath79_setup_ar933x_phy4_switch(bool mac, bool mdio)
iounmap(base);
}
+void __init ath79_setup_ar934x_eth_cfg(u32 mask)
+{
+ void __iomem *base;
+ u32 t;
+
+ base = ioremap(AR934X_GMAC_BASE, AR934X_GMAC_SIZE);
+
+ t = __raw_readl(base + AR934X_GMAC_REG_ETH_CFG);
+
+ t &= ~(AR934X_ETH_CFG_RGMII_GMAC0 |
+ AR934X_ETH_CFG_MII_GMAC0 |
+ AR934X_ETH_CFG_GMII_GMAC0 |
+ AR934X_ETH_CFG_SW_ONLY_MODE |
+ AR934X_ETH_CFG_SW_PHY_SWAP);
+
+ t |= mask;
+
+ __raw_writel(t, base + AR934X_GMAC_REG_ETH_CFG);
+ /* flush write */
+ __raw_readl(base + AR934X_GMAC_REG_ETH_CFG);
+
+ iounmap(base);
+}
+
static int ath79_eth_instance __initdata;
void __init ath79_register_eth(unsigned int id)
{
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
index d4f27d9cf2..561bf3ff86 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h
@@ -44,5 +44,6 @@ extern struct platform_device ath79_mdio1_device;
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);
#endif /* _ATH79_DEV_ETH_H */