lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zx/wMO0YjJ+QK7qT@lsv051416.swis.nl-cdc01.nxp.com>
Date: Mon, 28 Oct 2024 21:12:32 +0100
From: Jan Petrous <jan.petrous@....nxp.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>,
	Alexandre Torgue <alexandre.torgue@...s.st.com>,
	Jose Abreu <joabreu@...opsys.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Vinod Koul <vkoul@...nel.org>,
	Richard Cochran <richardcochran@...il.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Emil Renner Berthing <kernel@...il.dk>,
	Minda Chen <minda.chen@...rfivetech.com>,
	Nicolas Ferre <nicolas.ferre@...rochip.com>,
	Claudiu Beznea <claudiu.beznea@...on.dev>,
	Iyappan Subramanian <iyappan@...amperecomputing.com>,
	Keyur Chudgar <keyur@...amperecomputing.com>,
	Quan Nguyen <quan@...amperecomputing.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Giuseppe Cavallaro <peppe.cavallaro@...com>,
	linux-stm32@...md-mailman.stormreply.com,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org, linux-arm-msm@...r.kernel.org,
	imx@...ts.linux.dev, devicetree@...r.kernel.org,
	NXP S32 Linux Team <s32@....com>,
	"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Subject: Re: [PATCH v3 04/16] net: phy: Add helper for mapping RGMII link
 speed to clock rate

On Mon, Oct 14, 2024 at 03:40:51PM +0200, Andrew Lunn wrote:
> On Sun, Oct 13, 2024 at 11:27:39PM +0200, Jan Petrous via B4 Relay wrote:
> > From: "Jan Petrous (OSS)" <jan.petrous@....nxp.com>
> > 
> > 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);
> > 
> > Suggested-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> > Signed-off-by: Jan Petrous (OSS) <jan.petrous@....nxp.com>
> 
> But of an unusual commit message, but it does explain the "Why?".

I will reformulate description in v4.

> 
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> 

Thanks.

> >  
> > +/**
> > + * rgmii_clock - map link speed to the clock rate
> > + * @speed: link speed value
> > + *
> > + * Description: maps RGMII supported link speeds
> > + * into the clock rates.
> > + */
> 
> A Returns: line would be nice. 

 will add it in v4.

Thanks
/Jan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