* [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function
@ 2022-03-07 16:15 Arun Ramadoss
2022-03-07 16:15 ` [PATCH net-next 1/2] net: phy: exported the " Arun Ramadoss
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Arun Ramadoss @ 2022-03-07 16:15 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Andrew Lunn, Heiner Kallweit, Russell King, Jakub Kicinski,
David S . Miller, UNGLinuxDriver
LAN87xx T1 Phy has the same register field as gigabit phy for reading the
master slave configuration. But the genphy_read_master_slave function has a
check of gigabit phy. So refactored the function in such a way, moved the speed
check to the genphy_read_status function. Analyzed the nxp-tja11xx function for
refactoring, but the register for configuring master/slave is nxp specific
which is not extended phy register.
And analyzed the reusing genphy_setup_master_slave, but for LAN87xx
MASTER_ENABLE is always 1 and Preferred state is always 0. So, I didn't try to
change it.
Arun Ramadoss (2):
net: phy: exported the genphy_read_master_slave function
net: phy: lan87xx: use genphy_read_master_slave in read_status
drivers/net/phy/microchip_t1.c | 30 +-----------------------------
drivers/net/phy/phy_device.c | 19 +++++++++----------
include/linux/phy.h | 1 +
3 files changed, 11 insertions(+), 39 deletions(-)
base-commit: 57d29a2935c9aab0aaef6264bf6a58aad3859e7c
--
2.33.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/2] net: phy: exported the genphy_read_master_slave function
2022-03-07 16:15 [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function Arun Ramadoss
@ 2022-03-07 16:15 ` Arun Ramadoss
2022-03-07 16:29 ` Andrew Lunn
2022-03-07 16:15 ` [PATCH net-next 2/2] net: phy: lan87xx: use genphy_read_master_slave in read_status Arun Ramadoss
2022-03-08 14:30 ` [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Arun Ramadoss @ 2022-03-07 16:15 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Andrew Lunn, Heiner Kallweit, Russell King, Jakub Kicinski,
David S . Miller, UNGLinuxDriver
genphy_read_master_slave function allows to configure the master/slave
for gigabit phys only. In order to use this function irrespective of
speed, moved the speed check to the genphy_read_status call.
Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
drivers/net/phy/phy_device.c | 19 +++++++++----------
include/linux/phy.h | 1 +
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ce0bb5951b81..8406ac739def 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2051,17 +2051,11 @@ static int genphy_setup_master_slave(struct phy_device *phydev)
CTL1000_PREFER_MASTER), ctl);
}
-static int genphy_read_master_slave(struct phy_device *phydev)
+int genphy_read_master_slave(struct phy_device *phydev)
{
int cfg, state;
int val;
- if (!phydev->is_gigabit_capable) {
- phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;
- phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED;
- return 0;
- }
-
phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN;
phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
@@ -2102,6 +2096,7 @@ static int genphy_read_master_slave(struct phy_device *phydev)
return 0;
}
+EXPORT_SYMBOL(genphy_read_master_slave);
/**
* genphy_restart_aneg - Enable and Restart Autonegotiation
@@ -2396,14 +2391,18 @@ int genphy_read_status(struct phy_device *phydev)
if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
return 0;
+ phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED;
+ phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED;
phydev->speed = SPEED_UNKNOWN;
phydev->duplex = DUPLEX_UNKNOWN;
phydev->pause = 0;
phydev->asym_pause = 0;
- err = genphy_read_master_slave(phydev);
- if (err < 0)
- return err;
+ if (phydev->is_gigabit_capable) {
+ err = genphy_read_master_slave(phydev);
+ if (err < 0)
+ return err;
+ }
err = genphy_read_lpa(phydev);
if (err < 0)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index cd08cf1a8b0d..20beeaa7443b 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1578,6 +1578,7 @@ int genphy_update_link(struct phy_device *phydev);
int genphy_read_lpa(struct phy_device *phydev);
int genphy_read_status_fixed(struct phy_device *phydev);
int genphy_read_status(struct phy_device *phydev);
+int genphy_read_master_slave(struct phy_device *phydev);
int genphy_suspend(struct phy_device *phydev);
int genphy_resume(struct phy_device *phydev);
int genphy_loopback(struct phy_device *phydev, bool enable);
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] net: phy: lan87xx: use genphy_read_master_slave in read_status
2022-03-07 16:15 [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function Arun Ramadoss
2022-03-07 16:15 ` [PATCH net-next 1/2] net: phy: exported the " Arun Ramadoss
@ 2022-03-07 16:15 ` Arun Ramadoss
2022-03-08 14:30 ` [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Arun Ramadoss @ 2022-03-07 16:15 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Andrew Lunn, Heiner Kallweit, Russell King, Jakub Kicinski,
David S . Miller, UNGLinuxDriver
To read the master slave configuration of the LAN87xx T1 phy, used the
generic phy driver genphy_read_master_slave function. Removed the local
lan87xx_read_master_slave function.
Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/microchip_t1.c | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 8292f7305805..389df3f4293c 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -674,34 +674,6 @@ static int lan87xx_cable_test_get_status(struct phy_device *phydev,
return 0;
}
-static int lan87xx_read_master_slave(struct phy_device *phydev)
-{
- int rc = 0;
-
- phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN;
- phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
-
- rc = phy_read(phydev, MII_CTRL1000);
- if (rc < 0)
- return rc;
-
- if (rc & CTL1000_AS_MASTER)
- phydev->master_slave_get = MASTER_SLAVE_CFG_MASTER_FORCE;
- else
- phydev->master_slave_get = MASTER_SLAVE_CFG_SLAVE_FORCE;
-
- rc = phy_read(phydev, MII_STAT1000);
- if (rc < 0)
- return rc;
-
- if (rc & LPA_1000MSRES)
- phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
- else
- phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
-
- return rc;
-}
-
static int lan87xx_read_status(struct phy_device *phydev)
{
int rc = 0;
@@ -720,7 +692,7 @@ static int lan87xx_read_status(struct phy_device *phydev)
phydev->pause = 0;
phydev->asym_pause = 0;
- rc = lan87xx_read_master_slave(phydev);
+ rc = genphy_read_master_slave(phydev);
if (rc < 0)
return rc;
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] net: phy: exported the genphy_read_master_slave function
2022-03-07 16:15 ` [PATCH net-next 1/2] net: phy: exported the " Arun Ramadoss
@ 2022-03-07 16:29 ` Andrew Lunn
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2022-03-07 16:29 UTC (permalink / raw)
To: Arun Ramadoss
Cc: netdev, linux-kernel, Heiner Kallweit, Russell King,
Jakub Kicinski, David S . Miller, UNGLinuxDriver
On Mon, Mar 07, 2022 at 09:45:14PM +0530, Arun Ramadoss wrote:
> genphy_read_master_slave function allows to configure the master/slave
> for gigabit phys only. In order to use this function irrespective of
> speed, moved the speed check to the genphy_read_status call.
>
> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function
2022-03-07 16:15 [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function Arun Ramadoss
2022-03-07 16:15 ` [PATCH net-next 1/2] net: phy: exported the " Arun Ramadoss
2022-03-07 16:15 ` [PATCH net-next 2/2] net: phy: lan87xx: use genphy_read_master_slave in read_status Arun Ramadoss
@ 2022-03-08 14:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-08 14:30 UTC (permalink / raw)
To: Arun Ramadoss
Cc: netdev, linux-kernel, andrew, hkallweit1, linux, kuba, davem,
UNGLinuxDriver
Hello:
This series was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 7 Mar 2022 21:45:13 +0530 you wrote:
> LAN87xx T1 Phy has the same register field as gigabit phy for reading the
> master slave configuration. But the genphy_read_master_slave function has a
> check of gigabit phy. So refactored the function in such a way, moved the speed
> check to the genphy_read_status function. Analyzed the nxp-tja11xx function for
> refactoring, but the register for configuring master/slave is nxp specific
> which is not extended phy register.
> And analyzed the reusing genphy_setup_master_slave, but for LAN87xx
> MASTER_ENABLE is always 1 and Preferred state is always 0. So, I didn't try to
> change it.
>
> [...]
Here is the summary with links:
- [net-next,1/2] net: phy: exported the genphy_read_master_slave function
https://git.kernel.org/netdev/net-next/c/64807c232151
- [net-next,2/2] net: phy: lan87xx: use genphy_read_master_slave in read_status
https://git.kernel.org/netdev/net-next/c/f1f3a674261e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-08 14:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 16:15 [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function Arun Ramadoss
2022-03-07 16:15 ` [PATCH net-next 1/2] net: phy: exported the " Arun Ramadoss
2022-03-07 16:29 ` Andrew Lunn
2022-03-07 16:15 ` [PATCH net-next 2/2] net: phy: lan87xx: use genphy_read_master_slave in read_status Arun Ramadoss
2022-03-08 14:30 ` [PATCH net-next 0/2] net: phy: lan87xx: use genphy_read_master_slave function patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).