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]
Date:   Mon, 14 Nov 2022 21:10:10 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Andy Chiu <andy.chiu@...ive.com>
Cc:     davem@...emloft.net, kuba@...nel.org, michal.simek@...inx.com,
        radhey.shyam.pandey@...inx.com, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        robh+dt@...nel.org, pabeni@...hat.com, edumazet@...gle.com,
        greentime.hu@...ive.com
Subject: Re: [PATCH v3 RESEND net-next 2/3] net: axienet: set mdio clock
 according to bus-frequency

> +	u32 mdio_freq = MAX_MDIO_FREQ;

>  	/* clk_div can be calculated by deriving it from the equation:
>  	 * fMDIO = fHOST / ((1 + clk_div) * 2)

A nit pick, but MAX_MDIO_FREQ is not actually the max. The max would
be clk_div = 0. You can run the MDIO bus faster than 2.5MHz, if you
know all the devices on the bus actually support faster speeds. I've
run it at 6Mhz with Marvell Ethernet switches and PHYs.

DEFAULT_MDIO_FREQ would be better.

>  	 *
> @@ -209,13 +218,20 @@ static int axienet_mdio_enable(struct axienet_local *lp)
>  	 * "clock-frequency" from the CPU
>  	 */
>  
> -	lp->mii_clk_div = (host_clock / (MAX_MDIO_FREQ * 2)) - 1;
> +	clk_div = (host_clock / (mdio_freq * 2)) - 1;
>  	/* If there is any remainder from the division of
> -	 * fHOST / (MAX_MDIO_FREQ * 2), then we need to add
> +	 * fHOST / (mdio_freq * 2), then we need to add
>  	 * 1 to the clock divisor or we will surely be above 2.5 MHz

s/2.5 MHz/the requested frequency/

With these changes made:

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

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