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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZZPwdEgwCVaHdyZB@shell.armlinux.org.uk>
Date: Tue, 2 Jan 2024 11:16:04 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Marek Behún <kabel@...nel.org>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Alexander Couzens <lynxis@...0.eu>,
	Daniel Golle <daniel@...rotopia.org>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Willy Liu <willy.liu@...ltek.com>,
	Ioana Ciornei <ioana.ciornei@....com>,
	Marek Mojík <marek.mojik@....cz>,
	Maximilián Maliar <maximilian.maliar@....cz>
Subject: Re: [PATCH net-next 03/15] net: phy: realtek: rework MMD register
 access methods

On Wed, Dec 20, 2023 at 04:55:06PM +0100, Marek Behún wrote:
> The .read_mmd() and .write_mmd() methods for rtlgen and rtl822x
> currently allow access to only 6 MMD registers, via a vendor specific
> mechanism (a paged read / write).
> 
> The PHY specification explains that MMD registers for MMDs 1 to 30 can
> be accessed via the clause 22 indirect mechanism through registers 13
> and 14, but this is not possible for MMD 31.
> 
> A Realtek contact explained that MMD 31 registers can be accessed by
> setting clause 22 page register (register 31):
>   page = mmd_reg >> 4
>   reg = 0x10 | ((mmd_reg & 0xf) >> 1)
> 
> This mechanism is currently used in the driver. For example the
> .read_mmd() method accesses the PCS.EEE_ABLE register by setting page
> to 0xa5c and accessing register 0x12. By the formulas above, this
> corresponds to MMD register 31.a5c4. The Realtek contact confirmed that
> the PCS.EEE_ABLE register (3.0014) is also available via MMD alias
> 31.a5c4, and this is also true for the other registers:
> 
>   register name   address   page.reg  alias
>   PCS.EEE_ABLE    3.0x0014  0xa5c.12  31.0xa5c4
>   PCS.EEE_ABLE2   3.0x0015  0xa6e.16  31.0xa6ec
>   AN.EEE_ADV      7.0x003c  0xa5d.10  31.0xa5d0
>   AN.EEE_LPABLE   7.0x003d  0xa5d.11  31.0xa5d2
>   AN.EEE_ADV2     7.0x003e  0xa6d.12  31.0xa6d4
>   AN.EEE_LPABLE2  7.0x003f  0xa6d.10  31.0xa6d0
> 
> Since the registers are also available at the true MMD addresses where
> they can be accessed via the indirect mechanism (via registers 13 and
> 14) we can rework the code to be more generic and allow access to all
> MMD registers.
> 
> Rework the .read_mmd() and .write_mmd() methods for rtlgen and rtl822x
> PHYs:
> - use direct clause 45 access if the MDIO bus supports it
> - use the indirect access via clause 22 registers 13 and 14 for MMDs
>   1 to 30
> - use the vendor specific method to access MMD 31 registers
> 
> Signed-off-by: Marek Behún <kabel@...nel.org>
> ---

Reviewed-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