From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: <Tristram.Ha@microchip.com>
Cc: 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>,
"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>
Subject: Re: [PATCH net-next 6/6 v2] net: dsa: microchip: Setup fiber ports for KSZ8463
Date: Tue, 8 Jul 2025 12:22:37 +0200 [thread overview]
Message-ID: <20250708122237.08f4dd7c@device-24.home> (raw)
In-Reply-To: <20250708031648.6703-7-Tristram.Ha@microchip.com>
Hi Tristram,
On Mon, 7 Jul 2025 20:16:48 -0700
<Tristram.Ha@microchip.com> wrote:
> From: Tristram Ha <tristram.ha@microchip.com>
>
> The fiber ports in KSZ8463 cannot be detected internally, so it requires
> specifying that condition in the device tree. Like the one used in
> Micrel PHY the port link can only be read and there is no write to the
> PHY. The driver programs registers to operate fiber ports correctly.
>
> The PTP function of the switch is also turned off as it may interfere the
> normal operation of the MAC.
>
> Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
> ---
> drivers/net/dsa/microchip/ksz8.c | 26 ++++++++++++++++++++++++++
> drivers/net/dsa/microchip/ksz_common.c | 3 +++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/net/dsa/microchip/ksz8.c b/drivers/net/dsa/microchip/ksz8.c
> index 904db68e11f3..1207879ef80c 100644
> --- a/drivers/net/dsa/microchip/ksz8.c
> +++ b/drivers/net/dsa/microchip/ksz8.c
> @@ -1715,6 +1715,7 @@ void ksz8_config_cpu_port(struct dsa_switch *ds)
> const u32 *masks;
> const u16 *regs;
> u8 remote;
> + u8 fiber_ports = 0;
> int i;
>
> masks = dev->info->masks;
> @@ -1745,6 +1746,31 @@ void ksz8_config_cpu_port(struct dsa_switch *ds)
> else
> ksz_port_cfg(dev, i, regs[P_STP_CTRL],
> PORT_FORCE_FLOW_CTRL, false);
> + if (p->fiber)
> + fiber_ports |= (1 << i);
> + }
> + if (ksz_is_ksz8463(dev)) {
> + /* Setup fiber ports. */
What does fiber port mean ? Is it 100BaseFX ? As this configuration is
done only for the CPU port (it seems), looks like this mode is planned
to be used as the MAC to MAC mode on the DSA conduit. So, instead of
using this property maybe you should implement that as handling the
"100base-x" phy-mode ?
> + if (fiber_ports) {
> + regmap_update_bits(ksz_regmap_16(dev),
> + reg16(dev, KSZ8463_REG_CFG_CTRL),
> + fiber_ports << PORT_COPPER_MODE_S,
> + 0);
> + regmap_update_bits(ksz_regmap_16(dev),
> + reg16(dev, KSZ8463_REG_DSP_CTRL_6),
> + COPPER_RECEIVE_ADJUSTMENT, 0);
> + }
> +
> + /* Turn off PTP function as the switch's proprietary way of
> + * handling timestamp is not supported in current Linux PTP
> + * stack implementation.
> + */
> + regmap_update_bits(ksz_regmap_16(dev),
> + reg16(dev, KSZ8463_PTP_MSG_CONF1),
> + PTP_ENABLE, 0);
> + regmap_update_bits(ksz_regmap_16(dev),
> + reg16(dev, KSZ8463_PTP_CLK_CTRL),
> + PTP_CLK_ENABLE, 0);
> }
> }
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index c08e6578a0df..b3153b45ced9 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -5441,6 +5441,9 @@ int ksz_switch_register(struct ksz_device *dev)
> &dev->ports[port_num].interface);
>
> ksz_parse_rgmii_delay(dev, port_num, port);
> + dev->ports[port_num].fiber =
> + of_property_read_bool(port,
> + "micrel,fiber-mode");
Shouldn't this be described in the binding ?
> }
> of_node_put(ports);
> }
Maxime
next prev parent reply other threads:[~2025-07-08 10:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 3:16 [PATCH net-next 0/6 v2] net: dsa: microchip: Add KSZ8463 switch support Tristram.Ha
2025-07-08 3:16 ` [PATCH net-next 1/6 v2] dt-bindings: " Tristram.Ha
2025-07-08 8:12 ` Krzysztof Kozlowski
2025-07-08 14:18 ` Andrew Lunn
2025-07-08 3:16 ` [PATCH net-next 2/6 v2] net: dsa: microchip: Add KSZ8463 switch support to KSZ DSA driver Tristram.Ha
2025-07-08 3:16 ` [PATCH net-next 3/6 v2] net: dsa: microchip: Transform register for use with KSZ8463 Tristram.Ha
2025-07-08 3:16 ` [PATCH net-next 4/6 v2] net: dsa: microchip: Use different registers for KSZ8463 Tristram.Ha
2025-07-08 14:13 ` Jakub Kicinski
2025-07-08 3:16 ` [PATCH net-next 5/6 v2] net: dsa: microchip: Write switch MAC address differently " Tristram.Ha
2025-07-08 14:19 ` Andrew Lunn
2025-07-08 3:16 ` [PATCH net-next 6/6 v2] net: dsa: microchip: Setup fiber ports " Tristram.Ha
2025-07-08 10:22 ` Maxime Chevallier [this message]
2025-07-08 19:45 ` Tristram.Ha
2025-07-09 5:51 ` Maxime Chevallier
2025-07-09 6:12 ` Maxime Chevallier
2025-07-09 23:02 ` Tristram.Ha
2025-07-08 14:22 ` Andrew Lunn
2025-07-08 19:41 ` 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=20250708122237.08f4dd7c@device-24.home \
--to=maxime.chevallier@bootlin.com \
--cc=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=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--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;
as well as URLs for NNTP newsgroup(s).