diff mbox series

[3/9] ravb: Separate use of GIC reg for PTME from multi_irqs

Message ID 20220504145454.71287-4-phil.edworthy@renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Add Renesas RZ/V2M Ethernet support | expand

Commit Message

Phil Edworthy May 4, 2022, 2:54 p.m. UTC
When the HW has a single interrupt, the driver currently uses the
PTME (Presentation Time Match Enable) bit in the GIC register to
enable/disable the PTM irq. Otherwise, it uses the GIE/GID registers.

However, other SoCs, e.g. RZ/V2M, have multiple irqs and use the GIC
register PTME bit, so separate it out as it's own feature.

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      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 1 +
 drivers/net/ethernet/renesas/ravb_ptp.c  | 4 ++--
 3 files changed, 4 insertions(+), 2 deletions(-)

Comments

Sergey Shtylyov May 4, 2022, 8:40 p.m. UTC | #1
On 5/4/22 5:54 PM, Phil Edworthy wrote:

> When the HW has a single interrupt, the driver currently uses the
> PTME (Presentation Time Match Enable) bit in the GIC register to
> enable/disable the PTM irq. Otherwise, it uses the GIE/GID registers.
> 
> However, other SoCs, e.g. RZ/V2M, have multiple irqs and use the GIC
> register PTME bit, so separate it out as it's own feature.
> 
> 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      | 1 +
>  drivers/net/ethernet/renesas/ravb_main.c | 1 +
>  drivers/net/ethernet/renesas/ravb_ptp.c  | 4 ++--
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> index 08062d73df10..15aa09d93ff0 100644
> --- a/drivers/net/ethernet/renesas/ravb.h
> +++ b/drivers/net/ethernet/renesas/ravb.h
> @@ -1029,6 +1029,7 @@ struct ravb_hw_info {
>  	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
>  	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 */

   I think this needs to be controlled by the 'irq_en_dis' feature bit from the patch #4.

[...]

MBR, Sergey
Phil Edworthy May 5, 2022, 8:26 a.m. UTC | #2
Hi Sergey,

On 04 May 2022 21:40 Sergey Shtylyov wrote:
> On 5/4/22 5:54 PM, Phil Edworthy wrote:
> 
> > When the HW has a single interrupt, the driver currently uses the
> > PTME (Presentation Time Match Enable) bit in the GIC register to
> > enable/disable the PTM irq. Otherwise, it uses the GIE/GID registers.
> >
> > However, other SoCs, e.g. RZ/V2M, have multiple irqs and use the GIC
> > register PTME bit, so separate it out as it's own feature.
> >
> > 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      | 1 +
> >  drivers/net/ethernet/renesas/ravb_main.c | 1 +
> >  drivers/net/ethernet/renesas/ravb_ptp.c  | 4 ++--
> >  3 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/renesas/ravb.h
> b/drivers/net/ethernet/renesas/ravb.h
> > index 08062d73df10..15aa09d93ff0 100644
> > --- a/drivers/net/ethernet/renesas/ravb.h
> > +++ b/drivers/net/ethernet/renesas/ravb.h
> > @@ -1029,6 +1029,7 @@ struct ravb_hw_info {
> >  	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple
> irqs */
> >  	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 */
> 
>    I think this needs to be controlled by the 'irq_en_dis' feature bit
> from the patch #4.
Good point, I'll fix and squash the two patches.

Thanks
Phil
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 08062d73df10..15aa09d93ff0 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1029,6 +1029,7 @@  struct ravb_hw_info {
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
 	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 */
 	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 525d66f71f02..de2792c03099 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2434,6 +2434,7 @@  static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.rx_max_buf_size = SZ_2K,
 	.aligned_tx = 1,
 	.gptp = 1,
+	.gptp_ptm_gic = 1,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
diff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c
index c099656dd75b..f8e75dddcaf1 100644
--- a/drivers/net/ethernet/renesas/ravb_ptp.c
+++ b/drivers/net/ethernet/renesas/ravb_ptp.c
@@ -254,7 +254,7 @@  static int ravb_ptp_perout(struct ptp_clock_info *ptp,
 		error = ravb_ptp_update_compare(priv, (u32)start_ns);
 		if (!error) {
 			/* Unmask interrupt */
-			if (!info->multi_irqs)
+			if (info->gptp_ptm_gic)
 				ravb_modify(ndev, GIC, GIC_PTME, GIC_PTME);
 			else
 				ravb_write(ndev, GIE_PTMS0, GIE);
@@ -266,7 +266,7 @@  static int ravb_ptp_perout(struct ptp_clock_info *ptp,
 		perout->period = 0;
 
 		/* Mask interrupt */
-		if (!info->multi_irqs)
+		if (info->gptp_ptm_gic)
 			ravb_modify(ndev, GIC, GIC_PTME, 0);
 		else
 			ravb_write(ndev, GID_PTMD0, GID);