Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1848842lqg; Mon, 4 Mar 2024 05:56:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGR1Pic5SkixoOaZC0YUD6C+p0YSn/3oVNLZdgWxekGLdxseA9VNfkeSl6/CVWkErOvahgE1JNKz8F+rFbWGBH4DVu3ZTTvpiu7fkjSg== X-Google-Smtp-Source: AGHT+IH+ChWqJAvWQrDeFECHrhHvOEnWzfChpQb23JJK9fOF1i+xq8qwttOHyU0SoL3j3Khak57y X-Received: by 2002:ac2:485b:0:b0:513:19df:4eb6 with SMTP id 27-20020ac2485b000000b0051319df4eb6mr5741747lfy.12.1709560593048; Mon, 04 Mar 2024 05:56:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709560593; cv=pass; d=google.com; s=arc-20160816; b=xt2KMSR/EVgPyk6ZkI7RuLSYyGvGkFJ6ZnZokHUlb1j7wL9pzN0ivurYnce5/6fPkG +SkfxZGtMF3k8CZEr5JbSL2j8SEZUOhdQd4kaevPx8soDhzp5dxRgBcrJNQetFuTC5mE n+O8/c/UXbS2ouKmgUTIssu5y662iZToQLARFsQnwP/0qxxi6XgMPrW5OYRHHYvGNqY3 UsbfrFdvgAzxF4rEH2R8k6QD1RCorqkVnVb0I7TOb8CCAfLYfhF24vMD9MdSBXuGblp/ 39zwUfS1OLs0LWjSFK/80BlQTaYULbC0sC3+bFwd51IPy2W9ykDguYAkRPoB2QrtAjdI x2AQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Qu802eosuaqPz93V7C4QlcLw35mM7sl08do8nyPcUWE=; fh=M1qfrahb/qW7n6G/0kHpmUybK+Ky3Jq5+sps382+aZ4=; b=uuCiOlmitd4BHqAqJ3vJEoFU2i/RC3oy+0HcS00fo3k6Qhlbw6e2fZdljeG70pIU8Q eAGA6YsBx4Md+Ob6DE4YIFguj9zFCOxzxhRvXmPIjgYiCZj2jAoLz0KlH/0wya0s+ikS MJABg6Io1TZyXAo0f/JE0JnMqRyoKYsgJw3QiWO6qfDwkxws8HalMGYHPvQzJAIxZy3B aH/fwxlMw06ajs3LSAb0aE8cNnLPyJrwa+Q9RfmozujPrboSvZsT3W+OCSJyAXDy3V96 LFEiciimM/zFYok1Fr85boZcUXWkzFTw1wEAw8ZTc0aCN+XXY3qMDNQyTUQHNZ8pjsLZ VbTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-90691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90691-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s5-20020a50ab05000000b00566afb7bb1asi3486612edc.62.2024.03.04.05.56.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 05:56:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-90691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90691-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C06AD1F25F5B for ; Mon, 4 Mar 2024 13:56:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DC263F8D1; Mon, 4 Mar 2024 13:56:25 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C0AB2EB0F for ; Mon, 4 Mar 2024 13:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709560584; cv=none; b=jjheQezQ3kUVDFbuaGivUEvwxglAeO5wUpHZMQ+H2XsxdTj7JIdWuZpT1ljBM0Fp/jyLZHybwiIYjXyFE+frSWgac5OFr42guuu4+IvUNidC2SDb7h54nj+UEx2iHoJ3PMEOidFgLgsy4Ygi4psergjTeJBA/W4AnpUHnyRDpGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709560584; c=relaxed/simple; bh=QJQ63Qy2NxLUI09eztah+cUO41gaSAxVF3u7uBvwMs4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PPRw6/lAAAoPpBj0NVq5oav7nXpyzb54sX68+9RLf7+5o3cAds03R7zlZBvwSQ9lW0JCvj6jx5FsCajomxDwJfVfAtsQjk3GJVeJHQ3/Pc0tLNtrOolBL9AlN/rU8Yf8go7TMVhS13d5jU3ouoy5d6C+V//7J85nscpCK033he4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rh8ng-0004OE-7v; Mon, 04 Mar 2024 14:56:16 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rh8nf-004MiW-0Y; Mon, 04 Mar 2024 14:56:15 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rh8ne-003Prr-34; Mon, 04 Mar 2024 14:56:14 +0100 From: Oleksij Rempel To: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com Subject: [PATCH net v1 1/1] net: dsa: microchip: make sure drive strength configuration is not lost by soft reset Date: Mon, 4 Mar 2024 14:56:12 +0100 Message-Id: <20240304135612.814404-1-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org This driver has two separate reset sequence in different places: - gpio/HW reset on start of ksz_switch_register() - SW reset on start of ksz_setup() The second one will overwrite drive strength configuration made in the ksz_switch_register(). To fix it, move ksz_parse_drive_strength() from ksz_switch_register() to ksz_setup(). Fixes: d67d7247f641 ("net: dsa: microchip: Add drive strength configuration") Signed-off-by: Oleksij Rempel --- drivers/net/dsa/microchip/ksz_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index d58cc685478b1..83a5936506059 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2260,6 +2260,8 @@ static int ksz_pirq_setup(struct ksz_device *dev, u8 p) return ksz_irq_common_setup(dev, pirq); } +static int ksz_parse_drive_strength(struct ksz_device *dev); + static int ksz_setup(struct dsa_switch *ds) { struct ksz_device *dev = ds->priv; @@ -2281,6 +2283,10 @@ static int ksz_setup(struct dsa_switch *ds) return ret; } + ret = ksz_parse_drive_strength(dev); + if (ret) + return ret; + /* set broadcast storm protection 10% rate */ regmap_update_bits(ksz_regmap_16(dev), regs[S_BROADCAST_CTRL], BROADCAST_STORM_RATE, @@ -4345,10 +4351,6 @@ int ksz_switch_register(struct ksz_device *dev) for (port_num = 0; port_num < dev->info->port_cnt; ++port_num) dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA; if (dev->dev->of_node) { - ret = ksz_parse_drive_strength(dev); - if (ret) - return ret; - ret = of_get_phy_mode(dev->dev->of_node, &interface); if (ret == 0) dev->compat_interface = interface; -- 2.39.2