diff options
author | Paul Walmsley <paul@pwsan.com> | 2010-10-08 13:40:19 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-10-08 13:40:19 -0400 |
commit | cf4c87abe238ec17cd0255b4e21abd949d7f811e (patch) | |
tree | feffd8e664e1718ab4dc0d4ba83c26fe5b8d4be3 /arch/arm | |
parent | 829e5b127a33d3baa227e87636032f36cd4c05fc (diff) |
OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c
The OMAP ASoC McBSP code implemented CLKR and FSR signal muxing via
direct System Control Module writes on OMAP2+. This required the
omap_ctrl_{read,write}l() functions to be exported, which is against
policy: the only code that should call those functions directly is
OMAP core code, not device drivers. omap_ctrl_{read,write}*() are no
longer exported, so the driver no longer builds as a module.
Fix the pinmuxing part of the problem by removing calls to
omap_ctrl_{read,write}l() from the OMAP ASoC McBSP code and
implementing signal muxing functions in arch/arm/mach-omap2/mcbsp.c.
Due to the unfortunate way that McBSP support is implemented in ASoC
and the OMAP tree, these symbols must be exported for use by
sound/soc/omap/omap-mcbsp.c.
Going forward, the McBSP device driver should be moved from
arch/arm/*omap* into drivers/ or sound/soc/*, and the CPU DAI driver
should be implemented as a platform_driver as many other ASoC CPU DAI
drivers are. These two steps should resolve many of the layering
problems, which will rapidly reappear during a McBSP hwmod/PM runtime
conversion.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/mcbsp.c | 30 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/control.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/mcbsp.h | 13 | ||||
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 1 |
4 files changed, 45 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 88b8790e4fec..4c9c999dfa4a 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -22,7 +22,37 @@ | |||
22 | #include <plat/dma.h> | 22 | #include <plat/dma.h> |
23 | #include <plat/cpu.h> | 23 | #include <plat/cpu.h> |
24 | #include <plat/mcbsp.h> | 24 | #include <plat/mcbsp.h> |
25 | #include <plat/control.h> | ||
25 | 26 | ||
27 | /* McBSP internal signal muxing functions */ | ||
28 | |||
29 | void omap2_mcbsp1_mux_clkr_src(u8 mux) | ||
30 | { | ||
31 | u32 v; | ||
32 | |||
33 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
34 | if (mux == CLKR_SRC_CLKR) | ||
35 | v &= OMAP2_MCBSP1_CLKR_MASK; | ||
36 | else if (mux == CLKR_SRC_CLKX) | ||
37 | v |= OMAP2_MCBSP1_CLKR_MASK; | ||
38 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
39 | } | ||
40 | EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src); | ||
41 | |||
42 | void omap2_mcbsp1_mux_fsr_src(u8 mux) | ||
43 | { | ||
44 | u32 v; | ||
45 | |||
46 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
47 | if (mux == FSR_SRC_FSR) | ||
48 | v &= OMAP2_MCBSP1_FSR_MASK; | ||
49 | else if (mux == FSR_SRC_FSX) | ||
50 | v |= OMAP2_MCBSP1_FSR_MASK; | ||
51 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
52 | } | ||
53 | EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src); | ||
54 | |||
55 | /* Platform data */ | ||
26 | 56 | ||
27 | #ifdef CONFIG_ARCH_OMAP2420 | 57 | #ifdef CONFIG_ARCH_OMAP2420 |
28 | static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | 58 | static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { |
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h index 19c9b2a82046..54b0c3529c83 100644 --- a/arch/arm/plat-omap/include/plat/control.h +++ b/arch/arm/plat-omap/include/plat/control.h | |||
@@ -223,6 +223,8 @@ | |||
223 | #define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */ | 223 | #define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */ |
224 | #define OMAP24XX_USBSTANDBYCTRL (1 << 15) | 224 | #define OMAP24XX_USBSTANDBYCTRL (1 << 15) |
225 | #define OMAP2_MCBSP2_CLKS_MASK (1 << 6) | 225 | #define OMAP2_MCBSP2_CLKS_MASK (1 << 6) |
226 | #define OMAP2_MCBSP1_FSR_MASK (1 << 4) | ||
227 | #define OMAP2_MCBSP1_CLKR_MASK (1 << 3) | ||
226 | #define OMAP2_MCBSP1_CLKS_MASK (1 << 2) | 228 | #define OMAP2_MCBSP1_CLKS_MASK (1 << 2) |
227 | 229 | ||
228 | /* CONTROL_DEVCONF1 bits */ | 230 | /* CONTROL_DEVCONF1 bits */ |
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h index b4ff6a11a8f2..886d0e610aa7 100644 --- a/arch/arm/plat-omap/include/plat/mcbsp.h +++ b/arch/arm/plat-omap/include/plat/mcbsp.h | |||
@@ -312,6 +312,14 @@ | |||
312 | #define RFSREN 0x0002 | 312 | #define RFSREN 0x0002 |
313 | #define RSYNCERREN 0x0001 | 313 | #define RSYNCERREN 0x0001 |
314 | 314 | ||
315 | /* CLKR signal muxing options */ | ||
316 | #define CLKR_SRC_CLKR 0 | ||
317 | #define CLKR_SRC_CLKX 1 | ||
318 | |||
319 | /* FSR signal muxing options */ | ||
320 | #define FSR_SRC_FSR 0 | ||
321 | #define FSR_SRC_FSX 1 | ||
322 | |||
315 | /* we don't do multichannel for now */ | 323 | /* we don't do multichannel for now */ |
316 | struct omap_mcbsp_reg_cfg { | 324 | struct omap_mcbsp_reg_cfg { |
317 | u16 spcr2; | 325 | u16 spcr2; |
@@ -501,7 +509,6 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng | |||
501 | int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word); | 509 | int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word); |
502 | int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word); | 510 | int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word); |
503 | 511 | ||
504 | |||
505 | /* SPI specific API */ | 512 | /* SPI specific API */ |
506 | void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg); | 513 | void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg); |
507 | 514 | ||
@@ -510,6 +517,10 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf); | |||
510 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf); | 517 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf); |
511 | int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); | 518 | int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); |
512 | 519 | ||
520 | /* McBSP signal muxing API */ | ||
521 | void omap2_mcbsp1_mux_clkr_src(u8 mux); | ||
522 | void omap2_mcbsp1_mux_fsr_src(u8 mux); | ||
523 | |||
513 | #ifdef CONFIG_ARCH_OMAP3 | 524 | #ifdef CONFIG_ARCH_OMAP3 |
514 | /* Sidetone specific API */ | 525 | /* Sidetone specific API */ |
515 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); | 526 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index b2e046990d38..9836fb5dc013 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <plat/dma.h> | 28 | #include <plat/dma.h> |
29 | #include <plat/mcbsp.h> | 29 | #include <plat/mcbsp.h> |
30 | #include <plat/control.h> | ||
30 | 31 | ||
31 | #include "../mach-omap2/cm-regbits-34xx.h" | 32 | #include "../mach-omap2/cm-regbits-34xx.h" |
32 | 33 | ||