aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@bitmer.com>2011-09-26 03:45:49 -0400
committerTony Lindgren <tony@atomide.com>2011-09-26 20:49:07 -0400
commit7bc0c4bac72375517d904e02c46da2a23e079e8b (patch)
treece6c581b486751062adafd0e33c126ccb183c116 /arch/arm/mach-omap2
parent09d28d2c19fe5c2d51b3133329584166dec89f86 (diff)
ARM: OMAP: mcbsp: Start generalize signal muxing functions
This generalizes the omap2_mcbsp1_mux_clkr_src and omap2_mcbsp1_mux_fsr_src implementation between generic McBSP and OMAP2 specific McBSP code. These functions are used to select source for CLKR and FSR signals on OMAP2+. Start generalizing the code by implementing an optional mux_signal function pointer in platform data that will implement the actual muxing and which is called now from omap2_mcbsp1_mux_clkr_src and omap2_mcbsp1_mux_fsr_src. These functions are to be removed later and cleanup the API so that mux_signal gets its arguments directly from client code. Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/mcbsp.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 3dd4c473809e..5063f253c4b9 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -34,33 +34,36 @@
34#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
35#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
36 36
37/* McBSP internal signal muxing functions */ 37/* McBSP internal signal muxing function */
38 38static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
39void omap2_mcbsp1_mux_clkr_src(u8 mux) 39 const char *src)
40{ 40{
41 u32 v; 41 u32 v;
42 42
43 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); 43 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
44 if (mux == CLKR_SRC_CLKR)
45 v &= ~OMAP2_MCBSP1_CLKR_MASK;
46 else if (mux == CLKR_SRC_CLKX)
47 v |= OMAP2_MCBSP1_CLKR_MASK;
48 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
49}
50EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
51 44
52void omap2_mcbsp1_mux_fsr_src(u8 mux) 45 if (!strcmp(signal, "clkr")) {
53{ 46 if (!strcmp(src, "clkr"))
54 u32 v; 47 v &= ~OMAP2_MCBSP1_CLKR_MASK;
48 else if (!strcmp(src, "clkx"))
49 v |= OMAP2_MCBSP1_CLKR_MASK;
50 else
51 return -EINVAL;
52 } else if (!strcmp(signal, "fsr")) {
53 if (!strcmp(src, "fsr"))
54 v &= ~OMAP2_MCBSP1_FSR_MASK;
55 else if (!strcmp(src, "fsx"))
56 v |= OMAP2_MCBSP1_FSR_MASK;
57 else
58 return -EINVAL;
59 } else {
60 return -EINVAL;
61 }
55 62
56 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
57 if (mux == FSR_SRC_FSR)
58 v &= ~OMAP2_MCBSP1_FSR_MASK;
59 else if (mux == FSR_SRC_FSX)
60 v |= OMAP2_MCBSP1_FSR_MASK;
61 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); 63 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
64
65 return 0;
62} 66}
63EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
64 67
65/* McBSP CLKS source switching function */ 68/* McBSP CLKS source switching function */
66static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk, 69static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
@@ -181,6 +184,8 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
181 return PTR_ERR(pdev); 184 return PTR_ERR(pdev);
182 } 185 }
183 pdata->set_clk_src = omap2_mcbsp_set_clk_src; 186 pdata->set_clk_src = omap2_mcbsp_set_clk_src;
187 if (id == 1)
188 pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
184 omap_mcbsp_count++; 189 omap_mcbsp_count++;
185 return 0; 190 return 0;
186} 191}