From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD5C2C4332F for ; Fri, 25 Nov 2022 13:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ih8kwwpIJPhJXsNE53nRULud5ArpianKEQusyb+ohw=; b=XDKSmJ262zYdLL zDZXLBP8YccV0e3lXVHD4gUUDfe9O9l+OZ4efyFuZanG8/jc0OVxx2ch7mZ7aCIa+xCaevzUJGC78 riFmoCibGMd7PTyuhjl/K0DLxS2KV8XcaDeYMTVUS+mQdtnlQxLyc1r0ZllRoahjStNCgA8/oBwBk AtGwaYP1DXg/TGMyurNOi0lqUnnpKBqGH0mQ6GQ/NW0Syg+xLznBl4/iGQwk0gv25beLJ7iB4cIVV 6e2UTBFgXVzMzkJLi2G/pQi2cZRNhnCBEOEAD0jxHzpTrnGeiHKmAWux0cuVLw7SAY7R2aaYN2fQU +z24vOiuoQa1yTZmtZag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYbA-00Gczn-Sc; Fri, 25 Nov 2022 13:18:33 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyYar-00GcsJ-1c for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 13:18:15 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 91A2910000C; Fri, 25 Nov 2022 13:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669382289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=55j9+pE5serVzhnMTbv/yWHlwVqG0P8aXjk+91N8pmo=; b=SiOXIiLYraXwB85aZtJFfKRo6XCjpwXBNzHzXLTa1n1xVN9B4F4cVUdYoUL5xzUDi5aD8C mamEZ7hnUlvXa2l0lcG0A5M7Zg6Q8NohX8z9aNt8X8XcH28q5SGdwwiZeCN/3RhvmTMt9W rdKT+qb/vBD1ddGSoC9TKCw9tdjcoTskdaPB5e4lst2JvsPsG8k7vxTb1a76sCLqgf2OzT cuUSHHetIhIu52TSdgwzYLkmuvGdx1J7NqAmPQwDxrQup2/GcoyyNOBPVniPJ8WBqcAS8A 6KbMxbEpwSMpNa/ZiDj0eAjf5/EWyd6iMB8QtiFIr60CG3/gEmikL/BelB23AA== From: Maxime Chevallier To: davem@davemloft.net, Rob Herring Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski , devicetree@vger.kernel.org Subject: [PATCH net-next 1/3] net: pcs: altera-tse: use read_poll_timeout to wait for reset Date: Fri, 25 Nov 2022 14:17:59 +0100 Message-Id: <20221125131801.64234-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125131801.64234-1-maxime.chevallier@bootlin.com> References: <20221125131801.64234-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_051813_237040_46569F61 X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Software resets on the TSE PCS don't clear registers, but rather reset all internal state machines regarding AN, comma detection and encoding/decoding. Use read_poll_timeout to wait for the reset to clear instead of manually polling the register. Signed-off-by: Maxime Chevallier --- drivers/net/pcs/pcs-altera-tse.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/pcs/pcs-altera-tse.c b/drivers/net/pcs/pcs-altera-tse.c index 97a7cabff962..e86cadc391e8 100644 --- a/drivers/net/pcs/pcs-altera-tse.c +++ b/drivers/net/pcs/pcs-altera-tse.c @@ -60,7 +60,6 @@ static void tse_pcs_write(struct altera_tse_pcs *tse_pcs, int regnum, static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) { - int i = 0; u16 bmcr; /* Reset PCS block */ @@ -68,13 +67,9 @@ static int tse_pcs_reset(struct altera_tse_pcs *tse_pcs) bmcr |= BMCR_RESET; tse_pcs_write(tse_pcs, MII_BMCR, bmcr); - for (i = 0; i < SGMII_PCS_SW_RESET_TIMEOUT; i++) { - if (!(tse_pcs_read(tse_pcs, MII_BMCR) & BMCR_RESET)) - return 0; - udelay(1); - } - - return -ETIMEDOUT; + return read_poll_timeout(tse_pcs_read, bmcr, (bmcr & BMCR_RESET), + 10, SGMII_PCS_SW_RESET_TIMEOUT, 1, + tse_pcs, MII_BMCR); } static int alt_tse_pcs_validate(struct phylink_pcs *pcs, -- 2.38.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel