From patchwork Wed Dec 6 23:57:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 174795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4455162vqy; Wed, 6 Dec 2023 16:02:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IErFs7ZTCKg6fWST6WHnkEWspRH2eZm6akRRDpJH2Ld6SNXZawEZAEockEbuaQGhYv4Gq8G X-Received: by 2002:a17:902:f68e:b0:1d0:8f0d:b6e4 with SMTP id l14-20020a170902f68e00b001d08f0db6e4mr1399461plg.111.1701907320411; Wed, 06 Dec 2023 16:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907320; cv=none; d=google.com; s=arc-20160816; b=q25SLQd9PfOBcZejyQUEviRqgOheCagyJsNSfs2/yzyZn96nkkWU7+slFRrLSoC5q4 +9Zu88ET1JeJjPOBMU81ODgqDsXh8XpwdcC/tjrbyP6PTYWrR43QtbsH7z0xdjdd36pI gdRfunKW8y+3ijO47ANEhsOCduFlAvylyhOTH4z7/dyt2k3b1mc/K+ZpS/V4ZvxIvWGe Z7cMku9hAQf8eQiNdpN5yG0whtXO4Ovz+Wl888skGF/E+0aNQBAtPpQotl2x07jFla1J PXwwobM5/3SFrzPRTzaKNfeN23/X9DKQAylwJj2J9JGsmZhbhPw++zVm8SbQLNOaZV32 lYBQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GUKJ3W+rMNjz35Sa6zupf98XVAv1Y8sQonmYjlaTAA4=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=MwRCOHKTT7rv4pBt5TENkMYwszLaWNoOqW+FUpOShEcW/Z+vMg1kb9jOfoWmbuPcdE NXoeBOy4AN4T0DmOVdd1gjvLFNXMKSRHf4Pg0U42j4PGkVHmFkNWrziBPP+Xh5UwmEji 4+WlNKbd4ERuIVUhdZLRVKnzt7C9a9M9udDbiiRWkM17VuVUQAbU2GfpCJ3dAuO7pU+7 QBwrZk7bMl1E7jwOKhe/E/pPPr93FA7naFLtWpeIGaS+4T/Hnhg5IIhpoFHYO7btJHNN P0E6Q6ajHPwAOzek3gxXMK1kzCfSv/+zuniYz2HAdAzDkSLeg1x0hGiZT8URAUu5AoZA nBJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hrcoXchF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t6-20020a170902e84600b001cfde84f92esi65801plg.82.2023.12.06.16.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:02:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hrcoXchF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F0C408025779; Wed, 6 Dec 2023 16:01:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441899AbjLGAA5 (ORCPT + 99 others); Wed, 6 Dec 2023 19:00:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441907AbjLGAAU (ORCPT ); Wed, 6 Dec 2023 19:00:20 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A040D7D; Wed, 6 Dec 2023 16:00:26 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c09d0b045so4634715e9.0; Wed, 06 Dec 2023 16:00:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907224; x=1702512024; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GUKJ3W+rMNjz35Sa6zupf98XVAv1Y8sQonmYjlaTAA4=; b=hrcoXchFoSHDYwlCGgwosP9ICXBlpqE/4bHSv240xdP2uyHHrSNzhDzSdf1OhDDCDu gZ9VXqaysxf3Ms6tdibaDOmHQh97dCbSn0YkVzGUUFQ8pfmaI1hNaeqi/uOhiIWBg/IJ WIPED+4pEekYhbtd/Hffg7sAnA1ntesjYoenLeNc4mTl7JMMa27a1QxbLIOCwSPElAHO bUIIu9L4+wiyWJq+MR+cQNUuiqHXKupv2NXtKeiWll/C+5ZSf0vaFgTK0p2SK09+iKGx HrSST+k0hUUmHN57fRhvOvDnglm6hmGAE83D5uTdBooWR5MizQdoVLst3MTRfv+69o1B a5UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907224; x=1702512024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GUKJ3W+rMNjz35Sa6zupf98XVAv1Y8sQonmYjlaTAA4=; b=dWa6ttRMYTO66uODV7sMuo5DzEsbsu1b9+6InczU3/k6FNjPHq9WyhaIskH3VPlM83 fP2toOFTrRWnCL7832kYLPJTHvnJYSu7qJeGaauwmLO4VR+zQ8a7H+TE3KLDghhcf+rv T12peUBW7QVDCRHNTDdwbkGddjT1R7SMQqYMU+A9FpLBmBzKhhSwitk6cuGlMByrB75F FVSKLdtqrQKo/PzSYDp2Yzp8omskl0eSK50eRVYB+FQl8JSaQYd1Eu1OuEQ+woCKPNmB iffynLtIe3i3rgnRP5dxuShHQgPix30m+Ioc4zfKLzv0ujia+BWdeR69hNL/BhCiP9mF h4Cw== X-Gm-Message-State: AOJu0YxsJIcAz5C8PKBVoTxqXPzpe/MAbDs3p3eqoDCkhKF0CQVCfI8t 4K7vuJqv0z/sWLpgyQQM2H4= X-Received: by 2002:a1c:720c:0:b0:40c:25c1:3c02 with SMTP id n12-20020a1c720c000000b0040c25c13c02mr325178wmc.159.1701907224273; Wed, 06 Dec 2023 16:00:24 -0800 (PST) Received: from localhost.localdomain (host-79-26-252-6.retail.telecomitalia.it. [79.26.252.6]) by smtp.googlemail.com with ESMTPSA id je16-20020a05600c1f9000b00405442edc69sm50280wmb.14.2023.12.06.16.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:23 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v3 07/13] net: phy: at803x: move specific at8031 config_init to dedicated function Date: Thu, 7 Dec 2023 00:57:22 +0100 Message-Id: <20231206235728.6985-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231206235728.6985-1-ansuelsmth@gmail.com> References: <20231206235728.6985-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 06 Dec 2023 16:01:51 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579170752518900 X-GMAIL-MSGID: 1784579170752518900 Move specific at8031 config_init to dedicated function to make at803x_config_init more generic and tidy things up. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index ed3be7ed5463..02ac71f98466 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -951,27 +951,8 @@ static int at803x_hibernation_mode_config(struct phy_device *phydev) static int at803x_config_init(struct phy_device *phydev) { - struct at803x_priv *priv = phydev->priv; int ret; - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - /* Some bootloaders leave the fiber page selected. - * Switch to the appropriate page (fiber or copper), as otherwise we - * read the PHY capabilities from the wrong page. - */ - phy_lock_mdio_bus(phydev); - ret = at803x_write_page(phydev, - priv->is_fiber ? AT803X_PAGE_FIBER : - AT803X_PAGE_COPPER); - phy_unlock_mdio_bus(phydev); - if (ret) - return ret; - - ret = at8031_pll_config(phydev); - if (ret < 0) - return ret; - } - /* The RX and TX delay default is: * after HW reset: RX delay enabled and TX delay disabled * after SW reset: RX delay enabled, while TX delay retains the @@ -1606,6 +1587,30 @@ static int at8031_probe(struct phy_device *phydev) return ret; } +static int at8031_config_init(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + int ret; + + /* Some bootloaders leave the fiber page selected. + * Switch to the appropriate page (fiber or copper), as otherwise we + * read the PHY capabilities from the wrong page. + */ + phy_lock_mdio_bus(phydev); + ret = at803x_write_page(phydev, + priv->is_fiber ? AT803X_PAGE_FIBER : + AT803X_PAGE_COPPER); + phy_unlock_mdio_bus(phydev); + if (ret) + return ret; + + ret = at8031_pll_config(phydev); + if (ret < 0) + return ret; + + return at803x_config_init(phydev); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2115,7 +2120,7 @@ static struct phy_driver at803x_driver[] = { .name = "Qualcomm Atheros AR8031/AR8033", .flags = PHY_POLL_CABLE_TEST, .probe = at8031_probe, - .config_init = at803x_config_init, + .config_init = at8031_config_init, .config_aneg = at803x_config_aneg, .soft_reset = genphy_soft_reset, .set_wol = at803x_set_wol,