Skip to contentSkip to conversation

drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI ethernet interfaces of APM X-Gene SoC.

PATCH In review Suman Tripathi 2 participants 6 messages Jun 23, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI ethernet interfaces of APM X-Gene SoC.

---

Suman Tripathi (4):
drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI
interface of APM X-Gene SoC ethernet controller.
drivers: net: xgene: Implement the backward compatibility with the old
and new firmware w.r.t Tx completion IRQ interrupt.
drivers: net: xgene: Add ACPI support for SGMII0 and XFI1 interface of
2nd H/W version of APM X-Gene SoC ethernet controller.
drivers: net: xgene: Check for IS_ERR rather than NULL for clock.

 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c    |  7 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  | 84 ++++++++++++++---------
 drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 13 ++--
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 13 ++--
 4 files changed, 73 insertions(+), 44 deletions(-)

--
1.8.2.1

#1 lore raw

PATCH 1/4 drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI interface of APM X-Gene SoC ethernet controller.

This patch implements couple of fixes to support ACPI for RGMII/SGMII0/XFI interface of APM X-Gene SoC ethernet controller driver. This patch uses the _SUN acpi object to fetch the port-id information whereas the FDT uses port-id binding for port-id information.

---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c   |  2 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 66 +++++++++++++++---------
 2 files changed, 44 insertions(+), 24 deletions(-)
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +1 -1
index 25873d1..8ff736d 100644
@@ -751,7 +751,7 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
 	if (ret)
 		return -EINVAL;
 
-	phy = get_phy_device(mdio, phy_id, true);
+	phy = get_phy_device(mdio, phy_id, false);
 	if (!phy || IS_ERR(phy))
 		return -EIO;
 
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +43 -23

115 lines not on this page · raw message

--
1.8.2.1

#2 lore raw

PATCH 2/4 drivers: net: xgene: Implement the backward compatibility with the old and new firmware w.r.t Tx completion IRQ interrupt.

In reply to Suman Tripathi

This patch implements the backward compatibility with the old firmware where the Tx completion IRQ interrupt was absent whereas incase of new firmware the Tx completion IRQ interrupt is present.

---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +7 -7
index c8f97a7..946ebde 100644
@@ -1024,11 +1024,13 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	if (pdata->phy_mode != PHY_INTERFACE_MODE_RGMII) {
 		ret = platform_get_irq(pdev, 1);
 		if (ret <= 0) {
-			dev_err(dev, "Unable to get ENET Tx completion IRQ\n");
-			ret = ret ? : -ENXIO;
-			return ret;
-		}
-		pdata->txc_irq = ret;
+			pdata->cq_cnt = 0;
+			dev_info(dev, "Unable to get Tx completion IRQ,"
+				 "using Rx IRQ instead\n");
+		} else {
+			pdata->cq_cnt = XGENE_MAX_TXC_RINGS;
+			pdata->txc_irq = ret;
+		}
 	}
 
 	pdata->clk = devm_clk_get(&pdev->dev, NULL);
@@ -1105,13 +1107,11 @@ static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
 		pdata->mac_ops = &xgene_sgmac_ops;
 		pdata->port_ops = &xgene_sgport_ops;
 		pdata->rm = RM1;
-		pdata->cq_cnt = XGENE_MAX_TXC_RINGS;
 		break;
 	default:
 		pdata->mac_ops = &xgene_xgmac_ops;
 		pdata->port_ops = &xgene_xgport_ops;
 		pdata->rm = RM0;
-		pdata->cq_cnt = XGENE_MAX_TXC_RINGS;
 		break;
 	}
 

--
1.8.2.1

#3 lore raw

PATCH 3/4 drivers: net: xgene: Add ACPI support for SGMII0 and XFI1 interface of 2nd H/W version of APM X-Gene SoC ethernet controller.

In reply to Suman Tripathi

This patch adds the ACPI support for SGMII0 and XFI1 interface of 2nd H/W version of APM X-Gene SoC ethernet controller.

