From edd74d465b108e4e1c9185f889315a602c3de834 Mon Sep 17 00:00:00 2001 From: Suraj Jaiswal Date: Tue, 4 Aug 2020 16:59:09 +0530 Subject: [PATCH] net: stmmac: Fix gpio reset & other issue Add support for proper GPIO reset & qcom specific changes. Change-Id: Iad7a40d896c6847e06f775449f5c54dd828815b8 Acked-by: Nagarjuna Chaganti Signed-off-by: Suraj Jaiswal --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 ++++++-- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 40c42637ad75..e331f514dbe0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -264,7 +264,11 @@ int stmmac_mdio_reset(struct mii_bus *bus) struct net_device *ndev = bus->priv; struct stmmac_priv *priv = netdev_priv(ndev); unsigned int mii_address = priv->hw->mii.addr; + bool active_high = true; +#ifdef CONFIG_DWMAC_QCOM_ETHQOS + active_high = false; +#endif #ifdef CONFIG_OF if (priv->device->of_node) { struct gpio_desc *reset_gpio; @@ -283,11 +287,11 @@ int stmmac_mdio_reset(struct mii_bus *bus) if (delays[0]) msleep(DIV_ROUND_UP(delays[0], 1000)); - gpiod_set_value_cansleep(reset_gpio, 1); + gpiod_set_value_cansleep(reset_gpio, active_high ? 1 : 0); if (delays[1]) msleep(DIV_ROUND_UP(delays[1], 1000)); - gpiod_set_value_cansleep(reset_gpio, 0); + gpiod_set_value_cansleep(reset_gpio, active_high ? 0 : 1); if (delays[2]) msleep(DIV_ROUND_UP(delays[2], 1000)); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 508325cc105d..fe87319fe86e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -212,12 +212,13 @@ static int stmmac_mtl_setup(struct platform_device *pdev, queue++; } +#ifndef CONFIG_DWMAC_QCOM_ETHQOS if (queue != plat->rx_queues_to_use) { ret = -EINVAL; dev_err(&pdev->dev, "Not all RX queues were configured\n"); goto out; } - +#endif /* Processing TX queues common config */ if (of_property_read_u32(tx_node, "snps,tx-queues-to-use", &plat->tx_queues_to_use)) @@ -278,11 +279,13 @@ static int stmmac_mtl_setup(struct platform_device *pdev, queue++; } +#ifndef CONFIG_DWMAC_QCOM_ETHQOS if (queue != plat->tx_queues_to_use) { ret = -EINVAL; dev_err(&pdev->dev, "Not all TX queues were configured\n"); goto out; } +#endif out: of_node_put(rx_node);