aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/au1x/psc-i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/au1x/psc-i2s.c')
-rw-r--r--sound/soc/au1x/psc-i2s.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index fe923a7bdc39..814beffc56f2 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -120,10 +120,10 @@ static int au1xpsc_i2s_hw_params(struct snd_pcm_substream *substream,
120 unsigned long stat; 120 unsigned long stat;
121 121
122 /* check if the PSC is already streaming data */ 122 /* check if the PSC is already streaming data */
123 stat = au_readl(I2S_STAT(pscdata)); 123 stat = __raw_readl(I2S_STAT(pscdata));
124 if (stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB)) { 124 if (stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB)) {
125 /* reject parameters not currently set up in hardware */ 125 /* reject parameters not currently set up in hardware */
126 cfgbits = au_readl(I2S_CFG(pscdata)); 126 cfgbits = __raw_readl(I2S_CFG(pscdata));
127 if ((PSC_I2SCFG_GET_LEN(cfgbits) != params->msbits) || 127 if ((PSC_I2SCFG_GET_LEN(cfgbits) != params->msbits) ||
128 (params_rate(params) != pscdata->rate)) 128 (params_rate(params) != pscdata->rate))
129 return -EINVAL; 129 return -EINVAL;
@@ -149,33 +149,33 @@ static int au1xpsc_i2s_configure(struct au1xpsc_audio_data *pscdata)
149 unsigned long tmo; 149 unsigned long tmo;
150 150
151 /* bring PSC out of sleep, and configure I2S unit */ 151 /* bring PSC out of sleep, and configure I2S unit */
152 au_writel(PSC_CTRL_ENABLE, PSC_CTRL(pscdata)); 152 __raw_writel(PSC_CTRL_ENABLE, PSC_CTRL(pscdata));
153 au_sync(); 153 wmb(); /* drain writebuffer */
154 154
155 tmo = 1000000; 155 tmo = 1000000;
156 while (!(au_readl(I2S_STAT(pscdata)) & PSC_I2SSTAT_SR) && tmo) 156 while (!(__raw_readl(I2S_STAT(pscdata)) & PSC_I2SSTAT_SR) && tmo)
157 tmo--; 157 tmo--;
158 158
159 if (!tmo) 159 if (!tmo)
160 goto psc_err; 160 goto psc_err;
161 161
162 au_writel(0, I2S_CFG(pscdata)); 162 __raw_writel(0, I2S_CFG(pscdata));
163 au_sync(); 163 wmb(); /* drain writebuffer */
164 au_writel(pscdata->cfg | PSC_I2SCFG_DE_ENABLE, I2S_CFG(pscdata)); 164 __raw_writel(pscdata->cfg | PSC_I2SCFG_DE_ENABLE, I2S_CFG(pscdata));
165 au_sync(); 165 wmb(); /* drain writebuffer */
166 166
167 /* wait for I2S controller to become ready */ 167 /* wait for I2S controller to become ready */
168 tmo = 1000000; 168 tmo = 1000000;
169 while (!(au_readl(I2S_STAT(pscdata)) & PSC_I2SSTAT_DR) && tmo) 169 while (!(__raw_readl(I2S_STAT(pscdata)) & PSC_I2SSTAT_DR) && tmo)
170 tmo--; 170 tmo--;
171 171
172 if (tmo) 172 if (tmo)
173 return 0; 173 return 0;
174 174
175psc_err: 175psc_err:
176 au_writel(0, I2S_CFG(pscdata)); 176 __raw_writel(0, I2S_CFG(pscdata));
177 au_writel(PSC_CTRL_SUSPEND, PSC_CTRL(pscdata)); 177 __raw_writel(PSC_CTRL_SUSPEND, PSC_CTRL(pscdata));
178 au_sync(); 178 wmb(); /* drain writebuffer */
179 return -ETIMEDOUT; 179 return -ETIMEDOUT;
180} 180}
181 181
@@ -187,26 +187,26 @@ static int au1xpsc_i2s_start(struct au1xpsc_audio_data *pscdata, int stype)
187 ret = 0; 187 ret = 0;
188 188
189 /* if both TX and RX are idle, configure the PSC */ 189 /* if both TX and RX are idle, configure the PSC */
190 stat = au_readl(I2S_STAT(pscdata)); 190 stat = __raw_readl(I2S_STAT(pscdata));
191 if (!(stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB))) { 191 if (!(stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB))) {
192 ret = au1xpsc_i2s_configure(pscdata); 192 ret = au1xpsc_i2s_configure(pscdata);
193 if (ret) 193 if (ret)
194 goto out; 194 goto out;
195 } 195 }
196 196
197 au_writel(I2SPCR_CLRFIFO(stype), I2S_PCR(pscdata)); 197 __raw_writel(I2SPCR_CLRFIFO(stype), I2S_PCR(pscdata));
198 au_sync(); 198 wmb(); /* drain writebuffer */
199 au_writel(I2SPCR_START(stype), I2S_PCR(pscdata)); 199 __raw_writel(I2SPCR_START(stype), I2S_PCR(pscdata));
200 au_sync(); 200 wmb(); /* drain writebuffer */
201 201
202 /* wait for start confirmation */ 202 /* wait for start confirmation */
203 tmo = 1000000; 203 tmo = 1000000;
204 while (!(au_readl(I2S_STAT(pscdata)) & I2SSTAT_BUSY(stype)) && tmo) 204 while (!(__raw_readl(I2S_STAT(pscdata)) & I2SSTAT_BUSY(stype)) && tmo)
205 tmo--; 205 tmo--;
206 206
207 if (!tmo) { 207 if (!tmo) {
208 au_writel(I2SPCR_STOP(stype), I2S_PCR(pscdata)); 208 __raw_writel(I2SPCR_STOP(stype), I2S_PCR(pscdata));
209 au_sync(); 209 wmb(); /* drain writebuffer */
210 ret = -ETIMEDOUT; 210 ret = -ETIMEDOUT;
211 } 211 }
212out: 212out:
@@ -217,21 +217,21 @@ static int au1xpsc_i2s_stop(struct au1xpsc_audio_data *pscdata, int stype)
217{ 217{
218 unsigned long tmo, stat; 218 unsigned long tmo, stat;
219 219
220 au_writel(I2SPCR_STOP(stype), I2S_PCR(pscdata)); 220 __raw_writel(I2SPCR_STOP(stype), I2S_PCR(pscdata));
221 au_sync(); 221 wmb(); /* drain writebuffer */
222 222
223 /* wait for stop confirmation */ 223 /* wait for stop confirmation */
224 tmo = 1000000; 224 tmo = 1000000;
225 while ((au_readl(I2S_STAT(pscdata)) & I2SSTAT_BUSY(stype)) && tmo) 225 while ((__raw_readl(I2S_STAT(pscdata)) & I2SSTAT_BUSY(stype)) && tmo)
226 tmo--; 226 tmo--;
227 227
228 /* if both TX and RX are idle, disable PSC */ 228 /* if both TX and RX are idle, disable PSC */
229 stat = au_readl(I2S_STAT(pscdata)); 229 stat = __raw_readl(I2S_STAT(pscdata));
230 if (!(stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB))) { 230 if (!(stat & (PSC_I2SSTAT_TB | PSC_I2SSTAT_RB))) {
231 au_writel(0, I2S_CFG(pscdata)); 231 __raw_writel(0, I2S_CFG(pscdata));
232 au_sync(); 232 wmb(); /* drain writebuffer */
233 au_writel(PSC_CTRL_SUSPEND, PSC_CTRL(pscdata)); 233 __raw_writel(PSC_CTRL_SUSPEND, PSC_CTRL(pscdata));
234 au_sync(); 234 wmb(); /* drain writebuffer */
235 } 235 }
236 return 0; 236 return 0;
237} 237}
@@ -332,12 +332,12 @@ static int au1xpsc_i2s_drvprobe(struct platform_device *pdev)
332 /* preserve PSC clock source set up by platform (dev.platform_data 332 /* preserve PSC clock source set up by platform (dev.platform_data
333 * is already occupied by soc layer) 333 * is already occupied by soc layer)
334 */ 334 */
335 sel = au_readl(PSC_SEL(wd)) & PSC_SEL_CLK_MASK; 335 sel = __raw_readl(PSC_SEL(wd)) & PSC_SEL_CLK_MASK;
336 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 336 __raw_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
337 au_sync(); 337 wmb(); /* drain writebuffer */
338 au_writel(PSC_SEL_PS_I2SMODE | sel, PSC_SEL(wd)); 338 __raw_writel(PSC_SEL_PS_I2SMODE | sel, PSC_SEL(wd));
339 au_writel(0, I2S_CFG(wd)); 339 __raw_writel(0, I2S_CFG(wd));
340 au_sync(); 340 wmb(); /* drain writebuffer */
341 341
342 /* preconfigure: set max rx/tx fifo depths */ 342 /* preconfigure: set max rx/tx fifo depths */
343 wd->cfg |= PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8; 343 wd->cfg |= PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8;
@@ -364,10 +364,10 @@ static int au1xpsc_i2s_drvremove(struct platform_device *pdev)
364 364
365 snd_soc_unregister_component(&pdev->dev); 365 snd_soc_unregister_component(&pdev->dev);
366 366
367 au_writel(0, I2S_CFG(wd)); 367 __raw_writel(0, I2S_CFG(wd));
368 au_sync(); 368 wmb(); /* drain writebuffer */
369 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 369 __raw_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
370 au_sync(); 370 wmb(); /* drain writebuffer */
371 371
372 return 0; 372 return 0;
373} 373}
@@ -378,12 +378,12 @@ static int au1xpsc_i2s_drvsuspend(struct device *dev)
378 struct au1xpsc_audio_data *wd = dev_get_drvdata(dev); 378 struct au1xpsc_audio_data *wd = dev_get_drvdata(dev);
379 379
380 /* save interesting register and disable PSC */ 380 /* save interesting register and disable PSC */
381 wd->pm[0] = au_readl(PSC_SEL(wd)); 381 wd->pm[0] = __raw_readl(PSC_SEL(wd));
382 382
383 au_writel(0, I2S_CFG(wd)); 383 __raw_writel(0, I2S_CFG(wd));
384 au_sync(); 384 wmb(); /* drain writebuffer */
385 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 385 __raw_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
386 au_sync(); 386 wmb(); /* drain writebuffer */
387 387
388 return 0; 388 return 0;
389} 389}
@@ -393,12 +393,12 @@ static int au1xpsc_i2s_drvresume(struct device *dev)
393 struct au1xpsc_audio_data *wd = dev_get_drvdata(dev); 393 struct au1xpsc_audio_data *wd = dev_get_drvdata(dev);
394 394
395 /* select I2S mode and PSC clock */ 395 /* select I2S mode and PSC clock */
396 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 396 __raw_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
397 au_sync(); 397 wmb(); /* drain writebuffer */
398 au_writel(0, PSC_SEL(wd)); 398 __raw_writel(0, PSC_SEL(wd));
399 au_sync(); 399 wmb(); /* drain writebuffer */
400 au_writel(wd->pm[0], PSC_SEL(wd)); 400 __raw_writel(wd->pm[0], PSC_SEL(wd));
401 au_sync(); 401 wmb(); /* drain writebuffer */
402 402
403 return 0; 403 return 0;
404} 404}