---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +2 -0
index 946ebde..ed52d65 100644
@@ -1289,6 +1289,8 @@ static const struct acpi_device_id xgene_enet_acpi_match[] = {
 	{ "APMC0D05", XGENE_ENET1},
 	{ "APMC0D30", XGENE_ENET1},
 	{ "APMC0D31", XGENE_ENET1},
+	{ "APMC0D26", XGENE_ENET2},
+	{ "APMC0D25", XGENE_ENET2},
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match);

--
1.8.2.1

#4 lore raw

PATCH 4/4 drivers: net: xgene: Check for IS_ERR rather than NULL for clock.

In reply to Suman Tripathi

This patches fixes the code to check for IS_ERR rather than NULL for clock interface.

---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c    |  5 +++--
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  |  2 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 13 ++++++++-----
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 13 ++++++++-----
 4 files changed, 20 insertions(+), 13 deletions(-)
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +3 -2
index 8ff736d..a626c43 100644
@@ -610,7 +610,7 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
 	if (!xgene_ring_mgr_init(pdata))
 		return -ENODEV;
 
-	if (pdata->clk) {
+	if (!IS_ERR(pdata->clk)) {
 		clk_prepare_enable(pdata->clk);
 		clk_disable_unprepare(pdata->clk);
 		clk_prepare_enable(pdata->clk);
@@ -629,7 +629,8 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
 
 static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
 {
-	clk_disable_unprepare(pdata->clk);
+	if (!IS_ERR(pdata->clk))
+		clk_disable_unprepare(pdata->clk);
 }
 
 static int xgene_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +1 -1
index ed52d65..4e83d4c 100644
@@ -1036,7 +1036,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 	pdata->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pdata->clk)) {
 		/* Firmware may have set up the clock already. */
-		pdata->clk = NULL;
+		dev_info(dev, "clocks have been setup already\n");
 	}
 
 	if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c +8 -5
index ff240b3..2e80c95 100644
@@ -333,10 +333,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata *p)
 {
 	if (!xgene_ring_mgr_init(p))
 		return -ENODEV;
-
-	clk_prepare_enable(p->clk);
-	clk_disable_unprepare(p->clk);
-	clk_prepare_enable(p->clk);
+
+	if (!IS_ERR(p->clk)) {
+		clk_prepare_enable(p->clk);
+		clk_disable_unprepare(p->clk);
+		clk_prepare_enable(p->clk);
+	}
 
 	xgene_enet_ecc_init(p);
 	xgene_enet_config_ring_if_assoc(p);
@@ -369,7 +371,8 @@ static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
 
 static void xgene_enet_shutdown(struct xgene_enet_pdata *p)
 {
-	clk_disable_unprepare(p->clk);
+	if (!IS_ERR(p->clk))
+		clk_disable_unprepare(p->clk);
 }
 
 static void xgene_enet_link_state(struct work_struct *work)
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c +8 -5
index 27ba2fe..a86cfe4 100644
@@ -255,10 +255,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
 {
 	if (!xgene_ring_mgr_init(pdata))
 		return -ENODEV;
-
-	clk_prepare_enable(pdata->clk);
-	clk_disable_unprepare(pdata->clk);
-	clk_prepare_enable(pdata->clk);
+
+	if (!IS_ERR(pdata->clk)) {
+		clk_prepare_enable(pdata->clk);
+		clk_disable_unprepare(pdata->clk);
+		clk_prepare_enable(pdata->clk);
+	}
 
 	xgene_enet_ecc_init(pdata);
 	xgene_enet_config_ring_if_assoc(pdata);
@@ -285,7 +287,8 @@ static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
 
 static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata)
 {
-	clk_disable_unprepare(pdata->clk);
+	if (!IS_ERR(pdata->clk))
+		clk_disable_unprepare(pdata->clk);
 }
 
 static void xgene_enet_link_state(struct work_struct *work)

--
1.8.2.1