mbox series

[RFC,v4,net-next,0/4] MT7530 interrupt support

Message ID 20210412034237.2473017-1-dqfext@gmail.com
Headers show
Series MT7530 interrupt support | expand

Message

Qingfang Deng April 12, 2021, 3:42 a.m. UTC
Add support for MT7530 interrupt controller.

DENG Qingfang (4):
  net: phy: add MediaTek PHY driver
  net: dsa: mt7530: add interrupt support
  dt-bindings: net: dsa: add MT7530 interrupt controller binding
  staging: mt7621-dts: enable MT7530 interrupt controller

 .../devicetree/bindings/net/dsa/mt7530.txt    |   6 +
 drivers/net/dsa/Kconfig                       |   1 +
 drivers/net/dsa/mt7530.c                      | 266 ++++++++++++++++--
 drivers/net/dsa/mt7530.h                      |  20 +-
 drivers/net/phy/Kconfig                       |   5 +
 drivers/net/phy/Makefile                      |   1 +
 drivers/net/phy/mediatek.c                    | 111 ++++++++
 drivers/staging/mt7621-dts/mt7621.dtsi        |   4 +
 8 files changed, 385 insertions(+), 29 deletions(-)
 create mode 100644 drivers/net/phy/mediatek.c

Comments

Qingfang Deng April 12, 2021, 3:08 p.m. UTC | #1
On Mon, Apr 12, 2021 at 07:04:49AM +0000, René van Dorst wrote:
> Hi Qingfang,
> > +static void mtk_phy_config_init(struct phy_device *phydev)
> > +{
> > +	/* Disable EEE */
> > +	phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0);
> 
> For my EEE patch I changed this line to:
> 
> genphy_config_eee_advert(phydev);
> 
> So PHY EEE part is setup properly at boot, instead enable it manual via
> ethtool.
> This function also takes the DTS parameters "eee-broken-xxxx" in to account
> while
i> setting-up the PHY.

Thanks, I'm now testing with it.

> 
> > +
> > +	/* Enable HW auto downshift */
> > +	phy_modify_paged(phydev, MTK_PHY_PAGE_EXTENDED, 0x14, 0, BIT(4));
Qingfang Deng April 13, 2021, 3:59 a.m. UTC | #2
On Mon, Apr 12, 2021 at 11:08:36PM +0800, DENG Qingfang wrote:
> On Mon, Apr 12, 2021 at 07:04:49AM +0000, René van Dorst wrote:

> > Hi Qingfang,

> > > +static void mtk_phy_config_init(struct phy_device *phydev)

> > > +{

> > > +	/* Disable EEE */

> > > +	phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0);

> > 

> > For my EEE patch I changed this line to:

> > 

> > genphy_config_eee_advert(phydev);

> > 

> > So PHY EEE part is setup properly at boot, instead enable it manual via

> > ethtool.

> > This function also takes the DTS parameters "eee-broken-xxxx" in to account

> > while

> > setting-up the PHY.

> 

> Thanks, I'm now testing with it.


Hi Rene,

Within 12 hours, I got some spontaneous link down/ups when EEE is enabled:

[16334.236233] mt7530 mdio-bus:1f wan: Link is Down
[16334.241340] br-lan: port 3(wan) entered disabled state
[16337.355988] mt7530 mdio-bus:1f wan: Link is Up - 1Gbps/Full - flow control rx/tx
[16337.363468] br-lan: port 3(wan) entered blocking state
[16337.368638] br-lan: port 3(wan) entered forwarding state

The cable is a 30m Cat.6 and never has such issue when EEE is disabled.
Perhaps WAKEUP_TIME_1000/100 or some PHY registers need to be fine-tuned,
but for now I think it should be disabled by default.

> 

> > 

> > > +

> > > +	/* Enable HW auto downshift */

> > > +	phy_modify_paged(phydev, MTK_PHY_PAGE_EXTENDED, 0x14, 0, BIT(4));
René van Dorst April 13, 2021, 9:55 a.m. UTC | #3
Quoting DENG Qingfang <dqfext@gmail.com>:

> On Mon, Apr 12, 2021 at 11:08:36PM +0800, DENG Qingfang wrote:

>> On Mon, Apr 12, 2021 at 07:04:49AM +0000, René van Dorst wrote:

>> > Hi Qingfang,

>> > > +static void mtk_phy_config_init(struct phy_device *phydev)

>> > > +{

>> > > +	/* Disable EEE */

>> > > +	phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0);

>> >

>> > For my EEE patch I changed this line to:

>> >

>> > genphy_config_eee_advert(phydev);

