Takashi Iwai fcd788
From 7cbfee2e2e40d2be54196362a845a3ea0a3f877d Mon Sep 17 00:00:00 2001
Takashi Iwai fcd788
From: Richard Fitzgerald <rf@opensource.cirrus.com>
Takashi Iwai fcd788
Date: Fri, 2 Dec 2022 16:18:10 +0000
Takashi Iwai fcd788
Subject: [PATCH] soundwire: cadence: Don't overflow the command FIFOs
Takashi Iwai fcd788
Git-commit: 7cbfee2e2e40d2be54196362a845a3ea0a3f877d
Takashi Iwai fcd788
Patch-mainline: v6.3-rc1
Takashi Iwai fcd788
References: git-fixes
Takashi Iwai fcd788
Takashi Iwai fcd788
The command FIFOs in the Cadence IP can be configured during design
Takashi Iwai fcd788
up to 32 entries, and the code in cadence_master.c was assuming the
Takashi Iwai fcd788
full 32-entry FIFO. But all current Intel implementations use an 8-entry
Takashi Iwai fcd788
FIFO.
Takashi Iwai fcd788
Takashi Iwai fcd788
Up to now the longest message used was 6 entries so this wasn't
Takashi Iwai fcd788
causing any problem. But future Cirrus Logic codecs have downloadable
Takashi Iwai fcd788
firmware or tuning blobs. It is more efficient for the codec driver to
Takashi Iwai fcd788
issue long transfers that can take advantage of any queuing in the
Takashi Iwai fcd788
Soundwire controller and avoid the overhead of repeatedly writing the
Takashi Iwai fcd788
page registers.
Takashi Iwai fcd788
Takashi Iwai fcd788
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Takashi Iwai fcd788
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Takashi Iwai fcd788
Fixes: 2f52a5177caa ("soundwire: cdns: Add cadence library")
Takashi Iwai fcd788
Link: https://lore.kernel.org/r/20221202161812.4186897-2-rf@opensource.cirrus.com
Takashi Iwai fcd788
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Takashi Iwai fcd788
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai fcd788
Takashi Iwai fcd788
---
Takashi Iwai fcd788
 drivers/soundwire/cadence_master.c | 3 ++-
Takashi Iwai fcd788
 1 file changed, 2 insertions(+), 1 deletion(-)
Takashi Iwai fcd788
Takashi Iwai fcd788
diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
Takashi Iwai fcd788
index a1de363eba3f..27699f341f2c 100644
Takashi Iwai fcd788
--- a/drivers/soundwire/cadence_master.c
Takashi Iwai fcd788
+++ b/drivers/soundwire/cadence_master.c
Takashi Iwai fcd788
@@ -127,7 +127,8 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");
Takashi Iwai fcd788
 
Takashi Iwai fcd788
 #define CDNS_MCP_CMD_BASE			0x80
Takashi Iwai fcd788
 #define CDNS_MCP_RESP_BASE			0x80
Takashi Iwai fcd788
-#define CDNS_MCP_CMD_LEN			0x20
Takashi Iwai fcd788
+/* FIFO can hold 8 commands */
Takashi Iwai fcd788
+#define CDNS_MCP_CMD_LEN			8
Takashi Iwai fcd788
 #define CDNS_MCP_CMD_WORD_LEN			0x4
Takashi Iwai fcd788
 
Takashi Iwai fcd788
 #define CDNS_MCP_CMD_SSP_TAG			BIT(31)
Takashi Iwai fcd788
-- 
Takashi Iwai fcd788
2.35.3
Takashi Iwai fcd788