aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-20 15:00:52 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-04-20 15:00:52 +0000
commitbe5315b4dd7bd2c1ac4a457703ae821816be9ac6 (patch)
tree36580265655b25ce7560987931d29613c290c631 /target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
parent4960c20ca4ae7c5f7bf3d75fb32001810d13d579 (diff)
downloadmaster-187ad058-be5315b4dd7bd2c1ac4a457703ae821816be9ac6.tar.gz
master-187ad058-be5315b4dd7bd2c1ac4a457703ae821816be9ac6.tar.bz2
master-187ad058-be5315b4dd7bd2c1ac4a457703ae821816be9ac6.zip
ar71xx: add a helper function to set RXDV/RXD of ETH_CFG on AR934x
The ETH_RXDV_DELAY (17:16) and ETH_RXD_DELAY (15:14) are currently not cleared by the function ath79_setup_ar934x_eth_cfg. Clearing these in the ath79_setup_ar934x_eth_cfg may cause problems on some hardware because they rely on the preset value by the bootloader. Instead another function is introduced which also works on ETH_CFG on AR934x. It can be used to safely clear and set ETH_RXDV_DELAY and ETH_RXD_DELAY on machines which require special settings. Signed-off-by: Sven Eckelmann <sven@open-mesh.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45523 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c26
1 files changed, 26 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 c6842aad38..ae3db4c3ef 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
@@ -769,6 +769,32 @@ void __init ath79_setup_ar934x_eth_cfg(u32 mask)
iounmap(base);
}
+void __init ath79_setup_ar934x_eth_rx_delay(unsigned int rxd,
+ unsigned int rxdv)
+{
+ void __iomem *base;
+ u32 t;
+
+ rxd &= AR934X_ETH_CFG_RXD_DELAY_MASK;
+ rxdv &= AR934X_ETH_CFG_RDV_DELAY_MASK;
+
+ base = ioremap(AR934X_GMAC_BASE, AR934X_GMAC_SIZE);
+
+ t = __raw_readl(base + AR934X_GMAC_REG_ETH_CFG);
+
+ t &= ~(AR934X_ETH_CFG_RXD_DELAY_MASK << AR934X_ETH_CFG_RXD_DELAY_SHIFT |
+ AR934X_ETH_CFG_RDV_DELAY_MASK << AR934X_ETH_CFG_RDV_DELAY_SHIFT);
+
+ t |= (rxd << AR934X_ETH_CFG_RXD_DELAY_SHIFT |
+ rxdv << AR934X_ETH_CFG_RDV_DELAY_SHIFT);
+
+ __raw_writel(t, base + AR934X_GMAC_REG_ETH_CFG);
+ /* flush write */
+ __raw_readl(base + AR934X_GMAC_REG_ETH_CFG);
+
+ iounmap(base);
+}
+
void __init ath79_setup_qca955x_eth_cfg(u32 mask)
{
void __iomem *base;