linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Sergei Shtylyov <sergei.shtylyov@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Sergey Shtylyov <s.shtylyov@omprussia.ru>,
	Adam Ford <aford173@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Yuusuke Ashizuka <ashiduka@fujitsu.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: RE: [PATCH net-next 06/18] ravb: Factorise ptp feature
Date: Mon, 26 Jul 2021 09:01:29 +0000	[thread overview]
Message-ID: <OS0PR01MB5922DF642B0549BFCFCDA77C86E89@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <bff55135-c801-0a9e-e194-460469688afe@gmail.com>

Hi Sergei,

Thanks for the feedback.

> Subject: Re: [PATCH net-next 06/18] ravb: Factorise ptp feature
> 
> HEllo!
> 
> On 7/22/21 5:13 PM, Biju Das wrote:
> 
> > Gptp is active in CONFIG mode for R-Car Gen3, where as it is not
> 
>    It's gPTP, the manuals say. :-)

Ok.

> 
> > active in CONFIG mode for R-Car Gen2. Add feature bits to handle both
> > cases.
> 
>    I have no idea why this single diff requires 2 fetaure bits....

Basically this is a HW feature.

1) for R-Car Gen3, gPTP is active in config mode (R-Car Gen3)
2) for R-Car Gen2, gPTP is not active in config mode (R-Car Gen2)
3) RZ/G2L does not support ptp feature.

> 
> > RZ/G2L does not support ptp feature.
> 
>    Ah, that explains it. :-)
>    It doesn't explain why we should bother with the 2nd bit in the same
> patch tho...

See above it is HW feature diff between R-Car Gen3 and R-Car Gen2.

> 
> > Factorise ptp feature
> > specific to R-Car.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> >  drivers/net/ethernet/renesas/ravb.h      |  1 +
> >  drivers/net/ethernet/renesas/ravb_main.c | 81
> > ++++++++++++++++--------
> >  2 files changed, 56 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/renesas/ravb.h
> > b/drivers/net/ethernet/renesas/ravb.h
> > index 0ed21262f26b..a474ed68db22 100644
> > --- a/drivers/net/ethernet/renesas/ravb.h
> > +++ b/drivers/net/ethernet/renesas/ravb.h
> > @@ -998,6 +998,7 @@ struct ravb_drv_data {
> >  	size_t skb_sz;
> >  	u8 num_tx_desc;
> >  	enum ravb_chip_id chip_id;
> > +	u32 features;
> 
>    You didn't like bitfelds (in sh_eth) so much? :-)

OK. I will change to bit fields, if there is no objection.

> 
> [...]
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> > b/drivers/net/ethernet/renesas/ravb_main.c
> > index 84ebd6fef711..e966b76df32c 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -40,6 +40,14 @@
> >  		 NETIF_MSG_RX_ERR | \
> >  		 NETIF_MSG_TX_ERR)
> >
> > +#define RAVB_PTP_CONFIG_ACTIVE		BIT(0)
> > +#define RAVB_PTP_CONFIG_INACTIVE	BIT(1)
> 
>    If both bits are 0, it means GbEth?

Yes that is correct. ptp is not supported in GbEth.

> 
> > +
> > +#define RAVB_PTP	(RAVB_PTP_CONFIG_ACTIVE |
> RAVB_PTP_CONFIG_INACTIVE)
> 
>    Hm?
> 
> > +
> > +#define RAVB_RCAR_GEN3_FEATURES	RAVB_PTP_CONFIG_ACTIVE
> > +#define RAVB_RCAR_GEN2_FEATURES	RAVB_PTP_CONFIG_INACTIVE
> 
>    Not sure whtehr these are necessary...

If there is no objection for using bit fields, then the above definitions not required.

