bcm27xx: 6.1: add kernel patches
[openwrt/staging/stintel.git] / target / linux / bcm27xx / patches-6.1 / 950-0457-net-phy-BCM54210PE-does-not-support-PTP.patch
1 From b7bdb564eb5b2d0672d0c49d8b6b4c14196f71ca Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Sat, 5 Nov 2022 11:46:08 +0000
4 Subject: [PATCH] net: phy: BCM54210PE does not support PTP
5
6 BCM54213PE is an Ethernet PHY that supports PTP hardware timestamping.
7 BCM54210PW ia another Ethernet PHY, but one without PTP support.
8 Unfortunately the two PHYs return the same ID when queried, so some
9 extra information is required to determine whether the PHY is PTP-
10 capable.
11
12 There are two Raspberry Pi products that use these PHYs - Pi 4B and
13 CM4 - and fortunately they use different PHY addresses, so use that as
14 a differentiator. Choose to treat a PHY with the same ID but another
15 address as a BCM54210PE, which seems more common.
16
17 See: https://github.com/raspberrypi/linux/issues/5104
18
19 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
20 ---
21 drivers/net/phy/bcm-phy-ptp.c | 12 ++++++++++++
22 1 file changed, 12 insertions(+)
23
24 --- a/drivers/net/phy/bcm-phy-ptp.c
25 +++ b/drivers/net/phy/bcm-phy-ptp.c
26 @@ -916,6 +916,18 @@ struct bcm_ptp_private *bcm_ptp_probe(st
27 switch (BRCM_PHY_MODEL(phydev)) {
28 case PHY_ID_BCM54210E:
29 break;
30 +#ifdef PHY_ID_BCM54213PE
31 + case PHY_ID_BCM54213PE:
32 + switch (phydev->mdio.addr) {
33 + case 0: // CM4 - this is a BCM54210PE which supports PTP
34 + break;
35 + case 1: // 4B - this is a BCM54213PE which doesn't
36 + return NULL;
37 + default: // Unknown - assume it's BCM54210PE
38 + break;
39 + }
40 + break;
41 +#endif
42 default:
43 return NULL;
44 }