All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Cc: Yocto-mailing-list <yocto@lists.yoctoproject.org>,
	Trevor Woerner <twoerner@gmail.com>,
	Quentin Schulz <foss+yocto@0leil.net>
Subject: Re: [yocto] [meta-rockchip][PATCH] kernel: linux-yocto: fix broken Ethernet MAC controller on RK3399 on 5.14 >= version <= 5.14.11
Date: Tue, 16 Nov 2021 09:00:42 -0800	[thread overview]
Message-ID: <CAMKF1sq+cj8e31L1ExHSKckEVab-ZdeUCF3_CTSr0VPtZ=_sVQ@mail.gmail.com> (raw)
In-Reply-To: <20211116153256.3639663-1-quentin.schulz@theobroma-systems.com>

On Tue, Nov 16, 2021 at 7:52 AM Quentin Schulz
<quentin.schulz@theobroma-systems.com> wrote:
>
> From Linux kernel v5.14 to v5.14.11 (both included), the Ethernet MAC
> controller found on RK3399 is not working.
>
> A fix is available in v5.14.12 and later (available also in v5.15)
> which is provided here and applied to linux-yocto source tree if
> linux-yocto version is of the impacted ones.
>
> The conditional patching is unfortunately required because Honister 3.4
> has linux-yocto v5.14.9 and Honister 3.4.1 will have at least
> linux-yocto v5.14.14.

Patching piece below looks quite a bit.
lets just fix v5.14.14 and dont worry about 3.4

