1 From c11d5dbbe73fa7b450aaa77bb18df86a9714b422 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sat, 1 Jun 2024 01:35:02 +0200
4 Subject: [PATCH 1/2] net: phy: aquantia: move priv and hw stat to header
6 In preparation for LEDs support, move priv and hw stat to header to
7 reference priv struct also in other .c outside aquantia.main
9 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
10 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
13 drivers/net/phy/aquantia/aquantia.h | 38 ++++++++++++++++++++++++
14 drivers/net/phy/aquantia/aquantia_main.c | 37 -----------------------
15 2 files changed, 38 insertions(+), 37 deletions(-)
17 --- a/drivers/net/phy/aquantia/aquantia.h
18 +++ b/drivers/net/phy/aquantia/aquantia.h
20 #define VEND1_GLOBAL_RSVD_STAT9_MODE GENMASK(7, 0)
21 #define VEND1_GLOBAL_RSVD_STAT9_1000BT2 0x23
23 +/* MDIO_MMD_C22EXT */
24 +#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES 0xd292
25 +#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES 0xd294
26 +#define MDIO_C22EXT_STAT_SGMII_RX_FALSE_CARRIER 0xd297
27 +#define MDIO_C22EXT_STAT_SGMII_TX_GOOD_FRAMES 0xd313
28 +#define MDIO_C22EXT_STAT_SGMII_TX_BAD_FRAMES 0xd315
29 +#define MDIO_C22EXT_STAT_SGMII_TX_FALSE_CARRIER 0xd317
30 +#define MDIO_C22EXT_STAT_SGMII_TX_COLLISIONS 0xd318
31 +#define MDIO_C22EXT_STAT_SGMII_TX_LINE_COLLISIONS 0xd319
32 +#define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a
33 +#define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b
35 #define VEND1_GLOBAL_INT_STD_STATUS 0xfc00
36 #define VEND1_GLOBAL_INT_VEND_STATUS 0xfc01
39 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1)
40 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0)
42 +struct aqr107_hw_stat {
48 +#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s }
49 +static const struct aqr107_hw_stat aqr107_hw_stats[] = {
50 + SGMII_STAT("sgmii_rx_good_frames", RX_GOOD_FRAMES, 26),
51 + SGMII_STAT("sgmii_rx_bad_frames", RX_BAD_FRAMES, 26),
52 + SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER, 8),
53 + SGMII_STAT("sgmii_tx_good_frames", TX_GOOD_FRAMES, 26),
54 + SGMII_STAT("sgmii_tx_bad_frames", TX_BAD_FRAMES, 26),
55 + SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER, 8),
56 + SGMII_STAT("sgmii_tx_collisions", TX_COLLISIONS, 8),
57 + SGMII_STAT("sgmii_tx_line_collisions", TX_LINE_COLLISIONS, 8),
58 + SGMII_STAT("sgmii_tx_frame_alignment_err", TX_FRAME_ALIGN_ERR, 16),
59 + SGMII_STAT("sgmii_tx_runt_frames", TX_RUNT_FRAMES, 22),
62 +#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats)
65 + u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
68 #if IS_REACHABLE(CONFIG_HWMON)
69 int aqr_hwmon_probe(struct phy_device *phydev);
71 --- a/drivers/net/phy/aquantia/aquantia_main.c
72 +++ b/drivers/net/phy/aquantia/aquantia_main.c
74 #define MDIO_AN_RX_VEND_STAT3 0xe832
75 #define MDIO_AN_RX_VEND_STAT3_AFR BIT(0)
77 -/* MDIO_MMD_C22EXT */
78 -#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES 0xd292
79 -#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES 0xd294
80 -#define MDIO_C22EXT_STAT_SGMII_RX_FALSE_CARRIER 0xd297
81 -#define MDIO_C22EXT_STAT_SGMII_TX_GOOD_FRAMES 0xd313
82 -#define MDIO_C22EXT_STAT_SGMII_TX_BAD_FRAMES 0xd315
83 -#define MDIO_C22EXT_STAT_SGMII_TX_FALSE_CARRIER 0xd317
84 -#define MDIO_C22EXT_STAT_SGMII_TX_COLLISIONS 0xd318
85 -#define MDIO_C22EXT_STAT_SGMII_TX_LINE_COLLISIONS 0xd319
86 -#define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a
87 -#define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b
89 /* Sleep and timeout for checking if the Processor-Intensive
90 * MDIO operation is finished
92 #define AQR107_OP_IN_PROG_SLEEP 1000
93 #define AQR107_OP_IN_PROG_TIMEOUT 100000
95 -struct aqr107_hw_stat {
101 -#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s }
102 -static const struct aqr107_hw_stat aqr107_hw_stats[] = {
103 - SGMII_STAT("sgmii_rx_good_frames", RX_GOOD_FRAMES, 26),
104 - SGMII_STAT("sgmii_rx_bad_frames", RX_BAD_FRAMES, 26),
105 - SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER, 8),
106 - SGMII_STAT("sgmii_tx_good_frames", TX_GOOD_FRAMES, 26),
107 - SGMII_STAT("sgmii_tx_bad_frames", TX_BAD_FRAMES, 26),
108 - SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER, 8),
109 - SGMII_STAT("sgmii_tx_collisions", TX_COLLISIONS, 8),
110 - SGMII_STAT("sgmii_tx_line_collisions", TX_LINE_COLLISIONS, 8),
111 - SGMII_STAT("sgmii_tx_frame_alignment_err", TX_FRAME_ALIGN_ERR, 16),
112 - SGMII_STAT("sgmii_tx_runt_frames", TX_RUNT_FRAMES, 22),
114 -#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats)
116 -struct aqr107_priv {
117 - u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
120 static int aqr107_get_sset_count(struct phy_device *phydev)
122 return AQR107_SGMII_STAT_SZ;