Răsfoiți Sursa

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>
Tero Kristo 11 ani în urmă
părinte
comite
7a90da2ad3
1 a modificat fișierele cu 8 adăugiri și 8 ștergeri
  1. 8 8
      arch/arm/mach-omap2/mcbsp.c

+ 8 - 8
arch/arm/mach-omap2/mcbsp.c

@@ -25,6 +25,7 @@
 
 
 #include "soc.h"
 #include "soc.h"
 #include "omap_device.h"
 #include "omap_device.h"
+#include "clock.h"
 
 
 /*
 /*
  * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
  * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
@@ -33,22 +34,18 @@
 #include "cm3xxx.h"
 #include "cm3xxx.h"
 #include "cm-regbits-34xx.h"
 #include "cm-regbits-34xx.h"
 
 
+static struct clk *mcbsp_iclks[5];
+
 static int omap3_enable_st_clock(unsigned int id, bool enable)
 static int omap3_enable_st_clock(unsigned int id, bool enable)
 {
 {
-	unsigned int w;
-
 	/*
 	/*
 	 * Sidetone uses McBSP ICLK - which must not idle when sidetones
 	 * Sidetone uses McBSP ICLK - which must not idle when sidetones
 	 * are enabled or sidetones start sounding ugly.
 	 * are enabled or sidetones start sounding ugly.
 	 */
 	 */
-	w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
 	if (enable)
 	if (enable)
-		w &= ~(1 << (id - 2));
+		return omap2_clk_deny_idle(mcbsp_iclks[id]);
 	else
 	else
-		w |= 1 << (id - 2);
-	omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
-
-	return 0;
+		return omap2_clk_allow_idle(mcbsp_iclks[id]);
 }
 }
 
 
 static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 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)
 	struct omap_hwmod *oh_device[2];
 	struct omap_hwmod *oh_device[2];
 	struct omap_mcbsp_platform_data *pdata = NULL;
 	struct omap_mcbsp_platform_data *pdata = NULL;
 	struct platform_device *pdev;
 	struct platform_device *pdev;
+	char clk_name[11];
 
 
 	sscanf(oh->name, "mcbsp%d", &id);
 	sscanf(oh->name, "mcbsp%d", &id);
 
 
@@ -99,6 +97,8 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 		oh_device[1] = omap_hwmod_lookup((
 		oh_device[1] = omap_hwmod_lookup((
 		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
 		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
 		pdata->enable_st_clock = omap3_enable_st_clock;
 		pdata->enable_st_clock = omap3_enable_st_clock;
+		sprintf(clk_name, "mcbsp%d_ick", id);
+		mcbsp_iclks[id] = clk_get(NULL, clk_name);
 		count++;
 		count++;
 	}
 	}
 	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
 	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,