>
> Cc: Quentin Schulz <foss+yocto@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  ...-rk-Fix-ethernet-on-rk3399-based-dev.patch | 63 +++++++++++++++++++
>  .../linux/linux-yocto/5.14-rk3399-mac-fix.scc |  1 +
>  .../linux/linux-yocto_5.14.bbappend           | 11 ++++
>  3 files changed, 75 insertions(+)
>  create mode 100644 recipes-kernel/linux/linux-yocto/0001-net-stmmac-dwmac-rk-Fix-ethernet-on-rk3399-based-dev.patch
>  create mode 100644 recipes-kernel/linux/linux-yocto/5.14-rk3399-mac-fix.scc
>  create mode 100644 recipes-kernel/linux/linux-yocto_5.14.bbappend
>
> diff --git a/recipes-kernel/linux/linux-yocto/0001-net-stmmac-dwmac-rk-Fix-ethernet-on-rk3399-based-dev.patch b/recipes-kernel/linux/linux-yocto/0001-net-stmmac-dwmac-rk-Fix-ethernet-on-rk3399-based-dev.patch
> new file mode 100644
> index 0000000..b2ce7e8
> --- /dev/null
> +++ b/recipes-kernel/linux/linux-yocto/0001-net-stmmac-dwmac-rk-Fix-ethernet-on-rk3399-based-dev.patch
> @@ -0,0 +1,63 @@
> +From 8efe947ea1eace444d78398a31469b30e47ae585 Mon Sep 17 00:00:00 2001
> +From: Punit Agrawal <punitagrawal@gmail.com>
> +Date: Wed, 29 Sep 2021 22:50:49 +0900
> +Subject: [PATCH] net: stmmac: dwmac-rk: Fix ethernet on rk3399 based devices
> +
> +[ Upstream commit aec3f415f7244b7747a7952596971adb0df2f568 ]
> +
> +Commit 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings")
> +while getting rid of a runtime PM warning ended up breaking ethernet
> +on rk3399 based devices. By dropping an extra reference to the device,
> +the commit ends up enabling suspend / resume of the ethernet device -
> +which appears to be broken.
> +
> +While the issue with runtime pm is being investigated, partially
> +revert commit 2d26f6e39afb to restore the network on rk3399.
> +
> +Fixes: 2d26f6e39afb ("net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings")
> +Suggested-by: Heiko Stuebner <heiko@sntech.de>
> +Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
> +Cc: Michael Riesch <michael.riesch@wolfvision.net>
> +Tested-by: Heiko Stuebner <heiko@sntech.de>
> +Link: https://lore.kernel.org/r/20210929135049.3426058-1-punitagrawal@gmail.com
> +Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> +Signed-off-by: Sasha Levin <sashal@kernel.org>
> +
> +Upstream-Status: Backport [8efe947ea1eace444d78398a31469b30e47ae585]
> +---
> + drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 5 +++++
> + 1 file changed, 5 insertions(+)
> +
> +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +index ed817011a94a..6924a6aacbd5 100644
> +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +@@ -21,6 +21,7 @@
> + #include <linux/delay.h>
> + #include <linux/mfd/syscon.h>
> + #include <linux/regmap.h>
> ++#include <linux/pm_runtime.h>
> +
> + #include "stmmac_platform.h"
> +
> +@@ -1528,6 +1529,8 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
> +               return ret;
> +       }
> +
> ++      pm_runtime_get_sync(dev);
> ++
> +       if (bsp_priv->integrated_phy)
> +               rk_gmac_integrated_phy_powerup(bsp_priv);
> +
> +@@ -1539,6 +1542,8 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
> +       if (gmac->integrated_phy)
> +               rk_gmac_integrated_phy_powerdown(gmac);
> +
> ++      pm_runtime_put_sync(&gmac->pdev->dev);
> ++
> +       phy_power_on(gmac, false);
> +       gmac_clk_enable(gmac, false);
> + }
> +--
> +2.33.1
> +
> diff --git a/recipes-kernel/linux/linux-yocto/5.14-rk3399-mac-fix.scc b/recipes-kernel/linux/linux-yocto/5.14-rk3399-mac-fix.scc
> new file mode 100644
> index 0000000..1ad2bde
> --- /dev/null
> +++ b/recipes-kernel/linux/linux-yocto/5.14-rk3399-mac-fix.scc
> @@ -0,0 +1 @@
> +patch 0001-net-stmmac-dwmac-rk-Fix-ethernet-on-rk3399-based-dev.patch
> diff --git a/recipes-kernel/linux/linux-yocto_5.14.bbappend b/recipes-kernel/linux/linux-yocto_5.14.bbappend
> new file mode 100644
> index 0000000..5eaa604
> --- /dev/null
> +++ b/recipes-kernel/linux/linux-yocto_5.14.bbappend
> @@ -0,0 +1,11 @@
> +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
> +
> +# Fix Ethernet on 5.14 until 5.14.11 (included) for RK3399 MAC controller
> +# Conditional patching required because Honister 3.4 has linux-yocto
> +# v5.14.9 and Honister 3.4.1 will have at least linux-yocto v5.14.14.
> +python __anonymous() {
> +    kver = d.getVar('LINUX_VERSION') or ''
> +    if bb.utils.is_semver(kver) \
> +      and bb.utils.vercmp_string(kver, '5.14.11') <= 0:
> +        d.appendVar('SRC_URI', ' file://5.14-rk3399-mac-fix.scc')
> +}
> --
> 2.30.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> You automatically follow any topics you start or reply to.
> View/Reply Online (#55345): https://lists.yoctoproject.org/g/yocto/message/55345
> Mute This Topic: https://lists.yoctoproject.org/mt/87097671/1997914
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


       reply	other threads:[~2021-11-16 17:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211116153256.3639663-1-quentin.schulz@theobroma-systems.com>
2021-11-16 17:00 ` Khem Raj [this message]
     [not found]   ` <20211116170406.abau3j6liwsdonbp@fedora>
2021-11-16 17:08     ` [yocto] [meta-rockchip][PATCH] kernel: linux-yocto: fix broken Ethernet MAC controller on RK3399 on 5.14 >= version <= 5.14.11 Khem Raj
     [not found]       ` <20211116171242.7dyycd3d2qwb4ske@fedora>
2021-11-16 17:45         ` Khem Raj
2021-11-16 18:03           ` Quentin Schulz
2021-11-16 18:50             ` Khem Raj
     [not found]               ` <20211213090032.dy47s56sykoikbfc@fedora>
2021-12-13 15:04                 ` Khem Raj
2021-12-13 17:18                   ` Quentin Schulz
2021-12-13 17:35                     ` Khem Raj
2021-12-13 22:30                       ` Trevor Woerner

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='CAMKF1sq+cj8e31L1ExHSKckEVab-ZdeUCF3_CTSr0VPtZ=_sVQ@mail.gmail.com' \
    --to=raj.khem@gmail.com \
    --cc=foss+yocto@0leil.net \
    --cc=quentin.schulz@theobroma-systems.com \
    --cc=twoerner@gmail.com \
    --cc=yocto@lists.yoctoproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.