* [PATCH net-next] net: ethernet: ti: cpsw: Enable PHY timestamping
@ 2021-11-16 8:03 Kurt Kanzenbach
2021-11-17 4:26 ` Richard Cochran
2021-11-17 14:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Kurt Kanzenbach @ 2021-11-16 8:03 UTC (permalink / raw)
To: Grygorii Strashko, David S. Miller, Jakub Kicinski
Cc: Daniel Borkmann, Toke Høiland-Jørgensen,
Ilias Apalodimas, Lorenzo Bianconi, Björn Töpel,
Sebastian Andrzej Siewior, Richard Cochran, linux-omap, netdev,
Kurt Kanzenbach
If the used PHYs also support hardware timestamping, all configuration requests
should be forwared to the PHYs instead of being processed by the MAC driver
itself.
This enables PHY timestamping in combination with the cpsw driver.
Tested with an am335x based board with two DP83640 PHYs connected to the cpsw
switch.
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
drivers/net/ethernet/ti/cpsw_priv.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
index ecc2a6b7e28f..c99dd9735087 100644
--- a/drivers/net/ethernet/ti/cpsw_priv.c
+++ b/drivers/net/ethernet/ti/cpsw_priv.c
@@ -710,20 +710,26 @@ int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
struct cpsw_priv *priv = netdev_priv(dev);
struct cpsw_common *cpsw = priv->cpsw;
int slave_no = cpsw_slave_index(cpsw, priv);
+ struct phy_device *phy;
if (!netif_running(dev))
return -EINVAL;
- switch (cmd) {
- case SIOCSHWTSTAMP:
- return cpsw_hwtstamp_set(dev, req);
- case SIOCGHWTSTAMP:
- return cpsw_hwtstamp_get(dev, req);
+ phy = cpsw->slaves[slave_no].phy;
+
+ if (!phy_has_hwtstamp(phy)) {
+ switch (cmd) {
+ case SIOCSHWTSTAMP:
+ return cpsw_hwtstamp_set(dev, req);
+ case SIOCGHWTSTAMP:
+ return cpsw_hwtstamp_get(dev, req);
+ }
}
- if (!cpsw->slaves[slave_no].phy)
- return -EOPNOTSUPP;
- return phy_mii_ioctl(cpsw->slaves[slave_no].phy, req, cmd);
+ if (phy)
+ return phy_mii_ioctl(phy, req, cmd);
+
+ return -EOPNOTSUPP;
}
int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: cpsw: Enable PHY timestamping
2021-11-16 8:03 [PATCH net-next] net: ethernet: ti: cpsw: Enable PHY timestamping Kurt Kanzenbach
@ 2021-11-17 4:26 ` Richard Cochran
2021-11-17 14:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Richard Cochran @ 2021-11-17 4:26 UTC (permalink / raw)
To: Kurt Kanzenbach
Cc: Grygorii Strashko, David S. Miller, Jakub Kicinski,
Daniel Borkmann, Toke Høiland-Jørgensen,
Ilias Apalodimas, Lorenzo Bianconi, Björn Töpel,
Sebastian Andrzej Siewior, linux-omap, netdev
On Tue, Nov 16, 2021 at 09:03:25AM +0100, Kurt Kanzenbach wrote:
> If the used PHYs also support hardware timestamping, all configuration requests
> should be forwared to the PHYs instead of being processed by the MAC driver
> itself.
>
> This enables PHY timestamping in combination with the cpsw driver.
>
> Tested with an am335x based board with two DP83640 PHYs connected to the cpsw
> switch.
>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: ethernet: ti: cpsw: Enable PHY timestamping
2021-11-16 8:03 [PATCH net-next] net: ethernet: ti: cpsw: Enable PHY timestamping Kurt Kanzenbach
2021-11-17 4:26 ` Richard Cochran
@ 2021-11-17 14:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-17 14:40 UTC (permalink / raw)
To: Kurt Kanzenbach
Cc: grygorii.strashko, davem, kuba, daniel, toke, ilias.apalodimas,
lorenzo, bjorn, bigeasy, richardcochran, linux-omap, netdev
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Tue, 16 Nov 2021 09:03:25 +0100 you wrote:
> If the used PHYs also support hardware timestamping, all configuration requests
> should be forwared to the PHYs instead of being processed by the MAC driver
> itself.
>
> This enables PHY timestamping in combination with the cpsw driver.
>
> Tested with an am335x based board with two DP83640 PHYs connected to the cpsw
> switch.
>
> [...]
Here is the summary with links:
- [net-next] net: ethernet: ti: cpsw: Enable PHY timestamping
https://git.kernel.org/netdev/net-next/c/65483559dc0a
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] 3+ messages in thread
end of thread, other threads:[~2021-11-17 14:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-16 8:03 [PATCH net-next] net: ethernet: ti: cpsw: Enable PHY timestamping Kurt Kanzenbach
2021-11-17 4:26 ` Richard Cochran
2021-11-17 14:40 ` 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).