Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp318635rwl; Wed, 9 Aug 2023 15:15:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4nsJdSDwNlNcmR9P+aWnSRhq+Iqj1j0+sf9DEuB20QuLRVDSrtxY5bd46nJL4N2Qpd7vl X-Received: by 2002:a05:6830:4b9:b0:6b9:37e2:76fc with SMTP id l25-20020a05683004b900b006b937e276fcmr419905otd.30.1691619359680; Wed, 09 Aug 2023 15:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691619359; cv=none; d=google.com; s=arc-20160816; b=CKxmYIHJeiRe98vVvaSnm0jHsuP1bolj19o0lTB5BhFYdWhgewcDEZfvGwMT6UdsPp Q8oTpIWGp68WB62r9/atwjIgFDlVgP8n1H2In3Ot3BKykdJ79rmTOJlw4nyvaatvIAas XTMYE9PPYs1tO87xgCv94ww3b7F3o40o5bNh+tcG8sXzLs3YAeo4fNFIkv7LwpPcbtiC r1skr7BOiTs5yETmmgUO0FUqOpgCrbuajsqj/1NQLhKI+wFrfGoGQEnZHyVv8uu1hEF+ RQGi9bYjJgQGmYZ7Lywe/1SOi9HaiVZ0iGMKNKqNRF+XPeFXaJmk8pc3aqOpWcX5Zlpm oCMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OkMEyGGNHjpLY2UEkMN7YcqkjDj9e0LTmbSFlK+KoK0=; fh=cLl2QRH1KXHMhqVHzcsZLaiPs/POIsbTwPFiCqGH98E=; b=YVN8Exw4+mQh2NCmJvLe3Gkk+lMSgTPPJg9TYbem60g6UbXZFik5c/nOyyRR6Bc9t0 3dAM8+BZoRdKd443ki/Kd4C7fgd0VHahrVcx7nO9zw856lwq6xfIsoPcif2OGgqjZ72v xx01Ec9LOcVSEFh0MH1ghCZ9xrTv+dVC9bsQJeLPzS03Dt0BIHG/aKExkKvB+DGC+pz9 Q34vElL9ClUpC8pogbqJ5j+vaXcDCbHeNG+8Od17yyot+ZoTXVNzRQMfoj8TAgm6mkYh lMxVUvGISzTfSXPwPvb8zeb3GLg3zbdNzWOPECdAGsBu+Wo2y+lP4KGaRB5H7F5kFBB5 WNfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@libre.computer header.s=google header.b=VQqAQACY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg26-20020a056a02011a00b0051b90567f99si151297pgb.690.2023.08.09.15.15.47; Wed, 09 Aug 2023 15:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@libre.computer header.s=google header.b=VQqAQACY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231551AbjHIVyY (ORCPT + 99 others); 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-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: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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