فهرست منبع

ASoC: ti: davinci-mcasp: Add workaround for errata i868 (dra7xx family)

McASP FIFO events to eDMA or sDMA can be lost depending on the
timing between McASP side activity and DMA side activity, causing
overflow (capture) or underflow (playback).

The workaround consists of maximizing the time to avoid the
boundary condition in hardware.  So the RNUMEVT/WNUMEVT should be
set to the multiple of the active serializers that is less than
or equal to 32.

This errata is applicable for McASP IP revision < 3.3, which may
be present in other platforms.  But since the revision definition
is not consistent across those platforms, the errata workaround
is only set for DRA7xx family whose revision information is
known.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Peter Ujfalusi 10 سال پیش
والد
کامیت
8327bec3ca
2فایلهای تغییر یافته به همراه32 افزوده شده و 0 حذف شده
  1. 25 0
      sound/soc/ti/davinci-mcasp.c
  2. 7 0
      sound/soc/ti/davinci-mcasp.h

+ 25 - 0
sound/soc/ti/davinci-mcasp.c

@@ -2139,6 +2139,31 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 
 
 	mcasp_reparent_fck(pdev);
 	mcasp_reparent_fck(pdev);
 
 
+	if (mcasp->version == MCASP_VERSION_4) {
+		u32 rev;
+
+		pm_runtime_get_sync(mcasp->dev);
+		rev = mcasp_get_reg(mcasp, DAVINCI_MCASP_PID_REG) &
+				    MCASP_V4_REV_MASK;
+		pm_runtime_put(mcasp->dev);
+
+		if (rev < MCASP_V4_REV(3, 3)) {
+			/*
+			 * ERRATA i868: to avoid race condition between DMA and
+			 * AFIFO events the R/WNUMEVT need to be set to be
+			 * less-than-equal to 32 words.
+			 */
+			if (mcasp->txnumevt)
+				mcasp->txnumevt = 32;
+			if (mcasp->rxnumevt)
+				mcasp->rxnumevt = 32;
+
+			if (mcasp->txnumevt || mcasp->rxnumevt)
+				dev_info(&pdev->dev,
+					 "ERRATA i868 workaround is enabled\n");
+		}
+	}
+
 	ret = devm_snd_soc_register_component(&pdev->dev,
 	ret = devm_snd_soc_register_component(&pdev->dev,
 					&davinci_mcasp_component,
 					&davinci_mcasp_component,
 					&davinci_mcasp_dai[pdata->op_mode], 1);
 					&davinci_mcasp_dai[pdata->op_mode], 1);

+ 7 - 0
sound/soc/ti/davinci-mcasp.h

@@ -99,6 +99,13 @@
 #define MCASP_RFIFOCTL_OFFSET		(0x8)
 #define MCASP_RFIFOCTL_OFFSET		(0x8)
 #define MCASP_RFIFOSTS_OFFSET		(0xc)
 #define MCASP_RFIFOSTS_OFFSET		(0xc)
 
 
+/* DAVINCI_MCASP_PID_REG - Peripheral Identification Register Bits */
+#define MCASP_V4_REVMINOR_MASK		(0x3f)
+#define MCASP_V4_REVMAJOR_MASK		(0x7 << 8)
+#define MCASP_V4_REV_MASK		(MCASP_V4_REVMAJOR_MASK | \
+					 MCASP_V4_REVMINOR_MASK)
+#define MCASP_V4_REV(maj, min)		((maj) << 8 | (min))
+
 /*
 /*
  * DAVINCI_MCASP_PWREMUMGT_REG - Power Down and Emulation Management
  * DAVINCI_MCASP_PWREMUMGT_REG - Power Down and Emulation Management
  *     Register Bits
  *     Register Bits