netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Edworthy <phil.edworthy@renesas.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Phil Edworthy <phil.edworthy@renesas.com>,
	Sergey Shtylyov <s.shtylyov@omp.ru>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: [PATCH 5/9] ravb: Support separate Line0 (Desc), Line1 (Err) and Line2 (Mgmt) irqs
Date: Wed,  4 May 2022 15:54:50 +0100	[thread overview]
Message-ID: <20220504145454.71287-6-phil.edworthy@renesas.com> (raw)
In-Reply-To: <20220504145454.71287-1-phil.edworthy@renesas.com>

R-Car has a combined interrupt line, ch22 = Line0_DiA | Line1_A | Line2_A.
RZ/V2M has separate interrupt lines for each of these, so add a feature
that allows the driver to get these interrupts and call the common handler.

We keep the "ch22" name for Line0_DiA and "ch24" for Line3 interrupts to
keep the code simple.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  3 ++
 drivers/net/ethernet/renesas/ravb_main.c | 41 ++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 67a240665cd2..73976a392457 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1028,6 +1028,7 @@ struct ravb_hw_info {
 	unsigned carrier_counters:1;	/* E-MAC has carrier counters */
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
 	unsigned irq_en_dis_regs:1;	/* Has separate irq enable and disable regs */
+	unsigned err_mgmt_irqs:1;	/* Line1 (Err) and Line2 (Mgmt) irqs are separate */
 	unsigned gptp:1;		/* AVB-DMAC has gPTP support */
 	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
 	unsigned gptp_ptm_gic:1;	/* gPTP enables Presentation Time Match irq via GIC */
@@ -1079,6 +1080,8 @@ struct ravb_private {
 	int msg_enable;
 	int speed;
 	int emac_irq;
+	int erra_irq;
+	int mgmta_irq;
 	int rx_irqs[NUM_RX_QUEUE];
 	int tx_irqs[NUM_TX_QUEUE];
 
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d0b9688074ca..f12a23b9c391 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1798,12 +1798,23 @@ static int ravb_open(struct net_device *ndev)
 				      ndev, dev, "ch19:tx_nc");
 		if (error)
 			goto out_free_irq_nc_rx;
+
+		if (info->err_mgmt_irqs) {
+			error = ravb_hook_irq(priv->erra_irq, ravb_multi_interrupt,
+					      ndev, dev, "err_a");
+			if (error)
+				goto out_free_irq_nc_tx;
+			error = ravb_hook_irq(priv->mgmta_irq, ravb_multi_interrupt,
+					      ndev, dev, "mgmt_a");
+			if (error)
+				goto out_free_irq_erra;
+		}
 	}
 
 	/* Device init */
 	error = ravb_dmac_init(ndev);
 	if (error)
-		goto out_free_irq_nc_tx;
+		goto out_free_irq_mgmta;
 	ravb_emac_init(ndev);
 
 	/* Initialise PTP Clock driver */
@@ -1823,9 +1834,15 @@ static int ravb_open(struct net_device *ndev)
 	/* Stop PTP Clock driver */
 	if (info->gptp)
 		ravb_ptp_stop(ndev);
-out_free_irq_nc_tx:
+out_free_irq_mgmta:
 	if (!info->multi_irqs)
 		goto out_free_irq;
+	if (info->err_mgmt_irqs)
+		free_irq(priv->mgmta_irq, ndev);
+out_free_irq_erra:
+	if (info->err_mgmt_irqs)
+		free_irq(priv->erra_irq, ndev);
+out_free_irq_nc_tx:
 	free_irq(priv->tx_irqs[RAVB_NC], ndev);
 out_free_irq_nc_rx:
 	free_irq(priv->rx_irqs[RAVB_NC], ndev);
@@ -2167,6 +2184,10 @@ static int ravb_close(struct net_device *ndev)
 		free_irq(priv->rx_irqs[RAVB_BE], ndev);
 		free_irq(priv->emac_irq, ndev);
 	}
+	if (info->err_mgmt_irqs) {
+		free_irq(priv->erra_irq, ndev);
+		free_irq(priv->mgmta_irq, ndev);
+	}
 	free_irq(ndev->irq, ndev);
 
 	if (info->nc_queues)
@@ -2665,6 +2686,22 @@ static int ravb_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (info->err_mgmt_irqs) {
+		irq = platform_get_irq_byname(pdev, "err_a");
+		if (irq < 0) {
+			error = irq;
+			goto out_release;
+		}
+		priv->erra_irq = irq;
+
+		irq = platform_get_irq_byname(pdev, "mgmt_a");
+		if (irq < 0) {
+			error = irq;
+			goto out_release;
+		}
+		priv->mgmta_irq = irq;
+	}
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		error = PTR_ERR(priv->clk);
-- 
2.32.0


  parent reply	other threads:[~2022-05-04 14:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 14:54 [PATCH 0/9] Add Renesas RZ/V2M Ethernet support Phil Edworthy
2022-05-04 14:54 ` [PATCH 2/9] dt-bindings: net: renesas,etheravb: Document RZ/V2M SoC Phil Edworthy
2022-05-07 18:21   ` Sergey Shtylyov
2022-05-09  8:15     ` Phil Edworthy
2022-05-04 14:54 ` [PATCH 3/9] ravb: Separate use of GIC reg for PTME from multi_irqs Phil Edworthy
2022-05-04 20:40   ` Sergey Shtylyov
2022-05-05  8:26     ` Phil Edworthy
2022-05-04 14:54 ` [PATCH 4/9] ravb: Separate handling of irq enable/disable regs into feature Phil Edworthy
2022-05-04 19:54   ` Sergey Shtylyov
2022-05-05  8:12     ` Phil Edworthy
2022-05-04 14:54 ` Phil Edworthy [this message]
2022-05-05 19:40   ` [PATCH 5/9] ravb: Support separate Line0 (Desc), Line1 (Err) and Line2 (Mgmt) irqs Sergey Shtylyov
2022-05-09  8:00     ` Phil Edworthy
2022-05-04 14:54 ` [PATCH 6/9] ravb: Use separate clock for gPTP Phil Edworthy
2022-05-05 18:13   ` Sergey Shtylyov
2022-05-04 14:54 ` [PATCH 7/9] ravb: Add support for RZ/V2M Phil Edworthy
2022-05-05 20:18   ` Sergey Shtylyov
2022-05-09  7:01     ` Phil Edworthy
2022-05-05  0:57 ` [PATCH 0/9] Add Renesas RZ/V2M Ethernet support Jakub Kicinski
2022-05-05  6:59   ` Geert Uytterhoeven
2022-05-05  9:14     ` Phil Edworthy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220504145454.71287-6-phil.edworthy@renesas.com \
    --to=phil.edworthy@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.shtylyov@omp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).