From: Jerome Brunet <jbrunet@baylibre.com>
To: Heiner Kallweit <hkallweit1@gmail.com>, Da Xue <da@lessconfused.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
Erico Nunes <nunes.erico@gmail.com>,
netdev@vger.kernel.org, linux-amlogic@lists.infradead.org,
Kevin Hilman <khilman@baylibre.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Vyacheslav <adeep@lexina.in>, Qi Duan <qi.duan@amlogic.com>
Subject: Re: [RFC/RFT PATCH] net: stmmac: do not poke MAC_CTRL_REG twice on link up
Date: Mon, 29 Aug 2022 12:01:25 +0200 [thread overview]
Message-ID: <1jfshftliz.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <5c8f4cc4-9807-cfe5-7e0a-7961aef5057f@gmail.com>
On Fri 26 Aug 2022 at 22:36, Heiner Kallweit <hkallweit1@gmail.com> wrote:
> On 26.08.2022 17:45, Da Xue wrote:
>> Hi Heiner,
>>
>> I have been running with the patch reverted for about two weeks now
>> without issue but I have a modified u-boot with ethernet bringup
>> disabled.
>>
>> If u-boot brings up ethernet, all of the GXL boards with more than 1GB
>> memory experience various bugs. I had to bring the PHY initialization
>> patch into Linux proper:
>> https://github.com/libre-computer-project/libretech-linux/commit/1a4004c11877d4239b57b182da1ce69a81c0150c
>>
> Thanks for the follow-up. To be acceptable upstream I'm pretty sure that
> the maintainer is going to request replacing magic number 0x10110181
> with or'ing proper constants for the respective bits and fields.
>
>> Hope this helps someone.
>>
>> Best,
>>
>> Da
>>
>> On Fri, Aug 26, 2022 at 5:51 AM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>>
>>> On 07.07.2022 12:14, Jerome Brunet wrote:
>>>> For some reason, poking MAC_CTRL_REG a second time, even with the same
>>>> value, causes problem on a dwmac 3.70a.
>>>>
>>>> This problem happens on all the Amlogic SoCs, on link up, when the RMII
>>>> 10/100 internal interface is used. The problem does not happen on boards
>>>> using the external RGMII 10/100/1000 interface. Initially we suspected the
>>>> PHY to be the problem but after a lot of testing, the problem seems to be
>>>> coming from the MAC controller.
>>>>
>>>>> meson8b-dwmac c9410000.ethernet: IRQ eth_wake_irq not found
>>>>> meson8b-dwmac c9410000.ethernet: IRQ eth_lpi not found
>>>>> meson8b-dwmac c9410000.ethernet: PTP uses main clock
>>>>> meson8b-dwmac c9410000.ethernet: User ID: 0x11, Synopsys ID: 0x37
>>>>> meson8b-dwmac c9410000.ethernet: DWMAC1000
>>>>> meson8b-dwmac c9410000.ethernet: DMA HW capability register supported
>>>>> meson8b-dwmac c9410000.ethernet: RX Checksum Offload Engine supported
>>>>> meson8b-dwmac c9410000.ethernet: COE Type 2
>>>>> meson8b-dwmac c9410000.ethernet: TX Checksum insertion supported
>>>>> meson8b-dwmac c9410000.ethernet: Wake-Up On Lan supported
>>>>> meson8b-dwmac c9410000.ethernet: Normal descriptors
>>>>> meson8b-dwmac c9410000.ethernet: Ring mode enabled
>>>>> meson8b-dwmac c9410000.ethernet: Enable RX Mitigation via HW Watchdog Timer
>>>>
>>>> The problem is not systematic. Its occurence is very random from 1/50 to
>>>> 1/2. It is fairly easy to detect by setting the kernel to boot over NFS and
>>>> possibly setting it to reboot automatically when reaching the prompt.
>>>>
>>>> When problem happens, the link is reported up by the PHY but no packet are
>>>> actually going out. DHCP requests eventually times out and the kernel reset
>>>> the interface. It may take several attempts but it will eventually work.
>>>>
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
>>>>> Sending DHCP requests ...... timed out!
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Link is Down
>>>>> IP-Config: Retrying forever (NFS root)...
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: PHY [0.1:08] driver [Meson G12A Internal PHY] (irq=POLL)
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: No Safety Features support found
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: PTP not supported by HW
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: configuring for phy/rmii link mode
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
>>>>> Sending DHCP requests ...... timed out!
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Link is Down
>>>>> IP-Config: Retrying forever (NFS root)...
>>>>> [...] 5 retries ...
>>>>> IP-Config: Retrying forever (NFS root)...
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: PHY [0.1:08] driver [Meson G12A Internal PHY] (irq=POLL)
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: No Safety Features support found
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: PTP not supported by HW
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: configuring for phy/rmii link mode
>>>>> meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
>>>>> Sending DHCP requests ., OK
>>>>> IP-Config: Got DHCP answer from 10.1.1.1, my address is 10.1.3.229
>>>>
>>>> Of course the same problem happens when not using NFS and it fairly
>>>> difficult for IoT products to detect this situation and recover.
>>>>
>>>> The call to stmmac_mac_set() should be no-op in our case, the bits it sets
>>>> have already been set by an earlier call to stmmac_mac_set(). However
>>>> removing this call solves the problem. We have no idea why or what is the
>>>> actual problem.
>>>>
>>>> Even weirder, keeping the call to stmmac_mac_set() but inserting a
>>>> udelay(1) between writel() and stmmac_mac_set() solves the problem too.
>>>>
>>>> Suggested-by: Qi Duan <qi.duan@amlogic.com>
>>>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>>>> ---
>>>>
>>>> Hi,
>>>>
>>>> There is no intention to get this patch merged as it is.
>>>> It is sent with the hope to get a better understanding of the issue
>>>> and more testing.
>>>>
>>>> The discussion on this issue initially started on this thread
>>>> https://lore.kernel.org/all/CAK4VdL3-BEBzgVXTMejrAmDjOorvoGDBZ14UFrDrKxVEMD2Zjg@mail.gmail.com/
>>>>
>>>> The patches previously proposed in this thread have not solved the
>>>> problem.
>>>>
>>>> The line removed in this patch should be a no-op when it comes to the
>>>> value of MAC_CTRL_REG. So the change should make not a difference but
>>>> it does. Testing result have been very good so far so there must be an
>>>> unexpected consequence on the HW. I hope that someone with more
>>>> knowledge on this controller will be able to shine some light on this.
>>>>
>>>> Cheers
>>>> Jerome
>>>>
>>>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 -
>>>> 1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>>> index d1a7cf4567bc..3dca3cc61f39 100644
>>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>>> @@ -1072,7 +1072,6 @@ static void stmmac_mac_link_up(struct phylink_config *config,
>>>>
>>>> writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
>>>>
>>>> - stmmac_mac_set(priv, priv->ioaddr, true);
>>>> if (phy && priv->dma_cap.eee) {
>>>> priv->eee_active = phy_init_eee(phy, 1) >= 0;
>>>> priv->eee_enabled = stmmac_eee_init(priv);
>>>
>>> Now that we have a3a57bf07de2 ("net: stmmac: work around sporadic tx issue on link-up")
>>> in linux-next and scheduled for stable:
I will
>>>
>>> Jerome, can you confirm that after this commit the following is no longer needed?
>>> 2c87c6f9fbdd ("net: phy: meson-gxl: improve link-up behavior")
This never had any meaningful impact for me. I have already reverted it
for testing.
I'm all for reverting it
>>>
>>> Then I'd revert it, referencing the successor workaround / fix in stmmac.
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-08-29 10:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 10:14 [RFC/RFT PATCH] net: stmmac: do not poke MAC_CTRL_REG twice on link up Jerome Brunet
2022-07-13 9:24 ` Da Xue
2022-07-15 6:58 ` Da Xue
2022-08-26 9:51 ` Heiner Kallweit
2022-08-26 15:45 ` Da Xue
2022-08-26 20:36 ` Heiner Kallweit
2022-08-27 20:23 ` Da Xue
2022-08-29 7:39 ` Neil Armstrong
2022-08-29 10:01 ` Jerome Brunet [this message]
2022-08-29 10:29 ` Erico Nunes
2022-08-29 18:25 ` Heiner Kallweit
2022-09-13 7:55 ` Erico Nunes
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=1jfshftliz.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=adeep@lexina.in \
--cc=alexandre.torgue@foss.st.com \
--cc=da@lessconfused.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=narmstrong@baylibre.com \
--cc=netdev@vger.kernel.org \
--cc=nunes.erico@gmail.com \
--cc=peppe.cavallaro@st.com \
--cc=qi.duan@amlogic.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