OSDN Git Service

net: phy: mscc: migrate to phy_select/restore_page functions
authorQuentin Schulz <quentin.schulz@bootlin.com>
Mon, 8 Oct 2018 10:07:23 +0000 (12:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Oct 2018 17:29:20 +0000 (10:29 -0700)
commit6a0bfbbe20b0ce8bb0ee149ecea620a56fe038e4
tree483622c80d77ac459d56ee00781d8b53cd076ee5
parent590ac2ffde325da25371e169fc71826f2d118b6b
net: phy: mscc: migrate to phy_select/restore_page functions

The Microsemi PHYs have multiple banks of registers (called pages).
Registers can only be accessed from one page, if we need a register from
another page, we need to switch the page and the registers of all other
pages are not accessible anymore.

Basically, to read register 5 from page 0, 1, 2, etc., you do the same
phy_read(phydev, 5); but you need to set the desired page beforehand.

In order to guarantee that two concurrent functions do not change the
page, we need to do some locking per page. This can be achieved with the
use of phy_select_page and phy_restore_page functions but phy_write/read
calls in-between those two functions shall be replaced by their
lock-free alternative __phy_write/read.

Let's migrate this driver to those functions.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mscc.c