Skip to content

Commit

Permalink
net: phy: realtek: configure the INTB pin on RTL8211F
Browse files Browse the repository at this point in the history
The interrupt pin on the RTL8211F PHY can be used in two different
modes:
INTB
- the default mode of the PHY
- interrupts can be configured through page 0xa42 register RTL821x_INER
- interrupts can be ACK'ed through RTL8211F_INSR
- it acts as a level-interrupt which is active low
- Wake-on-LAN "wakeup" status is available in RTL8211F_INSR bit 7

PMEB:
- special mode for Wake-on-LAN
- interrupts configured through page 0xa42 register RTL821x_INER are
  disabled
- it supports a "pulse low" waveform for the interrupt

For now we simply force the pin into INTB mode since the PHY driver does
not support Wake-on-LAN yet.

Signed-off-by: Martin Blumenstingl <[email protected]>
  • Loading branch information
xdarklight authored and sigmaris committed Aug 3, 2020
1 parent 3407bed commit 941b1ec
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions drivers/net/phy/realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
#define RTL8201F_ISR 0x1e
#define RTL8201F_IER 0x13

#define RTL8211F_INTBCR 0x16
#define RTL8211F_INTBCR_INTB_PMEB BIT(5)

#define RTL8366RB_POWER_SAVE 0x15
#define RTL8366RB_POWER_SAVE_ON BIT(12)

Expand Down Expand Up @@ -135,12 +138,32 @@ static int rtl8211e_config_intr(struct phy_device *phydev)

static int rtl8211f_config_intr(struct phy_device *phydev)
{
int err;
u16 val;

if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
/*
* The interrupt pin has two functions:
* 0: INTB: it acts as interrupt pin which can be configured
* through RTL821x_INER and the status can be read through
* RTL8211F_INSR
* 1: PMEB: a special "Power Management Event" mode for
* Wake-on-LAN operation (with support for a "pulse low"
* wave format). Interrupts configured through RTL821x_INER
* will not work in this mode
*
* select INTB mode in the "INTB pin control" register to
* ensure that the interrupt pin is in the correct mode.
*/
err = phy_modify_paged(phydev, 0xd40, RTL8211F_INTBCR,
RTL8211F_INTBCR_INTB_PMEB, 0);
if (err)
return err;

val = RTL8211F_INER_LINK_STATUS;
else
} else {
val = 0;
}

return phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
}
Expand Down

0 comments on commit 941b1ec

Please sign in to comment.