Skip to contentSkip to conversation

ASoC: fsl_sai: Initialize with software reset

PATCH Applied Nicolin Chen 2 participants 2 messages Aug 5, 2014 – Aug 7, 2014

Subsystems (3)
lore
Share & tools
lore

Nicolin Chen

author reviewer
#0 lore raw

PATCH 1/1 ASoC: fsl_sai: Initialize with software reset

This patch adds software reset code in dai_probe() so as to make a true init by clearing SAI's internal logic, including the bit clock generation, status flags, and FIFO pointers.

---
 sound/soc/fsl/fsl_sai.c | 9 +++++++--
 sound/soc/fsl/fsl_sai.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_sai.c +7 -2
index dc84f98..ef7c758 100644
@@ -438,8 +438,13 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
 {
 	struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
 
-	regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, 0x0);
-	regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, 0x0);
+	/* Software Reset for both Tx and Rx */
+	regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
+	regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR);
+	/* Clear SR bit to finish the reset */
+	regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
+	regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
+
 	regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK,
 			   FSL_SAI_MAXBURST_TX * 2);
 	regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK,
sound/soc/fsl/fsl_sai.h +1 -0
index c24d3fd..b3d8864 100644
@@ -48,6 +48,7 @@
 /* SAI Transmit/Recieve Control Register */
 #define FSL_SAI_CSR_TERE	BIT(31)
 #define FSL_SAI_CSR_FR		BIT(25)
+#define FSL_SAI_CSR_SR		BIT(24)
 #define FSL_SAI_CSR_xF_SHIFT	16
 #define FSL_SAI_CSR_xF_W_SHIFT	18
 #define FSL_SAI_CSR_xF_MASK	(0x1f << FSL_SAI_CSR_xF_SHIFT)
Signature · 1 line
1.8.4
maintainer Applied
#1 lore raw
Quoted 3 lines · Nicolin Chen

This patch adds software reset code in dai_probe() so as to make a true init by clearing SAI's internal logic, including the bit clock generation, status flags, and FIFO pointers.

Applied, thanks.