From: Pete P. <pp...@us...> - 2002-05-01 18:08:19
|
Update of /cvsroot/linux-mips/linux/drivers/sound In directory usw-pr-cvs1:/tmp/cvs-serv32242/drivers/sound Modified Files: au1000.c Log Message: Replaced readl/writel type of macros with au_readl/au_writel since we need to enable software byte swapping in BE mode, but register accesses should not be swapped. The Pb1x00 boards are now mostly BE safe, but some external peripherals (external to the SOC) are not yet usable in BE mode. USB has not been tested in BE mode either. Index: au1000.c =================================================================== RCS file: /cvsroot/linux-mips/linux/drivers/sound/au1000.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- au1000.c 25 Mar 2002 22:58:15 -0000 1.10 +++ au1000.c 1 May 2002 18:00:30 -0000 1.11 @@ -255,25 +255,25 @@ spin_lock_irqsave(&s->lock, flags); for (i = 0; i < POLL_COUNT; i++) - if (!(inl(AC97C_STATUS) & AC97C_CP)) + if (!(au_readl(AC97C_STATUS) & AC97C_CP)) break; if (i == POLL_COUNT) err("rdcodec: codec cmd pending expired!"); cmd = (u32) addr & AC97C_INDEX_MASK; cmd |= AC97C_READ; // read command - outl(cmd, AC97C_CMD); + au_writel(cmd, AC97C_CMD); /* now wait for the data */ for (i = 0; i < POLL_COUNT; i++) - if (!(inl(AC97C_STATUS) & AC97C_CP)) + if (!(au_readl(AC97C_STATUS) & AC97C_CP)) break; if (i == POLL_COUNT) { err("rdcodec: read poll expired!"); return 0; } - data = inl(AC97C_CMD) & 0xffff; + data = au_readl(AC97C_CMD) & 0xffff; spin_unlock_irqrestore(&s->lock, flags); @@ -291,7 +291,7 @@ spin_lock_irqsave(&s->lock, flags); for (i = 0; i < POLL_COUNT; i++) - if (!(inl(AC97C_STATUS) & AC97C_CP)) + if (!(au_readl(AC97C_STATUS) & AC97C_CP)) break; if (i == POLL_COUNT) err("wrcodec: codec cmd pending expired!"); @@ -299,7 +299,7 @@ cmd = (u32) addr & AC97C_INDEX_MASK; cmd &= ~AC97C_READ; // write command cmd |= ((u32) data << AC97C_WD_BIT); // OR in the data word - outl(cmd, AC97C_CMD); + au_writel(cmd, AC97C_CMD); spin_unlock_irqrestore(&s->lock, flags); } @@ -315,7 +315,7 @@ // first poll the CODEC_READY tag bit for (i = 0; i < POLL_COUNT; i++) - if (inl(AC97C_STATUS) & AC97C_READY) + if (au_readl(AC97C_STATUS) & AC97C_READY) break; if (i == POLL_COUNT) { err("waitcodec: CODEC_READY poll expired!"); @@ -470,7 +470,7 @@ static void set_xmit_slots(int num_channels) { - u32 ac97_config = inl(AC97C_CONFIG) & ~AC97C_XMIT_SLOTS_MASK; + u32 ac97_config = au_readl(AC97C_CONFIG) & ~AC97C_XMIT_SLOTS_MASK; switch (num_channels) { case 1: // mono @@ -485,12 +485,12 @@ break; } - outl(ac97_config, AC97C_CONFIG); + au_writel(ac97_config, AC97C_CONFIG); } static void set_recv_slots(int num_channels) { - u32 ac97_config = inl(AC97C_CONFIG) & ~AC97C_RECV_SLOTS_MASK; + u32 ac97_config = au_readl(AC97C_CONFIG) & ~AC97C_RECV_SLOTS_MASK; /* * Always enable slots 3 and 4 (stereo). Slot 6 is @@ -498,7 +498,7 @@ */ ac97_config |= (0x3 << AC97C_RECV_SLOTS_BIT); - outl(ac97_config, AC97C_CONFIG); + au_writel(ac97_config, AC97C_CONFIG); } static void start_dac(struct au1000_state *s) @@ -512,7 +512,7 @@ spin_lock_irqsave(&s->lock, flags); - inl(AC97C_STATUS); // read status to clear sticky bits + au_readl(AC97C_STATUS); // read status to clear sticky bits // reset Buffer 1 and 2 pointers to nextOut and nextOut+dma_fragsize buf1 = virt_to_phys(db->nextOut); @@ -554,7 +554,7 @@ spin_lock_irqsave(&s->lock, flags); - inl(AC97C_STATUS); // read status to clear sticky bits + au_readl(AC97C_STATUS); // read status to clear sticky bits // reset Buffer 1 and 2 pointers to nextIn and nextIn+dma_fragsize buf1 = virt_to_phys(db->nextIn); @@ -711,7 +711,7 @@ unsigned long newptr; u32 ac97c_stat, buff_done; - ac97c_stat = inl(AC97C_STATUS); + ac97c_stat = au_readl(AC97C_STATUS); #ifdef AU1000_VERBOSE_DEBUG if (ac97c_stat & (AC97C_XU | AC97C_XO | AC97C_TE)) dbg("AC97C status = 0x%08x", ac97c_stat); @@ -792,7 +792,7 @@ unsigned long newptr; u32 ac97c_stat, buff_done; - ac97c_stat = inl(AC97C_STATUS); + ac97c_stat = au_readl(AC97C_STATUS); #ifdef AU1000_VERBOSE_DEBUG if (ac97c_stat & (AC97C_RU | AC97C_RO)) dbg("AC97C status = 0x%08x", ac97c_stat); @@ -1965,9 +1965,9 @@ // print out digital controller state len += sprintf(buf + len, "AU1000 Audio Controller registers\n"); len += sprintf(buf + len, "---------------------------------\n"); - len += sprintf (buf + len, "AC97C_CONFIG = %08x\n", inl(AC97C_CONFIG)); - len += sprintf (buf + len, "AC97C_STATUS = %08x\n", inl(AC97C_STATUS)); - len += sprintf (buf + len, "AC97C_CNTRL = %08x\n", inl(AC97C_CNTRL)); + len += sprintf (buf + len, "AC97C_CONFIG = %08x\n", au_readl(AC97C_CONFIG)); + len += sprintf (buf + len, "AC97C_STATUS = %08x\n", au_readl(AC97C_STATUS)); + len += sprintf (buf + len, "AC97C_CNTRL = %08x\n", au_readl(AC97C_CNTRL)); /* print out CODEC state */ len += sprintf(buf + len, "\nAC97 CODEC registers\n"); @@ -2079,26 +2079,26 @@ #endif /* AU1000_DEBUG */ // configure pins for AC'97 - outl(inl(SYS_PINFUNC) & ~0x02, SYS_PINFUNC); + au_writel(au_readl(SYS_PINFUNC) & ~0x02, SYS_PINFUNC); // Assert reset for 10msec to the AC'97 controller, and enable clock - outl(AC97C_RS | AC97C_CE, AC97C_CNTRL); + au_writel(AC97C_RS | AC97C_CE, AC97C_CNTRL); au1000_delay(10); - outl(AC97C_CE, AC97C_CNTRL); + au_writel(AC97C_CE, AC97C_CNTRL); au1000_delay(10); // wait for clock to stabilize /* cold reset the AC'97 */ - outl(AC97C_RESET, AC97C_CONFIG); + au_writel(AC97C_RESET, AC97C_CONFIG); au1000_delay(10); - outl(0, AC97C_CONFIG); + au_writel(0, AC97C_CONFIG); /* need to delay around 500msec(bleech) to give some CODECs enough time to wakeup */ au1000_delay(500); /* warm reset the AC'97 to start the bitclk */ - outl(AC97C_SG | AC97C_SYNC, AC97C_CONFIG); + au_writel(AC97C_SG | AC97C_SYNC, AC97C_CONFIG); udelay(100); - outl(0, AC97C_CONFIG); + au_writel(0, AC97C_CONFIG); /* codec init */ if (!ac97_probe_codec(&s->codec)) |