From patchwork Wed Dec 6 23:57: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: 13482478 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hQC3tj/p" Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04D7DD5A; Wed, 6 Dec 2023 16:00:18 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40c256ffdbcso3955175e9.2; Wed, 06 Dec 2023 16:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907216; x=1702512016; 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=MfZOawQYQNHqU9ZIBqp6/PMD5jOFrh8dAxaGlSct1Og=; b=hQC3tj/p0CV0CP+18+KrPYRR3wt0ZXfAirIY+Ry04RtClYu0gNx1nANlfpcWJ2UCYE mydpDvITtcsIsFIl3DTOJkZz3rYrLpGVGib+e5+sHhKNkx3s3UG++o6fDAuVnzJGC1IS qwE7XOnz6bO4RT1FGTYAgMJJmhPSSwEFAz0EYeQqis9AJSbVO77F4u6GOwfoktG0LI3E CTE6EAkFMss/djr6+BPCnZecHCvD+UjUlvmhgbJfzsWzn1huf0G+vYw69zfWDq35dqdu vWjvzPUVgJ0idNAJgZYRcm2quzTvRwI6O24aDYRIGSy5aTY4z+l+0nEzX1dtB/QX7KKe F35w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907216; x=1702512016; 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=MfZOawQYQNHqU9ZIBqp6/PMD5jOFrh8dAxaGlSct1Og=; b=Q5K/RAeZHQNme55DQRCpvLrDwgbQ1hOtkQ85OaBwGnF3vKSBSJ+azgMPg5BaTrB8AB I4JqtQxd8H6yrRzalhhbL7we4s04Ns39lWpSK8ezQPqZqDoqdDpleKUo8S7fKAdkJQk4 fBeHW028rNDPflAB46FI5Ja1J2w7y7O/Q4NZMTr3Tw3ZzaH8tjA3ScLFyrv5OTU6yB2/ QEaeSn02UHE2TJYR6chSU0rM22NjaqNKwTyeUzIR3WpOBNyTjOoww1T1NGcr9KBUvZAU ytQL68/7p5CZv+XxoCzLr/xzsKZCoIfrZQp14JP66o+/vahT/TpEfMxSEYmU/LgyTArB zG4g== X-Gm-Message-State: AOJu0Yy34IdSk6KG0i90kk8HWcNcSPI+ZjREa37MzxrOhTUlilZbXaLr hKsQW0slQw+f63ze9RVZ4eY= X-Google-Smtp-Source: AGHT+IEOynzLilO6iZ2qjgY8vw58zmZ29fqvyp7pN7y9fejQLNnGnyQxATUqRVqEvXv0QL0XthPTWA== X-Received: by 2002:a05:600c:4c94:b0:40b:5e59:c55a with SMTP id g20-20020a05600c4c9400b0040b5e59c55amr1063335wmp.132.1701907216123; Wed, 06 Dec 2023 16:00:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:15 -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 01/13] net: phy: at803x: fix passing the wrong reference for config_intr Date: Thu, 7 Dec 2023 00:57:16 +0100 Message-Id: <20231206235728.6985-2-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Fix passing the wrong reference for config_initr on passing the function pointer, drop the wrong & from at803x_config_intr in the PHY struct. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 37fb033e1c29..ef203b0807e5 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2104,7 +2104,7 @@ static struct phy_driver at803x_driver[] = { .write_page = at803x_write_page, .get_features = at803x_get_features, .read_status = at803x_read_status, - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, @@ -2134,7 +2134,7 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, @@ -2150,7 +2150,7 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .config_intr = &at803x_config_intr, + .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, From patchwork Wed Dec 6 23:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482479 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h3ETGmDy" Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B95BD68; Wed, 6 Dec 2023 16:00:19 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c2718a768so3802305e9.0; Wed, 06 Dec 2023 16:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907218; x=1702512018; 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=Ry9/OcH5p4w9QNEkHN6mJ+DUe89PzwuGd5SiP435vxk=; b=h3ETGmDyxfUwxk5YuR3+UGL2MPxUwBtznM/dF5GOD8RYC/+JopiWr/ICZsvoRrhpQG oevjoeoP24IV9m88vMsch0yGicwbLPztDolXKfWkRg+nyA9oDtYWEiYabXv8/mOQ6+qv ukfm15IwFPop/9fwMU7TM+Sz0YDRHXBMDggfLBWjdYKdMlyOadmal4HfZ/64ofi3LS7T Hbsp2HMoXRthORfDIIGSfbW9chmf2b0OcbBWTsA326vxzwrc+N2+LdBR4vUw/tHTFFR7 qhoLC6qjZmOIIGOHjet+JjZmWSGSULLzqVlBGDc6M2WijFG8t6osKhTBFAHOWK9HNMCo pw/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907218; x=1702512018; 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=Ry9/OcH5p4w9QNEkHN6mJ+DUe89PzwuGd5SiP435vxk=; b=S+rBLWpR5bDI+BunnDAYE17fNNJJ9nTkozsNWo3w7QwN3wBoTDZh5kiG1vDXWsgZjz q0xs1nrggqsikiuNVphepSsQQ8w7+RAqADOCKpP//PRVHtnpIDBzyj+JZ3nIv0kBG06J p5TmSscJx9ZDYzIJIfFQau1pmCAAtPptUO2WFG2JdqweN8SFsT4UyIeJIQXIuBrVPA2K bwpDaugJO75xS431rO2MY6sssFfO0YS/1jCyvC0zdLRF6Z/qThkI+cmMdXamNo+u5xaI FK7qgfhEW+rpBvePxT7LzB4vyIoUAalnSLV2AYlHRrhzjaDzJDr1JmfUNHBJxP67qcfP uQ5Q== X-Gm-Message-State: AOJu0YyoI2XvRpSZtnaxIJLBWWTbl8AhKh3xufJT6kokfUViMUcZvcaj Sl9XaKo21dt3R+eNZ0HWsbc= X-Google-Smtp-Source: AGHT+IH2vA+otiLYH+acwdCTTbDW2Pp/hIrnaCyIBDORx2wp8u/8gwQg3/eKHJe74FAVt01K3EyAQw== X-Received: by 2002:a7b:cbc6:0:b0:40b:5e22:98e with SMTP id n6-20020a7bcbc6000000b0040b5e22098emr1216967wmi.125.1701907217409; Wed, 06 Dec 2023 16:00:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:17 -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 02/13] net: phy: at803x: move disable WOL to specific at8031 probe Date: Thu, 7 Dec 2023 00:57:17 +0100 Message-Id: <20231206235728.6985-3-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Move the WOL disable call to specific at8031 probe to make at803x_probe more generic and drop extra check for PHY ID. Keep the same previous behaviour by first calling at803x_probe and then disabling WOL. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index ef203b0807e5..85302d96d133 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -886,15 +886,6 @@ static int at803x_probe(struct phy_device *phydev) priv->is_fiber = true; break; } - - /* Disable WoL in 1588 register which is enabled - * by default - */ - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, - AT803X_PHY_MMD3_WOL_CTRL, - AT803X_WOL_EN, 0); - if (ret) - return ret; } return 0; @@ -1591,6 +1582,24 @@ static int at803x_cable_test_start(struct phy_device *phydev) return 0; } +static int at8031_probe(struct phy_device *phydev) +{ + int ret; + + ret = at803x_probe(phydev); + if (ret) + return ret; + + /* Disable WoL in 1588 register which is enabled + * by default + */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); + + return ret; +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2092,7 +2101,7 @@ static struct phy_driver at803x_driver[] = { PHY_ID_MATCH_EXACT(ATH8031_PHY_ID), .name = "Qualcomm Atheros AR8031/AR8033", .flags = PHY_POLL_CABLE_TEST, - .probe = at803x_probe, + .probe = at8031_probe, .config_init = at803x_config_init, .config_aneg = at803x_config_aneg, .soft_reset = genphy_soft_reset, From patchwork Wed Dec 6 23:57:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482480 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZUq2wWfa" Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 698E1D6F; Wed, 6 Dec 2023 16:00:20 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40c1e3ea2f2so3785545e9.2; Wed, 06 Dec 2023 16:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907219; x=1702512019; 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=YrcJkPIDuZzmYGZsrVgKVn9yf3oQKZHA4PrUxB3CbJA=; b=ZUq2wWfavQeOa3p2ucQUTBLy4NGT+EIeT1gH4obYjgJrH61pbxefgbfgiqclyG1OEy L0H2R9CobnQD6JsqnMhUCdzoEHloBg81Il+Tmb5vm3irNlEcBaGFdC87LwgysYcIBA29 WJ/rFPbdNZajEGaDKowjdP0uGul2kwK4hdxbwc8l7x2Y8Vl+NvK42B1D1rRcLgR1svNP 7YGaWw46YXFRNPl3bnnNuN5awzcjufT5HNg2Al1z/G/uCFdXAxE4d6ypFJT3LmN/LbiX Wj+bHhBuaONrRvp8OtEiULDALclmU90bIGj0hWHYDgz8POqOWIlxEh19EuOwTob3lDTc /h0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907219; x=1702512019; 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=YrcJkPIDuZzmYGZsrVgKVn9yf3oQKZHA4PrUxB3CbJA=; b=rKGBBkEl0DCS3J/EFnjFnnzysrkux+FuNruwpINj5p+nR2cYnAfuPWY41iNiYamisN S3hVfp9W4qMBPVomlIkALXG/zCckD+QOi9pS3cDFmMJMBlPVnWMn9XCdh9D9e4lcu2Cr AOlAuUFJfLrbx4MMpMhFs0b7UwGSOnFQ94Uv94ZuvHDbYEqsGXVQgR3HZnUHB31J8SWP 0IURyzjljznIMN4JbioC8cw/3cO4R1CV1DLGBldBBBtmAHfjL0SXTD3CkW1DMonQipjb yZRi1U5iRm74XRMq+sSMkkzlNYJUZsw62UhABPmai6rUrMieCJsgOpSBMdoanlqfyR38 Vi2g== X-Gm-Message-State: AOJu0YzAcfYXeZgjFonaUMMBjmEFdR6QQxBIG6+HMBHNBvWMu0Xfn94v 8Tk0EbW+cAfeq1wT5RAYW/s= X-Google-Smtp-Source: AGHT+IEUIHuPLr5fFZ/86Yf7NAulTLD3gkTHTp73vEl8W4KU9sma9QQKiJGIs3kkn7cWuQj+ele1QQ== X-Received: by 2002:a7b:cb95:0:b0:40c:1855:1c27 with SMTP id m21-20020a7bcb95000000b0040c18551c27mr999316wmi.103.1701907218720; Wed, 06 Dec 2023 16:00:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:18 -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 03/13] net: phy: at803x: raname hw_stats functions to qca83xx specific name Date: Thu, 7 Dec 2023 00:57:18 +0100 Message-Id: <20231206235728.6985-4-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The function and the struct related to hw_stats were specific to qca83xx PHY but were called following the convention in the driver of calling everything with at803x prefix. To better organize the code, rename these function a more specific name to better describe that they are specific to 83xx PHY family. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 85302d96d133..b1ea52ba3f07 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -295,7 +295,7 @@ struct at803x_hw_stat { enum stat_access_type access_type; }; -static struct at803x_hw_stat at803x_hw_stats[] = { +static struct at803x_hw_stat qca83xx_hw_stats[] = { { "phy_idle_errors", 0xa, GENMASK(7, 0), PHY}, { "phy_receive_errors", 0x15, GENMASK(15, 0), PHY}, { "eee_wake_errors", 0x16, GENMASK(15, 0), MMD}, @@ -311,7 +311,7 @@ struct at803x_priv { bool is_1000basex; struct regulator_dev *vddio_rdev; struct regulator_dev *vddh_rdev; - u64 stats[ARRAY_SIZE(at803x_hw_stats)]; + u64 stats[ARRAY_SIZE(qca83xx_hw_stats)]; }; struct at803x_context { @@ -529,24 +529,24 @@ static void at803x_get_wol(struct phy_device *phydev, wol->wolopts |= WAKE_MAGIC; } -static int at803x_get_sset_count(struct phy_device *phydev) +static int qca83xx_get_sset_count(struct phy_device *phydev) { - return ARRAY_SIZE(at803x_hw_stats); + return ARRAY_SIZE(qca83xx_hw_stats); } -static void at803x_get_strings(struct phy_device *phydev, u8 *data) +static void qca83xx_get_strings(struct phy_device *phydev, u8 *data) { int i; - for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) { + for (i = 0; i < ARRAY_SIZE(qca83xx_hw_stats); i++) { strscpy(data + i * ETH_GSTRING_LEN, - at803x_hw_stats[i].string, ETH_GSTRING_LEN); + qca83xx_hw_stats[i].string, ETH_GSTRING_LEN); } } -static u64 at803x_get_stat(struct phy_device *phydev, int i) +static u64 qca83xx_get_stat(struct phy_device *phydev, int i) { - struct at803x_hw_stat stat = at803x_hw_stats[i]; + struct at803x_hw_stat stat = qca83xx_hw_stats[i]; struct at803x_priv *priv = phydev->priv; int val; u64 ret; @@ -567,13 +567,13 @@ static u64 at803x_get_stat(struct phy_device *phydev, int i) return ret; } -static void at803x_get_stats(struct phy_device *phydev, - struct ethtool_stats *stats, u64 *data) +static void qca83xx_get_stats(struct phy_device *phydev, + struct ethtool_stats *stats, u64 *data) { int i; - for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) - data[i] = at803x_get_stat(phydev, i); + for (i = 0; i < ARRAY_SIZE(qca83xx_hw_stats); i++) + data[i] = qca83xx_get_stat(phydev, i); } static int at803x_suspend(struct phy_device *phydev) @@ -2177,9 +2177,9 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, .soft_reset = genphy_soft_reset, - .get_sset_count = at803x_get_sset_count, - .get_strings = at803x_get_strings, - .get_stats = at803x_get_stats, + .get_sset_count = qca83xx_get_sset_count, + .get_strings = qca83xx_get_strings, + .get_stats = qca83xx_get_stats, .suspend = qca83xx_suspend, .resume = qca83xx_resume, }, { @@ -2193,9 +2193,9 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, .soft_reset = genphy_soft_reset, - .get_sset_count = at803x_get_sset_count, - .get_strings = at803x_get_strings, - .get_stats = at803x_get_stats, + .get_sset_count = qca83xx_get_sset_count, + .get_strings = qca83xx_get_strings, + .get_stats = qca83xx_get_stats, .suspend = qca83xx_suspend, .resume = qca83xx_resume, }, { @@ -2209,9 +2209,9 @@ static struct phy_driver at803x_driver[] = { .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, .soft_reset = genphy_soft_reset, - .get_sset_count = at803x_get_sset_count, - .get_strings = at803x_get_strings, - .get_stats = at803x_get_stats, + .get_sset_count = qca83xx_get_sset_count, + .get_strings = qca83xx_get_strings, + .get_stats = qca83xx_get_stats, .suspend = qca83xx_suspend, .resume = qca83xx_resume, }, { From patchwork Wed Dec 6 23:57:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482481 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l256Hu76" Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D03F319E; Wed, 6 Dec 2023 16:00:21 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c2308faedso4060085e9.1; Wed, 06 Dec 2023 16:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907220; x=1702512020; 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=5CMZETdDgYu5hG2aMQ54/zJsbch0uzjPkjbZMzkqZ7k=; b=l256Hu769S3aPPSPv7+NabZ/IhJNxgTGjqN9tXHJxghBS/AIFrx9kUzlWfN4iyj1kS DvGlAZdYl9S8vYpAXDQ7bGbVIGK2jgq+NYp5wgIFn5k81cPnUb2vVEprEwdswWECCSBZ AZYxLiSmOPLEBEGdUsW+12ht5LdQYYUsIvfGJDJJ2y0Q4Elw8LKTG1ozY8/tlVIL/Akz iWKcmYLzAy+ialczS1kbcZLVnVNltgsHR2iu+0NaTV7dX89oZGKb/VBg1qGxOQG8cAuO BRJ/s8SYjMLGCMkjjLQQNAXuWgip0o+h/SPgJrJJ+HUWaWcLU7i8qnqBZxKJ/ZfJz3bG QSXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907220; x=1702512020; 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=5CMZETdDgYu5hG2aMQ54/zJsbch0uzjPkjbZMzkqZ7k=; b=qmlJu9UXuED0IZ/WN/RSTD7T1vc4uBR9YOMV52/SXV1eqCRztprVseyCcASilLwOWP Lio/4j4vqw1sWwqkU7Q+ykA8oHGTBICqoXQ2+j3bZ02+eRVKSC8xWpMMdNgejhz57evX mGzaDo6CN406whHtyzW4jF9NDJxcaTEbXA8MU+SiX00WHbaJ4dVxY6ptYXE7TeDwkJcU NdoFXxkjzjwusrjeVp83BCXWWBfMytnmaqBlLT02MfGm6UQWPhi79tHSfq8YfoBoyG3z o2D2Ykb811Qetau0XUqEsRasOaWalinPgodXKIjw43nD01ld8Xc4jp32mA70MWrihpO5 lKNQ== X-Gm-Message-State: AOJu0Ywm/G2Tl5pXAeoWiFIMuzUpdsiHHOHHtEYbs1W+FX/bA9ftitOj +S8gMNlgHZLS2X7E+ESDntA= X-Google-Smtp-Source: AGHT+IHe5TmnKl7rtfreNmuGey3yAvVXgq8Ind/i25fa4zP8XPVxKQ2ABfPFeSFOfMkpxzsRB8NIgA== X-Received: by 2002:a05:600c:cb:b0:40b:5e59:c58a with SMTP id u11-20020a05600c00cb00b0040b5e59c58amr1017932wmm.180.1701907219993; Wed, 06 Dec 2023 16:00:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:19 -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 04/13] net: phy: at803x: move qca83xx specific check in dedicated functions Date: Thu, 7 Dec 2023 00:57:19 +0100 Message-Id: <20231206235728.6985-5-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Rework qca83xx specific check to dedicated function to tidy things up and drop useless phy_id check. Also drop an useless link_change_notify for QCA8337 as it did nothing an returned early. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 68 ++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index b1ea52ba3f07..779e0835fa5d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1625,27 +1625,26 @@ static int qca83xx_config_init(struct phy_device *phydev) break; } + /* Following original QCA sourcecode set port to prefer master */ + phy_set_bits(phydev, MII_CTRL1000, CTL1000_PREFER_MASTER); + + return 0; +} + +static int qca8327_config_init(struct phy_device *phydev) +{ /* QCA8327 require DAC amplitude adjustment for 100m set to +6%. * Disable on init and enable only with 100m speed following * qca original source code. */ - if (phydev->drv->phy_id == QCA8327_A_PHY_ID || - phydev->drv->phy_id == QCA8327_B_PHY_ID) - at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, - QCA8327_DEBUG_MANU_CTRL_EN, 0); + at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, + QCA8327_DEBUG_MANU_CTRL_EN, 0); - /* Following original QCA sourcecode set port to prefer master */ - phy_set_bits(phydev, MII_CTRL1000, CTL1000_PREFER_MASTER); - - return 0; + return qca83xx_config_init(phydev); } static void qca83xx_link_change_notify(struct phy_device *phydev) { - /* QCA8337 doesn't require DAC Amplitude adjustement */ - if (phydev->drv->phy_id == QCA8337_PHY_ID) - return; - /* Set DAC Amplitude adjustment to +6% for 100m on link running */ if (phydev->state == PHY_RUNNING) { if (phydev->speed == SPEED_100) @@ -1688,19 +1687,6 @@ static int qca83xx_resume(struct phy_device *phydev) static int qca83xx_suspend(struct phy_device *phydev) { - u16 mask = 0; - - /* Only QCA8337 support actual suspend. - * QCA8327 cause port unreliability when phy suspend - * is set. - */ - if (phydev->drv->phy_id == QCA8337_PHY_ID) { - genphy_suspend(phydev); - } else { - mask |= ~(BMCR_SPEED1000 | BMCR_FULLDPLX); - phy_modify(phydev, MII_BMCR, mask, 0); - } - at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_GREEN, AT803X_DEBUG_GATE_CLK_IN1000, 0); @@ -1711,6 +1697,27 @@ static int qca83xx_suspend(struct phy_device *phydev) return 0; } +static int qca8337_suspend(struct phy_device *phydev) +{ + /* Only QCA8337 support actual suspend. */ + genphy_suspend(phydev); + + return qca83xx_suspend(phydev); +} + +static int qca8327_suspend(struct phy_device *phydev) +{ + u16 mask = 0; + + /* QCA8327 cause port unreliability when phy suspend + * is set. + */ + mask |= ~(BMCR_SPEED1000 | BMCR_FULLDPLX); + phy_modify(phydev, MII_BMCR, mask, 0); + + return qca83xx_suspend(phydev); +} + static int qca808x_phy_fast_retrain_config(struct phy_device *phydev) { int ret; @@ -2172,7 +2179,6 @@ static struct phy_driver at803x_driver[] = { .phy_id_mask = QCA8K_PHY_ID_MASK, .name = "Qualcomm Atheros 8337 internal PHY", /* PHY_GBIT_FEATURES */ - .link_change_notify = qca83xx_link_change_notify, .probe = at803x_probe, .flags = PHY_IS_INTERNAL, .config_init = qca83xx_config_init, @@ -2180,7 +2186,7 @@ static struct phy_driver at803x_driver[] = { .get_sset_count = qca83xx_get_sset_count, .get_strings = qca83xx_get_strings, .get_stats = qca83xx_get_stats, - .suspend = qca83xx_suspend, + .suspend = qca8337_suspend, .resume = qca83xx_resume, }, { /* QCA8327-A from switch QCA8327-AL1A */ @@ -2191,12 +2197,12 @@ static struct phy_driver at803x_driver[] = { .link_change_notify = qca83xx_link_change_notify, .probe = at803x_probe, .flags = PHY_IS_INTERNAL, - .config_init = qca83xx_config_init, + .config_init = qca8327_config_init, .soft_reset = genphy_soft_reset, .get_sset_count = qca83xx_get_sset_count, .get_strings = qca83xx_get_strings, .get_stats = qca83xx_get_stats, - .suspend = qca83xx_suspend, + .suspend = qca8327_suspend, .resume = qca83xx_resume, }, { /* QCA8327-B from switch QCA8327-BL1A */ @@ -2207,12 +2213,12 @@ static struct phy_driver at803x_driver[] = { .link_change_notify = qca83xx_link_change_notify, .probe = at803x_probe, .flags = PHY_IS_INTERNAL, - .config_init = qca83xx_config_init, + .config_init = qca8327_config_init, .soft_reset = genphy_soft_reset, .get_sset_count = qca83xx_get_sset_count, .get_strings = qca83xx_get_strings, .get_stats = qca83xx_get_stats, - .suspend = qca83xx_suspend, + .suspend = qca8327_suspend, .resume = qca83xx_resume, }, { /* Qualcomm QCA8081 */ From patchwork Wed Dec 6 23:57:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482482 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LGIu+u4L" Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB831D44; Wed, 6 Dec 2023 16:00:22 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40c19467a63so4251385e9.3; Wed, 06 Dec 2023 16:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907221; x=1702512021; 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=7z3Xda0RnvaE2hW0I0S04OmD8rJgdjIJIqIdkvOJgVw=; b=LGIu+u4L6kkzX+UonEB482yBXGJyLkqQGE7twT9R0+TCNNeBKMSZrLstviiAcO14Y2 lDU/7++jreiUHeHrShcTxzuslViACKBOOky9VblNKlrgffMZtB0qs+Bh7g0Iv2ZT2ioP d2ULVUdgpu0pqt3f/TE9IJe5Fd2RLhje4grS62Qz2djNZfUgKlUincg4xjcMTc+/kuXM LrPZl7ijGniCUI2E3mPGKhFHei/NT+yWvIaEB86RmEcPqrXl5o6yqYYp9r29vM6MetgS Klu5YGURde8Wt30LibL14yowv9USc8PzVKHS1sUMECJh4bgen9Ow0xkz6dDdldOcPBpz 1yxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907221; x=1702512021; 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=7z3Xda0RnvaE2hW0I0S04OmD8rJgdjIJIqIdkvOJgVw=; b=eiJrtzV5kUtzezh6/DeTYXKa8VrhKuitDp4I6LrlWVsZ2BLnTRUF9QVVVt8Xrqi5ks QICkMc1Pz2Zw/XrHIDVkRz3AjyRFiro5/KFOB7G4Paht73EpQ52h6CpRQPWvoKhP1NhA IVRl53P45MLkxZiEtWe07NE9+3O1fRyvpHylnm0tWmy0hzR9HYeaeezQ4FwuPOJykaXu mk8U95i3a26mX1ZxErUWjrIZ92KiIVfx69TZ6o9/XzT+Y/gsbKqhwBnwuV+m/fMjFnJe bfC+otMeV2RlfPhQJhnqqDM7LQH8iTqMCDNAUoe0bmf5nbjwPOUBm73fynQ2APWdIUD4 EP/w== X-Gm-Message-State: AOJu0YwrbBrIVm7Ecgbk0F+2JcHBTSBRot0iFHv1UE5spEZ3Ukr3x0eO 0zUnVK2tCstJBWQ5Hs8Pk/s= X-Google-Smtp-Source: AGHT+IE0wMmw7bejA/8riUbIYNofsnvAKMasY9YgFVq/lnR8XE5cpEMMgyBYkpAUkieACrrFc1LGxw== X-Received: by 2002:a05:600c:444e:b0:40b:5e21:ec13 with SMTP id v14-20020a05600c444e00b0040b5e21ec13mr1037512wmn.69.1701907221286; Wed, 06 Dec 2023 16:00:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:21 -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 05/13] net: phy: at803x: move specific DT option for at8031 to specific probe Date: Thu, 7 Dec 2023 00:57:20 +0100 Message-Id: <20231206235728.6985-6-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Move specific DT options for at8031 to specific probe to tidy things up and make at803x_parse_dt more generic. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 55 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 779e0835fa5d..e507bf2c9bdd 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -825,30 +825,6 @@ static int at803x_parse_dt(struct phy_device *phydev) } } - /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping - * options. - */ - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - if (of_property_read_bool(node, "qca,keep-pll-enabled")) - priv->flags |= AT803X_KEEP_PLL_ENABLED; - - ret = at8031_register_regulators(phydev); - if (ret < 0) - return ret; - - ret = devm_regulator_get_enable_optional(&phydev->mdio.dev, - "vddio"); - if (ret) { - phydev_err(phydev, "failed to get VDDIO regulator\n"); - return ret; - } - - /* Only AR8031/8033 support 1000Base-X for SFP modules */ - ret = phy_sfp_probe(phydev, &at803x_sfp_ops); - if (ret < 0) - return ret; - } - return 0; } @@ -1582,6 +1558,30 @@ static int at803x_cable_test_start(struct phy_device *phydev) return 0; } +static int at8031_parse_dt(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; + struct at803x_priv *priv = phydev->priv; + int ret; + + if (of_property_read_bool(node, "qca,keep-pll-enabled")) + priv->flags |= AT803X_KEEP_PLL_ENABLED; + + ret = at8031_register_regulators(phydev); + if (ret < 0) + return ret; + + ret = devm_regulator_get_enable_optional(&phydev->mdio.dev, + "vddio"); + if (ret) { + phydev_err(phydev, "failed to get VDDIO regulator\n"); + return ret; + } + + /* Only AR8031/8033 support 1000Base-X for SFP modules */ + return phy_sfp_probe(phydev, &at803x_sfp_ops); +} + static int at8031_probe(struct phy_device *phydev) { int ret; @@ -1590,6 +1590,13 @@ static int at8031_probe(struct phy_device *phydev) if (ret) return ret; + /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping + * options. + */ + ret = at8031_parse_dt(phydev); + if (ret) + return ret; + /* Disable WoL in 1588 register which is enabled * by default */ From patchwork Wed Dec 6 23:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482483 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H3djEn6w" Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 627F4D72; Wed, 6 Dec 2023 16:00:24 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40c2718a768so3803185e9.0; Wed, 06 Dec 2023 16:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907223; x=1702512023; 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=9VxI3+LUEvRyW0jRbv9Ny2+Yv44I4YEi8/tstLSQ5Is=; b=H3djEn6wj8VvIEQXAkV6/zID4wz3v9QW0YhJY2WMO+uwKiNxbglDpA2ZTQME+W09G2 EZyXHukeVD+0N+FsmqkHbGnCeA9LKizVyDMEly+GweYfs18CV1ucDE+GaQsYjT+GKBKH eRtM8POZJsyM0wk3IWm8oZ+fAF9ds7xFkDu5FCW6rLh6Mn6u4O3sNbGf3mGOoWegjxaA ghqop/41iqYOy3LSLdjnSh3yawT5LazBrDG6GadmMwgsk1ku3Bvr98EXSd/RD3vsKxex 1Rx364V/ij0/usqtRLRjz3ev17CRUik0yxKQsUhUcL4l+YeZA0fkiKdsw7wB0/TCwepn oLpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907223; x=1702512023; 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=9VxI3+LUEvRyW0jRbv9Ny2+Yv44I4YEi8/tstLSQ5Is=; b=qCQpzYTAKn5SI7wJjIqN94JF7rWalSU2eQor7dIjq6p5XOjzFM4yksNBjG6XRSD1wT AN1FRUzj4LHIGqAQooSPyttfe8d0h2CixixktWZyZQx6eMF+9fd9r6QABCt7KXox+myl DMIps0Yr7eP3EGscgXrUwqD2dWG0BxhVIZspgfHvRdmUuHtm/ntHeh8R/XuVc0xDvaxW PPHazAEM1vDUHJ0dhF0qIi1LspNSYnV6Jf28Mf/aIlZA77t7cTg8yIv/DuWtOuNCC/Yh B2kkxRUoW24VAB0/av6yKW6/Zk6IDoKbnMDGMQvKNqgcbhJ47llpqa1KxXX70viVbcF9 Bnsw== X-Gm-Message-State: AOJu0YwdBufJ3O4MCRiWQn/Y07Djl/OV12PMGFe1BgwiPVIVDWyIo2D3 UXA1A8FBBleVY8XRFNUUP7Q= X-Google-Smtp-Source: AGHT+IFy/1geWj6cEV4QJsdc31il2EEGsBN/HzrXDmfVEXFYy3eDuD7ziHG6CO5KP8PxEqknlE1ADg== X-Received: by 2002:a05:600c:35d1:b0:40b:5e22:956 with SMTP id r17-20020a05600c35d100b0040b5e220956mr1185988wmq.69.1701907222670; Wed, 06 Dec 2023 16:00:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:22 -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 06/13] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Date: Thu, 7 Dec 2023 00:57:21 +0100 Message-Id: <20231206235728.6985-7-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 */ 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: 13482484 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hrcoXchF" 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-Google-Smtp-Source: AGHT+IGtX6xNTD954eyHj0z8r8TC/ZyeUdvYV40s2gQDr7eEQaqtO4Vf1IHtj4VNGg0LFoDRb85Jjw== 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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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, From patchwork Wed Dec 6 23:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482485 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="huKiWaSC" Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60E01D5A; Wed, 6 Dec 2023 16:00:27 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c0a074e71so3854965e9.1; Wed, 06 Dec 2023 16:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907226; x=1702512026; 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=Lg7qa9kgNv3JPVirMlKzkE9ZBdZKAWAeOTAv7Yn8WPU=; b=huKiWaSCh+YdySp5i9DkG1WF+yhoGmQ2TUtQuNXaigT4jCthFflqoNBXGkZWC+miaK irckehxWvsaX0J8Od1aABDti+uwp/zoVS9hg4RVzfmESolEmFEfNjq39dKtL/AlmmzPU 7aDvXfC8a3cxPsHSTj+cnasEPcD6aSuBmfvUO0HfJarYWtRL74Xnr5SF74gcMtNINwLL cX87IE8oE+e0l3vyYOKtRq45bEl271bW3HWdY9t64+5gEvJZLOmA4mhOXFajRQrDUN/7 YfX+R5sB2sq3TFnuCiP/+5yubOz9M5qKSn9/FRKqEEmueIIsN5+B32PPJUDBwfLDWT+j Db2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907226; x=1702512026; 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=Lg7qa9kgNv3JPVirMlKzkE9ZBdZKAWAeOTAv7Yn8WPU=; b=Aa6rph3TLgKJ5w4qPuYZwfU+ImIwaNP1na/oSZlOPvoJPhxqXMh+KjRIVD65N8neGE XhO7JhHwbteBKFvBabVQeds+cGX0FbGXktV1CgpxbJ2OV0mKMBGXDFgu9PLJneV2rIBX g/zM9MugoYayJWe2PTw5qFC+X/n6UC395NDcdj75nkVV+E6AxYG5BRUm8MOvQmPRh8Z/ aESCaHThDYETEIbY4OA0dUM//qJS9Dr/r3cy7yR89FiENTvfmYcpBsugAwydQGA5EbAZ PW/08sFU7evAVG1jDawEhRB/umYUuAoPo8FpMGoIa9/tvhv4PUoPHVAkMIj3+Bfjl1nx +zCw== X-Gm-Message-State: AOJu0YwoMewE6oBaHyeskauD7LikHdT8FORoNz23VE7cGoveBczdHPtR 4YhvfLPASaAaoEYt7PuQWSI= X-Google-Smtp-Source: AGHT+IF9bZtXPYGfUkxjyTZW8PvepHSY0TGZvquPTwalKlI+NpLXym3iwhh3TUKXXHR0amG/dojndg== X-Received: by 2002:a05:600c:1c20:b0:40b:4805:f829 with SMTP id j32-20020a05600c1c2000b0040b4805f829mr1061028wms.22.1701907225756; Wed, 06 Dec 2023 16:00:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:25 -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 08/13] net: phy: at803x: move specific at8031 WOL bits to dedicated function Date: Thu, 7 Dec 2023 00:57:23 +0100 Message-Id: <20231206235728.6985-9-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Move specific at8031 WOL enable/disable to dedicated function to make at803x_set_wol more generic. This is needed in preparation for PHY driver split as qca8081 share the same function to toggle WOL settings. In this new implementation WOL module in at8031 is enabled after the generic interrupt is setup. This should not cause any problem as the WOL_INT has a separate implementation and only relay on MAC bits. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 42 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 02ac71f98466..2de7a59c0faa 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -466,27 +466,11 @@ static int at803x_set_wol(struct phy_device *phydev, phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i], mac[(i * 2) + 1] | (mac[(i * 2)] << 8)); - /* Enable WOL function for 1588 */ - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, - AT803X_PHY_MMD3_WOL_CTRL, - 0, AT803X_WOL_EN); - if (ret) - return ret; - } /* Enable WOL interrupt */ ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL); if (ret) return ret; } else { - /* Disable WoL function for 1588 */ - if (phydev->drv->phy_id == ATH8031_PHY_ID) { - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, - AT803X_PHY_MMD3_WOL_CTRL, - AT803X_WOL_EN, 0); - if (ret) - return ret; - } /* Disable WOL interrupt */ ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0); if (ret) @@ -1611,6 +1595,30 @@ static int at8031_config_init(struct phy_device *phydev) return at803x_config_init(phydev); } +static int at8031_set_wol(struct phy_device *phydev, + struct ethtool_wolinfo *wol) +{ + int ret; + + /* First setup MAC address and enable WOL interrupt */ + ret = at803x_set_wol(phydev, wol); + if (ret) + return ret; + + if (wol->wolopts & WAKE_MAGIC) + /* Enable WOL function for 1588 */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + 0, AT803X_WOL_EN); + else + /* Disable WoL function for 1588 */ + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); + + return ret; +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2123,7 +2131,7 @@ static struct phy_driver at803x_driver[] = { .config_init = at8031_config_init, .config_aneg = at803x_config_aneg, .soft_reset = genphy_soft_reset, - .set_wol = at803x_set_wol, + .set_wol = at8031_set_wol, .get_wol = at803x_get_wol, .suspend = at803x_suspend, .resume = at803x_resume, From patchwork Wed Dec 6 23:57:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482486 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RBFiFxZv" Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A869ED62; Wed, 6 Dec 2023 16:00:28 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40b2ad4953cso8433275e9.0; Wed, 06 Dec 2023 16:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907227; x=1702512027; 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=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; b=RBFiFxZvRRQzYOeDmuZrldz20PDWn4DKI+awAiIwtSUPIn+npVFpkMfV6EJTA64Be8 lWCqjQ0JcxrnFn8k+VkgYeYrJuKPuH6GCh+0o3gSSrWzSPaNPIraOiag/+0JZm6gFGsn YmK5QhTgCR12YFdKI8joW6Unxk02n7Ji7jXoCO/1hQrrz3TjkG71rg0Nfn2RXGCfr4Ih GgrMRaJHPMNRsaPEi/HFMRc0nON9bC41GAJ5PC4R5QZUi0TM7M87W+MLJebPKgvo5aSQ mXjhneK2mcP6QsY/GbzUemVBhow/lKmmAmqU6xXt8XJUWWYpNzLAL53ugTdhqzAqsjrM XErA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907227; x=1702512027; 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=rYf/4x1S6Xi4qxCbsW/ZhILQxOYsjDvuEIJRKEsMK/k=; b=DZT4henzxJ6aIPI+LqOyx1qaue9OF6sC7eSh2DED7ejjZE2X7DN5TAkG8TBt2DPlnd gP+njGBzyKThOEnY9aq5hmhGKO+cOoxtFBjWfcrNEsMMiLxdBpNQ0lQSubR4g6r6cfvl m965c2+nrpAsSrjGkXhns3F9RrBWTkJKIynjpgBh8dNu98S4hcTcG0/q+SCQQHpAKlb4 O5SvcOL3VCxTR+TTLyvGAYCm8z2beqZiOOq7eq2vjtrZsjwyVB8SD7snT552qcNcx2pS T49qWzi10TjohX2SS2bA9UbYIiFOEf65kIAxu5yiXlH1Dt6VUSCbuVWfMCfLx6PNl6gp gS3w== X-Gm-Message-State: AOJu0YwGhzZtjEz0c0pPDlU2mbpRXlXLKqZ5G15rSXtBMoeuZAg+Ip+Z 8izACVpKVnSRlh/ubVd6hYo= X-Google-Smtp-Source: AGHT+IElsDJmDetQs/EdK0OPQeUrb6dsfr3O805FFpJ7oprp00YCThosfXR+HgRJpzu3BY5wA2GFWg== X-Received: by 2002:a7b:ce08:0:b0:40b:5e56:7b67 with SMTP id m8-20020a7bce08000000b0040b5e567b67mr2141779wmc.176.1701907227032; Wed, 06 Dec 2023 16:00:27 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:26 -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 09/13] net: phy: at803x: move specific at8031 config_intr to dedicated function Date: Thu, 7 Dec 2023 00:57:24 +0100 Message-Id: <20231206235728.6985-10-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Move specific at8031 config_intr bits to dedicated function to make at803x_config_initr more generic. This is needed in preparation for PHY driver split as qca8081 share the same function to setup interrupts. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 2de7a59c0faa..1897030667d9 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct phy_device *phydev) static int at803x_config_intr(struct phy_device *phydev) { - struct at803x_priv *priv = phydev->priv; int err; int value; @@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy_device *phydev) value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED; value |= AT803X_INTR_ENABLE_LINK_FAIL; value |= AT803X_INTR_ENABLE_LINK_SUCCESS; - if (priv->is_fiber) { - value |= AT803X_INTR_ENABLE_LINK_FAIL_BX; - value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX; - } err = phy_write(phydev, AT803X_INTR_ENABLE, value); } else { @@ -1619,6 +1614,29 @@ static int at8031_set_wol(struct phy_device *phydev, return ret; } +static int at8031_config_intr(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + int err, value = 0; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED && + priv->is_fiber) { + /* Clear any pending interrupts */ + err = at803x_ack_interrupt(phydev); + if (err) + return err; + + value |= AT803X_INTR_ENABLE_LINK_FAIL_BX; + value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX; + + err = phy_set_bits(phydev, AT803X_INTR_ENABLE, value); + if (err) + return err; + } + + return at803x_config_intr(phydev); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2139,7 +2157,7 @@ static struct phy_driver at803x_driver[] = { .write_page = at803x_write_page, .get_features = at803x_get_features, .read_status = at803x_read_status, - .config_intr = at803x_config_intr, + .config_intr = at8031_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, From patchwork Wed Dec 6 23:57:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482487 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fy5jm9o/" Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1266CD68; Wed, 6 Dec 2023 16:00:30 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40a4848c6e1so4785655e9.1; Wed, 06 Dec 2023 16:00:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907228; x=1702512028; 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=wLw2n/+QIBoz3p532oZh6o9IUO9Ie7XX1RcGDA2Pv8M=; b=fy5jm9o/tpuHjCmNhFrpgSWXiItoD+O9L7greFax7czsIt6myYI5tnHyrzqGZno1/D ovDLnGnAv21Ug9CTQeE+OabVduuGnal9AZ1bqweMvtZxuDeR60vddRFBea3BRhzyQwG/ k1y6yRXkIfliSvzO/HAeEJhbXGTDeGVhCkF8rk+l05lwhducVu+wi8j9AYORhXRV9D89 SP+hcGaLwrCx0LrWNWs0A7+MIKqEtaS7B82zkCkW8n0HSkQ8JHNuMg/bHR3bZqwxNWg+ DxBMOosLDxvIBo/0F212HR103iSAg+You5mxp0kEHf8nkwbQYMfss78M+xN8zgmqzm1S JB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907228; x=1702512028; 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=wLw2n/+QIBoz3p532oZh6o9IUO9Ie7XX1RcGDA2Pv8M=; b=sV89OZqQ4+fremdYvi1PMV9g80Uo+IIhz6JU8rvrmwgeh3jqQ0v8PlUuTcbu/0Mkkc LsE5R528RLyoStXFxAhHgucMiSAMNhE5EQlNqUr87q4awFchWVegLlcWG7dgWvwxKRJq +bGbOc1l7Meax6ffeiaqwcneBy4+zeEBsJ66XMaPMzMBJ1erdIiHagNsaXPSc/lepJF0 tOvIb/t+0p2Ai5Z2DJFB4crFjEL80HpxtjWKMjR7IY26KnAOmcnS7nUTX4WQuZ75ZUE0 6cjvwYivgVZS6OTZyqDEsctK4th4WUUq45aHMiLIc4sgi/gmaqCeGDj9iIK4nzbIYskL PTcg== X-Gm-Message-State: AOJu0Yw8mVpMJM96hlw1YrSO0WOrk+psDfSIe3fIBthj/uJcO0ehMaXc tsr7LjpSD5PqOuCXYTO7uWw= X-Google-Smtp-Source: AGHT+IGFEzSJMOGJdMF1ywLy4jaW24G5qtmITrA3QZZVnq35AtNoPoCpBNpHAB8t9UIItqSedn+UYQ== X-Received: by 2002:a05:600c:468d:b0:40b:5e4a:406a with SMTP id p13-20020a05600c468d00b0040b5e4a406amr996898wmo.138.1701907228314; Wed, 06 Dec 2023 16:00:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:28 -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 10/13] net: phy: at803x: make at8031 related DT functions name more specific Date: Thu, 7 Dec 2023 00:57:25 +0100 Message-Id: <20231206235728.6985-11-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Rename at8031 related DT function name to a more specific name referencing they are only related to at8031 and not to the generic at803x PHY family. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 1897030667d9..3ae15ed7d634 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -583,7 +583,7 @@ static int at803x_resume(struct phy_device *phydev) return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); } -static int at803x_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, +static int at8031_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector) { struct phy_device *phydev = rdev_get_drvdata(rdev); @@ -596,7 +596,7 @@ static int at803x_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, AT803X_DEBUG_RGMII_1V8, 0); } -static int at803x_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) +static int at8031_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) { struct phy_device *phydev = rdev_get_drvdata(rdev); int val; @@ -610,8 +610,8 @@ static int at803x_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) static const struct regulator_ops vddio_regulator_ops = { .list_voltage = regulator_list_voltage_table, - .set_voltage_sel = at803x_rgmii_reg_set_voltage_sel, - .get_voltage_sel = at803x_rgmii_reg_get_voltage_sel, + .set_voltage_sel = at8031_rgmii_reg_set_voltage_sel, + .get_voltage_sel = at8031_rgmii_reg_get_voltage_sel, }; static const unsigned int vddio_voltage_table[] = { @@ -666,7 +666,7 @@ static int at8031_register_regulators(struct phy_device *phydev) return 0; } -static int at803x_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) +static int at8031_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) { struct phy_device *phydev = upstream; __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support); @@ -710,10 +710,10 @@ static int at803x_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) return 0; } -static const struct sfp_upstream_ops at803x_sfp_ops = { +static const struct sfp_upstream_ops at8031_sfp_ops = { .attach = phy_sfp_attach, .detach = phy_sfp_detach, - .module_insert = at803x_sfp_insert, + .module_insert = at8031_sfp_insert, }; static int at803x_parse_dt(struct phy_device *phydev) @@ -1519,7 +1519,7 @@ static int at8031_parse_dt(struct phy_device *phydev) } /* Only AR8031/8033 support 1000Base-X for SFP modules */ - return phy_sfp_probe(phydev, &at803x_sfp_ops); + return phy_sfp_probe(phydev, &at8031_sfp_ops); } static int at8031_probe(struct phy_device *phydev) From patchwork Wed Dec 6 23:57:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482488 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kgTs+1q4" Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68A9B10C3; Wed, 6 Dec 2023 16:00:31 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40c1e3ea2f2so3787145e9.2; Wed, 06 Dec 2023 16:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907230; x=1702512030; 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=Q1GjoFCHwWRz6fRwuR7ibzQ19O6g0gXQ8gbR6f752RI=; b=kgTs+1q4xbcaFHdcXfiVH4sl+tA1vJPUEriiBIGOh7nlKjP7JPsnKhYnBsv+5BZYfM KCckmuAfYsQZh5iA9B+YihSU3PXNSSXn3u5YG+KnEAd+4vyCVODAP5D9Wr6FmoOL2LJ+ KnwsD6BJIWHq1BOWm5kLU++7JUmQvnOqgS+4ANGbW7K8nJCgZrR/BWcW8N6UMqI95qai KdmYyrmyJ1/UdEvQQ3yasnFgQaIYuigHnfv88LW8nGnY675sXiK2V1riUZRAtRZDK6oM vy3p9Axc52490nWyAIVyA93og7ntIjlD8yg2RzeL2SB7vo7cHFYIztKZxAB3lLh6ZsON yMrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907230; x=1702512030; 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=Q1GjoFCHwWRz6fRwuR7ibzQ19O6g0gXQ8gbR6f752RI=; b=MkoovLu8E1pITLU1vB/fv6cWoKV4thmPN7Ooy8zH3w5tjYQdBdsSBD3wedWGdVMog0 SoDIpsE4HL6lXaitF5Db5wZrg7AZ2KftZH7HTjBiT6hGoHtqVJbgcDCcQO+eSDSh2KAv P912o8nMImN5YLM1MG0rSRCo+DpX06URFnVJm5BguhpQto//mgIRahkQva/12J5i2js1 TuNzBcbDXJNdAEMZNdCNBLQKuw3Ow+QvK/5k5eDP76gQCRvOLSIOnz/mZh655zSrm5nR TKnx0EtUUzCHi55Y+puo81FmOftMxAUBzD6wM/RYCPL6qrNvNj+jzQ7BX6M/g5RFhN/z ZiyA== X-Gm-Message-State: AOJu0Yx4kN3HZYzzwWF7mk2+SDIsbvzK/ufE+DLn8udRQEDWpxxkvfCg 6uclRfjlcsYxhu/HtoUt9Ag= X-Google-Smtp-Source: AGHT+IGs5gfiZWcjtq9eQJ2iEvpi5sElLdhowK5mfeV692ypbllrxMYFKhCPvNJmzfe7kyKiNiL9sw== X-Received: by 2002:a05:600c:b46:b0:40b:5e1b:54a4 with SMTP id k6-20020a05600c0b4600b0040b5e1b54a4mr1209251wmr.48.1701907229812; Wed, 06 Dec 2023 16:00:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:29 -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 11/13] net: phy: at803x: move at8031 functions in dedicated section Date: Thu, 7 Dec 2023 00:57:26 +0100 Message-Id: <20231206235728.6985-12-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Move at8031 functions in dedicated section with dedicated at8031 parse_dt and probe. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 266 +++++++++++++++++++-------------------- 1 file changed, 133 insertions(+), 133 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 3ae15ed7d634..73d1a5e29202 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -583,139 +583,6 @@ static int at803x_resume(struct phy_device *phydev) return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); } -static int at8031_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, - unsigned int selector) -{ - struct phy_device *phydev = rdev_get_drvdata(rdev); - - if (selector) - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, - 0, AT803X_DEBUG_RGMII_1V8); - else - return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, - AT803X_DEBUG_RGMII_1V8, 0); -} - -static int at8031_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) -{ - struct phy_device *phydev = rdev_get_drvdata(rdev); - int val; - - val = at803x_debug_reg_read(phydev, AT803X_DEBUG_REG_1F); - if (val < 0) - return val; - - return (val & AT803X_DEBUG_RGMII_1V8) ? 1 : 0; -} - -static const struct regulator_ops vddio_regulator_ops = { - .list_voltage = regulator_list_voltage_table, - .set_voltage_sel = at8031_rgmii_reg_set_voltage_sel, - .get_voltage_sel = at8031_rgmii_reg_get_voltage_sel, -}; - -static const unsigned int vddio_voltage_table[] = { - 1500000, - 1800000, -}; - -static const struct regulator_desc vddio_desc = { - .name = "vddio", - .of_match = of_match_ptr("vddio-regulator"), - .n_voltages = ARRAY_SIZE(vddio_voltage_table), - .volt_table = vddio_voltage_table, - .ops = &vddio_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, -}; - -static const struct regulator_ops vddh_regulator_ops = { -}; - -static const struct regulator_desc vddh_desc = { - .name = "vddh", - .of_match = of_match_ptr("vddh-regulator"), - .n_voltages = 1, - .fixed_uV = 2500000, - .ops = &vddh_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, -}; - -static int at8031_register_regulators(struct phy_device *phydev) -{ - struct at803x_priv *priv = phydev->priv; - struct device *dev = &phydev->mdio.dev; - struct regulator_config config = { }; - - config.dev = dev; - config.driver_data = phydev; - - priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, &config); - if (IS_ERR(priv->vddio_rdev)) { - phydev_err(phydev, "failed to register VDDIO regulator\n"); - return PTR_ERR(priv->vddio_rdev); - } - - priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config); - if (IS_ERR(priv->vddh_rdev)) { - phydev_err(phydev, "failed to register VDDH regulator\n"); - return PTR_ERR(priv->vddh_rdev); - } - - return 0; -} - -static int at8031_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) -{ - struct phy_device *phydev = upstream; - __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support); - __ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support); - DECLARE_PHY_INTERFACE_MASK(interfaces); - phy_interface_t iface; - - linkmode_zero(phy_support); - phylink_set(phy_support, 1000baseX_Full); - phylink_set(phy_support, 1000baseT_Full); - phylink_set(phy_support, Autoneg); - phylink_set(phy_support, Pause); - phylink_set(phy_support, Asym_Pause); - - linkmode_zero(sfp_support); - sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces); - /* Some modules support 10G modes as well as others we support. - * Mask out non-supported modes so the correct interface is picked. - */ - linkmode_and(sfp_support, phy_support, sfp_support); - - if (linkmode_empty(sfp_support)) { - dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); - return -EINVAL; - } - - iface = sfp_select_interface(phydev->sfp_bus, sfp_support); - - /* Only 1000Base-X is supported by AR8031/8033 as the downstream SerDes - * interface for use with SFP modules. - * However, some copper modules detected as having a preferred SGMII - * interface do default to and function in 1000Base-X mode, so just - * print a warning and allow such modules, as they may have some chance - * of working. - */ - if (iface == PHY_INTERFACE_MODE_SGMII) - dev_warn(&phydev->mdio.dev, "module may not function if 1000Base-X not supported\n"); - else if (iface != PHY_INTERFACE_MODE_1000BASEX) - return -EINVAL; - - return 0; -} - -static const struct sfp_upstream_ops at8031_sfp_ops = { - .attach = phy_sfp_attach, - .detach = phy_sfp_detach, - .module_insert = at8031_sfp_insert, -}; - static int at803x_parse_dt(struct phy_device *phydev) { struct device_node *node = phydev->mdio.dev.of_node; @@ -1498,6 +1365,139 @@ static int at803x_cable_test_start(struct phy_device *phydev) return 0; } +static int at8031_rgmii_reg_set_voltage_sel(struct regulator_dev *rdev, + unsigned int selector) +{ + struct phy_device *phydev = rdev_get_drvdata(rdev); + + if (selector) + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, + 0, AT803X_DEBUG_RGMII_1V8); + else + return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_1F, + AT803X_DEBUG_RGMII_1V8, 0); +} + +static int at8031_rgmii_reg_get_voltage_sel(struct regulator_dev *rdev) +{ + struct phy_device *phydev = rdev_get_drvdata(rdev); + int val; + + val = at803x_debug_reg_read(phydev, AT803X_DEBUG_REG_1F); + if (val < 0) + return val; + + return (val & AT803X_DEBUG_RGMII_1V8) ? 1 : 0; +} + +static const struct regulator_ops vddio_regulator_ops = { + .list_voltage = regulator_list_voltage_table, + .set_voltage_sel = at8031_rgmii_reg_set_voltage_sel, + .get_voltage_sel = at8031_rgmii_reg_get_voltage_sel, +}; + +static const unsigned int vddio_voltage_table[] = { + 1500000, + 1800000, +}; + +static const struct regulator_desc vddio_desc = { + .name = "vddio", + .of_match = of_match_ptr("vddio-regulator"), + .n_voltages = ARRAY_SIZE(vddio_voltage_table), + .volt_table = vddio_voltage_table, + .ops = &vddio_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, +}; + +static const struct regulator_ops vddh_regulator_ops = { +}; + +static const struct regulator_desc vddh_desc = { + .name = "vddh", + .of_match = of_match_ptr("vddh-regulator"), + .n_voltages = 1, + .fixed_uV = 2500000, + .ops = &vddh_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, +}; + +static int at8031_register_regulators(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + struct device *dev = &phydev->mdio.dev; + struct regulator_config config = { }; + + config.dev = dev; + config.driver_data = phydev; + + priv->vddio_rdev = devm_regulator_register(dev, &vddio_desc, &config); + if (IS_ERR(priv->vddio_rdev)) { + phydev_err(phydev, "failed to register VDDIO regulator\n"); + return PTR_ERR(priv->vddio_rdev); + } + + priv->vddh_rdev = devm_regulator_register(dev, &vddh_desc, &config); + if (IS_ERR(priv->vddh_rdev)) { + phydev_err(phydev, "failed to register VDDH regulator\n"); + return PTR_ERR(priv->vddh_rdev); + } + + return 0; +} + +static int at8031_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) +{ + struct phy_device *phydev = upstream; + __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support); + __ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support); + DECLARE_PHY_INTERFACE_MASK(interfaces); + phy_interface_t iface; + + linkmode_zero(phy_support); + phylink_set(phy_support, 1000baseX_Full); + phylink_set(phy_support, 1000baseT_Full); + phylink_set(phy_support, Autoneg); + phylink_set(phy_support, Pause); + phylink_set(phy_support, Asym_Pause); + + linkmode_zero(sfp_support); + sfp_parse_support(phydev->sfp_bus, id, sfp_support, interfaces); + /* Some modules support 10G modes as well as others we support. + * Mask out non-supported modes so the correct interface is picked. + */ + linkmode_and(sfp_support, phy_support, sfp_support); + + if (linkmode_empty(sfp_support)) { + dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); + return -EINVAL; + } + + iface = sfp_select_interface(phydev->sfp_bus, sfp_support); + + /* Only 1000Base-X is supported by AR8031/8033 as the downstream SerDes + * interface for use with SFP modules. + * However, some copper modules detected as having a preferred SGMII + * interface do default to and function in 1000Base-X mode, so just + * print a warning and allow such modules, as they may have some chance + * of working. + */ + if (iface == PHY_INTERFACE_MODE_SGMII) + dev_warn(&phydev->mdio.dev, "module may not function if 1000Base-X not supported\n"); + else if (iface != PHY_INTERFACE_MODE_1000BASEX) + return -EINVAL; + + return 0; +} + +static const struct sfp_upstream_ops at8031_sfp_ops = { + .attach = phy_sfp_attach, + .detach = phy_sfp_detach, + .module_insert = at8031_sfp_insert, +}; + static int at8031_parse_dt(struct phy_device *phydev) { struct device_node *node = phydev->mdio.dev.of_node; From patchwork Wed Dec 6 23:57:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482489 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T6CsprVe" Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3366310C8; Wed, 6 Dec 2023 16:00:33 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40b2ad4953cso8433535e9.0; Wed, 06 Dec 2023 16:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907231; x=1702512031; 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=cJTYW3+VwtWQ9mxnVIQxaCRT7NyQ9rnqwM6rkDrYRts=; b=T6CsprVeOX9+SOx8MQkMZlDpoLUxczaqIlSLp7b6R3cynC9Q62BS2drX97Ic41CUaH hgqy8Y6RC8S536RAFwdNd+BNhP6oV/aS+JoOkkLSAZponhMFdNifkq/ltmFiMnY5tp1Z XTQXoADi13GN2xBUYrsjYZXUiJqaXiBey/nUTH/q4WrftkQZLN3eXdCRKxyq6xkVvuJ8 mGylMtFljUKTVG9K0lLbHrerzKee5PzyL7WisPjnVeQu2cjxG/Lg9JXwHIj74VgiSbv+ PjTw9I1cn0jyP2UkQoVKxEMMK+rx0DxdtMfXQGFjDQRmQZ28xIgUkLJtM9TENb9STphk Bn8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907231; x=1702512031; 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=cJTYW3+VwtWQ9mxnVIQxaCRT7NyQ9rnqwM6rkDrYRts=; b=gDATlOpp63izFO1AJfkyjufIdr5yX0VGpl4WSaPbXVeiAY8oIdlo98Eq0wmTDUhTC3 nt8CCs1ChzbbtSeaIfy469rfsxCb+OAb78iPC3HX13/uJPL/2hHcgGBMv99XwSJHBvLG huYgslgKuV2yxVGaKsukxfrBfdfBCjZSd8j6sccQuyu3lMZ9NlHfeanhdptUPEgqc8i7 uVN+tX/R44qIFvBbBE3kmGdFNVd3fpenYJn721/E8l1mU6tJyk5TFHJKryizzNHXZD2R p+a4zoKxaGhZOCKAudJYh/QUPlM5zu9PC8Rwuyist/syRtwUAw9QqNlZktN59SffmjLi Cd/Q== X-Gm-Message-State: AOJu0YyZA/dar75Tft6HmCZJddfJ9xgDKjlciZz7e77sB2AXi6zyy17j Ie2KG0thqC5ovdObKxJOjo8= X-Google-Smtp-Source: AGHT+IF8gdaNJ9L9K4O2YOFIskp+7zLtmxdNlcPLSbqVvjdxAfv8mfM4KrjvKogUh6rBKo20oGoYTQ== X-Received: by 2002:a05:600c:4f07:b0:40b:5e4a:233f with SMTP id l7-20020a05600c4f0700b0040b5e4a233fmr2176639wmq.65.1701907231466; Wed, 06 Dec 2023 16:00:31 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:31 -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 12/13] net: phy: at803x: move at8035 specific DT parse to dedicated probe Date: Thu, 7 Dec 2023 00:57:27 +0100 Message-Id: <20231206235728.6985-13-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Move at8035 specific DT parse for clock out frequency to dedicated probe to make at803x probe function more generic. This is to tidy code and no behaviour change are intended. Detection logic is changed, we check if the clk 25m mask is set and if it's not zero, we assume the qca,clk-out-frequency property is set. The property is checked in the generic at803x_parse_dt called by at803x_probe. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/phy/at803x.c | 60 +++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 73d1a5e29202..27dc0a9ca076 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -638,23 +638,6 @@ static int at803x_parse_dt(struct phy_device *phydev) priv->clk_25m_reg |= FIELD_PREP(AT803X_CLK_OUT_MASK, sel); priv->clk_25m_mask |= AT803X_CLK_OUT_MASK; - - /* Fixup for the AR8030/AR8035. This chip has another mask and - * doesn't support the DSP reference. Eg. the lowest bit of the - * mask. The upper two bits select the same frequencies. Mask - * the lowest bit here. - * - * Warning: - * There was no datasheet for the AR8030 available so this is - * just a guess. But the AR8035 is listed as pin compatible - * to the AR8030 so there might be a good chance it works on - * the AR8030 too. - */ - if (phydev->drv->phy_id == ATH8030_PHY_ID || - phydev->drv->phy_id == ATH8035_PHY_ID) { - priv->clk_25m_reg &= AT8035_CLK_OUT_MASK; - priv->clk_25m_mask &= AT8035_CLK_OUT_MASK; - } } ret = of_property_read_u32(node, "qca,clk-out-strength", &strength); @@ -1637,6 +1620,45 @@ static int at8031_config_intr(struct phy_device *phydev) return at803x_config_intr(phydev); } +static int at8035_parse_dt(struct phy_device *phydev) +{ + struct at803x_priv *priv = phydev->priv; + + /* Mask is set by the generic at803x_parse_dt + * if property is set. Assume property is set + * with the mask not zero. + */ + if (priv->clk_25m_mask) { + /* Fixup for the AR8030/AR8035. This chip has another mask and + * doesn't support the DSP reference. Eg. the lowest bit of the + * mask. The upper two bits select the same frequencies. Mask + * the lowest bit here. + * + * Warning: + * There was no datasheet for the AR8030 available so this is + * just a guess. But the AR8035 is listed as pin compatible + * to the AR8030 so there might be a good chance it works on + * the AR8030 too. + */ + priv->clk_25m_reg &= AT8035_CLK_OUT_MASK; + priv->clk_25m_mask &= AT8035_CLK_OUT_MASK; + } + + return 0; +} + +/* AR8030 and AR8035 shared the same special mask for clk_25m */ +static int at8035_probe(struct phy_device *phydev) +{ + int ret; + + ret = at803x_probe(phydev); + if (ret) + return ret; + + return at8035_parse_dt(phydev); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2109,7 +2131,7 @@ static struct phy_driver at803x_driver[] = { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID), .name = "Qualcomm Atheros AR8035", .flags = PHY_POLL_CABLE_TEST, - .probe = at803x_probe, + .probe = at8035_probe, .config_aneg = at803x_config_aneg, .config_init = at803x_config_init, .soft_reset = genphy_soft_reset, @@ -2130,7 +2152,7 @@ static struct phy_driver at803x_driver[] = { .phy_id = ATH8030_PHY_ID, .name = "Qualcomm Atheros AR8030", .phy_id_mask = AT8030_PHY_ID_MASK, - .probe = at803x_probe, + .probe = at8035_probe, .config_init = at803x_config_init, .link_change_notify = at803x_link_change_notify, .set_wol = at803x_set_wol, From patchwork Wed Dec 6 23:57:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13482490 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K17L3WnI" Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1720519E; Wed, 6 Dec 2023 16:00:34 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40b5155e154so4694545e9.3; Wed, 06 Dec 2023 16:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701907233; x=1702512033; 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=E05UGHQ4N7O1lFKOAb+MxjheYxLzG4PbQZQyg7KHlkU=; b=K17L3WnIMDYg/DJcmukoYgTHmhuUu8zblYO+0DJZ4N3FgYJM2MLb/XRrxFvTvwYnBr Z9imFBlJgR2kbsNPjKflcoLZWGtaZHn3IPWHvxl4+kvOnYYz5RuYi9PG6l0buyDHeNO8 kziJlkZllTji9+6eB4/D8uwzz1UjoOzNzsroh5Wf1IvgEXpRmvjtDXBsQATD2jQxuN7g mNKwHtOr2+Z0GawfIHKmPa9Q0FGS/v8awMJDuGbnDtU/jhO/RApglUC30kBehuwDRokM TQsp37FgW5pSe6sVz3OXBdyavzUZ+zvK5Ob3Gp8Vz96g+/fK8fhPgQ56owytMa8eWECI wPVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907233; x=1702512033; 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=E05UGHQ4N7O1lFKOAb+MxjheYxLzG4PbQZQyg7KHlkU=; b=DuKTCE2F6JLM5Av1A2vv8xqFAxd/JEpcU58Ha2BwG3iK8qEUr00Y6DX0Tigi3NT0Mk kmxyZ2VJylH4/AMbNFy0JDb2fMWFKdqXxZdC0YO92WYtdwG3rM8UCdZgTPkJ6ig0fLu9 eXY9QRiLHz8PB075JJPW/0Vc3Rh3Sjno7Lln4hmTLormuH7imicMwraw0/bNyQat6Rnm JCFg3tEtivS1AVwhNZ8PcsFjpidTWPW9HLQPoIb7CjTVUEdJzjsoTMU7O47oURfbtZuZ R9T/mSmhmIvkCzDdaiCkMjd0g9SnukDjAEQT/28FGJOXoaCsvFdHcX5kGydIE//2WMBw gklA== X-Gm-Message-State: AOJu0YydgrL2Ywt/xSOJWcY8d0M4/+TJU+5/CSGueDMqqY14SvLVD8GC kGNGvjTjba+ofGMj+Qw8anI8e8afnVU= X-Google-Smtp-Source: AGHT+IGvRhkPjkzqqHXVwRWA1q7K7c6tz6hNVInnpLjA9DxAE26oV/Piqn0osTB4NFHPW1XUWEMwKg== X-Received: by 2002:a05:600c:1f86:b0:40b:5e4a:406d with SMTP id je6-20020a05600c1f8600b0040b5e4a406dmr991376wmb.141.1701907233227; Wed, 06 Dec 2023 16:00:33 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:00:32 -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 13/13] net: phy: at803x: drop specific PHY ID check from cable test functions Date: Thu, 7 Dec 2023 00:57:28 +0100 Message-Id: <20231206235728.6985-14-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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Drop specific PHY ID check for cable test functions for at803x. This is done to make functions more generic. While at it better describe what the functions does by using more symbolic function names. PHYs that requires to set additional reg are moved to specific function calling the more generic one. cdt_start and cdt_wait_for_completion are changed to take an additional arg to pass specific values specific to the PHY. Signed-off-by: Christian Marangi --- drivers/net/phy/at803x.c | 95 +++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 27dc0a9ca076..d102f826db73 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1222,31 +1222,16 @@ static int at803x_cdt_fault_length(u16 status) return (dt * 824) / 10; } -static int at803x_cdt_start(struct phy_device *phydev, int pair) +static int at803x_cdt_start(struct phy_device *phydev, + u32 cdt_start) { - u16 cdt; - - /* qca8081 takes the different bit 15 to enable CDT test */ - if (phydev->drv->phy_id == QCA8081_PHY_ID) - cdt = QCA808X_CDT_ENABLE_TEST | - QCA808X_CDT_LENGTH_UNIT | - QCA808X_CDT_INTER_CHECK_DIS; - else - cdt = FIELD_PREP(AT803X_CDT_MDI_PAIR_MASK, pair) | - AT803X_CDT_ENABLE_TEST; - - return phy_write(phydev, AT803X_CDT, cdt); + return phy_write(phydev, AT803X_CDT, cdt_start); } -static int at803x_cdt_wait_for_completion(struct phy_device *phydev) +static int at803x_cdt_wait_for_completion(struct phy_device *phydev, + u32 cdt_en) { int val, ret; - u16 cdt_en; - - if (phydev->drv->phy_id == QCA8081_PHY_ID) - cdt_en = QCA808X_CDT_ENABLE_TEST; - else - cdt_en = AT803X_CDT_ENABLE_TEST; /* One test run takes about 25ms */ ret = phy_read_poll_timeout(phydev, AT803X_CDT, val, @@ -1266,11 +1251,13 @@ static int at803x_cable_test_one_pair(struct phy_device *phydev, int pair) }; int ret, val; - ret = at803x_cdt_start(phydev, pair); + val = FIELD_PREP(AT803X_CDT_MDI_PAIR_MASK, pair) | + AT803X_CDT_ENABLE_TEST; + ret = at803x_cdt_start(phydev, val); if (ret) return ret; - ret = at803x_cdt_wait_for_completion(phydev); + ret = at803x_cdt_wait_for_completion(phydev, AT803X_CDT_ENABLE_TEST); if (ret) return ret; @@ -1292,19 +1279,11 @@ static int at803x_cable_test_one_pair(struct phy_device *phydev, int pair) } static int at803x_cable_test_get_status(struct phy_device *phydev, - bool *finished) + bool *finished, unsigned long pair_mask) { - unsigned long pair_mask; int retries = 20; int pair, ret; - if (phydev->phy_id == ATH9331_PHY_ID || - phydev->phy_id == ATH8032_PHY_ID || - phydev->phy_id == QCA9561_PHY_ID) - pair_mask = 0x3; - else - pair_mask = 0xf; - *finished = false; /* According to the datasheet the CDT can be performed when @@ -1331,7 +1310,7 @@ static int at803x_cable_test_get_status(struct phy_device *phydev, return 0; } -static int at803x_cable_test_start(struct phy_device *phydev) +static void at803x_cable_test_autoneg(struct phy_device *phydev) { /* Enable auto-negotiation, but advertise no capabilities, no link * will be established. A restart of the auto-negotiation is not @@ -1339,11 +1318,11 @@ static int at803x_cable_test_start(struct phy_device *phydev) */ phy_write(phydev, MII_BMCR, BMCR_ANENABLE); phy_write(phydev, MII_ADVERTISE, ADVERTISE_CSMA); - if (phydev->phy_id != ATH9331_PHY_ID && - phydev->phy_id != ATH8032_PHY_ID && - phydev->phy_id != QCA9561_PHY_ID) - phy_write(phydev, MII_CTRL1000, 0); +} +static int at803x_cable_test_start(struct phy_device *phydev) +{ + at803x_cable_test_autoneg(phydev); /* we do all the (time consuming) work later */ return 0; } @@ -1620,6 +1599,29 @@ static int at8031_config_intr(struct phy_device *phydev) return at803x_config_intr(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) +{ + return at803x_cable_test_get_status(phydev, finished, 0xf); +} + +/* AR8031 and AR8035 share the same cable test start logic */ +static int at8031_cable_test_start(struct phy_device *phydev) +{ + at803x_cable_test_autoneg(phydev); + phy_write(phydev, MII_CTRL1000, 0); + /* we do all the (time consuming) work later */ + return 0; +} + +/* AR8032, AR9331 and QCA9561 share the same cable test get status reg */ +static int at8032_cable_test_get_status(struct phy_device *phydev, + bool *finished) +{ + return at803x_cable_test_get_status(phydev, finished, 0x3); +} + static int at8035_parse_dt(struct phy_device *phydev) { struct at803x_priv *priv = phydev->priv; @@ -2043,11 +2045,14 @@ static int qca808x_cable_test_get_status(struct phy_device *phydev, bool *finish *finished = false; - ret = at803x_cdt_start(phydev, 0); + val = QCA808X_CDT_ENABLE_TEST | + QCA808X_CDT_LENGTH_UNIT | + QCA808X_CDT_INTER_CHECK_DIS; + ret = at803x_cdt_start(phydev, val); if (ret) return ret; - ret = at803x_cdt_wait_for_completion(phydev); + ret = at803x_cdt_wait_for_completion(phydev, QCA808X_CDT_ENABLE_TEST); if (ret) return ret; @@ -2145,8 +2150,8 @@ static struct phy_driver at803x_driver[] = { .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, - .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_start = at8031_cable_test_start, + .cable_test_get_status = at8031_cable_test_get_status, }, { /* Qualcomm Atheros AR8030 */ .phy_id = ATH8030_PHY_ID, @@ -2183,8 +2188,8 @@ static struct phy_driver at803x_driver[] = { .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, .set_tunable = at803x_set_tunable, - .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_start = at8031_cable_test_start, + .cable_test_get_status = at8031_cable_test_get_status, }, { /* Qualcomm Atheros AR8032 */ PHY_ID_MATCH_EXACT(ATH8032_PHY_ID), @@ -2199,7 +2204,7 @@ static struct phy_driver at803x_driver[] = { .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_get_status = at8032_cable_test_get_status, }, { /* ATHEROS AR9331 */ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID), @@ -2212,7 +2217,7 @@ static struct phy_driver at803x_driver[] = { .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_get_status = at8032_cable_test_get_status, .read_status = at803x_read_status, .soft_reset = genphy_soft_reset, .config_aneg = at803x_config_aneg, @@ -2228,7 +2233,7 @@ static struct phy_driver at803x_driver[] = { .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, - .cable_test_get_status = at803x_cable_test_get_status, + .cable_test_get_status = at8032_cable_test_get_status, .read_status = at803x_read_status, .soft_reset = genphy_soft_reset, .config_aneg = at803x_config_aneg,