From: Andrew Lunn <andrew@lunn.ch>
To: David Yang <mmyangfl@gmail.com>
Cc: Kyle Switch <kyle.switch@motor-comm.com>,
olteanv@gmail.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
linux@armlinux.org.uk, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, ming.xu@motor-comm.com,
xiaolin.xu@motor-comm.com, jianmin.wang@motor-comm.com,
wei.zhang@gl-inet.com, sijia.huang@gl-inet.com
Subject: Re: [PATCH net-next v6 6/6] net: dsa: motorcomm: Add support for Motorcomm YT922x
Date: Wed, 9 Sep 2026 19:32:39 +0200 [thread overview]
Message-ID: <0aa20394-2042-4c52-b30b-cdd742d4da65@lunn.ch> (raw)
In-Reply-To: <CAAXyoMMLpaD5B4QojC0OKHxOFfPfFGpsS2nxCMT9e=nJeo8beg@mail.gmail.com>
> > +/**
> > + * Initialize serdes configuration based on interface mode.
> > + */
> > +static int yt922x_sds_init(struct yt921x_priv *priv, int port,
> > + phy_interface_t interface)
> > +{
> > + int addr;
> > + u16 data;
> > + int res;
> > +
> > + addr = yt922x_sds_phyaddr_get
> > + (port, YT922X_PHY_REG_TYPE_SDS_COMMON_EXT,
> > + YT922X_PHY_REG_SPACE_SGMII);
> > + if (addr < 0)
> > + return -EINVAL;
> > + /* write protect */
> > + res = yt921x_intif_ext_write(priv, addr, 0x4be, 0xd);
> > + if (res)
> > + return res;
> > + /* CDR */
> > + if (interface == PHY_INTERFACE_MODE_100BASEX) {
> > + res = yt921x_intif_ext_write(priv, addr, 0x406, 0x0);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x416, 0x3458);
> > + if (res)
> > + return res;
> > + } else {
> > + res = yt921x_intif_ext_write(priv, addr, 0x406, 0x800);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x416, 0x4558);
> > + if (res)
> > + return res;
> > + }
> > + /* PLL */
> > + if (interface == PHY_INTERFACE_MODE_USXGMII) {
> > + res = yt921x_intif_ext_write(priv, addr, 0x43a, 0x1006);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x43f, 0x3029);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x42a, 0xf070);
> > + if (res)
> > + return res;
> > + } else {
> > + res = yt921x_intif_ext_write(priv, addr, 0x43d, 0x207d);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x43c, 0x207d);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x43f, 0x3032);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x43a, 0x6);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x42a, 0xf070);
> > + if (res)
> > + return res;
> > + }
> > + /* VCO */
> > + res = yt921x_intif_ext_write(priv, addr, 0x439, 0xC0);
> > + if (res)
> > + return res;
> > + /* Vdac */
> > + res = yt921x_intif_ext_write(priv, addr, 0x492, 0x7f7f);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x491, 0x7f);
> > + if (res)
> > + return res;
> > + /* Eye */
> > + res = yt921x_intif_ext_write(priv, addr, 0x454, 0xf14);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x497, 0xa44);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x4cd, 0x0);
> > + if (res)
> > + return res;
> > +
> > + res = yt921x_intif_ext_write(priv, addr, 0x4af, 0x45e3);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x48a, 0xfff);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x408, 0x7c00);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x4d6, 0x7f);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x44f, 0xff08);
> > + if (res)
> > + return res;
> > + /* FFE */
> > + res = yt921x_intif_ext_write(priv, addr, 0x48e, 0x7d00);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0xd, 0x60f);
> > + if (res)
> > + return res;
> > + /* CTLE */
> > + res = yt921x_intif_ext_write(priv, addr, 0x4b0, 0x804);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x4b1, 0x7774);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x4af, 0x45e7);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x3, 0x5603);
> > + if (res)
> > + return res;
> > +
> > + msleep(20);
> > + res = yt921x_intif_ext_write(priv, addr, 0x492, 0x7fff);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x492, 0x7f7f);
> > + if (res)
> > + return res;
> > + /* CTLE */
> > + res = yt921x_intif_ext_write(priv, addr, 0x2000, 0x40);
> > + if (res)
> > + return res;
> > + res = yt921x_intif_ext_write(priv, addr, 0x2000, 0x0);
> > + if (res)
> > + return res;
> > +
> > + if (interface == PHY_INTERFACE_MODE_SGMII) {
> > + res = yt921x_intif_ext_write(priv, addr, 0x1042, 0x48c);
> > + if (res)
> > + return res;
> > + }
> > + /* soft reset */
> > + addr = yt922x_sds_phyaddr_get(port, YT922X_PHY_REG_TYPE_MII,
> > + YT922X_PHY_REG_SPACE_SGMII);
> > + if (addr < 0)
> > + return res;
> > + res = yt921x_intif_read(priv, addr, 0x0, &data);
> > + if (res)
> > + return res;
> > + data &= ~(1 << 15);
> > + res = yt921x_intif_write(priv, addr, 0x0, data);
> > + if (res)
> > + return res;
> > + addr = yt922x_sds_phyaddr_get(port, YT922X_PHY_REG_TYPE_MII,
> > + YT922X_PHY_REG_SPACE_USXGMII);
> > + if (addr < 0)
> > + return res;
> > + res = yt921x_intif_read(priv, addr, 0x0, &data);
> > + if (res)
> > + return res;
> > + data |= 1 << 15;
> > + res = yt921x_intif_write(priv, addr, 0x0, data);
> > + if (res)
> > + return res;
> > +
> > + return 0;
> > +}
>
> No one else, except you, can maintain this stuff. Drop it for now and
> discuss it later.
There also appears to be similar magic in the PHY driver. Can this be
consolidated?
Andrew
next prev parent reply other threads:[~2026-09-09 17:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 8:36 [PATCH net-next v6 0/6] net: dsa: motorcomm: add support yt922x driver Kyle Switch
2026-09-08 8:36 ` [PATCH net-next v6 1/6] net: dsa: motorcomm: initialize dsa_switch based on chipid Kyle Switch
2026-09-09 16:18 ` David Yang
2026-09-10 2:13 ` Kyle Switch
2026-09-08 8:36 ` [PATCH net-next v6 2/6] net: dsa: motorcomm: use max_ports in series for port bounds checking Kyle Switch
2026-09-08 8:36 ` [PATCH net-next v6 3/6] net: dsa: motorcomm: move mib start from probe() to dsa_setup() Kyle Switch
2026-09-08 8:36 ` [PATCH net-next v6 4/6] net: dsa: motorcomm: move mib stop from remove() to teardown() Kyle Switch
2026-09-08 8:36 ` [PATCH net-next v6 5/6] net: dsa: tag_yt922x: add support for Motorcomm YT922x tags Kyle Switch
2026-09-08 8:36 ` [PATCH net-next v6 6/6] net: dsa: motorcomm: Add support for Motorcomm YT922x Kyle Switch
2026-09-09 16:51 ` David Yang
2026-09-09 17:32 ` Andrew Lunn [this message]
2026-09-10 1:50 ` Kyle Switch
2026-09-10 1:57 ` Andrew Lunn
2026-09-10 3:23 ` Kyle Switch
2026-09-10 11:58 ` Andrew Lunn
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=0aa20394-2042-4c52-b30b-cdd742d4da65@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jianmin.wang@motor-comm.com \
--cc=kuba@kernel.org \
--cc=kyle.switch@motor-comm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=ming.xu@motor-comm.com \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=sijia.huang@gl-inet.com \
--cc=wei.zhang@gl-inet.com \
--cc=xiaolin.xu@motor-comm.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