From patchwork Tue Jan 2 14:03:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 184359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4462846dyb; Tue, 2 Jan 2024 06:05:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJdVd9r+bk0znipaWoWpCsPyXX87HGFc6M9vtgzh48wjdnVBaS0RSyBvwTAbFFno5kU4gp X-Received: by 2002:a17:906:28d:b0:a25:1ace:2c20 with SMTP id 13-20020a170906028d00b00a251ace2c20mr7614797ejf.86.1704204343245; Tue, 02 Jan 2024 06:05:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704204343; cv=none; d=google.com; s=arc-20160816; b=TCseuCbe4Pl6FuAbk1ExfbkWbNbzujw7iRwk3nJ6FHF7nX5EOvDZq9jrdAvPUHujPD EesZhVVvZ6DuE99wJMDJDG6q521QUK6ymOXA7mGTDhonwXeSBJuyt3eqkXMLJpWq0p3D S9phWlkfBE4xAg81N0Dph1fzHEKand24kNfc47G+E6tDSFUYIAlbNUcgzgJQxG3ecZmp sPHpHdAs1p/Qbpa2+KlK6AYLTGk72ZMhB4lyzTJfSfaWKKuo8d0YAV0Bm0A1+2xeMWIB De7fKjj2iNMal8/jcbR8O3CgM9AHCBNOz4HNyq7ty8r/41FC1gPW48w1XLSP+4NUdigq KmaA== 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=PUohTBda7ifVie9oF2zeFzpU4spjHotK8dJMRsvSxYc=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=INkwwuSlCUtDc3KbkQaDYEVQbHK1GP+eN2XA6DpyJMvCvzbcBPBRdedX0Rx0cUizug YbI8krTPPsJwuLz4+y06H4TnfwA00Y8qOSHmUjDgIq4yFTc4Na/AI7jy+EV4nccwO6C7 9b+fhyAxw5k2rXqSpaxesooNW6FYrJyP0lQzFFj1MTipUQp3fl9XB0TGzpW8BBaaG6mp asFw+jung/kokYDiNRWJFb75PvKyf0v01PW4D8C8d7vxjy/OhUPRrDmsmnJUXtpvpicQ fcDRHtt1UYiYupFSg+/CByaGYzdB5F1L8H5Kbxz9TJZJaI0SCpT5BWA/Usbu4PPPOJkO khbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VKijXRKW; spf=pass (google.com: domain of linux-kernel+bounces-14460-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i21-20020a170906115500b00a1e431f49besi10118878eja.339.2024.01.02.06.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 06:05:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14460-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VKijXRKW; spf=pass (google.com: domain of linux-kernel+bounces-14460-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14460-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D47551F22CA0 for ; Tue, 2 Jan 2024 14:05:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA56D156C7; Tue, 2 Jan 2024 14:03:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VKijXRKW" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 EB38F14AB9; Tue, 2 Jan 2024 14:03:42 +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-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40d5ac76667so46739365e9.1; Tue, 02 Jan 2024 06:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704204221; x=1704809021; 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=PUohTBda7ifVie9oF2zeFzpU4spjHotK8dJMRsvSxYc=; b=VKijXRKWadf1g9R9WVnwTIsLieRj1TNncnM+dQyBcCHbvYkJXnB1OpLe9PsgpVulGp i6sjjw8+8ycLADviEGywndF7wTI6NYz0Vy3+RObC5B4gazQWAqECtqIbPbf7DlyIJhIB R2p/xBDJfO9sPWi8I/bljiCK8lyedDNKP+iodmvEDpt0q6Ari5dZ6Aj1OQ0cjvfuRX/j 2qxILrmca5DjMcj+F2u2B8sekRURsxajei1G7tAmUd0xqVPkouCmasAvABNnV7dCaGrU Vb0gB7I/MytERw8amJtmly5cGWDbDwvZEdLD5jplX9OL3/PaGoSXmFNEBCWVnRAqbs1P K+rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704204221; x=1704809021; 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=PUohTBda7ifVie9oF2zeFzpU4spjHotK8dJMRsvSxYc=; b=FSLKUXnR3hvy4lYWdtuNd7ZZhiRCRRuGnvIaOjpHH+gw16D6VuM/oZBFEtXOF+wu88 ZgIm3Y9wzj0yXL8DWXWLPYRID3rYR3zAwtZpmOJ1QGSi90J7V6suNIisxRUOYy/wlHQa J0GAfw/3JDZr+JyfwUiuDG+RiHufveN7jPQ2CQKMLlQdxRD812k71SOrIKTFQYS60E3O 48Vo5MtwB3gtTd4fyTGHsqASV+V+okMoMa0ItvT0s0bZYTyqapGJL49hPt/i0QVBE8qC /nvL4xHLojoa3wjItfYDpYdiVoSE66ppw6fbfPwmfs00BkvZThwOC9bhJ5hdAbUXLAhv p6uQ== X-Gm-Message-State: AOJu0YwGNRKtEVtf6BQw96ELZleiggLFDAkIujiRIfmjUVMmmvt/E+pT xUqdOdmnjBDqvnmnCew/JhQ= X-Received: by 2002:a05:600c:13c3:b0:40d:350f:dc8f with SMTP id e3-20020a05600c13c300b0040d350fdc8fmr9558667wmg.87.1704204221242; Tue, 02 Jan 2024 06:03:41 -0800 (PST) Received: from localhost.localdomain (host-87-10-250-100.retail.telecomitalia.it. [87.10.250.100]) by smtp.googlemail.com with ESMTPSA id e17-20020a5d5311000000b0033672cfca96sm28427527wrv.89.2024.01.02.06.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 06:03:40 -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 4/4] net: phy: at803x: make read_status more generic Date: Tue, 2 Jan 2024 15:03:28 +0100 Message-ID: <20240102140330.7371-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102140330.7371-1-ansuelsmth@gmail.com> References: <20240102140330.7371-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: 1786987772992008039 X-GMAIL-MSGID: 1786987772992008039 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 3d3d34ef594c..d52b0ec81994 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) @@ -2568,7 +2575,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,