mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
3887a55909
Removed upstreamed: backport-5.15/430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch[1] backport-5.15/612-v6.3-skbuff-Fix-a-race-between-coalescing-and-releasing-S.patch[2] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.108&id=85d7a7044b759d865d10395a357632af00de5867 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.108&id=906a6689bb0191ad2a44131a3377006aa098af59 Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia <therealgraysky@proton.me>
99 lines
3.4 KiB
Diff
99 lines
3.4 KiB
Diff
From 8475c4b70b040f9d8cbc308100f2c4d865f810b3 Mon Sep 17 00:00:00 2001
|
|
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
|
Date: Tue, 13 Sep 2022 20:06:27 +0100
|
|
Subject: [PATCH 1/1] net: sfp: re-implement soft state polling setup
|
|
|
|
Re-implement the decision making for soft state polling. Instead of
|
|
generating the soft state mask in sfp_soft_start_poll() by looking at
|
|
which GPIOs are available, record their availability in
|
|
sfp_sm_mod_probe() in sfp->state_hw_mask.
|
|
|
|
This will then allow us to clear bits in sfp->state_hw_mask in module
|
|
specific quirks when the hardware signals should not be used, thereby
|
|
allowing us to switch to using the software state polling.
|
|
|
|
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/phy/sfp.c | 38 ++++++++++++++++++++++++++------------
|
|
1 file changed, 26 insertions(+), 12 deletions(-)
|
|
|
|
--- a/drivers/net/phy/sfp.c
|
|
+++ b/drivers/net/phy/sfp.c
|
|
@@ -240,6 +240,7 @@ struct sfp {
|
|
bool need_poll;
|
|
|
|
struct mutex st_mutex; /* Protects state */
|
|
+ unsigned int state_hw_mask;
|
|
unsigned int state_soft_mask;
|
|
unsigned int state;
|
|
struct delayed_work poll;
|
|
@@ -505,17 +506,18 @@ static void sfp_soft_set_state(struct sf
|
|
static void sfp_soft_start_poll(struct sfp *sfp)
|
|
{
|
|
const struct sfp_eeprom_id *id = &sfp->id;
|
|
+ unsigned int mask = 0;
|
|
|
|
sfp->state_soft_mask = 0;
|
|
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_DISABLE &&
|
|
- !sfp->gpio[GPIO_TX_DISABLE])
|
|
- sfp->state_soft_mask |= SFP_F_TX_DISABLE;
|
|
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_FAULT &&
|
|
- !sfp->gpio[GPIO_TX_FAULT])
|
|
- sfp->state_soft_mask |= SFP_F_TX_FAULT;
|
|
- if (id->ext.enhopts & SFP_ENHOPTS_SOFT_RX_LOS &&
|
|
- !sfp->gpio[GPIO_LOS])
|
|
- sfp->state_soft_mask |= SFP_F_LOS;
|
|
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_DISABLE)
|
|
+ mask |= SFP_F_TX_DISABLE;
|
|
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_TX_FAULT)
|
|
+ mask |= SFP_F_TX_FAULT;
|
|
+ if (id->ext.enhopts & SFP_ENHOPTS_SOFT_RX_LOS)
|
|
+ mask |= SFP_F_LOS;
|
|
+
|
|
+ // Poll the soft state for hardware pins we want to ignore
|
|
+ sfp->state_soft_mask = ~sfp->state_hw_mask & mask;
|
|
|
|
if (sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT) &&
|
|
!sfp->need_poll)
|
|
@@ -529,10 +531,11 @@ static void sfp_soft_stop_poll(struct sf
|
|
|
|
static unsigned int sfp_get_state(struct sfp *sfp)
|
|
{
|
|
- unsigned int state = sfp->get_state(sfp);
|
|
+ unsigned int soft = sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT);
|
|
+ unsigned int state;
|
|
|
|
- if (state & SFP_F_PRESENT &&
|
|
- sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT))
|
|
+ state = sfp->get_state(sfp) & sfp->state_hw_mask;
|
|
+ if (state & SFP_F_PRESENT && soft)
|
|
state |= sfp_soft_get_state(sfp);
|
|
|
|
return state;
|
|
@@ -1942,6 +1945,15 @@ static int sfp_sm_mod_probe(struct sfp *
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
+ /* Initialise state bits to use from hardware */
|
|
+ sfp->state_hw_mask = SFP_F_PRESENT;
|
|
+ if (sfp->gpio[GPIO_TX_DISABLE])
|
|
+ sfp->state_hw_mask |= SFP_F_TX_DISABLE;
|
|
+ if (sfp->gpio[GPIO_TX_FAULT])
|
|
+ sfp->state_hw_mask |= SFP_F_TX_FAULT;
|
|
+ if (sfp->gpio[GPIO_LOS])
|
|
+ sfp->state_hw_mask |= SFP_F_LOS;
|
|
+
|
|
if (!memcmp(id.base.vendor_name, "ALCATELLUCENT ", 16) &&
|
|
!memcmp(id.base.vendor_pn, "3FE46541AA ", 16))
|
|
sfp->module_t_start_up = T_START_UP_BAD_GPON;
|
|
@@ -2568,6 +2580,8 @@ static int sfp_probe(struct platform_dev
|
|
return PTR_ERR(sfp->gpio[i]);
|
|
}
|
|
|
|
+ sfp->state_hw_mask = SFP_F_PRESENT;
|
|
+
|
|
sfp->get_state = sfp_gpio_get_state;
|
|
sfp->set_state = sfp_gpio_set_state;
|
|
|