From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Biju Das <biju.das.jz@bp.renesas.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, 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 12/18] ravb: Factorise {emac,dmac} init function
Date: Mon, 2 Aug 2021 22:41:48 +0300 [thread overview]
Message-ID: <1bd80ea3-c216-a42a-c46c-0bb13173d793@gmail.com> (raw)
In-Reply-To: <20210722141351.13668-13-biju.das.jz@bp.renesas.com>
Hello!
On 7/22/21 5:13 PM, Biju Das wrote:
> The R-Car AVB module has Magic packet detection, multiple irq's and
> timestamp enable features which is not present on RZ/G2L Gigabit
^ are
> Ethernet module. Factorise emac and dmac initialization function to
> support the later SoC.
>
> 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 | 2 +
> drivers/net/ethernet/renesas/ravb_main.c | 58 ++++++++++++++++--------
> 2 files changed, 40 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> index d82bfa6e57c1..4d5910dcda86 100644
> --- a/drivers/net/ethernet/renesas/ravb.h
> +++ b/drivers/net/ethernet/renesas/ravb.h
> @@ -992,6 +992,8 @@ struct ravb_ops {
> void (*ring_free)(struct net_device *ndev, int q);
> void (*ring_format)(struct net_device *ndev, int q);
> bool (*alloc_rx_desc)(struct net_device *ndev, int q);
> + void (*emac_init)(struct net_device *ndev);
> + void (*dmac_init)(struct net_device *ndev);
> };
>
> struct ravb_drv_data {
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 3d0f6598b936..e200114376e4 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -454,7 +454,7 @@ static int ravb_ring_init(struct net_device *ndev, int q)
> }
>
> /* E-MAC init function */
> -static void ravb_emac_init(struct net_device *ndev)
> +static void ravb_emac_init_ex(struct net_device *ndev)
> {
> /* Receive frame limit set register */
> ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR);
> @@ -480,30 +480,19 @@ static void ravb_emac_init(struct net_device *ndev)
> ravb_write(ndev, ECSIPR_ICDIP | ECSIPR_MPDIP | ECSIPR_LCHNGIP, ECSIPR);
> }
>
> -/* Device init function for Ethernet AVB */
Grr, this comment seems oudated...
> -static int ravb_dmac_init(struct net_device *ndev)
> +static void ravb_emac_init(struct net_device *ndev)
> {
> struct ravb_private *priv = netdev_priv(ndev);
> const struct ravb_drv_data *info = priv->info;
> - int error;
>
> - /* Set CONFIG mode */
> - error = ravb_config(ndev);
> - if (error)
> - return error;
> -
> - error = ravb_ring_init(ndev, RAVB_BE);
> - if (error)
> - return error;
> - error = ravb_ring_init(ndev, RAVB_NC);
> - if (error) {
> - ravb_ring_free(ndev, RAVB_BE);
> - return error;
> - }
> + info->ravb_ops->emac_init(ndev);
> +}
The whole ravb_emac_init() now consists only of a single method call?
Why do we need it at all?
>
> - /* Descriptor format */
> - ravb_ring_format(ndev, RAVB_BE);
> - ravb_ring_format(ndev, RAVB_NC);
> +/* Device init function for Ethernet AVB */
s/Device/DMAC/. Or this comment shouldn't have been moved.
> +static void ravb_dmac_init_ex(struct net_device *ndev)
Please no _ex suffixes -- reminds me of Windoze too much. :-)
> +{
> + struct ravb_private *priv = netdev_priv(ndev);
> + const struct ravb_drv_data *info = priv->info;
>
> /* Set AVB RX */
> ravb_write(ndev,
> @@ -530,6 +519,33 @@ static int ravb_dmac_init(struct net_device *ndev)
> ravb_write(ndev, RIC2_QFE0 | RIC2_QFE1 | RIC2_RFFE, RIC2);
> /* Frame transmitted, timestamp FIFO updated */
> ravb_write(ndev, TIC_FTE0 | TIC_FTE1 | TIC_TFUE, TIC);
> +}
> +
> +static int ravb_dmac_init(struct net_device *ndev)
> +{
> + struct ravb_private *priv = netdev_priv(ndev);
> + const struct ravb_drv_data *info = priv->info;
> + int error;
> +
> + /* Set CONFIG mode */
> + error = ravb_config(ndev);
> + if (error)
> + return error;
> +
> + error = ravb_ring_init(ndev, RAVB_BE);
> + if (error)
> + return error;
> + error = ravb_ring_init(ndev, RAVB_NC);
> + if (error) {
> + ravb_ring_free(ndev, RAVB_BE);
> + return error;
> + }
> +
> + /* Descriptor format */
> + ravb_ring_format(ndev, RAVB_BE);
> + ravb_ring_format(ndev, RAVB_NC);
> +
> + info->ravb_ops->dmac_init(ndev);
>
> /* Setting the control will start the AVB-DMAC process. */
> ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_OPERATION);
> @@ -2018,6 +2034,8 @@ static const struct ravb_ops ravb_gen3_ops = {
> .ring_free = ravb_ring_free_rx,
> .ring_format = ravb_ring_format_rx,
> .alloc_rx_desc = ravb_alloc_rx_desc,
> + .emac_init = ravb_emac_init_ex,
> + .dmac_init = ravb_dmac_init_ex,
Hmm, why not also gen2?!
> };
[...]
MBR, Sergei
next prev parent reply other threads:[~2021-08-02 19:41 UTC|newest]
Thread overview: 42+ 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 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
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 [this message]
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 20:53 ` [PATCH net-next 00/18] Add Gigabit Ethernet " 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=1bd80ea3-c216-a42a-c46c-0bb13173d793@gmail.com \
--to=sergei.shtylyov@gmail.com \
--cc=Chris.Paterson2@renesas.com \
--cc=aford173@gmail.com \
--cc=andrew@lunn.ch \
--cc=ashiduka@fujitsu.com \
--cc=biju.das.jz@bp.renesas.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=yoshihiro.shimoda.uh@renesas.com \
/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).