> 
> [...]
> >  	}
> >
> >  	/* gPTP interrupt status summary */
> > -	if (iss & ISS_CGIS) {
> > +	if ((info->features & RAVB_PTP) && (iss & ISS_CGIS)) {
> 
>    This is not a transparent change -- the fearture check came fromn
> nownere...

I have added commit statement to make it clear, "RZ/G2L does not support ptp feature. Factorise ptp feature
specific to R-Car".

Do you see any issues with this? If needed we can factorize this portion of the code again to make 
It simpler. First patch is ptp feature for r-car differences(R-Car Gen3 and R-Car Gen2) and second patch( with "transparent" comments you have mentioned in this patch)

Please let me know.

> 
> >  		ravb_ptp_interrupt(ndev);
> >  		result = IRQ_HANDLED;
> >  	}
> [...]
> > @@ -1275,7 +1286,8 @@ static int ravb_get_ts_info(struct net_device
> *ndev,
> >  		(1 << HWTSTAMP_FILTER_NONE) |
> >  		(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
> >  		(1 << HWTSTAMP_FILTER_ALL);
> > -	info->phc_index = ptp_clock_index(priv->ptp.clock);
> > +	if (data->features & RAVB_PTP)
> 
>    Again, not transparent...

See above.

> 
> > +		info->phc_index = ptp_clock_index(priv->ptp.clock);
> >
> >  	return 0;
> >  }
> [...]
> > @@ -1992,14 +2009,20 @@ static int ravb_set_gti(struct net_device
> > *ndev)  static void ravb_set_config_mode(struct net_device *ndev)  {
> >  	struct ravb_private *priv = netdev_priv(ndev);
> > +	const struct ravb_drv_data *info = priv->info;
> >
> > -	if (priv->chip_id == RCAR_GEN2) {
> > +	switch (info->features & RAVB_PTP) {
> > +	case RAVB_PTP_CONFIG_INACTIVE:
> >  		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
> >  		/* Set CSEL value */
> >  		ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
> > -	} else {
> > +		break;
> > +	case RAVB_PTP_CONFIG_ACTIVE:
> >  		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG |
> >  			    CCC_GAC | CCC_CSEL_HPB);
> > +		break;
> > +	default:
> > +		ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
>    Not trasparent again...

See above.

First Case is for R-Car Gen3 where ptp is active in config mode.
Second Case is for R-Car Gen2 where ptp is not active in config mode.
Third Case is default for RZ/G2L where ptp is not present.

Do you see any issues with this?

> 
> [...]
> > @@ -2182,13 +2205,15 @@ static int ravb_probe(struct platform_device
> *pdev)
> >  	/* Set AVB config mode */
> >  	ravb_set_config_mode(ndev);
> >
> > -	/* Set GTI value */
> > -	error = ravb_set_gti(ndev);
> > -	if (error)
> > -		goto out_disable_refclk;
> > +	if (info->features & RAVB_PTP) {
> 
>    Not transparent enough yet again...

See above.

> 
> > +		/* Set GTI value */
> > +		error = ravb_set_gti(ndev);
> > +		if (error)
> > +			goto out_disable_refclk;
> >
> > -	/* Request GTI loading */
> > -	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
> > +		/* Request GTI loading */
> > +		ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
> > +	}
> >
> >  	if (priv->chip_id != RCAR_GEN2) {
> >  		ravb_parse_delay_mode(np, ndev);
> [...]
> > @@ -2377,13 +2404,15 @@ static int __maybe_unused ravb_resume(struct
> device *dev)
> >  	/* Set AVB config mode */
> >  	ravb_set_config_mode(ndev);
> >
> > -	/* Set GTI value */
> > -	ret = ravb_set_gti(ndev);
> > -	if (ret)
> > -		return ret;
> > +	if (info->features & RAVB_PTP) {
> 
>    Not transparent enough again...

See above.

Cheers,
Biju

  reply	other threads:[~2021-07-26  9:01 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 14:13 [PATCH net-next 00/18] Add Gigabit Ethernet driver support Biju Das
2021-07-22 14:13 ` [PATCH net-next 01/18] dt-bindings: net: renesas,etheravb: Document Gigabit Ethernet IP Biju Das
2021-07-22 14:13 ` [PATCH net-next 02/18] drivers: clk: renesas: rzg2l-cpg: Add support to handle MUX clocks Biju Das
2021-07-23 10:26   ` Sergei Shtylyov
2021-07-23 12:12     ` Biju Das
2021-07-26 10:53   ` Geert Uytterhoeven
2021-07-26 12:23     ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 03/18] drivers: clk: renesas: r9a07g044-cpg: Add ethernet clock sources Biju Das
2021-07-26 10:50   ` Geert Uytterhoeven
2021-07-26 11:43     ` Biju Das
2021-07-26 11:50       ` Geert Uytterhoeven
2021-07-22 14:13 ` [PATCH net-next 04/18] drivers: clk: renesas: r9a07g044-cpg: Add GbEthernet clock/reset Biju Das
2021-07-26 10:11   ` Geert Uytterhoeven
2021-07-26 10:18     ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 05/18] ravb: Replace chip type with a structure for driver data Biju Das
2021-07-22 20:42   ` Sergei Shtylyov
2021-07-23  6:08     ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 06/18] ravb: Factorise ptp feature Biju Das
2021-07-23 20:56   ` Sergei Shtylyov
2021-07-26  9:01     ` Biju Das [this message]
2021-07-26 13:08       ` Andrew Lunn
2021-07-26 13:41         ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 07/18] ravb: Add features specific to R-Car Gen3 Biju Das
2021-07-22 14:13 ` [PATCH net-next 08/18] ravb: Add R-Car common features Biju Das
2021-07-27 20:48   ` Sergei Shtylyov
2021-07-28 10:13     ` Biju Das
2021-07-28 13:45       ` Andrew Lunn
2021-07-29 15:10         ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 09/18] ravb: Factorise ravb_ring_free function Biju Das
2021-07-29 18:02   ` Sergei Shtylyov
2021-07-30  6:21     ` Biju Das
2021-08-20 15:32       ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 10/18] ravb: Factorise ravb_ring_format function Biju Das
2021-07-29 18:30   ` Sergei Shtylyov
2021-07-30  6:24     ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 11/18] ravb: Factorise ravb_ring_init function Biju Das
2021-07-29 18:53   ` Sergei Shtylyov
2021-07-30  6:54     ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 12/18] ravb: Factorise {emac,dmac} init function Biju Das
2021-08-02 19:41   ` Sergei Shtylyov
2021-08-20 15:42     ` Biju Das
2021-08-20 18:57       ` Sergey Shtylyov
2021-08-20 19:44         ` Biju Das
2021-07-22 14:13 ` [PATCH net-next 13/18] ravb: Factorise ravb_rx function Biju Das
2021-07-22 14:13 ` [PATCH net-next 14/18] ravb: Factorise ravb_adjust_link function Biju Das
2021-07-22 14:13 ` [PATCH net-next 15/18] ravb: Factorise ravb_set_features Biju Das
2021-07-22 14:13 ` [PATCH net-next 16/18] ravb: Add reset support Biju Das
2021-07-22 14:13 ` [PATCH net-next 17/18] ravb: Add GbEthernet driver support Biju Das
2021-07-22 14:13 ` [PATCH net-next 18/18] arm64: dts: renesas: r9a07g044: Add GbEther nodes Biju Das
2021-07-22 20:53 ` [PATCH net-next 00/18] Add Gigabit Ethernet driver support Sergei Shtylyov
2021-07-22 21:07   ` Andrew Lunn
2021-07-23  6:28     ` Biju Das
2021-07-26 10:55       ` Geert Uytterhoeven
2021-07-26 13:49         ` Arnd Bergmann
2021-07-23  6:23   ` Biju Das

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=OS0PR01MB5922DF642B0549BFCFCDA77C86E89@OS0PR01MB5922.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=aford173@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ashiduka@fujitsu.com \
    --cc=biju.das@bp.renesas.com \
    --cc=davem@davemloft.net \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.shtylyov@omprussia.ru \
    --cc=sergei.shtylyov@gmail.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    --subject='RE: [PATCH net-next 06/18] ravb: Factorise ptp feature' \
    /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

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).