aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/mcbsp.c
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>2010-02-15 13:03:32 -0500
committerTony Lindgren <tony@atomide.com>2010-02-15 13:03:32 -0500
commit14f796375b5c2bcc27986de12b6f769ec3827f36 (patch)
treeefe6dac184858a708d0c0744ba32090b603fa640 /arch/arm/plat-omap/mcbsp.c
parentc127c7dc1abb7f02dcfbbea173e7abb4f2d4585e (diff)
omap: McBSP: Use macros for all register read/write operations
There are several places where readw()/writew() functions are used instead of OMAP_MCBSP_READ()/WRITE() macros for manipulating McBSP registers. Replace them with macros to ensure consistent behaviour after caching is introduced. Tested on OMAP1510 based Amstrad Delta. Compile-tested with omap_3430sdp_defconfig. Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Jarkko Nikula <jhnikula@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r--arch/arm/plat-omap/mcbsp.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index c1eb61529394..eaaf53bb8395 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -636,26 +636,26 @@ int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
636 mcbsp = id_to_mcbsp_ptr(id); 636 mcbsp = id_to_mcbsp_ptr(id);
637 base = mcbsp->io_base; 637 base = mcbsp->io_base;
638 638
639 writew(buf, base + OMAP_MCBSP_REG_DXR1); 639 OMAP_MCBSP_WRITE(base, DXR1, buf);
640 /* if frame sync error - clear the error */ 640 /* if frame sync error - clear the error */
641 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) { 641 if (OMAP_MCBSP_READ(base, SPCR2) & XSYNC_ERR) {
642 /* clear error */ 642 /* clear error */
643 writew(readw(base + OMAP_MCBSP_REG_SPCR2) & (~XSYNC_ERR), 643 OMAP_MCBSP_WRITE(base, SPCR2,
644 base + OMAP_MCBSP_REG_SPCR2); 644 OMAP_MCBSP_READ(base, SPCR2) & (~XSYNC_ERR));
645 /* resend */ 645 /* resend */
646 return -1; 646 return -1;
647 } else { 647 } else {
648 /* wait for transmit confirmation */ 648 /* wait for transmit confirmation */
649 int attemps = 0; 649 int attemps = 0;
650 while (!(readw(base + OMAP_MCBSP_REG_SPCR2) & XRDY)) { 650 while (!(OMAP_MCBSP_READ(base, SPCR2) & XRDY)) {
651 if (attemps++ > 1000) { 651 if (attemps++ > 1000) {
652 writew(readw(base + OMAP_MCBSP_REG_SPCR2) & 652 OMAP_MCBSP_WRITE(base, SPCR2,
653 (~XRST), 653 OMAP_MCBSP_READ(base, SPCR2) &
654 base + OMAP_MCBSP_REG_SPCR2); 654 (~XRST));
655 udelay(10); 655 udelay(10);
656 writew(readw(base + OMAP_MCBSP_REG_SPCR2) | 656 OMAP_MCBSP_WRITE(base, SPCR2,
657 (XRST), 657 OMAP_MCBSP_READ(base, SPCR2) |
658 base + OMAP_MCBSP_REG_SPCR2); 658 (XRST));
659 udelay(10); 659 udelay(10);
660 dev_err(mcbsp->dev, "Could not write to" 660 dev_err(mcbsp->dev, "Could not write to"
661 " McBSP%d Register\n", mcbsp->id); 661 " McBSP%d Register\n", mcbsp->id);
@@ -681,24 +681,24 @@ int omap_mcbsp_pollread(unsigned int id, u16 *buf)
681 681
682 base = mcbsp->io_base; 682 base = mcbsp->io_base;
683 /* if frame sync error - clear the error */ 683 /* if frame sync error - clear the error */
684 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) { 684 if (OMAP_MCBSP_READ(base, SPCR1) & RSYNC_ERR) {
685 /* clear error */ 685 /* clear error */
686 writew(readw(base + OMAP_MCBSP_REG_SPCR1) & (~RSYNC_ERR), 686 OMAP_MCBSP_WRITE(base, SPCR1,
687 base + OMAP_MCBSP_REG_SPCR1); 687 OMAP_MCBSP_READ(base, SPCR1) & (~RSYNC_ERR));
688 /* resend */ 688 /* resend */
689 return -1; 689 return -1;
690 } else { 690 } else {
691 /* wait for recieve confirmation */ 691 /* wait for recieve confirmation */
692 int attemps = 0; 692 int attemps = 0;
693 while (!(readw(base + OMAP_MCBSP_REG_SPCR1) & RRDY)) { 693 while (!(OMAP_MCBSP_READ(base, SPCR1) & RRDY)) {
694 if (attemps++ > 1000) { 694 if (attemps++ > 1000) {
695 writew(readw(base + OMAP_MCBSP_REG_SPCR1) & 695 OMAP_MCBSP_WRITE(base, SPCR1,
696 (~RRST), 696 OMAP_MCBSP_READ(base, SPCR1) &
697 base + OMAP_MCBSP_REG_SPCR1); 697 (~RRST));
698 udelay(10); 698 udelay(10);
699 writew(readw(base + OMAP_MCBSP_REG_SPCR1) | 699 OMAP_MCBSP_WRITE(base, SPCR1,
700 (RRST), 700 OMAP_MCBSP_READ(base, SPCR1) |
701 base + OMAP_MCBSP_REG_SPCR1); 701 (RRST));
702 udelay(10); 702 udelay(10);
703 dev_err(mcbsp->dev, "Could not read from" 703 dev_err(mcbsp->dev, "Could not read from"
704 " McBSP%d Register\n", mcbsp->id); 704 " McBSP%d Register\n", mcbsp->id);
@@ -706,7 +706,7 @@ int omap_mcbsp_pollread(unsigned int id, u16 *buf)
706 } 706 }
707 } 707 }
708 } 708 }
709 *buf = readw(base + OMAP_MCBSP_REG_DRR1); 709 *buf = OMAP_MCBSP_READ(base, DRR1);
710 710
711 return 0; 711 return 0;
712} 712}