Re: [PATCH v2 4/7] net: phy: add helper for mapping RGMII link speed to clock rate
From: Jan Petrous
Date: Sun Oct 06 2024 - 15:29:21 EST
On Mon, Aug 19, 2024 at 05:49:58PM +0200, Andrew Lunn wrote:
> On Sun, Aug 18, 2024 at 09:50:46PM +0000, Jan Petrous (OSS) wrote:
> > The helper rgmii_clock() implemented Russel's hint during stmmac
> > glue driver review:
> >
> > ---
> > We seem to have multiple cases of very similar logic in lots of stmmac
> > platform drivers, and I think it's about time we said no more to this.
> > So, what I think we should do is as follows:
> >
> > add the following helper - either in stmmac, or more generically
> > (phylib? - in which case its name will need changing.)
> >
> > static long stmmac_get_rgmii_clock(int speed)
> > {
> > switch (speed) {
> > case SPEED_10:
> > return 2500000;
> >
> > case SPEED_100:
> > return 25000000;
> >
> > case SPEED_1000:
> > return 125000000;
> >
> > default:
> > return -ENVAL;
> > }
> > }
> >
> > Then, this can become:
> >
> > long tx_clk_rate;
> >
> > ...
> >
> > tx_clk_rate = stmmac_get_rgmii_clock(speed);
> > if (tx_clk_rate < 0) {
> > dev_err(gmac->dev, "Unsupported/Invalid speed: %d\n", speed);
> > return;
> > }
> >
> > ret = clk_set_rate(gmac->tx_clk, tx_clk_rate);
> > ---
> >
> > Signed-off-by: Jan Petrous (OSS) <jan.petrous@xxxxxxxxxxx>
>
> This Signed-off-by: needs to be above the first ---, otherwise it gets
> discard.
>
I see, it is used as delimiter, my fault.
I will change formating for v3.
> When you repost, please do try to get threading correct.
>
Yeh, I already got the same feedback from Krzysztof.
I'm switching to b4/lei/mutt for v3 what I hope fixed
the threading issue.
BR.
/Jan