[PATCH 1/3] net: rswitch: Fold MPSM C45 setting into rswitch_mii_access_c45()

Marek Vasut marek.vasut+renesas at mailbox.org
Fri Dec 20 01:48:40 CET 2024


The Set Station Management Mode : Clause 45 setting of MFF bit in MPSM
register can be done in rswitch_mii_access_c45() once, instead of this
being done before each rswitch_mii_access_c45() call. Deduplicate the
bit setting into rswitch_mii_access_c45(). No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
Cc: Ramon Fried <rfried.dev at gmail.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 drivers/net/rswitch.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/rswitch.c b/drivers/net/rswitch.c
index 247eb139ff9..5dc5de15f6f 100644
--- a/drivers/net/rswitch.c
+++ b/drivers/net/rswitch.c
@@ -365,6 +365,9 @@ static int rswitch_mii_access_c45(struct rswitch_etha *etha, bool read,
 	if (devad == 0xffffffff)
 		return 0;
 
+	/* Set Station Management Mode : Clause 45 */
+	setbits_le32(etha->addr + MPSM, MPSM_MFF_C45);
+
 	/* Clear completion flags */
 	writel(MMIS1_CLEAR_FLAGS, etha->addr + MMIS1);
 
@@ -429,9 +432,6 @@ static int rswitch_mii_read_c45(struct mii_dev *miidev, int phyad, int devad, in
 			MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
 			MPIC_MDC_CLK_SET);
 
-	/* Set Station Management Mode : Clause 45 */
-	setbits_le32(etha->addr + MPSM, MPSM_MFF_C45);
-
 	/* Access PHY register */
 	val = rswitch_mii_access_c45(etha, true, phyad, devad, regad, 0);
 
@@ -460,9 +460,6 @@ int rswitch_mii_write_c45(struct mii_dev *miidev, int phyad, int devad, int rega
 			MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
 			MPIC_MDC_CLK_SET);
 
-	/* Set Station Management Mode : Clause 45 */
-	setbits_le32(etha->addr + MPSM, MPSM_MFF_C45);
-
 	/* Access PHY register */
 	rswitch_mii_access_c45(etha, false, phyad, devad, regad, data);
 
-- 
2.45.2



More information about the U-Boot mailing list