From: Antoine Tenart <antoine.tenart@bootlin.com>
To: davem@davemloft.net, andrew@lunn.ch, f.fainelli@gmail.com,
hkallweit1@gmail.com
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com
Subject: [PATCH net-next 6/8] net: phy: mscc: restore the base page in vsc8514/8584_config_init
Date: Thu, 25 Jun 2020 17:42:09 +0200 [thread overview]
Message-ID: <20200625154211.606591-7-antoine.tenart@bootlin.com> (raw)
In-Reply-To: <20200625154211.606591-1-antoine.tenart@bootlin.com>
In the vsc8584_config_init and vsc8514_config_init, the base page is set
to 'GPIO', configuration is done, and the page is never explicitly
restored to the standard page. No bug was triggered as it turns out
helpers called in those config_init functions do modify the base page,
and set it back to standard. But that is dangerous and any modification
to those functions would introduce bugs. This patch fixes this, to
improve maintenance, by restoring the base page to 'standard' once
'GPIO' accesses are completed.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/phy/mscc/mscc_main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index 03680933f530..f625109df00a 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -1395,6 +1395,11 @@ static int vsc8584_config_init(struct phy_device *phydev)
if (ret)
goto err;
+ ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS,
+ MSCC_PHY_PAGE_STANDARD);
+ if (ret)
+ goto err;
+
if (!phy_interface_is_rgmii(phydev)) {
val = PROC_CMD_MCB_ACCESS_MAC_CONF | PROC_CMD_RST_CONF_PORT |
PROC_CMD_READ_MOD_WRITE_PORT;
@@ -1779,7 +1784,11 @@ static int vsc8514_config_init(struct phy_device *phydev)
val &= ~MAC_CFG_MASK;
val |= MAC_CFG_QSGMII;
ret = phy_base_write(phydev, MSCC_PHY_MAC_CFG_FASTLINK, val);
+ if (ret)
+ goto err;
+ ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS,
+ MSCC_PHY_PAGE_STANDARD);
if (ret)
goto err;
--
2.26.2
next prev parent reply other threads:[~2020-06-25 15:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 15:42 [PATCH net-next 0/8] net: phy: mscc: multiple improvements Antoine Tenart
2020-06-25 15:42 ` [PATCH net-next 1/8] net: phy: mscc: macsec: fix sparse warnings Antoine Tenart
2020-06-25 16:46 ` Andrew Lunn
2020-06-25 15:42 ` [PATCH net-next 2/8] net: phy: mscc: fix a possible double unlock Antoine Tenart
2020-06-25 15:42 ` [PATCH net-next 3/8] net: phy: mscc: ptp: fix a smatch error Antoine Tenart
2020-06-25 15:42 ` [PATCH net-next 4/8] net: phy: mscc: ptp: fix a typo in a comment Antoine Tenart
2020-06-25 15:42 ` [PATCH net-next 5/8] net: phy: mscc: do not access the MDIO bus lock directly Antoine Tenart
2020-06-25 16:47 ` Andrew Lunn
2020-06-25 15:42 ` Antoine Tenart [this message]
2020-06-25 15:42 ` [PATCH net-next 7/8] net: phy: mscc: remove useless page configuration in the config init Antoine Tenart
2020-06-25 15:42 ` [PATCH net-next 8/8] net: phy: mscc: improve vsc8514/8584_config_init consistency Antoine Tenart
2020-06-25 23:22 ` [PATCH net-next 0/8] net: phy: mscc: multiple improvements David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200625154211.606591-7-antoine.tenart@bootlin.com \
--to=antoine.tenart@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®