Skip to contentSkip to conversation

pxa2xx-i2s: Proper initialization

PATCH Superseded Karl Beldan 2 participants 3 messages May 7, 2009 – May 8, 2009

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 pxa2xx-i2s: Proper initialization

Reset FIFO logic and registers, and make sure REC and RPL functions and FIFO service are disabled.

---
 sound/soc/pxa/pxa2xx-i2s.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
sound/soc/pxa/pxa2xx-i2s.c +12 -0
index 2f4b6e4..52862dc 100644
@@ -370,6 +370,18 @@ static struct platform_driver pxa2xx_i2s_driver = {
 static int __init pxa2xx_i2s_init(void)
 {
 	clk_i2s = ERR_PTR(-ENOENT);
+
+	/*
+	 * PXA Developer's Manual:
+	 * If SACR0[ENB] is toggled in the middle of a normal operation,
+	 * the SACR0[RST] bit must also be set and cleared to reset all
+	 * I2S controller registers.
+	 */
+	SACR0 = SACR0_RST;
+	SACR0 = 0;
+	SACR1 = SACR1_DRPL | SACR1_DREC;
+	SAIMR &= ~(SAIMR_RFS | SAIMR_TFS);
+
 	return platform_driver_register(&pxa2xx_i2s_driver);
 }
 
Signature · 4 lines
1.6.3.rc1.34.g0be9b

-- 
Karl
#1 lore raw
Quoted 7 lines · Karl Beldan

Reset FIFO logic and registers, and make sure REC and RPL functions and FIFO service are disabled.

static int __init pxa2xx_i2s_init(void)
{

sound/soc/pxa/pxa2xx-i2s.c +1 -0
 	clk_i2s = ERR_PTR(-ENOENT);
+

sound/soc/pxa/pxa2xx-i2s.c static struct platform_driver pxa2xx_i2s_driver = { · line 383

Quoted 10 lines
sound/soc/pxa/pxa2xx-i2s.c +10 -0
+	/*
+	 * PXA Developer's Manual:
+	 * If SACR0[ENB] is toggled in the middle of a normal operation,
+	 * the SACR0[RST] bit must also be set and cleared to reset all
+	 * I2S controller registers.
+	 */
+	SACR0 = SACR0_RST;
+	SACR0 = 0;
+	SACR1 = SACR1_DRPL | SACR1_DREC;
+	SAIMR &= ~(SAIMR_RFS | SAIMR_TFS);

I'd expect this to happen when the driver is probed rather than when the module is initialised. Otherwise we'll end up writing to the hardware if run on systems where it's not present - for example if a kernel has both PXA2xx and PXA3xx support built in.

#2 lore raw
Quoted 20 lines · Mark Brown
Quoted 17 lines · Karl Beldan

Reset FIFO logic and registers, and make sure REC and RPL functions and FIFO service are disabled.

 static int __init pxa2xx_i2s_init(void)
 {
      clk_i2s = ERR_PTR(-ENOENT);
+
+     /*
+      * PXA Developer's Manual:
+      * If SACR0[ENB] is toggled in the middle of a normal operation,
+      * the SACR0[RST] bit must also be set and cleared to reset all
+      * I2S controller registers.
+      */
+     SACR0 = SACR0_RST;
+     SACR0 = 0;
+     SACR1 = SACR1_DRPL | SACR1_DREC;
+     SAIMR &= ~(SAIMR_RFS | SAIMR_TFS);

Quoted 2 lines

I'd expect this to happen when the driver is probed rather than when the module is initialised.  Otherwise we'll end up writing to the hardware

Indeed, will resend.

Signature · 1 line
Karl