From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 557DFC001E0 for ; Wed, 9 Aug 2023 21:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=CklC/joyDSdWlPtTGdiZpDy8fqoBRaSXPR/wlqY1WwQ=; b=HrXI6a4ZslXOSW 6QV/kPnDtcowbBnYLRV248kkdSr7uV4g/l5CdnX3OQG4XTUFxKyewZ0G8UPHzgJH1G0OcMcQZJZTG 55TsuExgyc4BBoMg6D+D5lUvjo4DaepMK/FspceLTfp35QMU0SuN+p2DJjzGWC8bF6smgYEbYGcak slMe1k4ac3Jam2mzR1426zEqOCn5MPaJKDVngOoa6ie+kJlAqKfhgkwUyieWW2JXB2cfCAWpEoYIE Is8mJGXgEZsBdYNUdKLHt/Otz0MeABgSdVg1s01Sj1snXVufBg/2WK8bKgAOM6VRw0hR0ESHwFfVw djGT3256bHIJlxwiRFDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTr8M-005wq6-2j; Wed, 09 Aug 2023 21:54:26 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTr8J-005wol-0M for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 21:54:24 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2b9c907bc68so4458001fa.2 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=a7R0NWMsy3C3PcvhR1G8OB4CHdI4Nt82gd85+7ywptWpkVyVTt9DDSeDUauadrxYn9 5oyHvXtJpoZjsEVjh4J7J9RJYvPLhpADSsWK39r1bagCnWt9bFwxPBCrD5yOa1TZy3GM SLO8NgqIt3RgQm4jcjut1oZETE8oCMs47y8FM4cv1mhI03a5SWM8yK68UrQj6XwKifk8 D/GCDQtpXTg4JGn7YI2ThkvZlFvvzunTZoOIVtuy7Blgc+zBrs+BTUcRmlSlCSapiQT0 P3Mc4eEkqnKh0Q7RCoaG64Pz0Q8Am/z4U5kKrMiaV1tOlElILqwQR9HIdpXIZaceJSAQ IpDw== X-Gm-Message-State: AOJu0Yzf/4J3VLON3FbtQoodvCsd+Vkcmb2fOo7ToDxHIX0GiNKzd+F/ Nnl0GshN5T+adqBWndyERsvn2A== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_145423_149630_2B1614F3 X-CRM114-Status: GOOD ( 20.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 dummy 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.computer - fix missing parameter of genphy_resume() v2: https://lore.kernel.org/netdev/20230804201903.1303713-1-da@libre.computer - call generic genphy_resume() v1: https://lore.kernel.org/all/CACqvRUZRyXTVQyy9bUviQZ+_moLQBjPc6nin_NQC+CJ37yNnLw@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 *phydev) return 0; } +static int meson_gxl_phy_resume(struct phy_device *phydev) +{ + int ret; + + ret = genphy_resume(phydev); + if (ret) + return ret; + + ret = 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[] = { .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, .suspend = genphy_suspend, - .resume = genphy_resume, + .resume = meson_gxl_phy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, }, { -- 2.40.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel