* [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling
@ 2023-06-19 13:28 Radu Pirea (NXP OSS)
2023-06-19 13:57 ` Andrew Lunn
2023-06-21 3:31 ` Jakub Kicinski
0 siblings, 2 replies; 4+ messages in thread
From: Radu Pirea (NXP OSS) @ 2023-06-19 13:28 UTC (permalink / raw)
To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
richardcochran
Cc: netdev, linux-kernel, sebastian.tobuschat, Radu Pirea (NXP OSS),
stable
.config_intr() handles only the link event interrupt and should
disable/enable the PTP interrupt also.
It's safe to disable/enable the PTP irq even if the egress ts irq
is disabled. This interrupt, the PTP one, acts as a global switch for all
PTP irqs.
Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support")
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
---
Where is V1?
https://patchwork.kernel.org/project/netdevbpf/patch/20230410124856.287753-1-radu-nicolae.pirea@oss.nxp.com/
Where is V2?
https://patchwork.kernel.org/project/netdevbpf/patch/20230616135323
drivers/net/phy/nxp-c45-tja11xx.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 029875a59ff8..f0d047019f33 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -63,6 +63,9 @@
#define VEND1_PORT_ABILITIES 0x8046
#define PTP_ABILITY BIT(3)
+#define VEND1_PORT_FUNC_IRQ_EN 0x807A
+#define PTP_IRQS BIT(3)
+
#define VEND1_PORT_INFRA_CONTROL 0xAC00
#define PORT_INFRA_CONTROL_EN BIT(14)
@@ -890,12 +893,26 @@ static int nxp_c45_start_op(struct phy_device *phydev)
static int nxp_c45_config_intr(struct phy_device *phydev)
{
- if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+ int ret;
+
+ /* 0x807A register is not present on SJA1110 PHYs. */
+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1,
+ VEND1_PORT_FUNC_IRQ_EN, PTP_IRQS);
+ if (ret)
+ return ret;
+
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1,
VEND1_PHY_IRQ_EN, PHY_IRQ_LINK_EVENT);
- else
+ } else {
+ ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1,
+ VEND1_PORT_FUNC_IRQ_EN, PTP_IRQS);
+ if (ret)
+ return ret;
+
return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1,
VEND1_PHY_IRQ_EN, PHY_IRQ_LINK_EVENT);
+ }
}
static irqreturn_t nxp_c45_handle_interrupt(struct phy_device *phydev)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling
2023-06-19 13:28 [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling Radu Pirea (NXP OSS)
@ 2023-06-19 13:57 ` Andrew Lunn
2023-06-21 3:31 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2023-06-19 13:57 UTC (permalink / raw)
To: Radu Pirea (NXP OSS)
Cc: hkallweit1, linux, davem, edumazet, kuba, pabeni, richardcochran,
netdev, linux-kernel, sebastian.tobuschat, stable
On Mon, Jun 19, 2023 at 04:28:51PM +0300, Radu Pirea (NXP OSS) wrote:
> .config_intr() handles only the link event interrupt and should
> disable/enable the PTP interrupt also.
>
> It's safe to disable/enable the PTP irq even if the egress ts irq
> is disabled. This interrupt, the PTP one, acts as a global switch for all
> PTP irqs.
>
> Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support")
> CC: stable@vger.kernel.org # 5.15+
> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling
2023-06-19 13:28 [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling Radu Pirea (NXP OSS)
2023-06-19 13:57 ` Andrew Lunn
@ 2023-06-21 3:31 ` Jakub Kicinski
2023-06-21 16:18 ` Radu Pirea (OSS)
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2023-06-21 3:31 UTC (permalink / raw)
To: Radu Pirea (NXP OSS)
Cc: andrew, hkallweit1, linux, davem, edumazet, pabeni,
richardcochran, netdev, linux-kernel, sebastian.tobuschat, stable
On Mon, 19 Jun 2023 16:28:51 +0300 Radu Pirea (NXP OSS) wrote:
> Subject: [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling
typo: enablig -> enabling
> .config_intr() handles only the link event interrupt and should
> disable/enable the PTP interrupt also.
I don't understand this sentence, TBH, could you rephrase?
> Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support")
For a fix we really need to commit message to say what the problem is,
in terms which will be understood by the user. User visible behavior.
> CC: stable@vger.kernel.org # 5.15+
> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
> ---
>
> Where is V1?
> https://patchwork.kernel.org/project/netdevbpf/patch/20230410124856.287753-1-radu-nicolae.pirea@oss.nxp.com/
>
> Where is V2?
> https://patchwork.kernel.org/project/netdevbpf/patch/20230616135323
This link looks cut off.
> + /* 0x807A register is not present on SJA1110 PHYs. */
Meaning? It's safe because the operation will be ignored?
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling
2023-06-21 3:31 ` Jakub Kicinski
@ 2023-06-21 16:18 ` Radu Pirea (OSS)
0 siblings, 0 replies; 4+ messages in thread
From: Radu Pirea (OSS) @ 2023-06-21 16:18 UTC (permalink / raw)
To: Jakub Kicinski
Cc: andrew, hkallweit1, linux, davem, edumazet, pabeni,
richardcochran, netdev, linux-kernel, sebastian.tobuschat, stable
Hi Jakub,
On 21.06.2023 06:31, Jakub Kicinski wrote:
> On Mon, 19 Jun 2023 16:28:51 +0300 Radu Pirea (NXP OSS) wrote:
>> Subject: [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling
>
> typo: enablig -> enabling
>
>> .config_intr() handles only the link event interrupt and should
>> disable/enable the PTP interrupt also.
>
> I don't understand this sentence, TBH, could you rephrase? >
>> Fixes: 514def5dd339 ("phy: nxp-c45-tja11xx: add timestamping support")
>
> For a fix we really need to commit message to say what the problem is,
> in terms which will be understood by the user. User visible behavior.
If tools like ptp4l are killed, will leave egress timestamp interrupt
enabled. And I would like to say that I was able to trigger any bug
related to this, but I wasn't. So, I don't have any bad behaviour to
describe :)
However, now I realize that disabling all the PTP IRQs is not a smart
way to fix this virtual pseudo issue.
>
>> CC: stable@vger.kernel.org # 5.15+
>> Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
>> ---
>>
>> Where is V1?
>> https://patchwork.kernel.org/project/netdevbpf/patch/20230410124856.287753-1-radu-nicolae.pirea@oss.nxp.com/
>>
>> Where is V2?
>> https://patchwork.kernel.org/project/netdevbpf/patch/20230616135323
>
> This link looks cut off.
https://patchwork.kernel.org/project/netdevbpf/patch/20230616135323.98215-2-radu-nicolae.pirea@oss.nxp.com/
>
>> + /* 0x807A register is not present on SJA1110 PHYs. */
>
> Meaning? It's safe because the operation will be ignored?
Yes. The PHY will ignore the writes and will return 0 on reads.
> --
> pw-bot: cr
--
Radu P.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-21 16:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19 13:28 [PATCH net v3 1/1] net: phy: nxp-c45-tja11xx: fix the PTP interrupt enablig/disabling Radu Pirea (NXP OSS)
2023-06-19 13:57 ` Andrew Lunn
2023-06-21 3:31 ` Jakub Kicinski
2023-06-21 16:18 ` Radu Pirea (OSS)
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).