Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 148314
b: refs/heads/master
c: ea8b27a
h: refs/heads/master
v: v3
  • Loading branch information
Jon Smirl authored and Mark Brown committed May 27, 2009
1 parent 9cf3d93 commit 6a0cd85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08d15f034e94251606479d7ca9070994c2e2fcf0
refs/heads/master: ea8b27ad0cc2573776c6cd87617a37aaf603b8bd
30 changes: 14 additions & 16 deletions trunk/sound/soc/fsl/mpc5200_psc_ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ static struct psc_dma *psc_dma;

static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
{
int rc;
int status;
unsigned int val;

/* Wait for command send status zero = ready */
spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
if (rc == 0) {
status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
MPC52xx_PSC_SR_CMDSEND), 100, 0);
if (status == 0) {
pr_err("timeout on ac97 bus (rdy)\n");
return -ENODEV;
}
/* Send the read */
out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24));

/* Wait for the answer */
spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
MPC52xx_PSC_SR_DATA_VAL), 100, 0, rc);
if (rc == 0) {
status = spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
MPC52xx_PSC_SR_DATA_VAL), 100, 0);
if (status == 0) {
pr_err("timeout on ac97 read (val) %x\n",
in_be16(&psc_dma->psc_regs->sr_csr.status));
return -ENODEV;
Expand All @@ -66,12 +66,12 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
static void psc_ac97_write(struct snd_ac97 *ac97,
unsigned short reg, unsigned short val)
{
int rc;
int status;

/* Wait for command status zero = ready */
spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
if (rc == 0) {
status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
MPC52xx_PSC_SR_CMDSEND), 100, 0);
if (status == 0) {
pr_err("timeout on ac97 bus (write)\n");
return;
}
Expand All @@ -82,24 +82,22 @@ static void psc_ac97_write(struct snd_ac97 *ac97,

static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
{
int rc;
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

out_be32(&regs->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_AWR);
spin_event_timeout(0, 3, 0, rc);
udelay(3);
out_be32(&regs->sicr, psc_dma->sicr);
}

static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
{
int rc;
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

/* Do a cold reset */
out_8(&regs->op1, MPC52xx_PSC_OP_RES);
spin_event_timeout(0, 10, 0, rc);
udelay(10);
out_8(&regs->op0, MPC52xx_PSC_OP_RES);
spin_event_timeout(0, 50, 0, rc);
udelay(50);
psc_ac97_warm_reset(ac97);
}

Expand Down

0 comments on commit 6a0cd85

Please sign in to comment.