Skip to content

Commit a502a8f

Browse files
hkallweitkuba-moo
authored andcommitted
net: phy: meson-gxl: fix interrupt handling in forced mode
This PHY doesn't support a link-up interrupt source. If aneg is enabled we use the "aneg complete" interrupt for this purpose, but if aneg is disabled link-up isn't signaled currently. According to a vendor driver there's an additional "energy detect" interrupt source that can be used to signal link-up if aneg is disabled. We can safely ignore this interrupt source if aneg is enabled. This patch was tested on a TX3 Mini TV box with S905W (even though boot message says it's a S905D). This issue has been existing longer, but due to changes in phylib and the driver the patch applies only from the commit marked as fixed. Fixes: 84c8f77 ("net: phy: meson-gxl: remove the use of .ack_callback()") Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent be4977b commit a502a8f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

drivers/net/phy/meson-gxl.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@
3030
#define INTSRC_LINK_DOWN BIT(4)
3131
#define INTSRC_REMOTE_FAULT BIT(5)
3232
#define INTSRC_ANEG_COMPLETE BIT(6)
33+
#define INTSRC_ENERGY_DETECT BIT(7)
3334
#define INTSRC_MASK 30
3435

36+
#define INT_SOURCES (INTSRC_LINK_DOWN | INTSRC_ANEG_COMPLETE | \
37+
INTSRC_ENERGY_DETECT)
38+
3539
#define BANK_ANALOG_DSP 0
3640
#define BANK_WOL 1
3741
#define BANK_BIST 3
@@ -200,7 +204,6 @@ static int meson_gxl_ack_interrupt(struct phy_device *phydev)
200204

201205
static int meson_gxl_config_intr(struct phy_device *phydev)
202206
{
203-
u16 val;
204207
int ret;
205208

206209
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
@@ -209,16 +212,9 @@ static int meson_gxl_config_intr(struct phy_device *phydev)
209212
if (ret)
210213
return ret;
211214

212-
val = INTSRC_ANEG_PR
213-
| INTSRC_PARALLEL_FAULT
214-
| INTSRC_ANEG_LP_ACK
215-
| INTSRC_LINK_DOWN
216-
| INTSRC_REMOTE_FAULT
217-
| INTSRC_ANEG_COMPLETE;
218-
ret = phy_write(phydev, INTSRC_MASK, val);
215+
ret = phy_write(phydev, INTSRC_MASK, INT_SOURCES);
219216
} else {
220-
val = 0;
221-
ret = phy_write(phydev, INTSRC_MASK, val);
217+
ret = phy_write(phydev, INTSRC_MASK, 0);
222218

223219
/* Ack any pending IRQ */
224220
ret = meson_gxl_ack_interrupt(phydev);
@@ -237,9 +233,16 @@ static irqreturn_t meson_gxl_handle_interrupt(struct phy_device *phydev)
237233
return IRQ_NONE;
238234
}
239235

236+
irq_status &= INT_SOURCES;
237+
240238
if (irq_status == 0)
241239
return IRQ_NONE;
242240

241+
/* Aneg-complete interrupt is used for link-up detection */
242+
if (phydev->autoneg == AUTONEG_ENABLE &&
243+
irq_status == INTSRC_ENERGY_DETECT)
244+
return IRQ_HANDLED;
245+
243246
phy_trigger_machine(phydev);
244247

245248
return IRQ_HANDLED;

0 commit comments

Comments
 (0)