diff options
author | Tero Kristo <t-kristo@ti.com> | 2013-10-11 12:15:33 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2013-10-19 12:11:51 -0400 |
commit | 7a90da2ad3fdd44a6230c0e2c0a374a5cda1711c (patch) | |
tree | c5c2282afb95953a786973aaf615931bf774ed65 | |
parent | 818b40e500b2afadeabfd7ca369800c350989143 (diff) |
ARM: OMAP3: McBSP: do not access CM register directly
McBSP driver require special hacks to enable/disable the autoidle feature
for its interface clock for the proper function of the sidetone hardware.
Currently the driver just writes CM registers directly, which should be
avoided. Thus, changed the driver to use the new deny/allow_autoidle
clock API calls.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
-rw-r--r-- | arch/arm/mach-omap2/mcbsp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 5d8768075dd9..b4ac3af1160c 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include "soc.h" | 26 | #include "soc.h" |
27 | #include "omap_device.h" | 27 | #include "omap_device.h" |
28 | #include "clock.h" | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. | 31 | * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. |
@@ -33,22 +34,18 @@ | |||
33 | #include "cm3xxx.h" | 34 | #include "cm3xxx.h" |
34 | #include "cm-regbits-34xx.h" | 35 | #include "cm-regbits-34xx.h" |
35 | 36 | ||
37 | static struct clk *mcbsp_iclks[5]; | ||
38 | |||
36 | static int omap3_enable_st_clock(unsigned int id, bool enable) | 39 | static int omap3_enable_st_clock(unsigned int id, bool enable) |
37 | { | 40 | { |
38 | unsigned int w; | ||
39 | |||
40 | /* | 41 | /* |
41 | * Sidetone uses McBSP ICLK - which must not idle when sidetones | 42 | * Sidetone uses McBSP ICLK - which must not idle when sidetones |
42 | * are enabled or sidetones start sounding ugly. | 43 | * are enabled or sidetones start sounding ugly. |
43 | */ | 44 | */ |
44 | w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
45 | if (enable) | 45 | if (enable) |
46 | w &= ~(1 << (id - 2)); | 46 | return omap2_clk_deny_idle(mcbsp_iclks[id]); |
47 | else | 47 | else |
48 | w |= 1 << (id - 2); | 48 | return omap2_clk_allow_idle(mcbsp_iclks[id]); |
49 | omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE); | ||
50 | |||
51 | return 0; | ||
52 | } | 49 | } |
53 | 50 | ||
54 | static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | 51 | static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) |
@@ -58,6 +55,7 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
58 | struct omap_hwmod *oh_device[2]; | 55 | struct omap_hwmod *oh_device[2]; |
59 | struct omap_mcbsp_platform_data *pdata = NULL; | 56 | struct omap_mcbsp_platform_data *pdata = NULL; |
60 | struct platform_device *pdev; | 57 | struct platform_device *pdev; |
58 | char clk_name[11]; | ||
61 | 59 | ||
62 | sscanf(oh->name, "mcbsp%d", &id); | 60 | sscanf(oh->name, "mcbsp%d", &id); |
63 | 61 | ||
@@ -99,6 +97,8 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
99 | oh_device[1] = omap_hwmod_lookup(( | 97 | oh_device[1] = omap_hwmod_lookup(( |
100 | (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); | 98 | (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); |
101 | pdata->enable_st_clock = omap3_enable_st_clock; | 99 | pdata->enable_st_clock = omap3_enable_st_clock; |
100 | sprintf(clk_name, "mcbsp%d_ick", id); | ||
101 | mcbsp_iclks[id] = clk_get(NULL, clk_name); | ||
102 | count++; | 102 | count++; |
103 | } | 103 | } |
104 | pdev = omap_device_build_ss(name, id, oh_device, count, pdata, | 104 | pdev = omap_device_build_ss(name, id, oh_device, count, pdata, |