netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Felix Fietkau <nbd@nbd.name>, Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
	lorenzo.bianconi83@gmail.com
Subject: Re: [PATCH net-next] net: airoha: configure hw mac address according to the port id
Date: Tue, 20 Aug 2024 15:33:49 -0700	[thread overview]
Message-ID: <20240820153349.2accb2fe@kernel.org> (raw)
In-Reply-To: <20240819-airoha-eth-wan-mac-addr-v1-1-e8d7c13b3182@kernel.org>

On Mon, 19 Aug 2024 13:10:09 +0200 Lorenzo Bianconi wrote:
> GDM1 port on EN7581 SoC is connected to the lan dsa switch.
> GDM{2,3,4} can be used as wan port connected to an external
> phy module. Configure hw mac address registers according to the port id.
> 
> ---
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

nit: sign-off under ---

>  drivers/net/ethernet/mediatek/airoha_eth.c | 33 +++++++++++++++++++++++-------
>  1 file changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
> index 1fb46db0c1e9..4914565c2fac 100644
> --- a/drivers/net/ethernet/mediatek/airoha_eth.c
> +++ b/drivers/net/ethernet/mediatek/airoha_eth.c
> @@ -67,6 +67,10 @@
>  #define FE_RST_GDM3_MBI_ARB_MASK	BIT(2)
>  #define FE_RST_CORE_MASK		BIT(0)
>  
> +#define REG_FE_WAN_MAC_H		0x0030
> +#define REG_FE_WAN_MAC_LMIN		0x0034
> +#define REG_FE_WAN_MAC_LMAX		0x0038
> +
>  #define REG_FE_LAN_MAC_H		0x0040
>  #define REG_FE_LAN_MAC_LMIN		0x0044
>  #define REG_FE_LAN_MAC_LMAX		0x0048

Isn't it better to define the base address and offsets?

#define REG_FE_MAC_BASE_WAN	0x0030
#define REG_FE_MAC_BASE_LAN	0x0040
#define REG_FE_MAC_OFF_H		0x00
#define REG_FE_MAC_OFF_LMIN		0x04
#define REG_FE_MAC_OFF_LMAX		0x08

Then you only need to select the base and the rest of the code won't
have conditionals (marginally improving readability)
-- 
pw-bot: cr

      parent reply	other threads:[~2024-08-20 22:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 11:10 [PATCH net-next] net: airoha: configure hw mac address according to the port id Lorenzo Bianconi
2024-08-20 21:43 ` Jacob Keller
2024-08-20 22:33 ` Jakub Kicinski [this message]

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=20240820153349.2accb2fe@kernel.org \
    --to=kuba@kernel.org \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.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).