Skip to content

Commit 8f17a6a

Browse files
author
Paolo Abeni
committed
Merge branch 'net-phy-marvell-88q2xxx-cleanup'
Dimitri Fedrau says: ==================== net: phy: marvell-88q2xxx: cleanup - align defines - order includes alphabetically - enable temperature sensor in mv88q2xxx_config_init Signed-off-by: Dimitri Fedrau <[email protected]> ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 01072de + 6c80672 commit 8f17a6a

File tree

1 file changed

+37
-40
lines changed

1 file changed

+37
-40
lines changed

drivers/net/phy/marvell-88q2xxx.c

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@
77
* Copyright (C) 2024 Liebherr-Electronics and Drives GmbH
88
*/
99
#include <linux/ethtool_netlink.h>
10+
#include <linux/hwmon.h>
1011
#include <linux/marvell_phy.h>
1112
#include <linux/of.h>
1213
#include <linux/phy.h>
13-
#include <linux/hwmon.h>
1414

15-
#define PHY_ID_88Q2220_REVB0 (MARVELL_PHY_ID_88Q2220 | 0x1)
16-
#define PHY_ID_88Q2220_REVB1 (MARVELL_PHY_ID_88Q2220 | 0x2)
17-
#define PHY_ID_88Q2220_REVB2 (MARVELL_PHY_ID_88Q2220 | 0x3)
15+
#define PHY_ID_88Q2220_REVB0 (MARVELL_PHY_ID_88Q2220 | 0x1)
16+
#define PHY_ID_88Q2220_REVB1 (MARVELL_PHY_ID_88Q2220 | 0x2)
17+
#define PHY_ID_88Q2220_REVB2 (MARVELL_PHY_ID_88Q2220 | 0x3)
1818

19-
#define MDIO_MMD_AN_MV_STAT 32769
20-
#define MDIO_MMD_AN_MV_STAT_ANEG 0x0100
21-
#define MDIO_MMD_AN_MV_STAT_LOCAL_RX 0x1000
22-
#define MDIO_MMD_AN_MV_STAT_REMOTE_RX 0x2000
23-
#define MDIO_MMD_AN_MV_STAT_LOCAL_MASTER 0x4000
24-
#define MDIO_MMD_AN_MV_STAT_MS_CONF_FAULT 0x8000
19+
#define MDIO_MMD_AN_MV_STAT 32769
20+
#define MDIO_MMD_AN_MV_STAT_ANEG 0x0100
21+
#define MDIO_MMD_AN_MV_STAT_LOCAL_RX 0x1000
22+
#define MDIO_MMD_AN_MV_STAT_REMOTE_RX 0x2000
23+
#define MDIO_MMD_AN_MV_STAT_LOCAL_MASTER 0x4000
24+
#define MDIO_MMD_AN_MV_STAT_MS_CONF_FAULT 0x8000
2525

26-
#define MDIO_MMD_AN_MV_STAT2 32794
27-
#define MDIO_MMD_AN_MV_STAT2_AN_RESOLVED 0x0800
28-
#define MDIO_MMD_AN_MV_STAT2_100BT1 0x2000
29-
#define MDIO_MMD_AN_MV_STAT2_1000BT1 0x4000
26+
#define MDIO_MMD_AN_MV_STAT2 32794
27+
#define MDIO_MMD_AN_MV_STAT2_AN_RESOLVED 0x0800
28+
#define MDIO_MMD_AN_MV_STAT2_100BT1 0x2000
29+
#define MDIO_MMD_AN_MV_STAT2_1000BT1 0x4000
3030

31-
#define MDIO_MMD_PCS_MV_RESET_CTRL 32768
32-
#define MDIO_MMD_PCS_MV_RESET_CTRL_TX_DISABLE 0x8
31+
#define MDIO_MMD_PCS_MV_RESET_CTRL 32768
32+
#define MDIO_MMD_PCS_MV_RESET_CTRL_TX_DISABLE 0x8
3333

34-
#define MDIO_MMD_PCS_MV_INT_EN 32784
35-
#define MDIO_MMD_PCS_MV_INT_EN_LINK_UP 0x0040
36-
#define MDIO_MMD_PCS_MV_INT_EN_LINK_DOWN 0x0080
37-
#define MDIO_MMD_PCS_MV_INT_EN_100BT1 0x1000
34+
#define MDIO_MMD_PCS_MV_INT_EN 32784
35+
#define MDIO_MMD_PCS_MV_INT_EN_LINK_UP 0x0040
36+
#define MDIO_MMD_PCS_MV_INT_EN_LINK_DOWN 0x0080
37+
#define MDIO_MMD_PCS_MV_INT_EN_100BT1 0x1000
3838

