diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-08-31 03:45:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-08-31 03:45:46 -0400 |
commit | daab7fc734a53fdeaf844b7c03053118ad1769da (patch) | |
tree | 575deb3cdcc6dda562acaed6f7c29bc81ae01cf2 /arch/arm/plat-omap/mcbsp.c | |
parent | 774ea0bcb27f57b6fd521b3b6c43237782fed4b9 (diff) | |
parent | 2bfc96a127bc1cc94d26bfaa40159966064f9c8c (diff) |
Merge commit 'v2.6.36-rc3' into x86/memblock
Conflicts:
arch/x86/kernel/trampoline.c
mm/memblock.c
Merge reason: Resolve the conflicts, update to latest upstream.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 7e669c9744d8..e31496e35b0f 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -481,9 +481,9 @@ int omap_st_is_enabled(unsigned int id) | |||
481 | EXPORT_SYMBOL(omap_st_is_enabled); | 481 | EXPORT_SYMBOL(omap_st_is_enabled); |
482 | 482 | ||
483 | /* | 483 | /* |
484 | * omap_mcbsp_set_tx_threshold configures how to deal | 484 | * omap_mcbsp_set_rx_threshold configures the transmit threshold in words. |
485 | * with transmit threshold. the threshold value and handler can be | 485 | * The threshold parameter is 1 based, and it is converted (threshold - 1) |
486 | * configure in here. | 486 | * for the THRSH2 register. |
487 | */ | 487 | */ |
488 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) | 488 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) |
489 | { | 489 | { |
@@ -498,14 +498,15 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) | |||
498 | } | 498 | } |
499 | mcbsp = id_to_mcbsp_ptr(id); | 499 | mcbsp = id_to_mcbsp_ptr(id); |
500 | 500 | ||
501 | MCBSP_WRITE(mcbsp, THRSH2, threshold); | 501 | if (threshold && threshold <= mcbsp->max_tx_thres) |
502 | MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); | ||
502 | } | 503 | } |
503 | EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold); | 504 | EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold); |
504 | 505 | ||
505 | /* | 506 | /* |
506 | * omap_mcbsp_set_rx_threshold configures how to deal | 507 | * omap_mcbsp_set_rx_threshold configures the receive threshold in words. |
507 | * with receive threshold. the threshold value and handler can be | 508 | * The threshold parameter is 1 based, and it is converted (threshold - 1) |
508 | * configure in here. | 509 | * for the THRSH1 register. |
509 | */ | 510 | */ |
510 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) | 511 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) |
511 | { | 512 | { |
@@ -520,7 +521,8 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) | |||
520 | } | 521 | } |
521 | mcbsp = id_to_mcbsp_ptr(id); | 522 | mcbsp = id_to_mcbsp_ptr(id); |
522 | 523 | ||
523 | MCBSP_WRITE(mcbsp, THRSH1, threshold); | 524 | if (threshold && threshold <= mcbsp->max_rx_thres) |
525 | MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); | ||
524 | } | 526 | } |
525 | EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold); | 527 | EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold); |
526 | 528 | ||
@@ -560,8 +562,20 @@ u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) | |||
560 | } | 562 | } |
561 | EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold); | 563 | EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold); |
562 | 564 | ||
563 | #define MCBSP2_FIFO_SIZE 0x500 /* 1024 + 256 locations */ | 565 | u16 omap_mcbsp_get_fifo_size(unsigned int id) |
564 | #define MCBSP1345_FIFO_SIZE 0x80 /* 128 locations */ | 566 | { |
567 | struct omap_mcbsp *mcbsp; | ||
568 | |||
569 | if (!omap_mcbsp_check_valid_id(id)) { | ||
570 | printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); | ||
571 | return -ENODEV; | ||
572 | } | ||
573 | mcbsp = id_to_mcbsp_ptr(id); | ||
574 | |||
575 | return mcbsp->pdata->buffer_size; | ||
576 | } | ||
577 | EXPORT_SYMBOL(omap_mcbsp_get_fifo_size); | ||
578 | |||
565 | /* | 579 | /* |
566 | * omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO | 580 | * omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO |
567 | */ | 581 | */ |
@@ -580,10 +594,7 @@ u16 omap_mcbsp_get_tx_delay(unsigned int id) | |||
580 | buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); | 594 | buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); |
581 | 595 | ||
582 | /* Number of slots are different in McBSP ports */ | 596 | /* Number of slots are different in McBSP ports */ |
583 | if (mcbsp->id == 2) | 597 | return mcbsp->pdata->buffer_size - buffstat; |
584 | return MCBSP2_FIFO_SIZE - buffstat; | ||
585 | else | ||
586 | return MCBSP1345_FIFO_SIZE - buffstat; | ||
587 | } | 598 | } |
588 | EXPORT_SYMBOL(omap_mcbsp_get_tx_delay); | 599 | EXPORT_SYMBOL(omap_mcbsp_get_tx_delay); |
589 | 600 | ||
@@ -1683,8 +1694,16 @@ static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) | |||
1683 | { | 1694 | { |
1684 | mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; | 1695 | mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; |
1685 | if (cpu_is_omap34xx()) { | 1696 | if (cpu_is_omap34xx()) { |
1686 | mcbsp->max_tx_thres = max_thres(mcbsp); | 1697 | /* |
1687 | mcbsp->max_rx_thres = max_thres(mcbsp); | 1698 | * Initially configure the maximum thresholds to a safe value. |
1699 | * The McBSP FIFO usage with these values should not go under | ||
1700 | * 16 locations. | ||
1701 | * If the whole FIFO without safety buffer is used, than there | ||
1702 | * is a possibility that the DMA will be not able to push the | ||
1703 | * new data on time, causing channel shifts in runtime. | ||
1704 | */ | ||
1705 | mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; | ||
1706 | mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; | ||
1688 | /* | 1707 | /* |
1689 | * REVISIT: Set dmap_op_mode to THRESHOLD as default | 1708 | * REVISIT: Set dmap_op_mode to THRESHOLD as default |
1690 | * for mcbsp2 instances. | 1709 | * for mcbsp2 instances. |