From: "Heiko Stübner" <heiko@sntech.de>
To: vkoul@kernel.org, kishon@kernel.org,
Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Cc: linux-phy@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
quentin.schulz@cherry.de,
Heiko Stuebner <heiko.stuebner@cherry.de>
Subject: Re: [PATCH 2/2] phy: phy-rockchip-samsung-hdptx: Don't use dt aliases to determine phy-id
Date: Fri, 06 Dec 2024 14:53:12 +0100 [thread overview]
Message-ID: <11259672.BaYr0rKQ5T@diego> (raw)
In-Reply-To: <87273a36-07f9-4224-bfff-63e905be9b0a@collabora.com>
Hi Cristian,
Am Freitag, 6. Dezember 2024, 12:26:35 CET schrieb Cristian Ciocaltea:
> On 12/6/24 12:34 PM, Heiko Stuebner wrote:
> > From: Heiko Stuebner <heiko.stuebner@cherry.de>
> >
> > The phy needs to know its identity in the system (phy0 or phy1 on rk3588)
> > for some actions and the driver currently contains code abusing of_alias
> > for that.
> >
> > Devicetree aliases are always optional and should not be used for core
> > device functionality, so instead keep a list of phys on a soc in the
> > of_device_data and find the phy-id by comparing against the mapped
> > register-base.
> >
> > Fixes: c4b09c562086 ("phy: phy-rockchip-samsung-hdptx: Add clock provider support")
> > Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
> > ---
> > .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 50 ++++++++++++++++---
> > 1 file changed, 44 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
> > index c5c64c209e96..b137f8c4d157 100644
> > --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
> > +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
> > @@ -385,11 +385,22 @@ enum rk_hdptx_reset {
> > RST_MAX
> > };
>
> [...]
>
> > +
> > + /* find the phy-id from the io address */
> > + hdptx->phy_id = -ENODEV;
> > + for (id = 0; id < hdptx->cfgs->num_phys; id++) {
> > + if (res->start == hdptx->cfgs->phy_ids[id]) {
> > + hdptx->phy_id = id;
> > + break;
> > + }
> > + }
> > +
> > + if (hdptx->phy_id < 0)
> > + return dev_err_probe(dev, -ENODEV, "no matching device found\n");
>
> Maybe we could simply fallback to assume phy1 doesn't exist in this
> case, which avoids the need to provide a match data with a single entry.
Personally I'm a fan of consistent behaviour, not things working
accidentially ;-) . See the usbdp phy for example, also declaring just
one phy using the same mechanism.
Also I really don't trust the hdptxphy-grf being stable over time.
Rockchip engineers always move bts around in those, so there will be a
need for platform-data at some point anyway.
> Regardless,
>
> Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
thanks :-)
Heiko
next prev parent reply other threads:[~2024-12-06 13:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 10:33 [PATCH 0/2] phy: phy-rockchip-samsung-hdptx: don't use of-alias Heiko Stuebner
2024-12-06 10:34 ` [PATCH 1/2] phy: phy-rockchip-samsung-hdptx: annotate regmap register-callback Heiko Stuebner
2024-12-06 11:18 ` Cristian Ciocaltea
2024-12-06 17:36 ` Heiko Stübner
2024-12-06 17:54 ` Cristian Ciocaltea
2024-12-06 10:34 ` [PATCH 2/2] phy: phy-rockchip-samsung-hdptx: Don't use dt aliases to determine phy-id Heiko Stuebner
2024-12-06 11:26 ` Cristian Ciocaltea
2024-12-06 13:53 ` Heiko Stübner [this message]
2024-12-06 16:59 ` [PATCH 0/2] phy: phy-rockchip-samsung-hdptx: don't use of-alias Sebastian Reichel
2025-02-09 21:18 ` Heiko Stübner
2025-02-10 17:21 ` Vinod Koul
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=11259672.BaYr0rKQ5T@diego \
--to=heiko@sntech.de \
--cc=cristian.ciocaltea@collabora.com \
--cc=heiko.stuebner@cherry.de \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=quentin.schulz@cherry.de \
--cc=vkoul@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