From: <Tristram.Ha@microchip.com>
To: Woojung Huh <woojung.huh@microchip.com>,
Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
Rob Herring <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
Simon Horman <horms@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Marek Vasut <marex@denx.de>, <UNGLinuxDriver@microchip.com>,
<devicetree@vger.kernel.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Tristram Ha <tristram.ha@microchip.com>
Subject: [PATCH net-next v5 4/6] net: dsa: microchip: Write switch MAC address differently for KSZ8463
Date: Tue, 22 Jul 2025 19:26:10 -0700 [thread overview]
Message-ID: <20250723022612.38535-5-Tristram.Ha@microchip.com> (raw)
In-Reply-To: <20250723022612.38535-1-Tristram.Ha@microchip.com>
From: Tristram Ha <tristram.ha@microchip.com>
KSZ8463 uses 16-bit register definitions so it writes differently for
8-bit switch MAC address.
Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/microchip/ksz_common.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 552c993b6519..e47c4a5aad6f 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -4821,7 +4821,16 @@ int ksz_switch_macaddr_get(struct dsa_switch *ds, int port,
/* Program the switch MAC address to hardware */
for (i = 0; i < ETH_ALEN; i++) {
- ret = ksz_write8(dev, regs[REG_SW_MAC_ADDR] + i, addr[i]);
+ if (ksz_is_ksz8463(dev)) {
+ u16 addr16 = ((u16)addr[i] << 8) | addr[i + 1];
+
+ ret = ksz_write16(dev, regs[REG_SW_MAC_ADDR] + i,
+ addr16);
+ i++;
+ } else {
+ ret = ksz_write8(dev, regs[REG_SW_MAC_ADDR] + i,
+ addr[i]);
+ }
if (ret)
goto macaddr_drop;
}
--
2.34.1
next prev parent reply other threads:[~2025-07-23 2:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 2:26 [PATCH net-next v5 0/6] net: dsa: microchip: Add KSZ8463 switch support Tristram.Ha
2025-07-23 2:26 ` [PATCH net-next v5 1/6] dt-bindings: " Tristram.Ha
2025-07-23 2:26 ` [PATCH net-next v5 2/6] net: dsa: microchip: Add KSZ8463 switch support to KSZ DSA driver Tristram.Ha
2025-07-23 17:09 ` Andrew Lunn
2025-07-23 17:16 ` Andrew Lunn
2025-07-23 2:26 ` [PATCH net-next v5 3/6] net: dsa: microchip: Use different registers for KSZ8463 Tristram.Ha
2025-07-23 16:26 ` Simon Horman
2025-07-23 2:26 ` Tristram.Ha [this message]
2025-07-23 2:26 ` [PATCH net-next v5 5/6] net: dsa: microchip: Setup fiber ports " Tristram.Ha
2025-07-23 2:26 ` [PATCH net-next v5 6/6] net: dsa: microchip: Disable PTP function of KSZ8463 Tristram.Ha
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=20250723022612.38535-5-Tristram.Ha@microchip.com \
--to=tristram.ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=woojung.huh@microchip.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