From patchwork Wed Dec 27 09:19:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 183446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1326455dyb; Wed, 27 Dec 2023 01:21:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlFDzMNb9p0StqbjtgD4Jkv5+LYIqFEEtiJVJH73F0Zhqk+0GYPVQuInjMsjt8aisxFYOM X-Received: by 2002:a05:6214:1948:b0:67c:d2fd:3e3f with SMTP id q8-20020a056214194800b0067cd2fd3e3fmr13170687qvk.27.1703668896646; Wed, 27 Dec 2023 01:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703668896; cv=none; d=google.com; s=arc-20160816; b=jVUkwRLY7ry/FG6TL+7oC7BFtf5XY5hF21yNCpHBY3kDBTJnNi24pDXa/MTljK997H vh6qwdIAoJvipeIa9eoEAmhbDyHgxMBHLIcmEd6JQqa4GtN1qOwS75J+tcPiw6Eq4JlY dHWPwxfBsdarbd+O88F6NgUYmfsp5ifSY5Zt9H9WCf7VUkDupFEtTifY6sjX0U3p1uGZ oVNAcYgLdQ0D8wKD/f2Naz2oTHuhmKYu1hgh0jntnMqMTxEA5jPO2O+iNn3Iz1TB3t0M 9Q8vMcSOxNUZow9REbNLR3lZFB30nwlUVcKja8sVCikq7y8D+8o7PnylnumTvX/7vbeT NI+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SK3beSWkL1WdKpoVMiSUuExdWouQ1FOB/P9yoXlJNOA=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=h0T63FiQT3lzTAmS4lq01Nq6udCbc9TyBL55aPFtjlk2v6RpMWdafexDQ8MXKsZqK5 P1GWH2/kPshEWidGgtC0ulFmzINMDyHdGpnrgPGZTQOVA0c6JSCeVdzemsxHoDevBZxY 5KsGJt24P+d5zF+9JZILSnaue28daJdPdaiqnkAVGtMJv2ndvaAolsWmNlD1dbNMOOWB LmWVp/6Z2lr5YhfUUpmoVTieleErLhCaT1XvcvERprtRLTSt7uuBUdiSuHbzDIIib5xp VHd1efp0iBhv0qrVpmrnVd/QOvS810FrsgJdNZ4bZJnTopmhf6sR1iZELGF6CXEJxjc6 PWLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=geNpBe3a; spf=pass (google.com: domain of linux-kernel+bounces-11931-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11931-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l7-20020a056214104700b0067f81005f4csi13926997qvr.176.2023.12.27.01.21.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 01:21:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11931-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=geNpBe3a; spf=pass (google.com: domain of linux-kernel+bounces-11931-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11931-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 718EB1C223BF for ; Wed, 27 Dec 2023 09:21:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C0002EB1A; Wed, 27 Dec 2023 09:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="geNpBe3a" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 457382DF65; Wed, 27 Dec 2023 09:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-33666fb9318so4840605f8f.2; Wed, 27 Dec 2023 01:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703668803; x=1704273603; 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=SK3beSWkL1WdKpoVMiSUuExdWouQ1FOB/P9yoXlJNOA=; b=geNpBe3aTn72lfEyVWXcjgdMF/dEyPcqeAfmA2RynctaDBWx/GQ7daq7HsYKYk8+v+ tH/JQIWL2h/CILGq1xRGRKv1mmoR4D/ghwQITMjOXvMleXZleXUeChLOUWqnIuHn0ilZ GV+KEw2lshBnx4nPqU1DkjKDuwY8wzwbGAWJw26wTaJLHqAvToRhCcfMDyz2fc4IB05J WobItAzQFkmfg6+zfkq7IKvQGy3ljJxXV9HhqkjIHkfhQhY+023qQaAIuMliqNH1HyyJ GA/NPfOxbMRhHmxeuc02qIxvFK0/KbjhhSoLm5O1S/paeg3bIih3og9p0/TOcNGK1TvU Thng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703668803; x=1704273603; 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=SK3beSWkL1WdKpoVMiSUuExdWouQ1FOB/P9yoXlJNOA=; b=uH1XbxE2Du2JFKMNu6h73wjmBuzvOm0BG0tbiiyD/qqGbV2tI6VaYmTqdgqDp/zSwK CA4bUpp2s/QjZ5dygUIDBpqBA/wu+KJVvAqsBkL6oOlo0itivWxmSYTfCx/s5OoXB2KP gvrZ4AUKDRcHzp4gNrVlvjzBinG3JLVH7V/GXsmVNSNr6JgRs1he7jiC4cb4QX09liE2 BaydVbEGdrYc3e8cQUwPKbG7FWIGKx90oetOweOWinzwYjy7Oz6egPTbKZv8tI1QeEf0 4dq0Ky+Uy/WVzuUuYzYOS0dlMHRHHvD/B9fjbxuzDFTzt8MkHs11yQHB26lc9Ayhcocx lbFw== X-Gm-Message-State: AOJu0YwmZXqcv15fL+S4fSs7+nVzGaxSveH0IvJ9JrsgCe73IWGaj4i/ 4hA6XTd3IoMVyCiZKc9HokzY2ndyBfg= X-Received: by 2002:a05:600c:4e92:b0:40d:53c4:9eec with SMTP id f18-20020a05600c4e9200b0040d53c49eecmr2608669wmq.73.1703668803461; Wed, 27 Dec 2023 01:20:03 -0800 (PST) Received: from localhost.localdomain (host-95-250-248-68.retail.telecomitalia.it. [95.250.248.68]) by smtp.googlemail.com with ESMTPSA id i2-20020a05600c354200b0040d5ac00dc6sm4539749wmq.8.2023.12.27.01.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 01:20:03 -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 3/3] net: phy: at803x: make read_status more generic Date: Wed, 27 Dec 2023 10:19:46 +0100 Message-Id: <20231227091946.12937-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231227091946.12937-1-ansuelsmth@gmail.com> References: <20231227091946.12937-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786426316872765115 X-GMAIL-MSGID: 1786426316872765115 Make read_status more generic in preparation on moving it to shared library as other PHY Family Driver will have the exact same implementation. The only specific part was a check for AR8031/33 if 1000basex was used. The check is moved to a dedicated function specific for those PHYs. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index a2f5d608b59e..2408001683cf 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1087,13 +1087,9 @@ static int at803x_read_specific_status(struct phy_device *phydev, static int at803x_read_status(struct phy_device *phydev) { - struct at803x_priv *priv = phydev->priv; struct at803x_ss_mask ss_mask = { 0 }; int err, old_link = phydev->link; - if (priv->is_1000basex) - return genphy_c37_read_status(phydev); - /* Update the link, but return if there was an error */ err = genphy_update_link(phydev); if (err) @@ -1685,6 +1681,17 @@ static int at8031_config_intr(struct phy_device *phydev) return at803x_config_intr(phydev); } +/* AR8031 and AR8033 share the same read status logic */ +static int at8031_read_status(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + + if (priv->is_1000basex) + return genphy_c37_read_status(phydev); + + return at803x_read_status(phydev); +} + /* AR8031 and AR8035 share the same cable test get status reg */ static int at8031_cable_test_get_status(struct phy_device *phydev, bool *finished) @@ -2569,7 +2576,7 @@ static struct phy_driver at803x_driver[] = { .read_page = at803x_read_page, .write_page = at803x_write_page, .get_features = at803x_get_features, - .read_status = at803x_read_status, + .read_status = at8031_read_status, .config_intr = at8031_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable,