linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
To: Oleksij Rempel <linux@rempel-privat.de>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Subject: RE: Linux kernel commit "add phy-mode support for the KSZ9031 PHY" broke ETH for Synopsys HSDK board.
Date: Tue, 7 Jul 2020 12:59:11 +0000	[thread overview]
Message-ID: <CH2PR12MB41043173D45D80E9E6867CDED9660@CH2PR12MB4104.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1feb8e17-c92d-c7b4-dbe4-7ff0a23dface@rempel-privat.de>

Hi Oleksij,

Thanks a lot for a detailed explanation and advices!  
Changing phy-mode to "rgmii-id" solved the issue.
Thank you for help!

Best regards,
Evgeniy Didin

-----Original Message-----
From: Oleksij Rempel <linux@rempel-privat.de> 
Sent: Friday, July 3, 2020 8:18 AM
To: Evgeniy Didin <didin@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>; Eugeniy Paltsev <paltsev@synopsys.com>; linux-snps-arc@lists.infradead.org; Jose Abreu <joabreu@synopsys.com>
Subject: Re: Linux kernel commit "add phy-mode support for the KSZ9031 PHY" broke ETH for Synopsys HSDK board.

Hi Evgeniy,

Am 03.07.20 um 01:28 schrieb Evgeniy Didin:
> Hi Oleksij,
> 
> Synopsys ARC HSDK board has “Micrel KSZ9031 Gigabit PHY” chip on it, boot log:
>> Starting network: stmmaceth f0008000.ethernet eth0: PHY [stmmac-0:00] 
>> driver [Micrel KSZ9031
> Gigabit PHY] (irq=POLL)
> With recent commit bcf3440c6dd ("net: phy: micrel: add phy-mode 
> support for the KSZ9031 PHY") Ethernet stopped
> 
> working on HSDK board.
> 
> 
> It seems that there is a lack of *phy* configuration in hsdk.dts file, see:
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/
> arch/arc/boot/dts/hsdk.dts#n229
> 
> What fields do you think we should add to the *ethernet-phy@0* configuration?
> Or maybe something else is causing the eth issue? Do you have any thoughts on this?

Short answer:
mac: ethernet@8000 {
  ...
  phy-mode = "rgmii-id"; (or "rgmii-rxid")
  ...
}

Long answer:
According to the RGMII v1.2 specification: "PC board design will require clocks to be routed such that an additional trace delay of greater than 1.5ns and less than 2.0ns"

Usually, to get this kind of delay on the clock line, you should make the clock line 10-15cm longer then the data lines.

Since it is kind of complicated, to add this long traces to a tiny embedded board, was introduced specification RGMII v2.0. It allows for MAC and/or PHY to have internal delay. A device with internal delay will be called "rgmii-id". In the kernel it is preffered to add this delay by the PHY, not MAC. Otherwise it will be a bug and should be fixed.

Since most of embedded boards do not have room for 15cm clock traces, then in most cases 'phy-mode = "rgmii"' is not correct. It will work as long as PHY driver will be fixed. Like in this case.

Per default KSZ9031 was configured as "rgmii-rxid":
- no delay on TX path (MAC to PHY)
- 1.2ns delay on RX path (PHY to MAC)

If it was working on your board in "rgmii-rxid" mode, then:
- the MAC added some delay. in this case, most probably it is a bug and should be fixed in the MAC driver.
- there was no TX delay and the PHY was working by accident on the edge of specification. Did you had some kind of random packet drops?
- The clock line is actually 10-15cm longer then data lines.

Beside, phy0 on this board is bootstrapped to the address 0, which is broadcast address on the MDIO bus. Please don't use this address if possible. And, it is probably a good idea to add in the comment the part name of the PHY. Бecause patching PHY drivers is usually done like: "туши свет, бросай гранату" ;)

--
Regards,
Oleksij

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

      reply	other threads:[~2020-07-07 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM6PR12MB41060B53C1B81BD0A2D49ED0D96D0@DM6PR12MB4106.namprd12.prod.outlook.com>
2020-07-03  5:18 ` Linux kernel commit "add phy-mode support for the KSZ9031 PHY" broke ETH for Synopsys HSDK board Oleksij Rempel
2020-07-07 12:59   ` Evgeniy Didin [this message]

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=CH2PR12MB41043173D45D80E9E6867CDED9660@CH2PR12MB4104.namprd12.prod.outlook.com \
    --to=evgeniy.didin@synopsys.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux@rempel-privat.de \
    /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;
as well as URLs for NNTP newsgroup(s).