From nobody Thu Sep 11 13:04:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEDBBC0015E for ; Wed, 9 Aug 2023 21:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbjHIVyY (ORCPT ); Wed, 9 Aug 2023 17:54:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjHIVyX (ORCPT ); Wed, 9 Aug 2023 17:54:23 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D11BA1FD2 for ; Wed, 9 Aug 2023 14:54:22 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2b9fa64db41so4630111fa.1 for ; Wed, 09 Aug 2023 14:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libre.computer; s=google; t=1691618061; x=1692222861; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OkMEyGGNHjpLY2UEkMN7YcqkjDj9e0LTmbSFlK+KoK0=; b=VQqAQACYQv8GjP6RmCx4yk0ArjFakRxwqfuCKdZKFFDcf4iW4s5YuusU2csrIqKWV+ h2w1pNtooaKj51cJfgZXblhg8/xZBk8HSazCyLJuxGwlQfEYGU3flDibNizuJ6Q3JnZl O80qxZmB9NdR5xTfOeHoVDh+RqbtQYtVPq21Ymcidnb3zuIZ9SwUc6Ku2fgCPyLR1nMA jLFM17Ip9W/l7Wn1B8kCQ+Mzwd9boqsPVaaf/Kt8L8cos3E4wy9bh/Ec2QsCAHp6IpXJ D9ZUOmpXbE9r00jHVY51+eTUEgm3A5rzSav8h9OirPhtUdyHdqBgBHA18KE0R/ClCPTQ 2lNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691618061; x=1692222861; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OkMEyGGNHjpLY2UEkMN7YcqkjDj9e0LTmbSFlK+KoK0=; b=lpEN2VJNMFMJu0jMz1iTazvVPAjLuX6f3Wn+d6XWvzD3PTi+pkRjUdaIbU6+MvWSgP LCr25TLTjusoZi5kPVwOA+8SKx8DABRX+SbjiGVBwv3JpC/KgxVHjX8XbJdpqgo55M47 FAUKKyc4puRJQ3pkCK7Q7QcfT0gA2N7usRbNQsIgtP9u1jnYVmXNuJSEu9HxJanyudGg ZysnkxuEmAlUKnVtsJR2ryQvxX0B3jTZgH2f5th8fjH9s0ZEdBP+37zHMhN7Yj1dx4R7 ibgaGLDpGRQPGz4Ph0urVYgJ48wpqh+RFUALjtfusHXev2zHknor6Chk/kQVVgIIl4XM 6lHQ== X-Gm-Message-State: AOJu0YxBMugayTYxoqycgnHG/lgjGKn+AsNN1CdPsp6k757da01tmW/N H31qvgI2+JzBxKybQ88Wnhg60e/6nnnGB8y13D4JlpQhY6o= X-Google-Smtp-Source: AGHT+IFLZ3XxvjmZxptWdKwKgWdhi9Xl+mBhFrej+tA4dJqxwRNQvSph1ArlQyTEWD7Vq+GK3SfMzQ== X-Received: by 2002:a2e:700c:0:b0:2b9:4492:1226 with SMTP id l12-20020a2e700c000000b002b944921226mr402768ljc.11.1691618060835; Wed, 09 Aug 2023 14:54:20 -0700 (PDT) Received: from bear.local ([69.165.74.129]) by smtp.gmail.com with ESMTPSA id k3-20020a2e8883000000b002b6995f38a2sm6199lji.100.2023.08.09.14.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 14:54:19 -0700 (PDT) From: Luke Lu To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Florian Fainelli Cc: Greg Kroah-Hartman , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Da Xue , Luke Lu Subject: [PATCH net v4] net: phy: meson-gxl: implement meson_gxl_phy_resume() Date: Wed, 9 Aug 2023 21:49:46 +0000 Message-Id: <20230809214946.18975-1-luke.lu@libre.computer> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Da Xue While testing the suspend/resume function, we found the ethernet is broken if using internal PHY of Amlogic meson GXL SoC. After system resume back, the ethernet is down, no carrier found. eth0: mtu 1500 qdisc mq state DOWN group default qlen 1000 In this patch, we re-initialize the internal PHY to fix this problem. eth0: mtu 1500 qdisc mq state UP group default qlen 1000 Fixes: 7334b3e47aee ("net: phy: Add Meson GXL Internal PHY driver") Signed-off-by: Da Xue Signed-off-by: Luke Lu --- Note, we don't Cc stable kernel tree in this patch intentionally, since there will be a cherry-pick failure if apply this patch from kernel version less than v6.2, it's not a logic failure but due to the changes too close. Please check commit 69ff53e4a4c9 ("net: phy: meson-gxl: use MMD access dumm= y stubs for GXL, internal PHY") We plan to slightly rework the patch, and send it to stable tree separately once this patch is accepted into mainline. v4: - refactor commit message to better explain the problem & fix - check return value of genphy_resume() - add 'net' annotation - add Fixes tag v3: https://lore.kernel.org/netdev/20230808050016.1911447-1-da@libre.comput= er - fix missing parameter of genphy_resume() v2: https://lore.kernel.org/netdev/20230804201903.1303713-1-da@libre.comput= er - call generic genphy_resume() v1: https://lore.kernel.org/all/CACqvRUZRyXTVQyy9bUviQZ+_moLQBjPc6nin_NQC+C= J37yNnLw@mail.gmail.com --- drivers/net/phy/meson-gxl.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index bb9b33b6bce2..9ebe09b0cd8c 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -132,6 +132,21 @@ static int meson_gxl_config_init(struct phy_device *ph= ydev) return 0; } =20 +static int meson_gxl_phy_resume(struct phy_device *phydev) +{ + int ret; + + ret =3D genphy_resume(phydev); + if (ret) + return ret; + + ret =3D meson_gxl_config_init(phydev); + if (ret) + return ret; + + return 0; +} + /* This function is provided to cope with the possible failures of this phy * during aneg process. When aneg fails, the PHY reports that aneg is done * but the value found in MII_LPA is wrong: @@ -196,7 +211,7 @@ static struct phy_driver meson_gxl_phy[] =3D { .config_intr =3D smsc_phy_config_intr, .handle_interrupt =3D smsc_phy_handle_interrupt, .suspend =3D genphy_suspend, - .resume =3D genphy_resume, + .resume =3D meson_gxl_phy_resume, .read_mmd =3D genphy_read_mmd_unsupported, .write_mmd =3D genphy_write_mmd_unsupported, }, { --=20 2.40.1