From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 47031337112; Fri, 17 Oct 2025 15:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760713309; cv=none; b=p97plFMR9x6sWMLSb+X2S3+zxbll95MsdTdVh8uZONFyRmgKvRvILgXN6xtcEEwSq9hPVDoX9/K4Z3Q7zZm/yMqRzaE1IrIp6A/0bViuknmqOnhFQxIWW/mTLdLn/YVQW0l8cmikYG4l7IpkczngykepK55SBAO43SrW3dFc/XE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760713309; c=relaxed/simple; bh=qOS+tOD0wFJNex0x3evTl2ibG5V9PNV+AIP6iGPgje8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LjQuJ7OcfVNxu/i5DgJS+uMOIh2cmrWMEgcETerNRVLHeizKjsvJXYe8S4dKv1lI3NiVf6b43+oWQX3lPm8D9rDYmF2OjNARmyqGWQDnuYtJcDIT7pvdoWg8st2E0ARU+FLysORPaAFlMplF6GAKegOfgWNve/6dr6rM5CW2D00= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zNyno9U0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zNyno9U0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E036C4CEFE; Fri, 17 Oct 2025 15:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760713309; bh=qOS+tOD0wFJNex0x3evTl2ibG5V9PNV+AIP6iGPgje8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zNyno9U0uehLY5lz4sHnm/4qQcnQIrRIDEtOOTYoldgPXCkbCG5GFxR3GSNvm9WPc 9XdPta5sgpKBuSwcF2LX3Cp7QYhbGgvZHtNlFmrZp3GazyyW0deWtjMMenJHqs43u9 l/3FKFVNuR2lczxVMgty1TmJEbrJ6Sue8O+pyHT8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pratyush Yadav , Santhosh Kumar K , Mark Brown Subject: [PATCH 6.1 119/168] spi: cadence-quadspi: Flush posted register writes before INDAC access Date: Fri, 17 Oct 2025 16:53:18 +0200 Message-ID: <20251017145133.408298530@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145129.000176255@linuxfoundation.org> References: <20251017145129.000176255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pratyush Yadav commit 29e0b471ccbd674d20d4bbddea1a51e7105212c5 upstream. cqspi_indirect_read_execute() and cqspi_indirect_write_execute() first set the enable bit on APB region and then start reading/writing to the AHB region. On TI K3 SoCs these regions lie on different endpoints. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level. It is possible for the AHB write to be executed before the APB write to enable the indirect controller, causing the transaction to be invalid and the write erroring out. Read back the APB region write before accessing the AHB region to make sure the write got flushed and the race condition is eliminated. Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller") CC: stable@vger.kernel.org Reviewed-by: Pratyush Yadav Signed-off-by: Pratyush Yadav Signed-off-by: Santhosh Kumar K Message-ID: <20250905185958.3575037-2-s-k6@ti.com> Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-cadence-quadspi.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -694,6 +694,7 @@ static int cqspi_indirect_read_execute(s reinit_completion(&cqspi->transfer_complete); writel(CQSPI_REG_INDIRECTRD_START_MASK, reg_base + CQSPI_REG_INDIRECTRD); + readl(reg_base + CQSPI_REG_INDIRECTRD); /* Flush posted write. */ while (remaining > 0) { if (!wait_for_completion_timeout(&cqspi->transfer_complete, @@ -968,6 +969,8 @@ static int cqspi_indirect_write_execute( reinit_completion(&cqspi->transfer_complete); writel(CQSPI_REG_INDIRECTWR_START_MASK, reg_base + CQSPI_REG_INDIRECTWR); + readl(reg_base + CQSPI_REG_INDIRECTWR); /* Flush posted write. */ + /* * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access * Controller programming sequence, couple of cycles of