From patchwork Tue Nov 19 09:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Chou X-Patchwork-Id: 13879546 X-Patchwork-Delegate: kuba@kernel.org Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (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 0424C14AD24; Tue, 19 Nov 2024 09:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732009915; cv=none; b=tHvMfhKNBmIuWuaCPXo8K+NOyGq288qiIghaYZBDORsDwLg1jW83me3E4n1EezI2/GmOBjbYIt5TCDrYDJn/lodX3BX1KGwJ0EYtQWL6m9OWaM6QS2ERF5u7el+hEEu5UM4CIC3IcLWYoRv70bLOBKHVE/3K8QeRo8bIFrpCZD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732009915; c=relaxed/simple; bh=NEOEA02DqsWW3lYC4YWQs/ZZbW9XL0vo3dmHU46UoDs=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=a/VDDj567pOs5NrwsO2N6MeaR0nIsP78mpXcuT2WtihF0YjFVkHj1fmjVMneGJAfSc/fLhpOSqV/8//Yhia9SmB8Fyu9mjdURtYTh0YQBfBP41Yn1pYZd8t2TeSV/4t8DlFqY0G/2WiSTnTdy7uJjxEMQ04ceuZmOB70pj6kxiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 19 Nov 2024 17:51:42 +0800 Received: from mail.aspeedtech.com (192.168.10.10) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Tue, 19 Nov 2024 17:51:42 +0800 From: Jacky Chou To: , , , , , , , , , , , , , CC: Subject: [PATCH net v2] net: mdio: aspeed: Add dummy read for fire control Date: Tue, 19 Nov 2024 17:51:41 +0800 Message-ID: <20241119095141.1236414-1-jacky_chou@aspeedtech.com> X-Mailer: git-send-email 2.25.1 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 command bus is sometimes busy, it may cause the command is not arrived to MDIO controller immediately. On software, the driver issues a write command to the command bus does not wait for command complete and it returned back to code immediately. But a read command will wait for the data back, once a read command was back indicates the previous write command had arrived to controller. Add a dummy read to ensure triggering mdio controller before starting polling the status of mdio controller to avoid polling unexpected timeout. Fixes: a9770eac511a ("net: mdio: Move MDIO drivers into a new subdirectory") Signed-off-by: Jacky Chou --- drivers/net/mdio/mdio-aspeed.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c index c2170650415c..373902d33b96 100644 --- a/drivers/net/mdio/mdio-aspeed.c +++ b/drivers/net/mdio/mdio-aspeed.c @@ -62,6 +62,8 @@ static int aspeed_mdio_op(struct mii_bus *bus, u8 st, u8 op, u8 phyad, u8 regad, | FIELD_PREP(ASPEED_MDIO_DATA_MIIRDATA, data); iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); + /* Add dummy read to ensure triggering mdio controller */ + (void)ioread32(ctx->base + ASPEED_MDIO_CTRL); return readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl, !(ctrl & ASPEED_MDIO_CTRL_FIRE),