Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: <Conor.Dooley@microchip.com>
To: <andrew@lunn.ch>, <linux@armlinux.org.uk>, <palmer@rivosinc.com>,
	<Daire.McNamara@microchip.com>
Cc: <apatel@ventanamicro.com>, <netdev@vger.kernel.org>,
	<Nicolas.Ferre@microchip.com>, <Claudiu.Beznea@microchip.com>,
	<hkallweit1@gmail.com>, <linux-riscv@lists.infradead.org>
Subject: Re: riscv defconfig CONFIG_PM/macb/generic PHY regression in v5.18-rc1
Date: Thu, 7 Apr 2022 14:30:00 +0000	[thread overview]
Message-ID: <6411f181-88a5-14a5-114b-77b401683570@microchip.com> (raw)
In-Reply-To: <dd69c92d-dcb9-48e3-8ff5-078ea041769a@microchip.com>

On 06/04/2022 08:36, Conor Dooley wrote:
> On 05/04/2022 15:04, Andrew Lunn wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>>> [ 2.818894] macb 20112000.ethernet eth0: PHY [20112000.ethernet-ffffffff:09] driver [Generic PHY] (irq=POLL)
>>> [ 2.828915] macb 20112000.ethernet eth0: configuring for phy/sgmii link mode
>>> [11.045411] macb 20112000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
>>> [11.053247] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
>>
>> You have a multi-part link. You need that the PHY reports the line
>> side is up. Put some printk in genphy_update_link() and look at
>> phydev->link. You also need that the SGMII link between the PHY and
>> the SoC is up. That is a bit harder to see, but try adding #define
>> DEBUG at the top of phylink.c and phy.c so you get additional debug
>> prints for the state machines.
> 
> Tracked the state of phydev->link in genphy_update_link, never saw a
> value other than 0.
> 
> Using the debug prints in phylink.c I got the following:
> [    3.230364] macb 20112000.ethernet eth0: PHY [20112000.ethernet-ffffffff:09] driver [Vitesse VSC8662] (irq=POLL)
> [    3.240682] macb 20112000.ethernet eth0: phy: sgmii setting supported 0000000,00000000,000042ff advertising 0000000,00000000,000042ff
> [    3.252783] macb 20112000.ethernet eth0: configuring for phy/sgmii link mode
> [    3.259892] macb 20112000.ethernet eth0: major config sgmii
> [    3.265526] macb 20112000.ethernet eth0: phylink_mac_config: mode=phy/sgmii/Unknown/Unknown adv=0000000,00000000,00000000 pause=00 link=0 an=0
> [    3.279249] macb 20112000.ethernet eth0: phy link down sgmii/Unknown/Unknown/off
> 
> I couldn't see any prints out of phy.c

I think I have found the problem. While the SMGII clock is not in
Linux's remit, the mac clocks are. Without CONFIG_PM I see
the following, where 5 represents the clock for MAC1:

[    0.907959] mpfs_periph_clk_enable: 5
[    1.312955] macb 20112000.ethernet eth0: Cadence GEM rev 0x0107010c at 0x20112000 irq 17 (00:04:a3:4d:4c:dc)
[    2.660376] macb 20112000.ethernet eth0: PHY [20112000.ethernet-ffffffff:09] driver [Generic PHY] (irq=POLL)
[    2.670400] macb 20112000.ethernet eth0: configuring for phy/sgmii link mode
[    6.789474] macb 20112000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

With CONFIG_PM, the MAC1 clock gets disabled between mac and phy
bringup. 4 is the clock for the other MAC:

[    0.932598] mpfs_periph_clk_enable: 5
[    1.327876] macb 20112000.ethernet eth0: Cadence GEM rev 0x0107010c at 0x20112000 irq 17 (00:04:a3:4d:4c:dc)
[    1.473632] mpfs_periph_clk_disable: 5
[    1.503327] mpfs_periph_clk_disable: 4
[    2.999528] mpfs_periph_clk_enable: 5
[    3.000300] macb 20112000.ethernet eth0: validation of sgmii with support 0000000,00000000,00006280 and advertisement 0000000,00000000,00004280 failed: -EINVAL
[    3.018612] macb 20112000.ethernet eth0: Could not attach PHY (-22)
[    3.143594] mpfs_periph_clk_disable: 5

However the clock driver is actually not only disabling the clock,
but also putting peripherals into reset when the clock to them is
disabled. Removing the reset gives:

[    0.934717] mpfs_periph_clk_enable: 5
[    1.326564] macb 20112000.ethernet eth0: Cadence GEM rev 0x0107010c at 0x20112000 irq 17 (00:04:a3:4d:4c:dc)
[    1.473155] mpfs_periph_clk_disable: 5
[    1.502805] mpfs_periph_clk_disable: 4
[    3.006384] mpfs_periph_clk_enable: 5
[    3.007691] macb 20112000.ethernet eth0: PHY [20112000.ethernet-ffffffff:09] driver [Generic PHY] (irq=POLL)
[    3.021409] macb 20112000.ethernet eth0: configuring for phy/sgmii link mode
[    7.114710] macb 20112000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off


Thanks for your help in figuring this out, looks like the problem
is mine to fix :)

Thanks again,
Conor.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-04-07 14:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 13:05 riscv defconfig CONFIG_PM/macb/generic PHY regression in v5.18-rc1 Conor.Dooley
2022-04-05 13:25 ` Andrew Lunn
2022-04-05 14:18   ` Conor.Dooley
2022-04-05 14:41     ` Conor.Dooley
2022-04-05 14:49     ` Andrew Lunn
2022-04-05 14:56 ` Andrew Lunn
2022-04-05 15:04 ` Andrew Lunn
2022-04-05 16:25   ` Conor Dooley
2022-04-06  8:36   ` Conor.Dooley
2022-04-07 14:30     ` Conor.Dooley [this message]
2022-04-05 15:53 ` Russell King (Oracle)
2022-04-05 16:56   ` Palmer Dabbelt
2022-04-05 17:23     ` Conor Dooley
2022-04-05 18:06       ` Andrew Lunn
2022-04-05 18:35         ` Conor Dooley
2022-04-05 16:58   ` Conor Dooley
2022-04-05 18:55     ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6411f181-88a5-14a5-114b-77b401683570@microchip.com \
    --to=conor.dooley@microchip.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=Daire.McNamara@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=apatel@ventanamicro.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=palmer@rivosinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox