From patchwork Fri Aug 9 19:38:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Dembicki X-Patchwork-Id: 13759204 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92A2615A876; Fri, 9 Aug 2024 19:38:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232307; cv=none; b=QWhNJtF5JOikMV5ob+WSiRkRHS7m7z/8YvB63hphXobeeixdVX25/vduVrovNs/aEEmXkDRJgslPeO8jXtYQ/ToPLgQdCO4LTuSUsfrvUt3X2VVOhAB+08PD39c6Yi8rsNpRXpO6dCoPfmyYFg/lZfPDTSucUNBDfcqLbmRPn1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232307; c=relaxed/simple; bh=Zz/cv3UXzDZf9i2qPD7wfnCs58Gt9LLq/F8Owr2MssE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lrr9/gTBfRh5MZEUBZx8OuCtqUYAWLE3Aglspsj4BrkdNzFu8jJY3Kb4dAUQKKl9IVVm2PIJfGCt0AHgVJbD09wwJWUeozZpahdRSr6i1vb9ys5ocDgKlnSNUoSriXL6gyCOHjB79DsjIFlBuoDjb6X9l7gsTcL7Jg5PqSM1wSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LSyuUQ5z; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LSyuUQ5z" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ef2fccca2cso25610711fa.1; Fri, 09 Aug 2024 12:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723232303; x=1723837103; 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=hgC3swiv5SXbh7i4mE8QJwRNEjiR6PHybrqQb9FZqrY=; b=LSyuUQ5zWpxUKLv7gPqDZEzwksyTODN8Jxfs3x9rs++1ySBaTBBRvykkpWcOB+VUNj BtXVzExjfsUlGJdp5cSRNVlfi+9j94nJMvjTiMcnzK81LcUas937et6eH0llYLek4PKm U7BvJLFUNELb6eP24R6SLC04ug9fjcPWQZZK9F7Azjkv5eulsfZP4T3VbsKJelTWJHhc HyPfbCiTveCdr8QBArv75OYWEWaPRTXMERdfgjJNkTOOE9uvc26a5p6p9cgEegy8uz8u e54QujXVJnOBnNbnqDIEqOc0b4wKV/c0z+qCS8JD9Pbo2pBfRvSzGa6VFwnlmQwPqEMp f2QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723232303; x=1723837103; 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=hgC3swiv5SXbh7i4mE8QJwRNEjiR6PHybrqQb9FZqrY=; b=KoxFLjFjXyCVj0P1cRaGJ5KyI+XaXmzcEKa2hljaQ5kGchoF8cFipXFXfTWm55Qn7R frE52HblcnNANW23KQPCC1zdaAJ98snAak4fUDkWEwyPF2dsvXO6MRuTDCDS2ln5I8Xe o5WFrfLJs09QoqaWWE6NVbW6dPfCoGyqC54a04HpzpvAYvgyF/GqcWOciE9BU+p/x5K1 PkjUeFulh7aIGvR0nflTN+vf2EQfLHOTv7+Gr2niAsRipojhMqXDVnMXzXRu/EasM+Fs vQLbael3ntLgJmi3bwLywfUXoPQTOpo7UIZj+o2yc0Raxo6CHYd5DU8DgRGPJ/1Jfpal J18g== X-Forwarded-Encrypted: i=1; AJvYcCVIvNTDNMkuqaTJb1gZXh6OWHTGd3XO78cNC46CN5I0gGLfmnycXfG8Y8PhKAzKZMLlGlvpG3Zt6cYsqLIoerJWx16/0VQ/lr7DQcIG X-Gm-Message-State: AOJu0Yyr6B/ExsH/LviUJKwSNKSNbrCL7IMvI72Sa9VyxBciJmQflRkA 5QL8hUorY7ZjrxKyu1bW+VeMToIPxEpousIEIYQfzpe4bkGaXm9SEzlhK+mh X-Google-Smtp-Source: AGHT+IGM6yFFiNlrb7zXSgCb+PpQZrGmtHcjpFkYbKspEgSK+ZhAke+kwE4f6qVKgHAcSSeXWGc68Q== X-Received: by 2002:a2e:712:0:b0:2ef:2c0f:2846 with SMTP id 38308e7fff4ca-2f1a6ce94fbmr16461701fa.17.1723232303140; Fri, 09 Aug 2024 12:38:23 -0700 (PDT) Received: from WBEC325.dom.lan ([2001:470:608f:0:8a4a:2fa4:7fd1:3010]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f291df4987sm451311fa.50.2024.08.09.12.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:38:22 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Pawel Dembicki , Linus Walleij , Florian Fainelli , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net v3 1/5] net: dsa: vsc73xx: fix port MAC configuration in full duplex mode Date: Fri, 9 Aug 2024 21:38:02 +0200 Message-Id: <20240809193807.2221897-2-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809193807.2221897-1-paweldembicki@gmail.com> References: <20240809193807.2221897-1-paweldembicki@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 According to the datasheet description ("Port Mode Procedure" in 5.6.2), the VSC73XX_MAC_CFG_WEXC_DIS bit is configured only for half duplex mode. The WEXC_DIS bit is responsible for MAC behavior after an excessive collision. Let's set it as described in the datasheet. Fixes: 05bd97fc559d ("net: dsa: Add Vitesse VSC73xx DSA router driver") Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: Pawel Dembicki --- v3: - resend only v2: - Added 'Fixes' and 'Reviewed-by' to commit message. This patch came from net-next series[0]. Changes since net-next: - rebased to netdev/main only [0] https://patchwork.kernel.org/project/netdevbpf/patch/20240729210615.279952-6-paweldembicki@gmail.com/ --- drivers/net/dsa/vitesse-vsc73xx-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index d9d3e30fd47a..f548ed4cb23f 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -957,6 +957,11 @@ static void vsc73xx_mac_link_up(struct phylink_config *config, if (duplex == DUPLEX_FULL) val |= VSC73XX_MAC_CFG_FDX; + else + /* In datasheet description ("Port Mode Procedure" in 5.6.2) + * this bit is configured only for half duplex. + */ + val |= VSC73XX_MAC_CFG_WEXC_DIS; /* This routine is described in the datasheet (below ARBDISC register * description) @@ -967,7 +972,6 @@ static void vsc73xx_mac_link_up(struct phylink_config *config, get_random_bytes(&seed, 1); val |= seed << VSC73XX_MAC_CFG_SEED_OFFSET; val |= VSC73XX_MAC_CFG_SEED_LOAD; - val |= VSC73XX_MAC_CFG_WEXC_DIS; /* Those bits are responsible for MTU only. Kernel takes care about MTU, * let's enable +8 bytes frame length unconditionally. From patchwork Fri Aug 9 19:38:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Dembicki X-Patchwork-Id: 13759205 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6F15160883; Fri, 9 Aug 2024 19:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232309; cv=none; b=KkobS9LZJZ/23fcHW2gtmSd+u7XggffSl9U7kvLY2zeSQP3V0DvhaaFoZ17108UukYrUDjG8gSaZXxdG0hG4BlQpo0ThHwnlUXCbSgLUBACYQyaFMm/HJ86mk+6wRbgwzTdK0O3Mf60iYxMuS0Mf8CnwKdGhjVlPIqFaE6MXipc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232309; c=relaxed/simple; bh=WSMIz8ePO8Mg0qWeewYQB+Bm2eSDnkwAHXVk5lb0b1A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=abswAEW0+1MMQkRjiefJ7YSVmPdTjI+VBUlzB6OKULOKaUlSj78UZ43yNdTK7NbLmOBnC4Gynq+PooCmL2wFErArIzDWRo59m/TcO1Xi4cTLFFa115p8T9dF9+0BWKY8+QKJ4o3y26PJAosiUJ+HLZv/Tjtf+UIkOgMmek8shdU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Z24/S14l; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z24/S14l" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2eeb1ba040aso32851251fa.1; Fri, 09 Aug 2024 12:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723232305; x=1723837105; 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=sQQOtv5+SwUJsnRDNKwr5ME9pKfFz7OtKr2B3mxcU2c=; b=Z24/S14l2EJVbAoMOsuG5pbajrbRiXX+OvIUe7eTzZ/zifkB1yPkyx9pGUK67CCERV VMPYD0bBjXULSzHEXxVlGduOctW7tiBS5QFkoVxZ6QfZyGk09YvFSLYxb3UvY03/ni91 GFXiMZXhvRYLTBWLXUBWi641ZV71zGEllCE3IYdNVqyGAYa79l8GcTp7v06q0EA27PmS vLigmEOlI+jUKbAoOTunn8tKMgPFJgRw1DlDv/U0mm3E2IWf6zUSrKD0BJyQPGVP2cPm G1hlreBrbgj7rTi6stF73htGciE2J42sj62sCXd5LbcINBtAgXju9uJqHM0REdXbVGnO I7lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723232305; x=1723837105; 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=sQQOtv5+SwUJsnRDNKwr5ME9pKfFz7OtKr2B3mxcU2c=; b=bvhdipGtedilV1FCX5peC5JH+R6/XLtjVin4mbiRCAzXJtgbtt3kQ1/E0bQM38IaR7 K9u6bhoeJtFKzESuyZrxGEJtn95kgH/M6K17ZcfPBZaDzyywBgEU/o6EhrpqjQuIheB6 lw2lQ8zPV55zkN6keS4WKcnjcrhBA9wkgc1kcJs9jedYL7u7GJ1zyu9lIageN3DxSsrm AHr/SMHoNw3AXmAIKKieV7g66pU+8rPUWRUOwpx4xAcfMVcFmzgfjY526sjCcXMBEW6E EBTdPy7mbQxHUv8g1XfngnPW+UVWaRGH3mhsX27+aF7HruQztPgVhVyL8Kyzr1KcOQxk yzKQ== X-Forwarded-Encrypted: i=1; AJvYcCVjbEvWc7Pw4aJylvPxQPXry9V8BHqNRVsvDl/ld04JH9d5GdjYF3c5wfpUWei6xvIaj6yS8v3GCyNBS8Acpc6mISvQ3AXOT7X366UI X-Gm-Message-State: AOJu0Yz0Jj2Ek6fIh6hGknxWa8/Cd4g8AQ0U95BgJhaAngtiiHvJbPhG PLnNTVxUYT5NpX4vjF+LLRqeWeHgTJVYVWH74piIhb76IqQPgfH4RIFsgnoC X-Google-Smtp-Source: AGHT+IHA2MeC2Vwulta89/mxT4t6l/gtG901wsBGSBxpF/JbbsG1jriKpEohhTEIBiHEPi7Ccw3Uzw== X-Received: by 2002:a05:651c:19a5:b0:2f0:29e4:dc52 with SMTP id 38308e7fff4ca-2f1a6d26849mr18914421fa.27.1723232305171; Fri, 09 Aug 2024 12:38:25 -0700 (PDT) Received: from WBEC325.dom.lan ([2001:470:608f:0:8a4a:2fa4:7fd1:3010]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f291df4987sm451311fa.50.2024.08.09.12.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:38:24 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Pawel Dembicki , Linus Walleij , Florian Fainelli , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net v3 2/5] net: dsa: vsc73xx: pass value in phy_write operation Date: Fri, 9 Aug 2024 21:38:03 +0200 Message-Id: <20240809193807.2221897-3-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809193807.2221897-1-paweldembicki@gmail.com> References: <20240809193807.2221897-1-paweldembicki@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 In the 'vsc73xx_phy_write' function, the register value is missing, and the phy write operation always sends zeros. This commit passes the value variable into the proper register. Fixes: 05bd97fc559d ("net: dsa: Add Vitesse VSC73xx DSA router driver") Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: Pawel Dembicki --- v3: - resend only v2: - Fixed 'Fixes' and added 'Reviewed-by' to commit message This patch came from net-next series[0]. Changes since net-next: - rebased to netdev/main only [0] https://patchwork.kernel.org/project/netdevbpf/patch/20240729210615.279952-6-paweldembicki@gmail.com/ --- drivers/net/dsa/vitesse-vsc73xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index f548ed4cb23f..4b300c293dec 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -574,7 +574,7 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum, return 0; } - cmd = (phy << 21) | (regnum << 16); + cmd = (phy << 21) | (regnum << 16) | val; ret = vsc73xx_write(vsc, VSC73XX_BLOCK_MII, 0, 1, cmd); if (ret) return ret; From patchwork Fri Aug 9 19:38:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Dembicki X-Patchwork-Id: 13759206 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E93B1684A7; Fri, 9 Aug 2024 19:38:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232311; cv=none; b=YpXWkY/CCbKgHhvXXf7vospvaXbZgjb7LPriXqbZTVmBDUFirV6X/ODhmwojl5m/dWZzsoI5zxOwWAhX1EiztlVa6KbjZUWpCi1fNinf8yPbw9pJLpsMXAArefZj0vtxlP8qVCQpicocHHFKeArmNYJbQ6lKKOFZOqPmTQviEp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232311; c=relaxed/simple; bh=/yCAqyA6gVsbQBhTheXOe+tlvtBKX20pI77Jv2ghB4Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iz+O36xlTg6ovl6MHDHnsZ0Be4R1FqXeKAE+xvCJVeUyhljH40OQGTJBFn4iBkcd662ILaWsRTr+HNS/FQIHI/0FT3GHid2NS7jCWuVA9ocLgc5fIqUDfZdKmb9jPsQHsbFwhjN/khEKwGkQHQhI3LGFR0bhAnQWeGmv4wpUJvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PHiqahge; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PHiqahge" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2f029e9c9cfso37838631fa.2; Fri, 09 Aug 2024 12:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723232307; x=1723837107; 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=1AAQSAmvvh8SOlXHbdx42aToLcQkg70Plu4sLk8pUEw=; b=PHiqahgeXiuGUwXZ0bdwv/cCYYFKn88IZoiJcZDwS916/5omyem0gcmojgjr2oLzUT Cm9O4a+28IDHZrzHWxYuO+Ko3mPXOg8RCYD+1dZYmSsSTfbH9hAiAJzJhy9E0RZWvjAw 6nQ+fceaQbA2DWsSpQq7IIYmVGEOmxY/SgtwYFcYnwSi50aaS6BIB9z+l8sJJ7T/Pvav kTrP8OlIZcilcZRzcnli0/r5wsyclh0uJp93ObSy0J5LXk4vZN3KCRvnjGSJNcWT8uLY U7ELwW2ZOAaEQnP9mei5ZzgWHIbrfADY2ty/hwbnUauQKMCS0aSsFHY/USv4/iwcvbT/ XZMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723232307; x=1723837107; 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=1AAQSAmvvh8SOlXHbdx42aToLcQkg70Plu4sLk8pUEw=; b=DVQdW6Mu7pDwERgjwA4EFTUZvAUw8Rv6dDfwuD6+x2CMpyvy/xtMq/7wVoUQxwnJUn QIHxyX6ORrrkEs3Z2HNSZm1al1o9KhVx6HSe+efWAh6eeIyXAaD8rbcI4bvloE7widHj y3hxpNc+FJEMGNWcCUQBGF2RNv3tRI5UmSJfzWFYtu4VeuHgHxRrmsHLd46EpfoNML0A w36TjXAXo3oOrdJQSe7CR2T9YL8cZnU3Ba4FBUx28z+Wj3hlc1DVYMOjG5XWlgU5VaOR 5x3iJZrRuq3+AAfa/iQ6SwDrjn4+EKopHmNhpGoHd28UIpXLU2vfkLudLBwc1mnQwx9U vvjQ== X-Forwarded-Encrypted: i=1; AJvYcCW1TNBU0iRNe2kephwx3D3Gh6/ZYTucW3BU3QWNSdAUY+IIbP6bS20FPx36vf7s6o8fUxC43LmL9yWTJ8Dm0dfqAwV9sex5QajqPuE7 X-Gm-Message-State: AOJu0YzGvG+JsLeV0wtuRb44AYXNfmoDTuHjq8wz1+RrrL2M70LDgqGQ bFbZIzMSOoJtv1TF85QooG8Od44ZDuqY81qUYOQ6fhZEJcwMCghAJEusZ+Ej X-Google-Smtp-Source: AGHT+IE9TyV4vS5zhXWSys/IgkKu7uC4MHmmHrsAbsFHe1QK06MeZKtMFH3Ih+EpbgXpZBCJfKNZbQ== X-Received: by 2002:a2e:bc0a:0:b0:2ef:2f9e:dd19 with SMTP id 38308e7fff4ca-2f1a6c4d2cdmr27630771fa.2.1723232306851; Fri, 09 Aug 2024 12:38:26 -0700 (PDT) Received: from WBEC325.dom.lan ([2001:470:608f:0:8a4a:2fa4:7fd1:3010]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f291df4987sm451311fa.50.2024.08.09.12.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:38:26 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Pawel Dembicki , Linus Walleij , Florian Fainelli , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net v3 3/5] net: dsa: vsc73xx: check busy flag in MDIO operations Date: Fri, 9 Aug 2024 21:38:04 +0200 Message-Id: <20240809193807.2221897-4-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809193807.2221897-1-paweldembicki@gmail.com> References: <20240809193807.2221897-1-paweldembicki@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 VSC73xx has a busy flag used during MDIO operations. It is raised when MDIO read/write operations are in progress. Without it, PHYs are misconfigured and bus operations do not work as expected. Fixes: 05bd97fc559d ("net: dsa: Add Vitesse VSC73xx DSA router driver") Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: Pawel Dembicki --- v3: - removed blank line and unnecessary variable init v2: - used defines from patch moved to net-next This patch came from net-next series[0]. Changes since net-next: - removed mutex - used method poll.h to poll busy value in 'vsc73xx_mdio_busy_check' - use 'vsc73xx_mdio_busy_check' for control if mdio is ready [0] https://patchwork.kernel.org/project/netdevbpf/patch/20240729210615.279952-6-paweldembicki@gmail.com/ --- drivers/net/dsa/vitesse-vsc73xx-core.c | 37 +++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index 4b300c293dec..a789b2da9b7d 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -40,6 +40,10 @@ #define VSC73XX_BLOCK_ARBITER 0x5 /* Only subblock 0 */ #define VSC73XX_BLOCK_SYSTEM 0x7 /* Only subblock 0 */ +/* MII Block subblock */ +#define VSC73XX_BLOCK_MII_INTERNAL 0x0 /* Internal MDIO subblock */ +#define VSC73XX_BLOCK_MII_EXTERNAL 0x1 /* External MDIO subblock */ + #define CPU_PORT 6 /* CPU port */ /* MAC Block registers */ @@ -225,6 +229,8 @@ #define VSC73XX_MII_CMD 0x1 #define VSC73XX_MII_DATA 0x2 +#define VSC73XX_MII_STAT_BUSY BIT(3) + /* Arbiter block 5 registers */ #define VSC73XX_ARBEMPTY 0x0c #define VSC73XX_ARBDISC 0x0e @@ -299,6 +305,7 @@ #define IS_739X(a) (IS_7395(a) || IS_7398(a)) #define VSC73XX_POLL_SLEEP_US 1000 +#define VSC73XX_MDIO_POLL_SLEEP_US 5 #define VSC73XX_POLL_TIMEOUT_US 10000 struct vsc73xx_counter { @@ -527,6 +534,22 @@ static int vsc73xx_detect(struct vsc73xx *vsc) return 0; } +static int vsc73xx_mdio_busy_check(struct vsc73xx *vsc) +{ + int ret, err; + u32 val; + + ret = read_poll_timeout(vsc73xx_read, err, + err < 0 || !(val & VSC73XX_MII_STAT_BUSY), + VSC73XX_MDIO_POLL_SLEEP_US, + VSC73XX_POLL_TIMEOUT_US, false, vsc, + VSC73XX_BLOCK_MII, VSC73XX_BLOCK_MII_INTERNAL, + VSC73XX_MII_STAT, &val); + if (ret) + return ret; + return err; +} + static int vsc73xx_phy_read(struct dsa_switch *ds, int phy, int regnum) { struct vsc73xx *vsc = ds->priv; @@ -534,12 +557,20 @@ static int vsc73xx_phy_read(struct dsa_switch *ds, int phy, int regnum) u32 val; int ret; + ret = vsc73xx_mdio_busy_check(vsc); + if (ret) + return ret; + /* Setting bit 26 means "read" */ cmd = BIT(26) | (phy << 21) | (regnum << 16); ret = vsc73xx_write(vsc, VSC73XX_BLOCK_MII, 0, 1, cmd); if (ret) return ret; - msleep(2); + + ret = vsc73xx_mdio_busy_check(vsc); + if (ret) + return ret; + ret = vsc73xx_read(vsc, VSC73XX_BLOCK_MII, 0, 2, &val); if (ret) return ret; @@ -563,6 +594,10 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum, u32 cmd; int ret; + ret = vsc73xx_mdio_busy_check(vsc); + if (ret) + return ret; + /* It was found through tedious experiments that this router * chip really hates to have it's PHYs reset. They * never recover if that happens: autonegotiation stops From patchwork Fri Aug 9 19:38:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Dembicki X-Patchwork-Id: 13759207 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB4DF15A876; Fri, 9 Aug 2024 19:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232312; cv=none; b=JadENE6t6eZLfEPHWMREV4w/Q4lagiTFBN1UWSFFlVV5aX8s4/RA0H8zs4NsdV2U80JAfSDBRkqI8xXERRbtE63zJgTYuDIYhKjpmSpW1XeePTNaU/clycfaWNkT3Vpt467jU/b930aGBDnD8OO8IE+h0nyCeaF/S30fFf1/qZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232312; c=relaxed/simple; bh=hGiIHFCuDlCJorymIuZvjwbZr8IRQttMj5OJQ1BJn5w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XOr3nk56YqJ5tI5I4oukukUJ75Vd6sJt8Zq5IL2r5mb2LP/edACwmaOcnIa+Ajntru6kBF+AdEJW7KrqtnxYZ441KqEeVP+n9E05N2y9dQtwqsJeIGd2sQKPastuH1lP6fWMIGgEaWyuiaBpT0PZSoCSBboiOdclqPG2iEXAx5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d0D00T90; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d0D00T90" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2ef2c56da6cso26121621fa.1; Fri, 09 Aug 2024 12:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723232309; x=1723837109; 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=H5XnvSJGfWoNnd9xB3nkKhARJnXMCYFlCktgU13i1x4=; b=d0D00T90VOrAMdAMRMepbhyTLRzL6oCfcxDHp4eEybK6BuLbfVXTfZ5oYUhD/IhlHt 0UREOMqclcMdE2nC/2p69ChijhI0pdkqGFwGrGpg5BFS2Q5c2RMZqTOH+NYtFbXdIGbP 4a6wP+k9YZO/Li8ggWYQx9j1r02gDc+7qCJk9V6JV0x0x7FYfKKqOtE76AmCVNXrhglg 3XntiPQwRw0HG3oln2DEwcBTwvZpuApVkvZUT5bDRFFWk+Z0+pUstTtNWhzN+rJbv9u0 RaNzD0S9QoND9ah1J3vehUw3mE87gw5OGvQ3CKeCtmdkfH52Ndm+Vbp8PrAIgAr9sqjO QY0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723232309; x=1723837109; 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=H5XnvSJGfWoNnd9xB3nkKhARJnXMCYFlCktgU13i1x4=; b=Qh68esdnLbO6g5Rghno9vNcfafiCWQ05gQ3d1vrMn8wW+eqcowXdUqGTmze1VvAs0g yFAlo/vEcw1ChHKpXVCkdAJ7a2kWNi7pqFtIy2kQJGIBYZHmlKl2J8Z+RPkWkxZGG+Gx bvwMXVh5tiDi8mg8E+2d/76wtrlLhxEZsZlHtSIgZtaisQWO+YHx8casCaZnVG8W3C9L mFgcMyqOPTbt8yk1gcHaqq1oqdDZFrn91/BHMUJLsa8f6xDhZy9Hd8KoAa1JA3kv23kO xG8C/NUToIzwO0ivktwLLeirDmLICtdtH2+T3x4KYY3oEQc3p5y+wKBmGYi0qF4iWJ6N /JuA== X-Forwarded-Encrypted: i=1; AJvYcCUse0a+cbR779CAZ66eaGc487Ia1S+NYar6H8KvL5XNj6VRbYPYHKan4eZ2qNMok8CfaapLdO55+AnnfwOKqxUae9CgWufF3jbfJs9j X-Gm-Message-State: AOJu0Yz8aIfAl6iPdz98O15/4QjGDrjAkkeuMncP/rRGo/vqo8VgMrc0 4CIyoJy3NOt1JiXRAnMQz9pyfsGiRwBm/KCHjnZmfHt6D5xiJPdr7J9KKQdM X-Google-Smtp-Source: AGHT+IEbfdTEnzonydMkAgqLF47kdXiqOOeuXt9NdeU0/+leTu/2jcCLUvll/fXH2SpAEININDq9Dw== X-Received: by 2002:a2e:9e89:0:b0:2ef:2e1c:79b5 with SMTP id 38308e7fff4ca-2f1a6c5aa3cmr16934361fa.14.1723232308518; Fri, 09 Aug 2024 12:38:28 -0700 (PDT) Received: from WBEC325.dom.lan ([2001:470:608f:0:8a4a:2fa4:7fd1:3010]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f291df4987sm451311fa.50.2024.08.09.12.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:38:28 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Pawel Dembicki , Linus Walleij , Florian Fainelli , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net v3 4/5] net: dsa: vsc73xx: allow phy resetting Date: Fri, 9 Aug 2024 21:38:05 +0200 Message-Id: <20240809193807.2221897-5-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809193807.2221897-1-paweldembicki@gmail.com> References: <20240809193807.2221897-1-paweldembicki@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 Resetting the VSC73xx PHY was problematic because the MDIO bus, without a busy check, read and wrote incorrect register values. My investigation indicates that resetting the PHY only triggers changes in configuration. However, improper register values written earlier were only exposed after a soft reset. The reset itself wasn't the issue; rather, the problem stemmed from incorrect read and write operations. A 'soft_reset' can now proceed normally. There are no reasons to keep the VSC73xx from being reset. This commit removes the reset blockade in the 'vsc73xx_phy_write' function. Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: Pawel Dembicki --- v3: - resend only v2: - improved commit description This patch came from net-next series[0]. Changes since net-next: - rebased to netdev/main only [0] https://patchwork.kernel.org/project/netdevbpf/patch/20240729210615.279952-6-paweldembicki@gmail.com/ --- drivers/net/dsa/vitesse-vsc73xx-core.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index a789b2da9b7d..e3f95d2cc2c1 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -598,17 +598,6 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum, if (ret) return ret; - /* It was found through tedious experiments that this router - * chip really hates to have it's PHYs reset. They - * never recover if that happens: autonegotiation stops - * working after a reset. Just filter out this command. - * (Resetting the whole chip is OK.) - */ - if (regnum == 0 && (val & BIT(15))) { - dev_info(vsc->dev, "reset PHY - disallowed\n"); - return 0; - } - cmd = (phy << 21) | (regnum << 16) | val; ret = vsc73xx_write(vsc, VSC73XX_BLOCK_MII, 0, 1, cmd); if (ret) From patchwork Fri Aug 9 19:38:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Dembicki X-Patchwork-Id: 13759208 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA643160883; Fri, 9 Aug 2024 19:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232314; cv=none; b=EOLs8l5yR7eaJTwINSbLy16x2JV3FFV8HukhHRVN59fcm1H22RBc927U9c9QIyeLvMQPoj/F65tn8IdRgP1jMYqQsSYdmDZfmqwzBsJ6vKqwCAW4jc6FdR6beCUfCPYtEruVZZ44w5ji82slDzJ8iFDGHL3Xw8zzVwHgFZs6TnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723232314; c=relaxed/simple; bh=MUIgI0Og4nEqKaqgSG8ih/xROp2NjP1rKYFpIp8+vC4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NKP6F+01MbzcnkMM95Cl2Jhb4Z/PzHgVFMOvLW8s/t/Qo8q7c7XURmChH4b5E/Rz/Ku/IzO4Xl61g45IJZgYaLBpHpKrYMTtRuBSAhm0kK33+Z0JGCfvKwhft5eUN6d/8ziBNLu7qkL7egBAAZcDou1pI0GHYH0CVJPBad1hU/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=W+4X1BZj; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W+4X1BZj" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2f149845d81so27353331fa.0; Fri, 09 Aug 2024 12:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723232310; x=1723837110; 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=ToeSXl+vM3WNVB6qyUTcA+LVhXh+7FU6kYmOVQ0FknE=; b=W+4X1BZjRD5N40dHcTk6OtWfk4gUM/2Cf0aaMuc23YsX5alPo071xWUP87PB9dhBvF gSlMIqzo1mtwasMtM9qOlMNLasgcobQnqpB+QHKR9/qOsKKBmF1qIQaNxxTvGT+wIRfn P7AdkwlY/w8LAQW9VwZyVuEe7A2DNSGKBwt3Fcv/E+eUwH/E1geh8/PPfcmqPS3g8ov2 nz0LtNmBCW83HJLWRO7vU49N+Pl4tlcq2ujJplaxtfQz/FkvmAbve4QKcYFYpA8VXOeI y6k9maFJ/ov/z/PmGs2Ec/1XYwvNCIL1kbtIrigPnBtEanQ55MQO5nqWGHoxJ/Igu/k0 8lsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723232310; x=1723837110; 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=ToeSXl+vM3WNVB6qyUTcA+LVhXh+7FU6kYmOVQ0FknE=; b=IMLybKEKM82VWcab4i+7QRK8gGLk5iprXCxZOAV3v5XII6YucBARLChr6yRUAoErq+ TGlBsFO32B+Dlm0VJGa/EEavBHTZwELaWGei4jAl8mxnCcHh99XdcQ8Nz3eVtWx3vYar ZdhFoI7bl9/X8VGZjSuAn2fyvi5JB48Twy/4HPxDVnOIyTGVoUOe3mHLt4BVoCL/gwEc sn7+ER/R+yo7sffsuUrBk+35qCgD6F/e/F+wXvxXVPSmvXV9mZoXcYuJWwO3cvy3Ziuf xXYGJZuhuKWwfOGTSahCLew7H3ruGqDrBhIPW5FQl8teRI4ZkV9TXofJyg8J8qoL8YL2 dWeg== X-Forwarded-Encrypted: i=1; AJvYcCUiVit/gbege71V7BDVMv40QsTBwkp3NG1PbrFtQXBiYf2q8GLb6D5gBFEVlEwhoASWkeC3dP0ZBsKaB3UeyK0rdEI3pWC/Z38kJ13B X-Gm-Message-State: AOJu0Yxf2xU4zx4thP3sCOv2Z9u3kQl+lLG7B5tyy84myQHVxPPp06/4 /afELqMkp7UdurzmJlUITIrYZWPBQdPd2O9UZaL6X0m/UV9Tew/DYnMpMrpm X-Google-Smtp-Source: AGHT+IFoUoqtHP3+J0aLZSfxAPkik547Kb93xmKUBljA7YDmwMP6PtBGU17Q0i0IW3CqK+UCuHDisQ== X-Received: by 2002:a2e:f1a:0:b0:2ef:2c87:3bd7 with SMTP id 38308e7fff4ca-2f1a6ce6ea0mr17738631fa.37.1723232310129; Fri, 09 Aug 2024 12:38:30 -0700 (PDT) Received: from WBEC325.dom.lan ([2001:470:608f:0:8a4a:2fa4:7fd1:3010]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f291df4987sm451311fa.50.2024.08.09.12.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 12:38:29 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Pawel Dembicki , Linus Walleij , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net v3 5/5] net: phy: vitesse: repair vsc73xx autonegotiation Date: Fri, 9 Aug 2024 21:38:06 +0200 Message-Id: <20240809193807.2221897-6-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809193807.2221897-1-paweldembicki@gmail.com> References: <20240809193807.2221897-1-paweldembicki@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 When the vsc73xx mdio bus work properly, the generic autonegotiation configuration works well. Reviewed-by: Linus Walleij Signed-off-by: Pawel Dembicki --- v3: - removed MDI-X with disabled autoneg feature (it will goes to net-next in future) v2: - resend only This patch came from net-next series[0]. Changes since net-next: - rebased to netdev/main only [0] https://patchwork.kernel.org/project/netdevbpf/patch/20240729210615.279952-6-paweldembicki@gmail.com/ --- drivers/net/phy/vitesse.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 897b979ec03c..3b5fcaf0dd36 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -237,16 +237,6 @@ static int vsc739x_config_init(struct phy_device *phydev) return 0; } -static int vsc73xx_config_aneg(struct phy_device *phydev) -{ - /* The VSC73xx switches does not like to be instructed to - * do autonegotiation in any way, it prefers that you just go - * with the power-on/reset defaults. Writing some registers will - * just make autonegotiation permanently fail. - */ - return 0; -} - /* This adds a skew for both TX and RX clocks, so the skew should only be * applied to "rgmii-id" interfaces. It may not work as expected * on "rgmii-txid", "rgmii-rxid" or "rgmii" interfaces. @@ -444,7 +434,6 @@ static struct phy_driver vsc82xx_driver[] = { .phy_id_mask = 0x000ffff0, /* PHY_GBIT_FEATURES */ .config_init = vsc738x_config_init, - .config_aneg = vsc73xx_config_aneg, .read_page = vsc73xx_read_page, .write_page = vsc73xx_write_page, }, { @@ -453,7 +442,6 @@ static struct phy_driver vsc82xx_driver[] = { .phy_id_mask = 0x000ffff0, /* PHY_GBIT_FEATURES */ .config_init = vsc738x_config_init, - .config_aneg = vsc73xx_config_aneg, .read_page = vsc73xx_read_page, .write_page = vsc73xx_write_page, }, { @@ -462,7 +450,6 @@ static struct phy_driver vsc82xx_driver[] = { .phy_id_mask = 0x000ffff0, /* PHY_GBIT_FEATURES */ .config_init = vsc739x_config_init, - .config_aneg = vsc73xx_config_aneg, .read_page = vsc73xx_read_page, .write_page = vsc73xx_write_page, }, { @@ -471,7 +458,6 @@ static struct phy_driver vsc82xx_driver[] = { .phy_id_mask = 0x000ffff0, /* PHY_GBIT_FEATURES */ .config_init = vsc739x_config_init, - .config_aneg = vsc73xx_config_aneg, .read_page = vsc73xx_read_page, .write_page = vsc73xx_write_page, }, {