net: phy: realtek: fix RTL8211F interrupt mode
Subsystems (4)
Heiner Kallweit
maintainerPATCH 1/1 net: phy: realtek: fix RTL8211F interrupt mode
After commit b94d22d94ad22 "ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.
It turned out that no interrupts were triggered. Further analysis showed the register INER can't be altered on page 0. Because register INSR needs to be accessed via page 0xa43 I assumed that register INER needs to be accessed via some page too. Some brute force check resulted in page 0xa42 being the right one.
With this patch the phy is working properly in interrupt mode.
--- drivers/net/phy/realtek.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/realtek.c +2 -0
@@ -115,11 +115,13 @@ static int rtl8211f_config_intr(struct phy_device *phydev) {int err; +phy_write (phydev, RTL821x_PAGE_SELECT,0xa42 );if (phydev->interrupts ==PHY_INTERRUPT_ENABLED ) err =phy_write (phydev, RTL821x_INER,RTL8211F_INER_LINK_STATUS );else err =phy_write (phydev, RTL821x_INER,0 ); +phy_write (phydev, RTL821x_PAGE_SELECT,0 );return err; }
Signature · 1 line
2.15.0
Andrew Lunn
maintainerQuoted 3 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.
Hi Jerome
Please could you test this. I Just want to be sure we don't introduce a regression by breaking the boards you tested on.
Thanks
Andrew
Jerome Brunet
reviewerQuoted 9 lines · Andrew Lunn
Quoted 3 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.Hi Jerome
Please could you test this. I Just want to be sure we don't introduce a regression by breaking the boards you tested on.
Sure I'll try it tomorrow.
When I tested this, I was more focused on the SoC side of it (the interrupt controller itself) and whether the interrupt worked or not. The board (p200) I tested on used a micrel PHY and worked well ... I did not really expect that a problem would come from the phy side. This was clearly a mistake.
Quoted 3 lines
Thanks
Andrew
Andrew Lunn
maintainerQuoted 8 lines · Jerome Brunet
Quoted 7 lines · Andrew Lunn
Quoted 3 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.Hi Jerome
Quoted 8 lines
Quoted 2 lines
Please could you test this. I Just want to be sure we don't introduce a regression by breaking the boards you tested on.
Sure I'll try it tomorrow.
When I tested this, I was more focused on the SoC side of it (the interrupt controller itself) and whether the interrupt worked or not. The board (p200) I tested on used a micrel PHY and worked well ...
Hi Jerome
Ah, O.K. Do you have a board with a RTL8211? If all your boards use a different PHY, there is no chance of a regression for you.
Thanks
Andrew
Jerome Brunet
reviewerQuoted 14 lines · Andrew Lunn
Quoted 13 lines · Jerome Brunet
Quoted 9 lines · Andrew Lunn
Quoted 3 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.Hi Jerome
Please could you test this. I Just want to be sure we don't introduce a regression by breaking the boards you tested on.
Sure I'll try it tomorrow.
Quoted 8 lines
Quoted 4 lines
When I tested this, I was more focused on the SoC side of it (the interrupt controller itself) and whether the interrupt worked or not. The board (p200) I
tested on used a micrel PHY and worked well ...Hi Jerome
Ah, O.K. Do you have a board with a RTL8211?
I do have some. I'll confirm Heiner's report and fix tomorrow.
Quoted 2 lines
If all your boards use a
different PHY, there is no chance of a regression for you.
I'm not expecting any, quite the contrary actually
Quoted 3 lines
Thanks
Andrew
Hi Heiner,
Quoted 11 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.It turned out that no interrupts were triggered. Further analysis showed the register INER can't be altered on page 0. Because register INSR needs to be accessed via page
0xa43I assumed that register INER needs to be accessed via some page too. Some brute force check resulted in page0xa42being the right one.With this patch the phy is working properly in interrupt mode.
What would be the appropriate Fixes: tag for that patch?
Quoted 25 lines
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/net/phy/realtek.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/phy/realtek.c +2
-0@@ -115,11 +115,13 @@ static int rtl8211f_config_intr(struct phy_device *phydev) {int err; +phy_write (phydev, RTL821x_PAGE_SELECT,0xa42 );if (phydev->interrupts ==PHY_INTERRUPT_ENABLED ) err =phy_write (phydev, RTL821x_INER,RTL8211F_INER_LINK_STATUS );else err =phy_write (phydev, RTL821x_INER,0 ); +phy_write (phydev, RTL821x_PAGE_SELECT,0 );return err; }
Signature · 1 line
Florian
Jerome Brunet
reviewerQuoted 13 lines · Florian Fainelli
Hi Heiner,
Quoted 10 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.It turned out that no interrupts were triggered. Further analysis showed the register INER can't be altered on page 0. Because register INSR needs to be accessed via page
0xa43I assumed that register INER needs to be accessed via some page too. Some brute force check resulted in page0xa42being the right one.
Quoted 3 lines
Quoted 1 line
With this patch the phy is working properly in interrupt mode.
What would be the appropriate Fixes: tag for that patch?
Seems appropriate
Quoted 10 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.It turned out that no interrupts were triggered. Further analysis showed the register INER can't be altered on page 0. Because register INSR needs to be accessed via page
0xa43I assumed that register INER needs to be accessed via some page too. Some brute force check resulted in page0xa42being the right one.
Quoted 3 lines
With this patch the phy is working properly in interrupt mode.
Signed-off-by Heiner Kallweit <[email protected]>
From: Heiner Kallweit <[email protected]>
Date: Sun, 12 Nov 2017 16:16:04 +0100
Quoted 10 lines
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.It turned out that no interrupts were triggered. Further analysis showed the register INER can't be altered on page 0. Because register INSR needs to be accessed via page
0xa43I assumed that register INER needs to be accessed via some page too. Some brute force check resulted in page0xa42being the right one.
Quoted 3 lines
With this patch the phy is working properly in interrupt mode.
Signed-off-by Heiner Kallweit <[email protected]>
Applied.
Martin Blumenstingl
reviewerHi Heiner,
Quoted 9 lines · Heiner Kallweit
After commit
b94d22d94ad22"ARM64: dts: meson-gx: add external PHY interrupt on some platforms" ethernet stopped working on my Odroid-C2 which has a RTL8211F phy.It turned out that no interrupts were triggered. Further analysis showed the register INER can't be altered on page 0. Because register INSR needs to be accessed via page
0xa43I assumed that register INER needs to be accessed via some page too. Some brute force check resulted in page0xa42being the right one.
unfortunately there's no public datasheet for the RTL8211F. I contacted Realtek to see if we could get a datasheet. unfortunately an NDA is required for that
however, they were kind enough to share some information from the RTL8211F datasheet with me
RTL821x_INER is called INER (Interrupt Enable Register) in the datasheet. it is located at page 0xa42, address (the register after selecting the page) 0x12 (RTL821x_INER is also 0x12)
in other words: your findings were correct!
(I know that my mail is too late to make it into the commit message - but with this mail it's "documented" online now)
RTL8211E also uses RTL821x_INER (0x12) register, but according to the information I got from Realtek it is located in page 0x0 (so no special page has to be selected before changing that register on RTL8211E)
Regards
Martin