From: Daniel Golle <daniel@makrotopia.org>
To: Sky Huang <SkyLake.Huang@mediatek.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Qingfang Deng <dqfext@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Steven Liu <Steven.Liu@mediatek.com>
Subject: Re: [PATCH net-next 3/3] net: phy: mediatek: add driver for built-in 2.5G ethernet PHY on MT7988
Date: Thu, 16 Jan 2025 01:58:23 +0000 [thread overview]
Message-ID: <Z4hnv2lzy8Ntd_Hp@makrotopia.org> (raw)
In-Reply-To: <20250116012159.3816135-4-SkyLake.Huang@mediatek.com>
Hi Sky,
On Thu, Jan 16, 2025 at 09:21:58AM +0800, Sky Huang wrote:
> From: Sky Huang <skylake.huang@mediatek.com>
>
> Add support for internal 2.5Gphy on MT7988. This driver will load
> necessary firmware and add appropriate time delay to make sure
> that firmware works stably. Also, certain control registers will
> be set to fix link-up issues.
>
> Signed-off-by: Sky Huang <skylake.huang@mediatek.com>
> ---
> MAINTAINERS | 1 +
> drivers/net/phy/mediatek/Kconfig | 11 +
> drivers/net/phy/mediatek/Makefile | 1 +
> drivers/net/phy/mediatek/mtk-2p5ge.c | 343 +++++++++++++++++++++++++++
> 4 files changed, 356 insertions(+)
> create mode 100644 drivers/net/phy/mediatek/mtk-2p5ge.c
>
> [...]
> +static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)
> +{
> + struct mtk_i2p5ge_phy_priv *priv;
> +
> + priv = devm_kzalloc(&phydev->mdio.dev,
> + sizeof(struct mtk_i2p5ge_phy_priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + switch (phydev->drv->phy_id) {
> + case MTK_2P5GPHY_ID_MT7988:
> + /* The original hardware only sets MDIO_DEVS_PMAPMD */
> + phydev->c45_ids.mmds_present |= MDIO_DEVS_PCS |
> + MDIO_DEVS_AN |
> + MDIO_DEVS_VEND1 |
> + MDIO_DEVS_VEND2;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + priv->fw_loaded = false;
> + phydev->priv = priv;
> +
> + mtk_phy_leds_state_init(phydev);
Calling mtk_phy_leds_state_init() can't work without also defining
led_hw_control_get() for that driver.
This is what mtk_phy_leds_state_init() does:
for (i = 0; i < 2; ++i)
phydev->drv->led_hw_control_get(phydev, i, NULL);
The driver lacking led_hw_control_get() method (see below) will make
this a call to a NULL function pointer.
Imho it's fine to add the driver without support for the LEDs for now
and add LED support later on. But in that case you also shouldn't call
mtk_phy_leds_state_init().
> +
> + return 0;
> +}
> +
> +static struct phy_driver mtk_2p5gephy_driver[] = {
> + {
> + PHY_ID_MATCH_MODEL(MTK_2P5GPHY_ID_MT7988),
> + .name = "MediaTek MT7988 2.5GbE PHY",
> + .probe = mt798x_2p5ge_phy_probe,
> + .config_init = mt798x_2p5ge_phy_config_init,
> + .config_aneg = mt798x_2p5ge_phy_config_aneg,
> + .get_features = mt798x_2p5ge_phy_get_features,
> + .read_status = mt798x_2p5ge_phy_read_status,
> + .get_rate_matching = mt798x_2p5ge_phy_get_rate_matching,
> + .suspend = genphy_suspend,
> + .resume = genphy_resume,
> + .read_page = mtk_phy_read_page,
> + .write_page = mtk_phy_write_page,
> + },
> +};
> +
> +module_phy_driver(mtk_2p5gephy_driver);
> +
> +static struct mdio_device_id __maybe_unused mtk_2p5ge_phy_tbl[] = {
> + { PHY_ID_MATCH_VENDOR(0x00339c00) },
> + { }
> +};
> +
> +MODULE_DESCRIPTION("MediaTek 2.5Gb Ethernet PHY driver");
> +MODULE_AUTHOR("SkyLake Huang <SkyLake.Huang@mediatek.com>");
> +MODULE_LICENSE("GPL");
> +
> +MODULE_DEVICE_TABLE(mdio, mtk_2p5ge_phy_tbl);
> +MODULE_FIRMWARE(MT7988_2P5GE_PMB_FW);
> --
> 2.45.2
>
next prev parent reply other threads:[~2025-01-16 2:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 1:21 [PATCH net-next 0/3] net: phy: mediatek: Add token-ring ops Sky Huang
2025-01-16 1:21 ` [PATCH net-next 1/3] net: phy: mediatek: Add token ring access helper functions in mtk-phy-lib Sky Huang
2025-01-16 12:55 ` Krzysztof Kozlowski
2025-01-19 17:12 ` Andrew Lunn
2025-02-13 7:39 ` SkyLake Huang (黃啟澤)
2025-02-13 13:29 ` Andrew Lunn
2025-02-13 13:43 ` Daniel Golle
2025-02-13 15:34 ` Andrew Lunn
2025-02-14 3:35 ` SkyLake Huang (黃啟澤)
2025-02-16 16:39 ` Andrew Lunn
2025-01-16 1:21 ` [PATCH net-next 2/3] net: phy: mediatek: Move some macros to phy-lib for later use Sky Huang
2025-01-19 17:20 ` Andrew Lunn
2025-01-16 1:21 ` [PATCH net-next 3/3] net: phy: mediatek: add driver for built-in 2.5G ethernet PHY on MT7988 Sky Huang
2025-01-16 1:58 ` Daniel Golle [this message]
2025-01-19 17:35 ` Andrew Lunn
2025-02-14 13:13 ` SkyLake Huang (黃啟澤)
2025-01-16 12:45 ` Krzysztof Kozlowski
2025-02-14 13:23 ` SkyLake Huang (黃啟澤)
2025-02-14 15:31 ` Krzysztof Kozlowski
2025-01-16 12:51 ` Krzysztof Kozlowski
2025-01-19 17:31 ` Andrew Lunn
2025-02-14 13:25 ` SkyLake Huang (黃啟澤)
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=Z4hnv2lzy8Ntd_Hp@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=SkyLake.Huang@mediatek.com \
--cc=Steven.Liu@mediatek.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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