summaryrefslogtreecommitdiff
path: root/target/linux/ath79
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2018-08-13 01:48:39 +0200
committerJohn Crispin <john@phrozen.org>2018-08-13 08:43:15 +0200
commit7d1b742b4d18636b26b09142b7265215bf4eff32 (patch)
tree27994a48a4f4edcea817e69d0357f7ffef9005b0 /target/linux/ath79
parent2276bc0082c90b227be564ff5c76bc641a2cf16d (diff)
downloadmtk-20170518-7d1b742b4d18636b26b09142b7265215bf4eff32.zip
mtk-20170518-7d1b742b4d18636b26b09142b7265215bf4eff32.tar.gz
mtk-20170518-7d1b742b4d18636b26b09142b7265215bf4eff32.tar.bz2
ath79: add QCA956x GMAC config
This commit adds the ability to configure the GMAC of the QCA956x. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target/linux/ath79')
-rw-r--r--target/linux/ath79/dts/qca956x.dtsi5
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/target/linux/ath79/dts/qca956x.dtsi b/target/linux/ath79/dts/qca956x.dtsi
index 10c88ee..8145371 100644
--- a/target/linux/ath79/dts/qca956x.dtsi
+++ b/target/linux/ath79/dts/qca956x.dtsi
@@ -222,6 +222,11 @@
#address-cells = <1>;
#size-cells = <0>;
};
+
+ gmac: gmac@18070000 {
+ compatible = "qca,qca9560-gmac";
+ reg = <0x18070000 0x64>;
+ };
};
usb_phy0: usb-phy {
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c
index 55a8f57..2e5fb3a 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c
@@ -75,6 +75,17 @@ static void ag71xx_setup_gmac_955x(struct device_node *np, void __iomem *base)
__raw_writel(val, base + QCA955X_GMAC_REG_ETH_CFG);
}
+static void ag71xx_setup_gmac_956x(struct device_node *np, void __iomem *base)
+{
+ u32 val = __raw_readl(base + QCA956X_GMAC_REG_ETH_CFG);
+
+ ag71xx_of_bit(np, "switch-phy-swap", &val, QCA956X_ETH_CFG_SW_PHY_SWAP);
+ ag71xx_of_bit(np, "switch-phy-addr-swap", &val,
+ QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
+
+ __raw_writel(val, base + QCA956X_GMAC_REG_ETH_CFG);
+}
+
int ag71xx_setup_gmac(struct device_node *np)
{
struct device_node *np_dev;
@@ -102,6 +113,8 @@ int ag71xx_setup_gmac(struct device_node *np)
ag71xx_setup_gmac_934x(np, base);
else if (of_device_is_compatible(np_dev, "qca,qca9550-gmac"))
ag71xx_setup_gmac_955x(np, base);
+ else if (of_device_is_compatible(np_dev, "qca,qca9560-gmac"))
+ ag71xx_setup_gmac_956x(np, base);
iounmap(base);