#include <linux/sizes.h>
#include <linux/of_net.h>
#include <linux/of_address.h>
+#include <linux/of_platform.h>
#include "ag71xx.h"
#define AG71XX_DEFAULT_MSG_ENABLE \
{
ag71xx_hw_stop(ag);
- if (ag->phy_reset) {
- reset_control_assert(ag->phy_reset);
- msleep(50);
- reset_control_deassert(ag->phy_reset);
- msleep(200);
- }
-
ag71xx_sb(ag, AG71XX_REG_MAC_CFG1, MAC_CFG1_SR);
udelay(20);
ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, fifo5);
ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl);
- if (of_device_is_compatible(np, "qca,qca9530-eth")) {
+ if (of_device_is_compatible(np, "qca,qca9530-eth") ||
+ of_device_is_compatible(np, "qca,qca9560-eth")) {
/*
* The rx ring buffer can stall on small packets on QCA953x and
* QCA956x. Disabling the inline checksum engine fixes the stall.
if (ret)
goto err;
- ag71xx_ar7240_start(ag);
phy_start(ag->phy_dev);
return 0;
return "unknown";
}
-static void ag71xx_of_bit(struct device_node *np, const char *prop,
- u32 *reg, u32 mask)
-{
- u32 val;
-
- if (of_property_read_u32(np, prop, &val))
- return;
-
- if (val)
- *reg |= mask;
- else
- *reg &= ~mask;
-}
-
-static void ag71xx_setup_gmac_933x(struct device_node *np, void __iomem *base)
-{
- u32 val = __raw_readl(base + AR933X_GMAC_REG_ETH_CFG);
-
- ag71xx_of_bit(np, "switch-phy-swap", &val, AR933X_ETH_CFG_SW_PHY_SWAP);
- ag71xx_of_bit(np, "switch-phy-addr-swap", &val,
- AR933X_ETH_CFG_SW_PHY_ADDR_SWAP);
-
- __raw_writel(val, base + AR933X_GMAC_REG_ETH_CFG);
-}
-
-static int ag71xx_setup_gmac(struct device_node *np)
-{
- struct device_node *np_dev;
- void __iomem *base;
- int err = 0;
-
- np = of_get_child_by_name(np, "gmac-config");
- if (!np)
- return 0;
-
- np_dev = of_parse_phandle(np, "device", 0);
- if (!np_dev)
- goto out;
-
- base = of_iomap(np_dev, 0);
- if (!base) {
- pr_err("%pOF: can't map GMAC registers\n", np_dev);
- err = -ENOMEM;
- goto err_iomap;
- }
-
- if (of_device_is_compatible(np_dev, "qca,ar9330-gmac"))
- ag71xx_setup_gmac_933x(np, base);
-
- iounmap(base);
-
-err_iomap:
- of_node_put(np_dev);
-out:
- of_node_put(np);
- return err;
-}
-
static int ag71xx_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ struct device_node *mdio_node;
struct net_device *dev;
struct resource *res;
struct ag71xx *ag;
goto err_free;
}
- ag->phy_reset = devm_reset_control_get_optional(&pdev->dev, "phy");
-
if (of_property_read_u32_array(np, "fifo-data", ag->fifodata, 3)) {
if (of_device_is_compatible(np, "qca,ar9130-eth") ||
of_device_is_compatible(np, "qca,ar7100-eth")) {
ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0);
ag71xx_hw_init(ag);
- ag71xx_mdio_init(ag);
+
+ if(!of_device_is_compatible(np, "simple-mfd")) {
+ mdio_node = of_get_child_by_name(np, "mdio-bus");
+ if(!IS_ERR(mdio_node))
+ of_platform_device_create(mdio_node, NULL, NULL);
+ }
err = ag71xx_phy_connect(ag);
if (err)
- goto err_mdio_free;
+ goto err_free;
err = ag71xx_debugfs_init(ag);
if (err)
err_phy_disconnect:
ag71xx_phy_disconnect(ag);
-err_mdio_free:
- ag71xx_mdio_cleanup(ag);
err_free:
free_netdev(dev);
return err;
ag = netdev_priv(dev);
ag71xx_debugfs_exit(ag);
ag71xx_phy_disconnect(ag);
- ag71xx_mdio_cleanup(ag);
unregister_netdev(dev);
free_irq(dev->irq, dev);
iounmap(ag->mac_base);