From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: Ameya Palande <ameya.palande@nokia.com>,
Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
Felipe Contreras <felipe.contreras@nokia.com>,
Nishanth Menon <nm@ti.com>,
Omar Ramirez Luna <omar.ramirez@ti.com>
Subject: [PATCH v2] DSPBRIDGE: iva2 clock handling
Date: Tue, 27 Apr 2010 20:29:18 -0500 [thread overview]
Message-ID: <1272418167-12630-11-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1272418167-12630-10-git-send-email-omar.ramirez@ti.com>
Change the way iva2 clock is handled and since the rate is needed
for this clock only, make the function get_rate to be specific for
iva clock.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
arch/arm/plat-omap/include/dspbridge/clk.h | 16 +------
drivers/dsp/bridge/services/clk.c | 71 +++++++---------------------
drivers/dsp/bridge/services/services.c | 9 +---
drivers/dsp/bridge/wmd/tiomap3430.c | 3 +-
4 files changed, 22 insertions(+), 77 deletions(-)
diff --git a/arch/arm/plat-omap/include/dspbridge/clk.h b/arch/arm/plat-omap/include/dspbridge/clk.h
index f19d024..2602d9f 100644
--- a/arch/arm/plat-omap/include/dspbridge/clk.h
+++ b/arch/arm/plat-omap/include/dspbridge/clk.h
@@ -71,7 +71,7 @@ extern void dsp_clk_exit(void);
* Ensures:
* CLK initialized.
*/
-extern bool dsp_clk_init(void);
+extern void dsp_clk_init(void);
/*
* ======== dsp_clk_enable ========
@@ -99,19 +99,7 @@ extern dsp_status dsp_clk_enable(IN enum dsp_clk_id clk_id);
*/
extern dsp_status dsp_clk_disable(IN enum dsp_clk_id clk_id);
-/*
- * ======== dsp_clk_get_rate ========
- * Purpose:
- * Get the clock rate of requested clock.
- * Parameters:
- * Returns:
- * DSP_SOK: Success.
- * -EPERM: Error occured while Getting the clock rate.
- * Requires:
- * Ensures:
- */
-extern dsp_status dsp_clk_get_rate(IN enum dsp_clk_id clk_id,
- u32 *speedMhz);
+extern u32 dsp_clk_get_iva2_rate(void);
extern void ssi_clk_prepare(bool FLAG);
diff --git a/drivers/dsp/bridge/services/clk.c b/drivers/dsp/bridge/services/clk.c
index d5c3d4e..9c994d3 100644
--- a/drivers/dsp/bridge/services/clk.c
+++ b/drivers/dsp/bridge/services/clk.c
@@ -57,7 +57,6 @@ struct dsp_clk_t {
* 'dsp_clk_id' provided in the header file.. any changes in the
* enumerations needs to be fixed in the array as well */
static struct dsp_clk_t dsp_clks[] = {
- {NULL, "iva2_ck", -1},
{NULL, "gpt5_fck", -1},
{NULL, "gpt5_ick", -1},
{NULL, "gpt6_fck", -1},
@@ -83,6 +82,8 @@ static struct dsp_clk_t dsp_clks[] = {
{NULL, ""}
};
+struct clk *iva2_clk;
+
static s8 get_clk_type(u8 id)
{
s8 type;
@@ -110,17 +111,7 @@ static s8 get_clk_type(u8 id)
*/
void dsp_clk_exit(void)
{
- int i = 0;
-
- /* Relinquish the clock handles */
- while (i < DSP_CLK_NOT_DEFINED) {
- if (dsp_clks[i].clk_handle)
- clk_put(dsp_clks[i].clk_handle);
-
- dsp_clks[i].clk_handle = NULL;
- i++;
- }
-
+ clk_put(iva2_clk);
}
/*
@@ -128,33 +119,15 @@ void dsp_clk_exit(void)
* Purpose:
* Initialize CLK module.
*/
-bool dsp_clk_init(void)
+void dsp_clk_init(void)
{
static struct platform_device dspbridge_device;
- struct clk *clk_handle;
- int i = 0;
dspbridge_device.dev.bus = &platform_bus_type;
- /* Get the clock handles from base port and store locally */
- while (i < DSP_CLK_NOT_DEFINED) {
- /* get the handle from BP */
- dspbridge_device.id = dsp_clks[i].id;
-
- clk_handle = clk_get(&dspbridge_device.dev,
- dsp_clks[i].clk_name);
-
- if (IS_ERR(clk_handle)) {
- pr_err("%s: failed to get clk handle %s, dev id = %d\n",
- __func__, dsp_clks[i].clk_name,
- dsp_clks[i].id);
- return false;
- }
- dsp_clks[i].clk_handle = clk_handle;
- i++;
- }
-
- return true;
+ iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck");
+ if (IS_ERR(iva2_clk))
+ dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk);
}
/*
@@ -170,6 +143,8 @@ dsp_status dsp_clk_enable(IN enum dsp_clk_id clk_id)
switch (get_clk_type(clk_id)) {
case IVA2_CLK:
+ clk_enable(iva2_clk);
+ break;
case GPT_CLK:
case MCBSP_CLK:
case WDT_CLK:
@@ -214,6 +189,8 @@ dsp_status dsp_clk_disable(IN enum dsp_clk_id clk_id)
switch (get_clk_type(clk_id)) {
case IVA2_CLK:
+ clk_disable(iva2_clk);
+ break;
case GPT_CLK:
case MCBSP_CLK:
case WDT_CLK:
@@ -232,29 +209,15 @@ dsp_status dsp_clk_disable(IN enum dsp_clk_id clk_id)
return status;
}
-/*
- * ======== dsp_clk_get_rate ========
- * Purpose:
- * GetClock Speed.
- *
- */
-
-dsp_status dsp_clk_get_rate(IN enum dsp_clk_id clk_id, u32 *speedKhz)
+u32 dsp_clk_get_iva2_rate(void)
{
- dsp_status status = DSP_SOK;
- struct clk *clk_handle;
- u32 clk_speed_hz;
+ u32 clk_speed_khz;
- DBC_REQUIRE(clk_id < SERVICESCLK_NOT_DEFINED);
- *speedKhz = 0x0;
+ clk_speed_khz = clk_get_rate(iva2_clk);
+ clk_speed_khz /= 1000;
+ dev_dbg(bridge, "%s: clk speed Khz = %d\n", __func__, clk_speed_khz);
- clk_handle = dsp_clks[clk_id].clk_handle;
- clk_speed_hz = clk_get_rate(clk_handle);
- *speedKhz = clk_speed_hz / 1000;
- dev_dbg(bridge, "%s: clk_speed_hz = %d, speedinKhz = %d\n",
- __func__, clk_speed_hz, *speedKhz);
-
- return status;
+ return clk_speed_khz;
}
void ssi_clk_prepare(bool FLAG)
diff --git a/drivers/dsp/bridge/services/services.c b/drivers/dsp/bridge/services/services.c
index afb01be..cc2e89d 100644
--- a/drivers/dsp/bridge/services/services.c
+++ b/drivers/dsp/bridge/services/services.c
@@ -56,19 +56,14 @@ bool services_init(void)
{
bool ret = true;
bool fcfg;
- bool fclk;
/* Perform required initialization of SERVICES modules. */
fcfg = cfg_init();
- fclk = dsp_clk_init();
+ dsp_clk_init();
- ret = fcfg && fclk;
+ ret = fcfg;
if (!ret) {
-
- if (fclk)
- dsp_clk_exit();
-
if (fcfg)
cfg_exit();
}
diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c b/drivers/dsp/bridge/wmd/tiomap3430.c
index 52ec3bc..bb78df2 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -592,8 +592,7 @@ static dsp_status bridge_brd_start(struct wmd_dev_context *hDevContext,
if ((unsigned int *)ul_dsp_clk_addr != NULL) {
/* Get the clock rate */
- status = dsp_clk_get_rate(DSP_CLK_IVA2_CK,
- &ul_dsp_clk_rate);
+ ul_dsp_clk_rate = dsp_clk_get_iva2_rate();
dev_dbg(bridge, "%s: DSP clock rate (KHZ): 0x%x \n",
__func__, ul_dsp_clk_rate);
(void)bridge_brd_write(dev_context,
--
1.6.0.4
next prev parent reply other threads:[~2010-04-28 1:24 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-28 1:29 [PATCH v2] generic clk module removal Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: remove clk_handle from drv interface Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: fail if clk handle is NULL Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: Now actually fail if a clk handle is wrong Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: Rename services_clk_* to dsp_clk_* Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: remove unused clock sys_ck Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: remove function clk_set32k_hz Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: remove clk_get_use_cnt Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: trivial clock cleanup for unused code Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: function to get the type of clock requested by dsp Omar Ramirez Luna
2010-04-28 1:29 ` Omar Ramirez Luna [this message]
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: use dm timer framework for gpt timers Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: use omap mcbsp to enable mcbsp clocks Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: remove wdt3 from dsp control Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: dsp interface to enable ssi clocks Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: use one call for both ick and fck clocks Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: Move MCBSP_CLOCKS code to a common place Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: Balance the number of enable/disable Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: move clk to dsp-clock Omar Ramirez Luna
2010-04-28 1:29 ` [PATCH v2] DSPBRIDGE: reorganize the code to handle peripheral clocks Omar Ramirez Luna
2010-04-28 7:46 ` [PATCH v2] DSPBRIDGE: use dm timer framework for gpt timers Felipe Contreras
2010-04-28 14:15 ` Omar Ramirez Luna
2010-04-28 16:29 ` Kevin Hilman
2010-04-28 16:36 ` Nishanth Menon
2010-04-28 17:00 ` Omar Ramirez Luna
2010-04-28 17:11 ` Vladimir Pantelic
2010-04-28 17:22 ` Nishanth Menon
2010-04-28 17:59 ` Kevin Hilman
2010-04-28 18:56 ` Nishanth Menon
2010-04-28 19:52 ` Vladimir Pantelic
2010-04-28 19:57 ` Nishanth Menon
2010-04-28 20:50 ` Kevin Hilman
2010-04-29 13:40 ` Benoit Cousson
2010-04-29 14:12 ` Kevin Hilman
2010-04-28 17:02 ` Uribe de Leon, Armando
2010-04-28 17:04 ` Felipe Contreras
2010-04-28 1:34 ` [PATCH v2] generic clk module removal Nishanth Menon
2010-04-28 13:55 ` Omar Ramirez Luna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1272418167-12630-11-git-send-email-omar.ramirez@ti.com \
--to=omar.ramirez@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=ameya.palande@nokia.com \
--cc=felipe.contreras@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox