From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Frank Wunderlich <frank-w@public-files.de>,
Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>,
daniel@makrotopia.org, dqfext@gmail.com,
SkyLake.Huang@mediatek.com, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH AUTOSEL 6.15 029/118] net: phy: mediatek: do not require syscon compatible for pio property
Date: Tue, 3 Jun 2025 20:49:20 -0400 [thread overview]
Message-ID: <20250604005049.4147522-29-sashal@kernel.org> (raw)
In-Reply-To: <20250604005049.4147522-1-sashal@kernel.org>
From: Frank Wunderlich <frank-w@public-files.de>
[ Upstream commit 15d7b3dfafa98270eade6c77d2336790dde0a40d ]
Current implementation requires syscon compatible for pio property
which is used for driving the switch leds on mt7988.
Replace syscon_regmap_lookup_by_phandle with of_parse_phandle and
device_node_to_regmap to get the regmap already assigned by pinctrl
driver.
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Link: https://patch.msgid.link/20250510174933.154589-1-linux@fw-web.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
**YES** This commit should be backported to stable kernel trees. ##
Analysis ### Core Issue Being Fixed The commit addresses a **device tree
compatibility problem** in the MediaTek MT7988 PHY driver. The original
code used `syscon_regmap_lookup_by_phandle()` which **requires** the
target device node to have a "syscon" compatible string. This created an
artificial requirement that forced users to modify their device trees
even when the pinctrl driver already provided the necessary regmap. ###
Code Changes Analysis The change is minimal but significant: ```c //
OLD: Forces syscon compatible requirement regmap =
syscon_regmap_lookup_by_phandle(np, "mediatek,pio"); // NEW: Works with
any regmap provider pio_np = of_parse_phandle(np, "mediatek,pio", 0);
regmap = device_node_to_regmap(pio_np); of_node_put(pio_np); ``` **Key
differences:** - `syscon_regmap_lookup_by_phandle()` requires "syscon"
compatible - `device_node_to_regmap()` works with any device that has
registered a regmap - Proper error handling maintained with
`of_node_put()` ### Why This Should Be Backported **1. Fixes Real User
Issues:** - MT7988 hardware is actively deployed (BananaPi R4,
networking devices) - Users cannot use PHY LED functionality without
modifying device trees - This affects real hardware in production, not
just development boards **2. Low Risk Change:** - Only 9 insertions, 1
deletion - No functional behavior change - same register access, same
error paths - Uses well-established kernel APIs - **Backward
compatible:** Still works with DTs that have syscon compatible -
**Forward compatible:** Also works with DTs that don't have syscon
compatible **3. High Impact Fix:** - Removes artificial device tree
constraints - Enables legitimate hardware configurations without DT
hacks - Prevents fragmentation of MT7988 ecosystem across kernel
versions - LED functionality is important for networking hardware
visibility **4. Fits Stable Criteria:** - Fixes important functionality
for users - Does not introduce new features - No architectural changes -
Confined to one driver/subsystem - Minimal regression risk ###
Comparison to Similar Commits Looking at the historical examples
provided, this commit is similar to "clk: mediatek: Get regmap without
syscon compatible check" which also moved from `syscon_node_to_regmap()`
to `device_node_to_regmap()` for the same compatibility reasons. The
pattern of removing unnecessary syscon requirements is well-established
and safe. ### Real-World Impact Without this fix, users with legitimate
device trees (where pinctrl doesn't have syscon compatible) cannot use
MT7988 PHY LED functionality. This forces them to either: 1. Patch their
device trees (not always possible in production) 2. Use older kernel
versions 3. Lose LED functionality entirely The commit solves a
**compatibility regression** rather than adding new functionality,
making it an ideal stable backport candidate.
drivers/net/phy/mediatek/mtk-ge-soc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/mediatek/mtk-ge-soc.c b/drivers/net/phy/mediatek/mtk-ge-soc.c
index 175cf5239bba8..21975ef946d5b 100644
--- a/drivers/net/phy/mediatek/mtk-ge-soc.c
+++ b/drivers/net/phy/mediatek/mtk-ge-soc.c
@@ -7,6 +7,7 @@
#include <linux/pinctrl/consumer.h>
#include <linux/phy.h>
#include <linux/regmap.h>
+#include <linux/of.h>
#include "../phylib.h"
#include "mtk.h"
@@ -1319,6 +1320,7 @@ static int mt7988_phy_probe_shared(struct phy_device *phydev)
{
struct device_node *np = dev_of_node(&phydev->mdio.bus->dev);
struct mtk_socphy_shared *shared = phy_package_get_priv(phydev);
+ struct device_node *pio_np;
struct regmap *regmap;
u32 reg;
int ret;
@@ -1336,7 +1338,13 @@ static int mt7988_phy_probe_shared(struct phy_device *phydev)
* The 4 bits in TPBANK0 are kept as package shared data and are used to
* set LED polarity for each of the LED0.
*/
- regmap = syscon_regmap_lookup_by_phandle(np, "mediatek,pio");
+ pio_np = of_parse_phandle(np, "mediatek,pio", 0);
+ if (!pio_np)
+ return -ENODEV;
+
+ regmap = device_node_to_regmap(pio_np);
+ of_node_put(pio_np);
+
if (IS_ERR(regmap))
return PTR_ERR(regmap);
--
2.39.5
next prev parent reply other threads:[~2025-06-04 0:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250604005049.4147522-1-sashal@kernel.org>
2025-06-04 0:48 ` [PATCH AUTOSEL 6.15 008/118] wifi: mt76: mt7996: drop fragments with multicast or broadcast RA Sasha Levin
2025-06-04 0:49 ` [PATCH AUTOSEL 6.15 010/118] Bluetooth: btusb: Add new VID/PID 13d3/3630 for MT7925 Sasha Levin
2025-06-04 0:49 ` [PATCH AUTOSEL 6.15 014/118] Bluetooth: btmtksdio: Fix wakeup source leaks on device unbind Sasha Levin
2025-06-04 0:49 ` [PATCH AUTOSEL 6.15 015/118] wifi: mt76: mt7996: fix uninitialized symbol warning Sasha Levin
2025-06-04 0:49 ` [PATCH AUTOSEL 6.15 016/118] wifi: mt76: mt76x2: Add support for LiteOn WN4516R,WN4519R Sasha Levin
2025-06-04 0:49 ` [PATCH AUTOSEL 6.15 017/118] wifi: mt76: mt7921: add 160 MHz AP for mt7922 device Sasha Levin
2025-06-04 0:49 ` [PATCH AUTOSEL 6.15 018/118] wifi: mt76: mt7925: introduce thermal protection Sasha Levin
2025-06-04 0:49 ` Sasha Levin [this message]
2025-06-04 0:50 ` [PATCH AUTOSEL 6.15 070/118] tracing: Only return an adjusted address if it matches the kernel address Sasha Levin
2025-06-04 1:15 ` Steven Rostedt
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=20250604005049.4147522-29-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=SkyLake.Huang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=daniel@makrotopia.org \
--cc=dqfext@gmail.com \
--cc=frank-w@public-files.de \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®