>> >

>> > So PHY EEE part is setup properly at boot, instead enable it manual via

>> > ethtool.

>> > This function also takes the DTS parameters "eee-broken-xxxx" in  

>> to account

>> > while

>> > setting-up the PHY.

>>

>> Thanks, I'm now testing with it.

>

> Hi Rene,

>

> Within 12 hours, I got some spontaneous link down/ups when EEE is enabled:

>

> [16334.236233] mt7530 mdio-bus:1f wan: Link is Down

> [16334.241340] br-lan: port 3(wan) entered disabled state

> [16337.355988] mt7530 mdio-bus:1f wan: Link is Up - 1Gbps/Full -  

> flow control rx/tx

> [16337.363468] br-lan: port 3(wan) entered blocking state

> [16337.368638] br-lan: port 3(wan) entered forwarding state

>

> The cable is a 30m Cat.6 and never has such issue when EEE is disabled.

> Perhaps WAKEUP_TIME_1000/100 or some PHY registers need to be fine-tuned,

> but for now I think it should be disabled by default.


Hi Qingfang,

Problem is that, may be the other device on the other side, may is issue.
So it is hard to tell which device is the issue.


I have a low traffic access point with 1meter cable running the  
openwrt 5.10 kernel with the openwrt EEE patch.
EEE is active and uptime with 16days without an issue.
This was with the old patch which clears the WAKEUP_TIME_1000/100 values.


I changed my ethernet setup so that access point switch has more  
traffic and longer cable ~18meters.
I also upgraded the kernel to 5.10.28 and added the EEE v2 patch.
Let's see what happens for a longer time and with more real world traffic.

Greats,

René
>

>>

>> >

>> > > +

>> > > +	/* Enable HW auto downshift */

>> > > +	phy_modify_paged(phydev, MTK_PHY_PAGE_EXTENDED, 0x14, 0, BIT(4));
Russell King (Oracle) April 13, 2021, 1:12 p.m. UTC | #4
On Tue, Apr 13, 2021 at 11:59:20AM +0800, DENG Qingfang wrote:
> Within 12 hours, I got some spontaneous link down/ups when EEE is enabled:

> 

> [16334.236233] mt7530 mdio-bus:1f wan: Link is Down

> [16334.241340] br-lan: port 3(wan) entered disabled state

> [16337.355988] mt7530 mdio-bus:1f wan: Link is Up - 1Gbps/Full - flow control rx/tx

> [16337.363468] br-lan: port 3(wan) entered blocking state

> [16337.368638] br-lan: port 3(wan) entered forwarding state

> 

> The cable is a 30m Cat.6 and never has such issue when EEE is disabled.

> Perhaps WAKEUP_TIME_1000/100 or some PHY registers need to be fine-tuned,

> but for now I think it should be disabled by default.


Experience with Atheros AR8035 which has a very similar issue would
suggest that before resorting to the blunt hammer of disabling
SmartEEE, one should definitely experiment with the 1G Tw settings.

Using 24us for 1G speeds on AR8035 helps a great deal, whereas the PHY
defaults to 17us for 1G and 23us for 100M.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Qingfang Deng April 15, 2021, 9:49 a.m. UTC | #5
On Tue, Apr 13, 2021 at 02:12:59PM +0100, Russell King - ARM Linux admin wrote:
> On Tue, Apr 13, 2021 at 11:59:20AM +0800, DENG Qingfang wrote:

> > Within 12 hours, I got some spontaneous link down/ups when EEE is enabled:

> > 

> > [16334.236233] mt7530 mdio-bus:1f wan: Link is Down

> > [16334.241340] br-lan: port 3(wan) entered disabled state

> > [16337.355988] mt7530 mdio-bus:1f wan: Link is Up - 1Gbps/Full - flow control rx/tx

> > [16337.363468] br-lan: port 3(wan) entered blocking state

> > [16337.368638] br-lan: port 3(wan) entered forwarding state

> > 

> > The cable is a 30m Cat.6 and never has such issue when EEE is disabled.

> > Perhaps WAKEUP_TIME_1000/100 or some PHY registers need to be fine-tuned,

> > but for now I think it should be disabled by default.

> 

> Experience with Atheros AR8035 which has a very similar issue would

> suggest that before resorting to the blunt hammer of disabling

> SmartEEE, one should definitely experiment with the 1G Tw settings.

> 

> Using 24us for 1G speeds on AR8035 helps a great deal, whereas the PHY

> defaults to 17us for 1G and 23us for 100M.


I set the 1G Tw to maximum 255us and still got the link issue..