aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/mcbsp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
commit7b6181e06841f5ad15c4ff708b967b4db65a64de (patch)
treebdfcf5b74b692f76581156e452d268b64c795200 /arch/arm/plat-omap/mcbsp.c
parent72e58063d63c5f0a7bf65312f1e3a5ed9bb5c2ff (diff)
parentbc487fb341af05120bccb9f59ce76302391dcc77 (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (163 commits) omap: complete removal of machine_desc.io_pg_offst and .phys_io omap: UART: fix wakeup registers for OMAP24xx UART2 omap: Fix spotty MMC voltages ASoC: OMAP4: MCPDM: Remove unnecessary include of plat/control.h serial: omap-serial: fix signess error OMAP3: DMA: Errata i541: sDMA FIFO draining does not finish omap: dma: Fix buffering disable bit setting for omap24xx omap: serial: Fix the boot-up crash/reboot without CONFIG_PM OMAP3: PM: fix scratchpad memory accesses for off-mode omap4: pandaboard: enable the ehci port on pandaboard omap4: pandaboard: Fix the init if CONFIG_MMC_OMAP_HS is not set omap4: pandaboard: remove unused hsmmc definition OMAP: McBSP: Remove null omap44xx ops comment OMAP: McBSP: Swap CLKS source definition OMAP: McBSP: Fix CLKR and FSR signal muxing OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks OMAP: control: move plat-omap/control.h to mach-omap2/control.h OMAP: split plat-omap/common.c OMAP: McBSP: implement functional clock switching via clock framework OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c ... Fixed up trivial conflicts in arch/arm/mach-omap2/ {board-zoom-peripherals.c,devices.c} as per Tony
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r--arch/arm/plat-omap/mcbsp.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 0c8612fd8312..eac4b978e9fd 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -33,7 +33,7 @@
33struct omap_mcbsp **mcbsp_ptr; 33struct omap_mcbsp **mcbsp_ptr;
34int omap_mcbsp_count, omap_mcbsp_cache_size; 34int omap_mcbsp_count, omap_mcbsp_cache_size;
35 35
36void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) 36static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
37{ 37{
38 if (cpu_class_is_omap1()) { 38 if (cpu_class_is_omap1()) {
39 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val; 39 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val;
@@ -47,7 +47,7 @@ void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
47 } 47 }
48} 48}
49 49
50int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache) 50static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache)
51{ 51{
52 if (cpu_class_is_omap1()) { 52 if (cpu_class_is_omap1()) {
53 return !from_cache ? __raw_readw(mcbsp->io_base + reg) : 53 return !from_cache ? __raw_readw(mcbsp->io_base + reg) :
@@ -62,12 +62,12 @@ int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache)
62} 62}
63 63
64#ifdef CONFIG_ARCH_OMAP3 64#ifdef CONFIG_ARCH_OMAP3
65void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) 65static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
66{ 66{
67 __raw_writel(val, mcbsp->st_data->io_base_st + reg); 67 __raw_writel(val, mcbsp->st_data->io_base_st + reg);
68} 68}
69 69
70int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg) 70static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
71{ 71{
72 return __raw_readl(mcbsp->st_data->io_base_st + reg); 72 return __raw_readl(mcbsp->st_data->io_base_st + reg);
73} 73}
@@ -80,9 +80,6 @@ int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
80#define MCBSP_READ_CACHE(mcbsp, reg) \ 80#define MCBSP_READ_CACHE(mcbsp, reg) \
81 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1) 81 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1)
82 82
83#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
84#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
85
86#define MCBSP_ST_READ(mcbsp, reg) \ 83#define MCBSP_ST_READ(mcbsp, reg) \
87 omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg) 84 omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg)
88#define MCBSP_ST_WRITE(mcbsp, reg, val) \ 85#define MCBSP_ST_WRITE(mcbsp, reg, val) \
@@ -878,7 +875,7 @@ EXPORT_SYMBOL(omap_mcbsp_free);
878void omap_mcbsp_start(unsigned int id, int tx, int rx) 875void omap_mcbsp_start(unsigned int id, int tx, int rx)
879{ 876{
880 struct omap_mcbsp *mcbsp; 877 struct omap_mcbsp *mcbsp;
881 int idle; 878 int enable_srg = 0;
882 u16 w; 879 u16 w;
883 880
884 if (!omap_mcbsp_check_valid_id(id)) { 881 if (!omap_mcbsp_check_valid_id(id)) {
@@ -893,10 +890,13 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
893 mcbsp->rx_word_length = (MCBSP_READ_CACHE(mcbsp, RCR1) >> 5) & 0x7; 890 mcbsp->rx_word_length = (MCBSP_READ_CACHE(mcbsp, RCR1) >> 5) & 0x7;
894 mcbsp->tx_word_length = (MCBSP_READ_CACHE(mcbsp, XCR1) >> 5) & 0x7; 891 mcbsp->tx_word_length = (MCBSP_READ_CACHE(mcbsp, XCR1) >> 5) & 0x7;
895 892
896 idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) | 893 /* Only enable SRG, if McBSP is master */
897 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1); 894 w = MCBSP_READ_CACHE(mcbsp, PCR0);
895 if (w & (FSXM | FSRM | CLKXM | CLKRM))
896 enable_srg = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
897 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
898 898
899 if (idle) { 899 if (enable_srg) {
900 /* Start the sample generator */ 900 /* Start the sample generator */
901 w = MCBSP_READ_CACHE(mcbsp, SPCR2); 901 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
902 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6)); 902 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6));
@@ -919,7 +919,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
919 */ 919 */
920 udelay(500); 920 udelay(500);
921 921
922 if (idle) { 922 if (enable_srg) {
923 /* Start frame sync */ 923 /* Start frame sync */
924 w = MCBSP_READ_CACHE(mcbsp, SPCR2); 924 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
925 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7)); 925 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
@@ -1645,7 +1645,7 @@ static const struct attribute_group sidetone_attr_group = {
1645 .attrs = (struct attribute **)sidetone_attrs, 1645 .attrs = (struct attribute **)sidetone_attrs,
1646}; 1646};
1647 1647
1648int __devinit omap_st_add(struct omap_mcbsp *mcbsp) 1648static int __devinit omap_st_add(struct omap_mcbsp *mcbsp)
1649{ 1649{
1650 struct omap_mcbsp_platform_data *pdata = mcbsp->pdata; 1650 struct omap_mcbsp_platform_data *pdata = mcbsp->pdata;
1651 struct omap_mcbsp_st_data *st_data; 1651 struct omap_mcbsp_st_data *st_data;