From: Roger Quadros <rogerq@kernel.org>
To: Siddharth Vadapalli <s-vadapalli@ti.com>
Cc: u-boot@lists.denx.de, nm@ti.com, joe.hershberger@ni.com,
robertcnelson@gmail.com, jkridner@beagleboard.org,
r-gunasekaran@ti.com, srk@ti.com, trini@konsulko.com,
Ramon Fried <rfried.dev@gmail.com>
Subject: Re: [PATCH 1/2] net: ti: am65-cpsw-nuss: Workaround for buggy PHY/Board
Date: Wed, 23 Aug 2023 11:35:59 +0300 [thread overview]
Message-ID: <566b58f1-fb4f-46ca-c08a-58c100fdf03d@kernel.org> (raw)
In-Reply-To: <8b48a7a0-575d-83dc-877b-d134f85e6077@kernel.org>
On 23/08/2023 11:14, Roger Quadros wrote:
>
>
> On 23/08/2023 11:02, Siddharth Vadapalli wrote:
>>
>>
>> On 23/08/23 13:22, Roger Quadros wrote:
>>> Hi Siddharth,
>>>
>>> On 23/08/2023 07:35, Siddharth Vadapalli wrote:
>>>> Roger,
>>>>
>>>> On 22/08/23 17:43, Roger Quadros wrote:
>>>>> Beagleplay has a buggy Ethernet PHY implementation for the Gigabit
>>>>> PHY in the sense that it is non responsive over MDIO immediately
>>>>> after power-up/reset.
>>>>>
>>>>> We need to either try multiple times or wait sufficiently long enough
>>>>> (couple of 10s of ms?) before the PHY begins to respond correctly.
>>>>
>>>> Based on the datasheet at:
>>>> https://datasheet.lcsc.com/lcsc/1912111437_Realtek-Semicon-RTL8211F-CG_C187932.pdf
>>>> in the section 7.17. PHY Reset (Hardware Reset), it is stated that
>>>> software has to wait for at least 50 ms before accessing the PHY
>>>> registers. Is this why the for-loop in the code below tries for at most
>>>> 5 times with a delay of 10 ms before the next try? If yes, then isn't it
>>>
At power on, the constraint is even larger.
Please see Section 9.3 Power sequence.
PHY registers can be accessed at T2 which is sum of Rt3, Rt4, Rt5
which is about 146.5ms after Power Active and PHY Reset de-asserted.
>>> Good catch. This might be the reason why PHY is not responding in the first
>>> few attempts.
>>>
>>>> better to move the delay into the realtek PHY driver at
>>>> drivers/net/phy/realtek.c
>>>
>>> We are currently at the MDIO bus driver where we don't even know what PHY
>>> is on the bus. So this delay cannot come at the realtec PHY driver.
>>> It has to come at the MDIO bus driver level.
>>
>> Thank you for clarifying.
>>
>
> Looking closer, this is already being addressed by drivers/net/eth-phy-uclass.c
> in eth_phy_pre_probe()
>
> linux/Documentation/devicetree/bindings/net/ethernet-phy.yaml
>
> reset-assert-us:
> description:
> Delay after the reset was asserted in microseconds. If this
> property is missing the delay will be skipped.
>
> reset-deassert-us:
> description:
> Delay after the reset was deasserted in microseconds. If
> this property is missing the delay will be skipped.
>
> So we can drop this patch once we implement proper uclass driver for cpsw-mdio.
>
>>>
>>>> Shouldn't it be the PHY driver which ensures that any reads/writes to the PHY
>>>> registers are valid? It can ensure this by having a one time 50ms delay for the
>>>> very first access to the PHY registers.>
>>
>> ...
>>
>>>>
>>>
>>
>
--
cheers,
-roger
next prev parent reply other threads:[~2023-08-23 8:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 12:13 [PATCH 0/2] net: Fix Ethernet PHY detection on Beagleplay Roger Quadros
2023-08-22 12:13 ` [PATCH 1/2] net: ti: am65-cpsw-nuss: Workaround for buggy PHY/Board Roger Quadros
2023-08-23 4:35 ` Siddharth Vadapalli
2023-08-23 7:52 ` Roger Quadros
2023-08-23 8:02 ` Siddharth Vadapalli
2023-08-23 8:14 ` Roger Quadros
2023-08-23 8:35 ` Roger Quadros [this message]
2023-08-24 18:04 ` Siddharth Vadapalli
2023-08-24 18:24 ` Tom Rini
2023-08-24 19:09 ` Roger Quadros
2023-08-25 5:42 ` Siddharth Vadapalli
2023-08-25 7:52 ` Roger Quadros
2023-08-25 8:22 ` Siddharth Vadapalli
2023-08-22 12:13 ` [PATCH 2/2] net: phy: Change "PHY not found" message to debug() Roger Quadros
2023-08-23 4:54 ` Siddharth Vadapalli
2023-08-23 8:06 ` Roger Quadros
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=566b58f1-fb4f-46ca-c08a-58c100fdf03d@kernel.org \
--to=rogerq@kernel.org \
--cc=jkridner@beagleboard.org \
--cc=joe.hershberger@ni.com \
--cc=nm@ti.com \
--cc=r-gunasekaran@ti.com \
--cc=rfried.dev@gmail.com \
--cc=robertcnelson@gmail.com \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.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