mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
69f8647608
Replace Aquantia pending LEDs patch with upstream version. Sadly net maintainers didn't like integrated solution hence we still need to handle LED restore on reset with custom solution. Link: https://github.com/openwrt/openwrt/pull/15797 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
123 lines
4.7 KiB
Diff
123 lines
4.7 KiB
Diff
From c11d5dbbe73fa7b450aaa77bb18df86a9714b422 Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Sat, 1 Jun 2024 01:35:02 +0200
|
|
Subject: [PATCH 1/2] net: phy: aquantia: move priv and hw stat to header
|
|
|
|
In preparation for LEDs support, move priv and hw stat to header to
|
|
reference priv struct also in other .c outside aquantia.main
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
drivers/net/phy/aquantia/aquantia.h | 38 ++++++++++++++++++++++++
|
|
drivers/net/phy/aquantia/aquantia_main.c | 37 -----------------------
|
|
2 files changed, 38 insertions(+), 37 deletions(-)
|
|
|
|
--- a/drivers/net/phy/aquantia/aquantia.h
|
|
+++ b/drivers/net/phy/aquantia/aquantia.h
|
|
@@ -82,6 +82,18 @@
|
|
#define VEND1_GLOBAL_RSVD_STAT9_MODE GENMASK(7, 0)
|
|
#define VEND1_GLOBAL_RSVD_STAT9_1000BT2 0x23
|
|
|
|
+/* MDIO_MMD_C22EXT */
|
|
+#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES 0xd292
|
|
+#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES 0xd294
|
|
+#define MDIO_C22EXT_STAT_SGMII_RX_FALSE_CARRIER 0xd297
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_GOOD_FRAMES 0xd313
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_BAD_FRAMES 0xd315
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_FALSE_CARRIER 0xd317
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_COLLISIONS 0xd318
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_LINE_COLLISIONS 0xd319
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a
|
|
+#define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b
|
|
+
|
|
#define VEND1_GLOBAL_INT_STD_STATUS 0xfc00
|
|
#define VEND1_GLOBAL_INT_VEND_STATUS 0xfc01
|
|
|
|
@@ -108,6 +120,32 @@
|
|
#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1)
|
|
#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0)
|
|
|
|
+struct aqr107_hw_stat {
|
|
+ const char *name;
|
|
+ int reg;
|
|
+ int size;
|
|
+};
|
|
+
|
|
+#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s }
|
|
+static const struct aqr107_hw_stat aqr107_hw_stats[] = {
|
|
+ SGMII_STAT("sgmii_rx_good_frames", RX_GOOD_FRAMES, 26),
|
|
+ SGMII_STAT("sgmii_rx_bad_frames", RX_BAD_FRAMES, 26),
|
|
+ SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER, 8),
|
|
+ SGMII_STAT("sgmii_tx_good_frames", TX_GOOD_FRAMES, 26),
|
|
+ SGMII_STAT("sgmii_tx_bad_frames", TX_BAD_FRAMES, 26),
|
|
+ SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER, 8),
|
|
+ SGMII_STAT("sgmii_tx_collisions", TX_COLLISIONS, 8),
|
|
+ SGMII_STAT("sgmii_tx_line_collisions", TX_LINE_COLLISIONS, 8),
|
|
+ SGMII_STAT("sgmii_tx_frame_alignment_err", TX_FRAME_ALIGN_ERR, 16),
|
|
+ SGMII_STAT("sgmii_tx_runt_frames", TX_RUNT_FRAMES, 22),
|
|
+};
|
|
+
|
|
+#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats)
|
|
+
|
|
+struct aqr107_priv {
|
|
+ u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
|
|
+};
|
|
+
|
|
#if IS_REACHABLE(CONFIG_HWMON)
|
|
int aqr_hwmon_probe(struct phy_device *phydev);
|
|
#else
|
|
--- a/drivers/net/phy/aquantia/aquantia_main.c
|
|
+++ b/drivers/net/phy/aquantia/aquantia_main.c
|
|
@@ -84,49 +84,12 @@
|
|
#define MDIO_AN_RX_VEND_STAT3 0xe832
|
|
#define MDIO_AN_RX_VEND_STAT3_AFR BIT(0)
|
|
|
|
-/* MDIO_MMD_C22EXT */
|
|
-#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES 0xd292
|
|
-#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES 0xd294
|
|
-#define MDIO_C22EXT_STAT_SGMII_RX_FALSE_CARRIER 0xd297
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_GOOD_FRAMES 0xd313
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_BAD_FRAMES 0xd315
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_FALSE_CARRIER 0xd317
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_COLLISIONS 0xd318
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_LINE_COLLISIONS 0xd319
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_FRAME_ALIGN_ERR 0xd31a
|
|
-#define MDIO_C22EXT_STAT_SGMII_TX_RUNT_FRAMES 0xd31b
|
|
-
|
|
/* Sleep and timeout for checking if the Processor-Intensive
|
|
* MDIO operation is finished
|
|
*/
|
|
#define AQR107_OP_IN_PROG_SLEEP 1000
|
|
#define AQR107_OP_IN_PROG_TIMEOUT 100000
|
|
|
|
-struct aqr107_hw_stat {
|
|
- const char *name;
|
|
- int reg;
|
|
- int size;
|
|
-};
|
|
-
|
|
-#define SGMII_STAT(n, r, s) { n, MDIO_C22EXT_STAT_SGMII_ ## r, s }
|
|
-static const struct aqr107_hw_stat aqr107_hw_stats[] = {
|
|
- SGMII_STAT("sgmii_rx_good_frames", RX_GOOD_FRAMES, 26),
|
|
- SGMII_STAT("sgmii_rx_bad_frames", RX_BAD_FRAMES, 26),
|
|
- SGMII_STAT("sgmii_rx_false_carrier_events", RX_FALSE_CARRIER, 8),
|
|
- SGMII_STAT("sgmii_tx_good_frames", TX_GOOD_FRAMES, 26),
|
|
- SGMII_STAT("sgmii_tx_bad_frames", TX_BAD_FRAMES, 26),
|
|
- SGMII_STAT("sgmii_tx_false_carrier_events", TX_FALSE_CARRIER, 8),
|
|
- SGMII_STAT("sgmii_tx_collisions", TX_COLLISIONS, 8),
|
|
- SGMII_STAT("sgmii_tx_line_collisions", TX_LINE_COLLISIONS, 8),
|
|
- SGMII_STAT("sgmii_tx_frame_alignment_err", TX_FRAME_ALIGN_ERR, 16),
|
|
- SGMII_STAT("sgmii_tx_runt_frames", TX_RUNT_FRAMES, 22),
|
|
-};
|
|
-#define AQR107_SGMII_STAT_SZ ARRAY_SIZE(aqr107_hw_stats)
|
|
-
|
|
-struct aqr107_priv {
|
|
- u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
|
|
-};
|
|
-
|
|
static int aqr107_get_sset_count(struct phy_device *phydev)
|
|
{
|
|
return AQR107_SGMII_STAT_SZ;
|