From patchwork Fri Dec 1 00:14:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 172182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp776111vqy; Thu, 30 Nov 2023 16:15:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3y+QSvOBxZI4JX5718jEMVBqmvLpRKWw5JI4rcvsSjtfCIQtRVkLkWSBYrxE1dkrCkhJE X-Received: by 2002:a05:6a21:150b:b0:148:f952:552b with SMTP id nq11-20020a056a21150b00b00148f952552bmr31630616pzb.51.1701389728917; Thu, 30 Nov 2023 16:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701389728; cv=none; d=google.com; s=arc-20160816; b=CdamaVscJAz5MeOAZ97BH/BCsljmevyNyerlIjZjcK6LsX/XqD7k4eYOrV4P6GeDSW 4zMVsWENMeuwGkNbnLpqVkQpfpj+8Ei3XqFbMkhBQLqElefbfstcHWK5Oi0zwSxzo1jZ w7agiQ6wvN6cSTvk0cO9pYcBTDV8/jL7cj89nGI1RSIk37FjNftHsSDCsiVusZ1DeNOv F+C0jnGLpm2A5FvnFSPv2eG5xaj+TiWRbQGTFjCH9i5uCWnFxLvmGV+v5BDkE1NwzlmB qxa0D4A+MES1LovzfrRsux/qHv1vgFGZZnEBjKIdHV7BR0VWedDMdCkxo+eTMK2yxTxD FbFA== 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=UtJoPBjW5rnAlurZq2lS+01nGhFNdESFfyXMasseLeU=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=r0B+TH5TPRhahqjbDFWUv6/QjT7pCHgy/cBWoP+JHa8LgMuQZgfGcXj0zAeESUXWtU nnL+gCjN4/g/HDjckYjtyCw2yiyWkHRbiLBOwThup4gRzecO6ODf0RfK6P+HfFV2EuEQ n1zO5YsDkvDqOsSZ1+sltNrGmjnQEW6ggSitLf9V464pyaoGGuoLvOaBXRSykv0ynCvg XSTQUtaNFODhugKsTyKTDjqC0ohfS4O1lX7T1wwujJViONdQBu830DcXHx0XwZK+GTRk YqBrehaTnU0hoW5PWOY+cQnUkoMmbGN8tvymD9TUr94RKuOL1tZtxA69mVhFSLony6VQ n73Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FB0oQb9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z27-20020a630a5b000000b005bdf5961646si2214532pgk.268.2023.11.30.16.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FB0oQb9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id AE9FF85F6E89; Thu, 30 Nov 2023 16:15:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377457AbjLAAPG (ORCPT + 99 others); Thu, 30 Nov 2023 19:15:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377445AbjLAAPB (ORCPT ); Thu, 30 Nov 2023 19:15:01 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 786CD170B; Thu, 30 Nov 2023 16:14:56 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40838915cecso14649305e9.2; Thu, 30 Nov 2023 16:14:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701389695; x=1701994495; 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=UtJoPBjW5rnAlurZq2lS+01nGhFNdESFfyXMasseLeU=; b=FB0oQb9mVqUxKEVx96/3Qm3mtA1Y5bC7DPqP8yRdIO9kQDCRy6dm/qQl8x0T4XUlD5 EE8PJnVJgM/nEO31NVeq1FfPH713Tpk+JATlggS1vCdKlxPF+2tK7YcufyG9gJZD9zv6 2jnB2WYxT6CG8mqb0MjlCkgIXJ5kLRhqTt+Oqacx3KzixSNdD5PqyxHS60jNiifjQ06Q c2mM6iyoAZwHIpCxz17DjqTAtJ9wO1Hbsvn5Ns/sENw9EURxHO3bfZCZEOxOAj/CORTL CuSUWU31lqyJ2CEUodkxEIyerF2ifIK5tBPAVot6GTK656KLnjADRAjbptViz70yyqxz jUVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701389695; x=1701994495; 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=UtJoPBjW5rnAlurZq2lS+01nGhFNdESFfyXMasseLeU=; b=iTVvODyMqkDiQerDJW23HIXegAlcujLTjGEo/qfIX0PXWgMjJAx46vunT3AHfjlTNt KI22Q/25Q4XYI26Q1HLK58J3HRzwHDWFl2AYgx3wXYHPAPPKSiC3tFxxo8LArNEM4Tsb HktWSkN2p964mkPC2nXagY2KJE3gfCRIiphG9ypdoKOQZuW69ymuKwN9+Hbze94KbIvt xmoIp2aNCYeQlLKAJrSnt5OVz6MuLqaIlpepBpB/siDCqmBAYmNHWrWYSprY2is0YWVJ ck4kpbwigVA2FxTgtxSARlxenCy8NgUay0zX8yn1ob8oBATU4iZjAqTz/EImfss5rUU+ tGGQ== X-Gm-Message-State: AOJu0YzainiCBz6WPedGAE1AgsGr37hQkHj6/ZZe2r+XuYaz0j7GFGOg R3HeDdLsLneDCPk4iK8GORg= X-Received: by 2002:a05:600c:2318:b0:40b:5e21:e274 with SMTP id 24-20020a05600c231800b0040b5e21e274mr110188wmo.97.1701389694743; Thu, 30 Nov 2023 16:14:54 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g16-20020a05600c4ed000b0040b47c53610sm3535457wmq.14.2023.11.30.16.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:14:54 -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 v2 06/12] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Date: Fri, 1 Dec 2023 01:14:16 +0100 Message-Id: <20231201001423.20989-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com> References: <20231201001423.20989-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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:15:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784036436333252873 X-GMAIL-MSGID: 1784036436333252873 Move specific at8031 probe mode check to dedicated probe to make at803x_probe more generic and keep code tidy. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index e507bf2c9bdd..ed3be7ed5463 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -844,26 +844,6 @@ static int at803x_probe(struct phy_device *phydev) if (ret) return ret; - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); - int mode_cfg; - - if (ccr < 0) - return ccr; - mode_cfg = ccr & AT803X_MODE_CFG_MASK; - - switch (mode_cfg) { - case AT803X_MODE_CFG_BX1000_RGMII_50OHM: - case AT803X_MODE_CFG_BX1000_RGMII_75OHM: - priv->is_1000basex = true; - fallthrough; - case AT803X_MODE_CFG_FX100_RGMII_50OHM: - case AT803X_MODE_CFG_FX100_RGMII_75OHM: - priv->is_fiber = true; - break; - } - } - return 0; } @@ -1584,6 +1564,9 @@ static int at8031_parse_dt(struct phy_device *phydev) static int at8031_probe(struct phy_device *phydev) { + struct at803x_priv *priv = phydev->priv; + int mode_cfg; + int ccr; int ret; ret = at803x_probe(phydev); @@ -1597,6 +1580,22 @@ static int at8031_probe(struct phy_device *phydev) if (ret) return ret; + ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); + if (ccr < 0) + return ccr; + mode_cfg = ccr & AT803X_MODE_CFG_MASK; + + switch (mode_cfg) { + case AT803X_MODE_CFG_BX1000_RGMII_50OHM: + case AT803X_MODE_CFG_BX1000_RGMII_75OHM: + priv->is_1000basex = true; + fallthrough; + case AT803X_MODE_CFG_FX100_RGMII_50OHM: + case AT803X_MODE_CFG_FX100_RGMII_75OHM: + priv->is_fiber = true; + break; + } + /* Disable WoL in 1588 register which is enabled * by default */