From patchwork Fri Dec 8 14:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485468 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="FRJoZFQs" Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9C433593; Fri, 8 Dec 2023 06:52:10 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c0a074e71so22114895e9.1; Fri, 08 Dec 2023 06:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047128; x=1702651928; 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=FRJoZFQsDPDD0RUzEkwDOo1X7mfxWnGks1qhHw6m8zGRfsWnFN54vxpkOUpoyARiae 9ZENINeGoEkyoYX21VLSY95v8a3iNL87iALUCsvZLmCpMsRrSfl9VkL6qOy+ntYM1mbN 1LikYqz9CZBy/SgmpNoKIXZ3uvWq4SHl5g/1ee6ROABbG0T4jk1QXGv3G4PcVRcI+jPz hQKF51jp37ZnSKRD/+HVxTE5tnywe21zJ3m0lZ5dH8T0gnFxKHFztGm4qHgIPLTxSSP9 dO7KlsUlc3SYlQKcgS10zCvSHquUQuUxxBQFSgShiVCsOKS6nfIhvnVN+SJwAmvWHaOO J0Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047128; x=1702651928; 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=STFg5l4cMnX3jfxrU+GsZnGHsmb4zttimbKgwZvzMbEzhhit/RUQxh5LRo5fhJ1Wa6 z3ZfWwuiAi2Yjrssyg6BlbOxgduPA1L3ebK68nTEwgKM6ZAc7+sVBwNQ7urUmVlNhpBa yvTCchWNMfZBzU9O6J2HIFh4/tf5yUDzGM/FaO+Qh0t2XFA9RWLRzpBkKeJj3mamOl4c FdRhJAyKFWSHkrVJ90e6Xieh0j5duVo3wS7HskozNIiWOO5Q+/HSLbgg9PPZJZVvjhZj 751lm+n+bzVPYpEPT0AjyOVkDcr9PVD2z6GqnmQJ7Ox4sltrTUs3ub+aYptrs6hy7Uwl m4vA== X-Gm-Message-State: AOJu0Yz7YW7CAU7zdb4ZzNOP16UV4G1E4eXOBxyswJr4hKP/rqYnM0Av tUZ9G18Alv2O7oTPGZfBCPc= X-Google-Smtp-Source: AGHT+IE/SOjn5UV/UdZ/t8XCr1FucK2FELU5cjyGxsSmj7b+nLd+jsfDHCxefrHKjQ3MHBc4T0ySvg== X-Received: by 2002:a05:600c:378d:b0:40c:2b29:1bbe with SMTP id o13-20020a05600c378d00b0040c2b291bbemr71535wmr.54.1702047128143; Fri, 08 Dec 2023 06:52:08 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:07 -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 v4 01/13] net: phy: at803x: fix passing the wrong reference for config_intr Date: Fri, 8 Dec 2023 15:51:48 +0100 Message-Id: <20231208145200.25162-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 Fri Dec 8 14:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485465 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="R+33ggdu" 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 63B603599; Fri, 8 Dec 2023 06:52:11 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c19f5f822so12487275e9.1; Fri, 08 Dec 2023 06:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047129; x=1702651929; 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=WHoMR2yNKpJ7vVM7Ri3zOKS32TyWFv4sZETti3k6Nk8=; b=R+33ggduWCjCTF1BvF01ieHH1wTi6d8Y7MMnKviA5ufCXgTG8+lV5bKkk8E12BagVf 81b5ySelnVbKLbDSEuQkxojOaIKftmkZRtCrHlC4+KTrt67z+p1x319qW6ikdatR+/99 8sKQAjDtPO5oPyYsqv307trkcwPtl3DD55crTTI/3SAVirmFIwcPs925jyluxYgbcHCB VeGSXBef+y92lPIn4qL/0qT711+gVeaL3TMLhO8eFgGEIa4cCqN16iLQ2W6Kyvtrh56U 28vAzE0wFvnahq5sj/OI4ntFqupIaphsWD9sqs78tma1aBAxOfNU4RGD/RIK/EqFkf9p 1kKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047129; x=1702651929; 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=WHoMR2yNKpJ7vVM7Ri3zOKS32TyWFv4sZETti3k6Nk8=; b=upKXKyn5Q3mkhEgA7lQsy28Pk2BmeVr6icE2e0iOQODcmYMljci+yi+2oGwcq+wRyJ SfpoFQPY2Eh8vo2Qe5Tw3aR4V8wy4nUZy1HLhmhprJYUb/JDt0EJGlVFcZxDuyv8vBXL rbLsEZNaAAqGFODTTJy0Jui2AUAvI/rH+9ao1uGiv3pxrvO8513/b5NKYhIkqXkK1T6I TvmGYMxCIt9VbqEOsJ+XaKV3TH//MS3WL2NjZJKoS73ElFEBSgc7bXC5r8+w3DPrOGxZ OwU4YWrw4cIMQEv/SQpFm0eEM+E7Gyps6GmCPOBke/h1FqH5FoAyCB/dKYtlAQBe6Agt kzPw== X-Gm-Message-State: AOJu0Yw6GxScyOQI+FUw/6fwEcO2p9ZWQDXY6haJ+B3mFUvWUgVlrv5Y EZtG4/p8BoGEBO0mmRA3C7E= X-Google-Smtp-Source: AGHT+IH3OSJGOHb3jLohEgdeuv83AL412GIVU6HTHYfpArS/MOHC/XZVNM/JjXNoCnOvvzOSPHIQQw== X-Received: by 2002:a05:600c:4fd3:b0:40b:5e56:7b44 with SMTP id o19-20020a05600c4fd300b0040b5e567b44mr127875wmq.141.1702047129250; Fri, 08 Dec 2023 06:52:09 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:08 -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 v4 02/13] net: phy: at803x: move disable WOL to specific at8031 probe Date: Fri, 8 Dec 2023 15:51:49 +0100 Message-Id: <20231208145200.25162-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index ef203b0807e5..b8f3c215d0e8 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,22 @@ 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 + */ + return phy_modify_mmd(phydev, MDIO_MMD_PCS, + AT803X_PHY_MMD3_WOL_CTRL, + AT803X_WOL_EN, 0); +} + static int qca83xx_config_init(struct phy_device *phydev) { u8 switch_revision; @@ -2092,7 +2099,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 Fri Dec 8 14:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485466 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="grGzUsrq" 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 670BD1BE8; Fri, 8 Dec 2023 06:52:12 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c09d0b045so25400185e9.0; Fri, 08 Dec 2023 06:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047130; x=1702651930; 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=k3CRHE2JlPJvxR2z8QlM71Lcm2zabL9cZ1I1qY4IDPc=; b=grGzUsrqvep430CEdV8YFprBx8rmBxEQNtfiXKP+2a2KYEJke2JxqQnWttFRy4Katn X+K0aCsVsW+J4OdeyExEPOKtlg+Bl7Uib1q68k9EpSxW7r+C8UPbZeC8ThJGZBVp+T4x hPY3TbAud7vIfXGs81qpSkRPXMPXH1YD0NFvIVYTXQAQqJXUVi1a4ndZ4bzdyhK1lGbq dEU59m0q+I8CGqyHZD9+xFzFQ9BnLr6HgdrZVyik6WvLO5GDla3Z5fQyiuRWJJhhLKgb W929lcbzmZ8tgSdOLlzD3oElkNd+j89JA0doNygzLDTRsQux27hhco27DohNSog3ixsr +mDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047130; x=1702651930; 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=k3CRHE2JlPJvxR2z8QlM71Lcm2zabL9cZ1I1qY4IDPc=; b=AW1Rfj7PnmSTQ4wmLEYrJTmSZZlHH/iYgQWs0XZpSiuzRUBKFm0BZr1QUg/WYVNbOm 8ENqGLXgr9IrbqUNtC19dafMfLXVN+auVMHhEXbFKdy3Q2tA2kbK4jwSDbQVv6169vQN Bkxl2RpoZ1JRA+ljF6kJ4YHC5J3PJNoZmL7E4R0Hy++Q59nRufSTr5EKwQPOemMpARgX TmaqTKRGYlgJHy1EUp/z4JlTHrxQF4vNXZ6HiZgzzkHc6HFQiU8t7lnxOaCf4PJl2N64 fYEWiid3JR0lZQHUrs/2fjlt3OXnYItotH+27jMwTxWgDE9nGfBCxhNxAcff0qcHxP2k PiAg== X-Gm-Message-State: AOJu0YxTxi2/tXl+yI+uFbH5z3UxzzFRMb905tZw9RiC71p4ogakcdXh CBvGzsrbWiiW7IGGMBMz+A8= X-Google-Smtp-Source: AGHT+IE+Sl9uvm0eP7FJUHY58vaObqFyBtRzEdpfIkIq3tIEwLcDaQIduGUVkPvMv8tYJtW2m6NOnA== X-Received: by 2002:a7b:cd12:0:b0:40c:3742:5a3 with SMTP id f18-20020a7bcd12000000b0040c374205a3mr27161wmj.256.1702047130293; Fri, 08 Dec 2023 06:52:10 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:09 -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 v4 03/13] net: phy: at803x: raname hw_stats functions to qca83xx specific name Date: Fri, 8 Dec 2023 15:51:50 +0100 Message-Id: <20231208145200.25162-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 b8f3c215d0e8..277a6c27af7c 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) @@ -2175,9 +2175,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, }, { @@ -2191,9 +2191,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, }, { @@ -2207,9 +2207,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 Fri Dec 8 14:51:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485488 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="VAvE848/" 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 31DC835AA; Fri, 8 Dec 2023 06:52:13 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40c039e9719so24711325e9.1; Fri, 08 Dec 2023 06:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047131; x=1702651931; 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=5feJ9c621I5/VZmz7DYVtyWPMsJYNgURBm5K+LW+VFE=; b=VAvE848/Z4AsZCW4EnDdXInW35aj5vHwd+v+LiAWGNVd9VNfkEkWH6E8w6WXhLtnMl 22GK8JFTxnAn90Pmw71FJ5ufMNhWePVUeN6ml1Y8d3NbnKWh4Qre0kZdveTRCy0/cuxN ITbZD7GwSOr6oD+Rr9E7I3rXra3fftKpx6YFIB1TuuHQ6ukBEbE6O+JJ8J6H5J8j0Dei 4f0G+37zF8C12l/s9nlp/BbyINrUCql36goPEThGUu6ovjS5UyxHbasJDBi6jlFb6hdQ B0jydWazDdgaBKKOrlKiK/Etso8Gr5lxR1gl94LLv2ckSdIa02amYLBHvmUSiy24dH2q F2MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047131; x=1702651931; 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=5feJ9c621I5/VZmz7DYVtyWPMsJYNgURBm5K+LW+VFE=; b=u9RXusz4fBWaZL36K50ureiC3odlN1Pc7c9cM+z67cwy1f7tXb0zSepwyF0R676OC2 YH55kyFTDxhDVlofWZF0an8baMHlocPpGKFdUEkdAvpokWnCwgOympPe25+8F4y9/XKD xiN7Zw/pD8/IxxGZvgK936fHTG4PpY+RL1NfVxmUKMQ0zE9seuVCGDDUqBI9AFKIUJ3V /bL0WZkqSNidt3uMnp//bY8zzX7rOS3X7qZHeQQRofPi2NJkyUuELBe5b8wBP+vn0oDG WaI/NX8QMuZLKU9NJdOEHlW0EcMIaAAzVXtpIRmu8nTeip4jd9RfB3TvfO0srU9o4WHH egmA== X-Gm-Message-State: AOJu0Yz57HOGl1Ja99AekQbP268EWKG2ihEnYoObP1vLl72KsV8CH8rS 0XX3wk2/F3TsY+ZX0WSi58Y= X-Google-Smtp-Source: AGHT+IG/zXGDmAWkck+f5HF8HcpPavtzuWSCoZICM0+LbFLtrHxewTUfDYWTbtMCc3mbob6q7vyjug== X-Received: by 2002:a05:600c:2b0f:b0:40c:33be:d166 with SMTP id y15-20020a05600c2b0f00b0040c33bed166mr49417wme.87.1702047131342; Fri, 08 Dec 2023 06:52:11 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:10 -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 v4 04/13] net: phy: at803x: move qca83xx specific check in dedicated functions Date: Fri, 8 Dec 2023 15:51:51 +0100 Message-Id: <20231208145200.25162-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 277a6c27af7c..fa412a4e080d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1623,27 +1623,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) @@ -1686,19 +1685,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); @@ -1709,6 +1695,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; @@ -2170,7 +2177,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, @@ -2178,7 +2184,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 */ @@ -2189,12 +2195,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 */ @@ -2205,12 +2211,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 Fri Dec 8 14:51:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485486 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="fMS8AMWu" Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3535C35B1; Fri, 8 Dec 2023 06:52:14 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c0f3a7717so24649315e9.1; Fri, 08 Dec 2023 06:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047132; x=1702651932; 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=SKdApVa1/ad6QR0kGy/pXmtTCWwb2YcJRtG4h3T2bUY=; b=fMS8AMWuOCa8yU1df2vi/+X0nowQfPxHdBkEworfzHRmYXd99vc4clBYy3WyM5nIoH Di5CVXTufCJMwc2bpq0pw98QldBiJIMegvhb7iJVtdZKB3bPNLO3YwUQx0pNMwPinIcz tvOUxqAS7jzzbu4AT+JHYClX38SUFNrOVbYpjA2cKD7SAlRp58LuPf/nSz336ra0WxMU FVu9hiBKWoDE+4ZQwghpoT7+6weIynO7Ut0XS6pJXAaQK5K6MVhFNqJX+EeXiZKwrBkL NOZVYWnds207MGhvbjw5egcbH3gFiunJ06ZODcvmgnZPBi0QGagg1K5tawthEaqzlK6v 4lSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047132; x=1702651932; 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=SKdApVa1/ad6QR0kGy/pXmtTCWwb2YcJRtG4h3T2bUY=; b=bJZJ4thDxrJDWYkJlA6uOPamihu/B3jPFIRgaOs+oH8LFP4mNWUgFselalrVdfhNXu T4iGEPeRFj94uz2n857T1tf3aOMxPHKE/L4Jzl0PDt+5PLHjHc+sEWA7iJhfkSMWgCD6 AeZyPKfKYel/PJPJkbAuie4pxpnhSG9dk6GH1VU39VGpAXS7NNwhryaKTIYFS4Ops5Np Cvtd5sDAQrCPGRJVZeKNWY/ttPezoKCQrGLQnMcbQcOpFJS56axPKP7AWDWcczGv0EIJ e3g8RzKylwcM774xUqyPSUw+zwNrgZ9xndWnGYX4or8sqt/KoooGy8FEfpXSy7TJbzRo IYJA== X-Gm-Message-State: AOJu0YymTPCbLb0ZWU2dEgqFXI/5KlTYp35y1lbuIkJ4/Q3UWp8AXlpA VLvHMRTeMHkbr1FgfDvnaiw= X-Google-Smtp-Source: AGHT+IF+dqlzPLibBM3YHFIrfF8fdOtcPcNS2v/dAzKrDQOs162Ja2IE5onrQ17NY/uibq6xI7oUfg== X-Received: by 2002:a1c:740d:0:b0:40b:5e22:2f6 with SMTP id p13-20020a1c740d000000b0040b5e2202f6mr27184wmc.98.1702047132401; Fri, 08 Dec 2023 06:52:12 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:11 -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 v4 05/13] net: phy: at803x: move specific DT option for at8031 to specific probe Date: Fri, 8 Dec 2023 15:51:52 +0100 Message-Id: <20231208145200.25162-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 fa412a4e080d..5694c2667b4d 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 Fri Dec 8 14:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485469 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="k6VZUtd+" 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 4808419A1; Fri, 8 Dec 2023 06:52:15 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40c09f4bea8so23343965e9.1; Fri, 08 Dec 2023 06:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047133; x=1702651933; 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=+xPT5eitsPLMWqf9JvP+rrRy2e2KvhKrvYQ5CxZDAVg=; b=k6VZUtd+i34aIFvxN1LZ2iwjt9OiyogBuCb1Pb8ApKbvskaenCfqhVgqhdni9tq1x7 PiblA+ZwQjp9HktUxlzCM9eoiYP0m9fFVrLwohq5s4u04vb4PMabsdwQBJorNkbHqY7x 8v+EfLg5ist3XDdmoZOQpNuE63RRhp9baOS3lyow6V+9SHddJ3uDpVqfCxrgZSoQJgwK 9K/ph74veol19tCfyc+XZnxGx7nSqr6+ufEXfOSP1uU087Wk8YPsvVn3W251leVN1T9z WUNb1v5FCRV5suFQkYmfePy+RhCKUPEsujVOmBWJiQBWxeJKjcl6HBJdRH/81Slp/mEO qSKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047133; x=1702651933; 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=+xPT5eitsPLMWqf9JvP+rrRy2e2KvhKrvYQ5CxZDAVg=; b=ABQipJLm5pUd6/llphZ5UO1pJuELtRYj2c/cgr8/Jw92mC5vpfn8tbwG9NrAhu1okR 9Her9aDtSTsBPwTXq9dTT87qS7a6jsN67WI5mzKzmjX9tdk24P6y34h4Vr0LeiDxWzUh TNhgzIrfPeAI+TfkK5Mn57YDk++Wz9szfBpQeyAfUXs/2AEbGSmJHqfLADjWLDALLBjW S/Hmt9dgAotiBJjpkav2v2ZgGql3EYEezY4K2rDYyhxXztp7AJmwwAYAIfBo2xhXuhji +i35o7D0s1Z3d8al5W3z9sZHdxeQPbF4tzieMOIaSAkhh2r576eF0r4D7AcPXobervFk d+kw== X-Gm-Message-State: AOJu0Yznbc0Ii2Q+2lWCCGXpeqkVIz9uixj470fyrxi9GlAmNryNu/5I tGlI8sBH6QYEiM8FglYjD4Y= X-Google-Smtp-Source: AGHT+IGzOVMestV1zQHtSsFECYZkabM6IvIokypmmsUerQb4p914/KLF2mT4Kn9HmIba1n5stNqhww== X-Received: by 2002:a05:600c:4709:b0:40b:3dae:1ff6 with SMTP id v9-20020a05600c470900b0040b3dae1ff6mr60904wmo.14.1702047133519; Fri, 08 Dec 2023 06:52:13 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:13 -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 v4 06/13] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Date: Fri, 8 Dec 2023 15:51:53 +0100 Message-Id: <20231208145200.25162-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 5694c2667b4d..6cb41af31818 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 Fri Dec 8 14:51:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485467 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="cCjhuI4V" Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A006B3848; Fri, 8 Dec 2023 06:52:16 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40c19467a63so24583635e9.3; Fri, 08 Dec 2023 06:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047135; x=1702651935; 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=P5/O/H6nUdwu1//MonWtOM4w7F6u3pPBln032X6Yzks=; b=cCjhuI4V7g3BKattb0Qk7pUDvdvXOUbdqVoi3KEzIO8aYKFHk3HrmPIkmpQnZt5KPz 7X1nPZZP0oeUZpUzL+lbLAW2cNmmqmjE3/UfE9Ixyvu7zS/Vi6j3p0vG9CaB2CnzduWm irqQ1UwjmPIBEfuqh4h0mt1rYuYKWC7abhq4pBK2zu2g7M9CrAnJY2QJfN84NDpV1H+C hzFyz7RacH6scZAvhSIla7649KCUp84GhVC3PTOotfKN72F+oOTeNY/WMUjGUQojKeXo aFqwzQjGN3cA76EwCXZuFirb7H3GbpXrVnKlo4Ow33TSInBMMzraFt1EJ4Q5Vv4y5B7I R/mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047135; x=1702651935; 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=P5/O/H6nUdwu1//MonWtOM4w7F6u3pPBln032X6Yzks=; b=A3ymuCLvmFKpcniWP13ZM8fd0VCzhGsfTIPMm8G5LMhFTo6hY7DoF6vuHsvro9UgoI cODRXC4CES8MmCy+9c/VGAwi7HzjQgx20wI1JDYmjuW2+cgRbvFyHgV9eUgwZ270l88J Usruz0ktP4yrirfaDDFZIvAmQo7M3E8+Ue0WxiqSsL7KHROsjYtvZ6Xqm79ELKH2NUu+ GItHV60Gt0q6pGGJ2m4VP6MdwGhWLBHHU53N6kd5PdL/9/pGWTxNFDSSK+P+ydujuCkG G7OIGc/LWxJ1kIwj06r1dA6C0YM0wmYsd3SnnXninbvJMtGWeVjubdf7iFzUVySYjj4W 4qHw== X-Gm-Message-State: AOJu0YyXtRsxSiBTCBhimdXPPPcmrY0qOkDBxB9Q0b6hR0jajW/UQyb5 P4IX4C1PFe5aRH6dQW0BpgM/fVpAoy8= X-Google-Smtp-Source: AGHT+IHVaHwU+tLLPUOaGgsgNxEGh6ogpNiaXnDzv0nvMD3D1QPq0vsU6EY6ItnQ3vls8tTbGj0Vfw== X-Received: by 2002:a05:600c:204b:b0:40b:5e59:e9f3 with SMTP id p11-20020a05600c204b00b0040b5e59e9f3mr40459wmg.146.1702047134544; Fri, 08 Dec 2023 06:52:14 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:14 -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 v4 07/13] net: phy: at803x: move specific at8031 config_init to dedicated function Date: Fri, 8 Dec 2023 15:51:54 +0100 Message-Id: <20231208145200.25162-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 6cb41af31818..e2bf5a16ba3c 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 @@ -1604,6 +1585,30 @@ static int at8031_probe(struct phy_device *phydev) AT803X_WOL_EN, 0); } +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; @@ -2113,7 +2118,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 Fri Dec 8 14:51:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485489 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="jnT/hZqf" Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E6FF3853; Fri, 8 Dec 2023 06:52:17 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40c2718a768so22048665e9.0; Fri, 08 Dec 2023 06:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047136; x=1702651936; 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=jUWRj8SMGfke2llijADB8r/5G0kPfaXc58R9QB7gQMQ=; b=jnT/hZqfNztMEu/jSWkZpVQ97zYhtCSDzbi8qMIFt/CLCZ/T48CgWGud9qnG6btfZ4 BTZGRtBRbpFfpaNGdGr4+OoG8q/az0hUlq3Vuj7SU1Uxblg647JqLougto2ul7FwO0j1 88RXDOva5/9fHFWx6Savykqh8ahOZbu0HMLZNHU0O3RJ+zjZRg3y/WDzLp1etdl9urVf GJSVvDaWzBBDWwUTxXze7H5AOfTYDqEIxeJRl8cG74tX8NSbJvTjfZJ5OJz903PnZqmp wFk1+BzgefH2o6NnpkskBlxTrDoUxzLax58p5JuIt8RVwP3gD3r8rHEv+WtH6UnHo5mj 3/hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047136; x=1702651936; 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=jUWRj8SMGfke2llijADB8r/5G0kPfaXc58R9QB7gQMQ=; b=p6/qSnmwQNWTx4w86Bt3PZg+O744ZdMxjexGF61s7cVTseNcAxjemKsnsNZ8iAkj8l +DK+QixFXv6XCZlmCUiVJZcpTgsotjH/ScQWxEo/pyo0/xN3aoeOpvyOzrpKGm7bOhTN RXkk0r+q/WCc4WadhA/l3n6Syayi0bSXAUyvyOV4/dwDFOfAvH0i2Ol6elSWbnBr3YXP RjrjbrbRPiAVqaVw3ftz9HrTazgruAgNTWoKtjmuEpYwApb3I0pTbhQtZcVaODFQYGBQ lF2u795vH/CvQdPwdsL0QdRECtoMmLTFGUc1/oB1lhQTyTcQqcPL2NA+qNZfrAVj2Pq6 YheQ== X-Gm-Message-State: AOJu0Yx8/R4I3Vwtoy/j7VcWVTNevS/nlRChWMthCh9yFz31Z3EbHHvu VeTxbmasJ9jMT6Y4ybpWLxcuEN6FRPY= X-Google-Smtp-Source: AGHT+IE9X8QmX/V+T4sumcp3bnCyNdzU2BbAqVxUj8ZkQ/dwLinBWoKzQ0o+xJnidQRKwolLwsyw3Q== X-Received: by 2002:a05:600c:32af:b0:40c:2c2f:a5f0 with SMTP id t47-20020a05600c32af00b0040c2c2fa5f0mr41351wmp.92.1702047135709; Fri, 08 Dec 2023 06:52:15 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52: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 v4 08/13] net: phy: at803x: move specific at8031 WOL bits to dedicated function Date: Fri, 8 Dec 2023 15:51:55 +0100 Message-Id: <20231208145200.25162-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 e2bf5a16ba3c..862ec08ad86b 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) @@ -1609,6 +1593,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; @@ -2121,7 +2129,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 Fri Dec 8 14:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485473 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="Fq+TVfSK" Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E0A3860; Fri, 8 Dec 2023 06:52:18 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40c32df9174so8939985e9.3; Fri, 08 Dec 2023 06:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047137; x=1702651937; 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=Ire9TzxrqfCVF6+oXacCtQAHi8rA2FHZhZNxfVwYUAk=; b=Fq+TVfSKYAxiWrGtf3VtEXuYgOLVOQnXZzmSlb3mM0CtUGBvP122/kcep7Vqb+bK4K oywyMa6xrbseYkeGLCWmXZ/lswNIsHswwifZ4eoqVxM138Gn46sG9FQ5DZZOG49VmvtW 6UlME8F1fi3P/PJIAmC+vVqzr1M9+2Z2aOXZheSJoPjY3c9mgEUbUi2lUFtNQ1QSO0e7 KErl4iKuWGTCeF5Z4IPTSiptNQygxgP3UubUBv5SVyfLa83sM9YAX7zzNL+Qb7/uRjIB HDu0MRh/NrDc2SCObA+k/8v+8QJ8Q4Ai6XM+ZvwssdYi48fDlABJ8GUhCnAWInl/Aj9x aTbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047137; x=1702651937; 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=Ire9TzxrqfCVF6+oXacCtQAHi8rA2FHZhZNxfVwYUAk=; b=AS7cpmS6jtXPEJOWhYNdYRxcPGNOeBTsXf32VXTBxJkHY9GPGRTVGED4q4mVsSGFp7 VE1crID2fQsBeh0n6vbtPJmPg9V+e18BLEP59UJZjEJGfjxUe22q2klcuJ8c98eEg0nl pAq63uEB5YrIOe5Jvvmzuj3iZ2d+7bz0apVgQhGfwCNCrB8j+dNfw5ID6eZDGYSHLEN/ jh+MmIif4IUatxlbd5Ynr4Unmukm47NBJukvl+XuMlygsLPi5nvuteAUm2pvD25200/G A4LdoJaqNpw94BOEWahzIofotRWVJxjpUX00TRKOBePkhdkarFfJgRrQKwMUZd11KOpB UqDw== X-Gm-Message-State: AOJu0YwwK6Nm0Aam9TQAVgPPSTrKZenyl5OxLHaqHam4BYIMEngD3ZsT Sy7dAYL8HuFV9tsr0jIcOF8= X-Google-Smtp-Source: AGHT+IHZO6Lq0ydedpSvPcnC4aVvltxnvxW0gEH+xl+MUm4RczIy8vJ4hlqTYIQzk+x8F2slWOKQqg== X-Received: by 2002:a1c:7c1a:0:b0:40b:5e21:c5b6 with SMTP id x26-20020a1c7c1a000000b0040b5e21c5b6mr30370wmc.132.1702047136938; Fri, 08 Dec 2023 06:52:16 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:16 -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 v4 09/13] net: phy: at803x: move specific at8031 config_intr to dedicated function Date: Fri, 8 Dec 2023 15:51:56 +0100 Message-Id: <20231208145200.25162-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 862ec08ad86b..83428305281b 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 { @@ -1617,6 +1612,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; @@ -2137,7 +2155,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 Fri Dec 8 14:51:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485470 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="QSan3pD/" 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 8B786386F; Fri, 8 Dec 2023 06:52:20 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c256ffdbcso22578955e9.2; Fri, 08 Dec 2023 06:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047138; x=1702651938; 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=l/LkCIkEWQjEgEt2tt9hxl04Qa/tBAKJsHnx5bVDjm0=; b=QSan3pD/hLnk9N111xORmrs2/4lCjvmbEvF+NYk87r5FeV4Y1G9Z23+scCPLEZ8AZG BN/iDpS02MmF0QfYnvzIMomea8ny6F3OYFRwvS7VTRfLGgkdMYUa9c3/HczoSSrwqec+ 1acM9FlauXk3y0LQb4SXouffuOqi7MTuJEOduHPqt/RzWRTE9YHAhMy+gHlSgKsRYJJP FOcE05gL6Zp0w1e8TezMY/DcwkzeV+EUYtGqSi0eHdYClfjEwsvb6j/pgE4QLKoqi4AC MyyiLWDei7d461icI0QiIL8MGgB9K4NzCnRsW2eSeGbFpZdVnRZDhxkFdGKLr5XxVtpc WKsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047138; x=1702651938; 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=l/LkCIkEWQjEgEt2tt9hxl04Qa/tBAKJsHnx5bVDjm0=; b=Z1e5h31I6OIhU4IDnDMhcHAprV6qupIwfYaqxWlq2wuPFjQEr82CTYlrP6uspuljUY diMKxZChlfeJPMDbvHuIJQp6O48tFSfHMs9XwGrIO+A9qqcIrwA6KmiYj8RZictHvf1I yXbYrq90ZNkIZnkImP94LreDokCkQASUGZRZJxh/hzqOQoFPvBaC58WK8zBZAeipDDIO Wlgrx6qLIlAM+7e3Y3f2gj9xlZjsyeIyDC24HKJiu27bmQQacmbLBXoIel7dhlI10Eev KIAhTD+KmKoIOL4gFWyPPjmQ6u16WetbRL9Jy6WWMFcM/HS4EOlGfYMZdCzK2td5blLw cc9w== X-Gm-Message-State: AOJu0YwEiVTX7cwB3r7HscKrTyg/3wjDTSfEA/qUDAi6ievH4J9MxyMQ GinrPAx99kDG2Tg5cL8aq4g= X-Google-Smtp-Source: AGHT+IFj7dF/TB9yUsm0f4KRaidOuh26cbvdaL9a+KV72dPfZQWHlZGgIqNx4q2NMoWrJNnhAJwfUw== X-Received: by 2002:a05:600c:492f:b0:40b:5e1e:cf6 with SMTP id f47-20020a05600c492f00b0040b5e1e0cf6mr53165wmp.49.1702047138266; Fri, 08 Dec 2023 06:52:18 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52: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 v4 10/13] net: phy: at803x: make at8031 related DT functions name more specific Date: Fri, 8 Dec 2023 15:51:57 +0100 Message-Id: <20231208145200.25162-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 83428305281b..7443bc8fe17c 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 Fri Dec 8 14:51:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485472 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="OvNqJ3Y/" 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 0F74A3871; Fri, 8 Dec 2023 06:52:21 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c19467a63so24584715e9.3; Fri, 08 Dec 2023 06:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047139; x=1702651939; 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=kxuFbcbCxLZZxQ+emdGZsDK+ZXhQqCPZYukVIrO9V20=; b=OvNqJ3Y/qp79ELQCaAtHV7bLPx1MDlPgXYqz+jDY5NP3Mi95fXBQSLU0T9Ue3U9nTP k0S2YV/XPPu7HOeawn+PzkHvUQWYl/hvcogIomo+Ur0tcbLTnhpybiWqNu9pYhsMjp4Z 507ZmxV2+lQe/k447osPzY8nB1ZZANzQsIItcMIZxJCaCSqiXb4iO8UMFqbbWpnFWQo3 7elvGYFpz6x1rE0aGdZUtLDx1UmIfyfbLjAR/bJs56Up08zCLro4NaYABuUyv8en+WpI FlMxj7uvFAjj7E9h/pS3JKdIFBtW4JYpa0uiXTUo3ftYG9nYP+vMxfZ5yfH+nPAyxpu7 YoVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047139; x=1702651939; 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=kxuFbcbCxLZZxQ+emdGZsDK+ZXhQqCPZYukVIrO9V20=; b=NiUEyKDDqIk2nH/bK8v2lw72S2w44aRBH37dNU6zpAS+BXA9+SSkr0jUHmeVG2aOcV 3kvZjgp0skeMQCp3+HG11Cuv0N1fbwKZNm9+xltMV30JdnpdveSzkfJhfBqZr4m4pBOc uBzCtC1eb7i6QGtyAVXZz9ia3969Efg2jyKJERd8jnL6fth4/DXZvDL60iM6glOyKh1N Q/pRJ1vevAYLccYxBjjHEueAjRgYlWQRdTbj4/SymUqXVhseyeS6MvmmWN52qBUwgaUp A+q9rO0gRt7M10+qylvMMsgErp4Dc4+6P1kvRUrTAOR/SVdA0VI9E+dkLcAfbcJUgHZK hJYA== X-Gm-Message-State: AOJu0YxSfUGIzVOZE/yYGdj5PeZE/M6gML7BiU6ajZWT/DwKSZU+NG54 z1PonxgiELh9hzWXmCYWnYOY3BJ+OJs= X-Google-Smtp-Source: AGHT+IG67jle1Z2+zoxP4oxAg5HtbCK0/2vEfR21l/LEJ7SMw/5MK6qxCmYyT46wCLW/IK0TyZIn7Q== X-Received: by 2002:a05:600c:518a:b0:405:4776:735a with SMTP id fa10-20020a05600c518a00b004054776735amr61561wmb.2.1702047139231; Fri, 08 Dec 2023 06:52:19 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52: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 v4 11/13] net: phy: at803x: move at8031 functions in dedicated section Date: Fri, 8 Dec 2023 15:51:58 +0100 Message-Id: <20231208145200.25162-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 7443bc8fe17c..c08d3c4f097f 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 Fri Dec 8 14:51:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485471 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="FPlxBK4M" 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 19DDB387D; Fri, 8 Dec 2023 06:52:21 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c09f4814eso28992975e9.1; Fri, 08 Dec 2023 06:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047140; x=1702651940; 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=svpeSInqcPybABBCUtSaJ0EECZ2cPeIJlTmLy81gfdg=; b=FPlxBK4MRu+/soRdfLrZBTgz1ovbdftFcggpVP+akAOIZeLn0s3JAs4Es3rgVe1/lD 80x2esOW+VAO7KgFeV18WnWeZ8yh5qnOLDz3+tz72+ZAjyzNCNs7iR1qTc9GWcwuZk05 sQZwd+ZD9GY8hyueZIChtVkux2ei/lseL9BW+2SDC8RfP4qxAoSTsGox5ALUF726OGBF I88EGJKRNvWfx9oGiXdzGtj6kbtbBgcWefpGwPXO5aBkS7e34SAC1dDMVg62ba88vclA e1EdDx8bSy3rWfGcj0HC8w00vrd0HDMpzJ2fvauj7bpoNAPdnqJbcW5lvcsZpdsMzPTS H6bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047140; x=1702651940; 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=svpeSInqcPybABBCUtSaJ0EECZ2cPeIJlTmLy81gfdg=; b=dnOkESTVUGc1sDra7bZfxI6qQKta94IUlDZBkoTzanwHGp47yTur6PU1ziFJ6P+Ybj 2tB0TNr15oQjmumEMO7tPsINcClg/DezHfA3oFwyP2fg9z8kAldjYoDXBa7VZsh4H87W kDpPfCSzludM4O4a6zd5EoYKg5ku9f4KRTPsffYMXLs1aUvLuGlD8rp4O1rHn9aZBot/ taKtC3sU3R5lVBN+w0/ruuM8OC/z/t/JWNHVMiMIKwycoheS5ZQJtT1ldFlWBx3if3Gd 30AmfeXXpzwT8Bvb1D/blFNZNUIL77kfNaBdfonL1FZLt1hN0tkJmB/PHWvxHd4pGVdr QvMA== X-Gm-Message-State: AOJu0YwIZJY0X6XZMRFWpadoqKpb5JSAl77l4QB4cMmEas8TchIlgxdy fwqVfd9Fo2VJKqBSIEVDhbM= X-Google-Smtp-Source: AGHT+IFCTqsfFFENH0LRFz02F/flJE6WQboHEipudGjKJqFLP6F8WTsQSkqd5DXniqxh4OfTIX9qZw== X-Received: by 2002:a05:600c:2214:b0:40c:3308:3aec with SMTP id z20-20020a05600c221400b0040c33083aecmr54376wml.132.1702047140270; Fri, 08 Dec 2023 06:52:20 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52: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 v4 12/13] net: phy: at803x: move at8035 specific DT parse to dedicated probe Date: Fri, 8 Dec 2023 15:51:59 +0100 Message-Id: <20231208145200.25162-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 c08d3c4f097f..da3506fd19c8 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); @@ -1635,6 +1618,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; @@ -2107,7 +2129,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, @@ -2128,7 +2150,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 Fri Dec 8 14:52:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13485487 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="Nw1Rl4Gs" Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A013A8B; Fri, 8 Dec 2023 06:52:23 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40b595bf5d2so25234445e9.2; Fri, 08 Dec 2023 06:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702047141; x=1702651941; 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=wXKo4SROCMc9mbMIHxYwIaoEGcT/NyrozQrh4hVTf9Q=; b=Nw1Rl4Gs9IChcfVh/cf3B25PqJ5vatx0llIe8D4HlIzV18ujmHd6ge5SyrQFm7AsbE kaKrGikmdWPmXdsBUxUEJzB//c+18LUGJI3o3lxHRZkiz1wCyeFqWqUtXHIVZVIbI9dA ixeoOeQ4XuhLWIO3fhB3jArVZzB/tMhPlv8HJxx89Ey14DdDz++88E28SetCNICKGf1B 68FLYQ09Cc5D717u63bbSwRgQfQcROSQ4QWT/USma2Nr3zyEabJ/LHNStRFRzKBL3Nr9 EKhwOiYCpYThEFsyz53l9GcqvbqqRrtIkbZ1hLbPC6IZgfNWjrebBKG37sM428ynUABL dPNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702047141; x=1702651941; 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=wXKo4SROCMc9mbMIHxYwIaoEGcT/NyrozQrh4hVTf9Q=; b=RZjXgMpFraw3ZkvsVOxz9KWqte3qegepbHr8NsIK8KtODFTjXkGlbaHZ1VBdOM0X3k 4uFWdxz9PUKxbcbeCBeLXrb+AIWNOC8tiV4+xp5pT0f839SAsc8OyygGqKDUcf87JjZz ZcK+dx0O6ZvGyEl5zH0VSQnC1M5GDi5csJTw7GC7OMtDMVYfDeaRBV7GIGIrEcSFPMJV Z3qrabDvW/lAIYoKpkTNbTA2pyjM6BVm5auOhIGT4YIn53za+L/HSNIvZL47L1gGiBUS Wmhq/z89O3TC8uXEd2NcKaU3+XsAcz3cVGy+IR6RVcP+h0Kf56Dz0+o9RXR+O8GsOMcF 7TGA== X-Gm-Message-State: AOJu0YziE/vSQJmgWkqTsXEG0Lu7dFo4eYdkI4Hmc5gwcGlDrL5HUjqk 38Ai1hq2xtl0wMXrP8FDX4M= X-Google-Smtp-Source: AGHT+IGpZBovJ+Gk07o/Wvyd2bGrC+Z9SGFt14Humk7kOlMBgMrK/RiyAAtrTs1NC3t2vyJyGphBKA== X-Received: by 2002:a05:600c:1715:b0:40b:5e21:c5b5 with SMTP id c21-20020a05600c171500b0040b5e21c5b5mr29432wmn.131.1702047141418; Fri, 08 Dec 2023 06:52:21 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id r9-20020a05600c458900b0040b3e79bad3sm3088264wmo.40.2023.12.08.06.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 06:52:20 -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 v4 13/13] net: phy: at803x: drop specific PHY ID check from cable test functions Date: Fri, 8 Dec 2023 15:52:00 +0100 Message-Id: <20231208145200.25162-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231208145200.25162-1-ansuelsmth@gmail.com> References: <20231208145200.25162-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 da3506fd19c8..b9d3a26cf6dc 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; } @@ -1618,6 +1597,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; @@ -2041,11 +2043,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; @@ -2143,8 +2148,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, @@ -2181,8 +2186,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), @@ -2197,7 +2202,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), @@ -2210,7 +2215,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, @@ -2226,7 +2231,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,