ath79: add QCA956x GMAC config
authorDavid Bauer <mail@david-bauer.net>
Sun, 12 Aug 2018 23:48:39 +0000 (01:48 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 13 Aug 2018 06:43:15 +0000 (08:43 +0200)
This commit adds the ability to configure the GMAC of the QCA956x.

Signed-off-by: David Bauer <mail@david-bauer.net>
target/linux/ath79/dts/qca956x.dtsi
target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_gmac.c

index 10c88eedc240e70e77f2d814cc462affad69f6f6..81453717477f5985dff912c50c720a0d46b40957 100644 (file)
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
+
+               gmac: gmac@18070000 {
+                       compatible = "qca,qca9560-gmac";
+                       reg = <0x18070000 0x64>;
+               };
        };
 
        usb_phy0: usb-phy {
index 55a8f57f15557edd9a82aba9020f28bf325efa51..2e5fb3a64108c849343034f05fe93d69ad9159f6 100644 (file)
@@ -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);