aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/mcbsp.c
diff options
context:
space:
mode:
authorJarkko Nikula <jhnikula@gmail.com>2009-08-23 05:24:27 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-08-25 05:20:48 -0400
commitd09a2afc9359407114b7062519101f1ee2d05388 (patch)
tree43a4ac61d26e2c760dc2547066cef1b4d076a07f /arch/arm/plat-omap/mcbsp.c
parent32080af7a612e8c56131d6bdcd268cd9e8b0add1 (diff)
ARM: OMAP: McBSP: Merge two functions into omap_mcbsp_start/_stop
Functionality of functions omap_mcbsp_xmit_enable and omap_mcbsp_recv_enable can be merged into omap_mcbsp_start and omap_mcbsp_stop since API of those omap_mcbsp_start and omap_mcbsp_stop was changed recently allowing to start and stop individually the transmitter and receiver. This cleans up the code in arch/arm/plat-omap/mcbsp.c and in sound/soc/omap/omap-mcbsp.c which was the only user for those removed functions. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com> Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r--arch/arm/plat-omap/mcbsp.c84
1 files changed, 28 insertions, 56 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index ee60ab68251d..8dc7927906f1 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -529,11 +529,13 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
529 } 529 }
530 530
531 /* Enable transmitter and receiver */ 531 /* Enable transmitter and receiver */
532 tx &= 1;
532 w = OMAP_MCBSP_READ(io_base, SPCR2); 533 w = OMAP_MCBSP_READ(io_base, SPCR2);
533 OMAP_MCBSP_WRITE(io_base, SPCR2, w | (tx & 1)); 534 OMAP_MCBSP_WRITE(io_base, SPCR2, w | tx);
534 535
536 rx &= 1;
535 w = OMAP_MCBSP_READ(io_base, SPCR1); 537 w = OMAP_MCBSP_READ(io_base, SPCR1);
536 OMAP_MCBSP_WRITE(io_base, SPCR1, w | (rx & 1)); 538 OMAP_MCBSP_WRITE(io_base, SPCR1, w | rx);
537 539
538 /* 540 /*
539 * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec 541 * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
@@ -549,6 +551,16 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
549 OMAP_MCBSP_WRITE(io_base, SPCR2, w | (1 << 7)); 551 OMAP_MCBSP_WRITE(io_base, SPCR2, w | (1 << 7));
550 } 552 }
551 553
554 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
555 /* Release the transmitter and receiver */
556 w = OMAP_MCBSP_READ(io_base, XCCR);
557 w &= ~(tx ? XDISABLE : 0);
558 OMAP_MCBSP_WRITE(io_base, XCCR, w);
559 w = OMAP_MCBSP_READ(io_base, RCCR);
560 w &= ~(rx ? RDISABLE : 0);
561 OMAP_MCBSP_WRITE(io_base, RCCR, w);
562 }
563
552 /* Dump McBSP Regs */ 564 /* Dump McBSP Regs */
553 omap_mcbsp_dump_reg(id); 565 omap_mcbsp_dump_reg(id);
554} 566}
@@ -570,12 +582,24 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
570 io_base = mcbsp->io_base; 582 io_base = mcbsp->io_base;
571 583
572 /* Reset transmitter */ 584 /* Reset transmitter */
585 tx &= 1;
586 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
587 w = OMAP_MCBSP_READ(io_base, XCCR);
588 w |= (tx ? XDISABLE : 0);
589 OMAP_MCBSP_WRITE(io_base, XCCR, w);
590 }
573 w = OMAP_MCBSP_READ(io_base, SPCR2); 591 w = OMAP_MCBSP_READ(io_base, SPCR2);
574 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(tx & 1)); 592 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~tx);
575 593
576 /* Reset receiver */ 594 /* Reset receiver */
595 rx &= 1;
596 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
597 w = OMAP_MCBSP_READ(io_base, RCCR);
598 w |= (tx ? RDISABLE : 0);
599 OMAP_MCBSP_WRITE(io_base, RCCR, w);
600 }
577 w = OMAP_MCBSP_READ(io_base, SPCR1); 601 w = OMAP_MCBSP_READ(io_base, SPCR1);
578 OMAP_MCBSP_WRITE(io_base, SPCR1, w & ~(rx & 1)); 602 OMAP_MCBSP_WRITE(io_base, SPCR1, w & ~rx);
579 603
580 idle = !((OMAP_MCBSP_READ(io_base, SPCR2) | 604 idle = !((OMAP_MCBSP_READ(io_base, SPCR2) |
581 OMAP_MCBSP_READ(io_base, SPCR1)) & 1); 605 OMAP_MCBSP_READ(io_base, SPCR1)) & 1);
@@ -588,58 +612,6 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
588} 612}
589EXPORT_SYMBOL(omap_mcbsp_stop); 613EXPORT_SYMBOL(omap_mcbsp_stop);
590 614
591void omap_mcbsp_xmit_enable(unsigned int id, u8 enable)
592{
593 struct omap_mcbsp *mcbsp;
594 void __iomem *io_base;
595 u16 w;
596
597 if (!(cpu_is_omap2430() || cpu_is_omap34xx()))
598 return;
599
600 if (!omap_mcbsp_check_valid_id(id)) {
601 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
602 return;
603 }
604
605 mcbsp = id_to_mcbsp_ptr(id);
606 io_base = mcbsp->io_base;
607
608 w = OMAP_MCBSP_READ(io_base, XCCR);
609
610 if (enable)
611 OMAP_MCBSP_WRITE(io_base, XCCR, w & ~(XDISABLE));
612 else
613 OMAP_MCBSP_WRITE(io_base, XCCR, w | XDISABLE);
614}
615EXPORT_SYMBOL(omap_mcbsp_xmit_enable);
616
617void omap_mcbsp_recv_enable(unsigned int id, u8 enable)
618{
619 struct omap_mcbsp *mcbsp;
620 void __iomem *io_base;
621 u16 w;
622
623 if (!(cpu_is_omap2430() || cpu_is_omap34xx()))
624 return;
625
626 if (!omap_mcbsp_check_valid_id(id)) {
627 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
628 return;
629 }
630
631 mcbsp = id_to_mcbsp_ptr(id);
632 io_base = mcbsp->io_base;
633
634 w = OMAP_MCBSP_READ(io_base, RCCR);
635
636 if (enable)
637 OMAP_MCBSP_WRITE(io_base, RCCR, w & ~(RDISABLE));
638 else
639 OMAP_MCBSP_WRITE(io_base, RCCR, w | RDISABLE);
640}
641EXPORT_SYMBOL(omap_mcbsp_recv_enable);
642
643/* polled mcbsp i/o operations */ 615/* polled mcbsp i/o operations */
644int omap_mcbsp_pollwrite(unsigned int id, u16 buf) 616int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
645{ 617{