3939
#define MDIO_MMD_PCS_MV_GPIO_INT_STAT 32785
4040
#define MDIO_MMD_PCS_MV_GPIO_INT_STAT_LINK_UP 0x0040
@@ -80,19 +80,19 @@
8080
#define MDIO_MMD_PCS_MV_100BT1_STAT1_REMOTE_RX 0x2000
8181
#define MDIO_MMD_PCS_MV_100BT1_STAT1_LOCAL_MASTER 0x4000
8282

83-
#define MDIO_MMD_PCS_MV_100BT1_STAT2 33033
84-
#define MDIO_MMD_PCS_MV_100BT1_STAT2_JABBER 0x0001
85-
#define MDIO_MMD_PCS_MV_100BT1_STAT2_POL 0x0002
86-
#define MDIO_MMD_PCS_MV_100BT1_STAT2_LINK 0x0004
87-
#define MDIO_MMD_PCS_MV_100BT1_STAT2_ANGE 0x0008
83+
#define MDIO_MMD_PCS_MV_100BT1_STAT2 33033
84+
#define MDIO_MMD_PCS_MV_100BT1_STAT2_JABBER 0x0001
85+
#define MDIO_MMD_PCS_MV_100BT1_STAT2_POL 0x0002
86+
#define MDIO_MMD_PCS_MV_100BT1_STAT2_LINK 0x0004
87+
#define MDIO_MMD_PCS_MV_100BT1_STAT2_ANGE 0x0008
8888

8989
#define MDIO_MMD_PCS_MV_100BT1_INT_EN 33042
9090
#define MDIO_MMD_PCS_MV_100BT1_INT_EN_LINKEVENT 0x0400
9191

9292
#define MDIO_MMD_PCS_MV_COPPER_INT_STAT 33043
9393
#define MDIO_MMD_PCS_MV_COPPER_INT_STAT_LINKEVENT 0x0400
9494

95-
#define MDIO_MMD_PCS_MV_RX_STAT 33328
95+
#define MDIO_MMD_PCS_MV_RX_STAT 33328
9696

9797
#define MDIO_MMD_PCS_MV_TDR_RESET 65226
9898
#define MDIO_MMD_PCS_MV_TDR_RESET_TDR_RST 0x1000
@@ -115,8 +115,8 @@
115115

116116
#define MDIO_MMD_PCS_MV_TDR_OFF_CUTOFF 65246
117117

118-
#define MV88Q2XXX_LED_INDEX_TX_ENABLE 0
119-
#define MV88Q2XXX_LED_INDEX_GPIO 1
118+
#define MV88Q2XXX_LED_INDEX_TX_ENABLE 0
119+
#define MV88Q2XXX_LED_INDEX_GPIO 1
120120

121121
struct mv88q2xxx_priv {
122122
bool enable_temp;
@@ -513,6 +513,15 @@ static int mv88q2xxx_config_init(struct phy_device *phydev)
513513
return ret;
514514
}
515515

516+
/* Enable temperature sense */
517+
if (priv->enable_temp) {
518+
ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
519+
MDIO_MMD_PCS_MV_TEMP_SENSOR2,
520+
MDIO_MMD_PCS_MV_TEMP_SENSOR2_DIS_MASK, 0);
521+
if (ret < 0)
522+
return ret;
523+
}
524+
516525
return 0;
517526
}
518527

@@ -903,18 +912,6 @@ static int mv88q222x_revb1_revb2_config_init(struct phy_device *phydev)
903912

904913
static int mv88q222x_config_init(struct phy_device *phydev)
905914
{
906-
struct mv88q2xxx_priv *priv = phydev->priv;
907-
int ret;
908-
909-
/* Enable temperature sense */
910-
if (priv->enable_temp) {
911-
ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
912-
MDIO_MMD_PCS_MV_TEMP_SENSOR2,
913-
MDIO_MMD_PCS_MV_TEMP_SENSOR2_DIS_MASK, 0);
914-
if (ret < 0)
915-
return ret;
916-
}
917-
918915
if (phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] == PHY_ID_88Q2220_REVB0)
919916
return mv88q222x_revb0_config_init(phydev);
920917
else

0 commit comments

Comments
 (0)