Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 313375
b: refs/heads/master
c: 2b2d352
h: refs/heads/master
i:
  313373: bd5cd28
  313371: b5f9318
  313367: 4c6af9b
  313359: d401ff5
  313343: 63050c9
v: v3
  • Loading branch information
Jon Hunter authored and Tony Lindgren committed Jun 14, 2012
1 parent 9162441 commit 7d8f2d2
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 57 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bca4580845cbffb455d77783fc7e58a94b3904e0
refs/heads/master: 2b2d35230099613365ad6000f4d71086130b9e71
55 changes: 0 additions & 55 deletions trunk/arch/arm/mach-omap2/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,59 +389,6 @@ static void __init omap4_timer_init(void)
OMAP_SYS_TIMER(4)
#endif

/**
* omap2_dm_timer_set_src - change the timer input clock source
* @pdev: timer platform device pointer
* @source: array index of parent clock source
*/
static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
{
int ret;
struct clk *fclk, *parent;
char *parent_name = NULL;

fclk = clk_get(&pdev->dev, "fck");
if (IS_ERR_OR_NULL(fclk)) {
dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
__func__, __LINE__);
return -EINVAL;
}

switch (source) {
case OMAP_TIMER_SRC_SYS_CLK:
parent_name = "sys_ck";
break;

case OMAP_TIMER_SRC_32_KHZ:
parent_name = "32k_ck";
break;

case OMAP_TIMER_SRC_EXT_CLK:
parent_name = "alt_ck";
break;
}

parent = clk_get(&pdev->dev, parent_name);
if (IS_ERR_OR_NULL(parent)) {
dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
__func__, __LINE__, parent_name);
clk_put(fclk);
return -EINVAL;
}

ret = clk_set_parent(fclk, parent);
if (IS_ERR_VALUE(ret)) {
dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
__func__, parent_name);
ret = -EINVAL;
}

clk_put(parent);
clk_put(fclk);

return ret;
}

/**
* omap_timer_init - build and register timer device with an
* associated timer hwmod
Expand Down Expand Up @@ -489,8 +436,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
*/
sscanf(oh->name, "timer%2d", &id);

pdata->set_timer_src = omap2_dm_timer_set_src;

if (timer_dev_attr)
pdata->timer_capability = timer_dev_attr->timer_capability;

Expand Down
46 changes: 45 additions & 1 deletion trunk/arch/arm/plat-omap/dmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
{
int ret;
char *parent_name = NULL;
struct clk *fclk, *parent;
struct dmtimer_platform_data *pdata;

if (unlikely(!timer))
Expand All @@ -407,7 +409,49 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
if (source < 0 || source >= 3)
return -EINVAL;

ret = pdata->set_timer_src(timer->pdev, source);
/*
* FIXME: Used for OMAP1 devices only because they do not currently
* use the clock framework to set the parent clock. To be removed
* once OMAP1 migrated to using clock framework for dmtimers
*/
if (pdata->set_timer_src)
return pdata->set_timer_src(timer->pdev, source);

fclk = clk_get(&timer->pdev->dev, "fck");
if (IS_ERR_OR_NULL(fclk)) {
pr_err("%s: fck not found\n", __func__);
return -EINVAL;
}

switch (source) {
case OMAP_TIMER_SRC_SYS_CLK:
parent_name = "sys_ck";
break;

case OMAP_TIMER_SRC_32_KHZ:
parent_name = "32k_ck";
break;

case OMAP_TIMER_SRC_EXT_CLK:
parent_name = "alt_ck";
break;
}

parent = clk_get(&timer->pdev->dev, parent_name);
if (IS_ERR_OR_NULL(parent)) {
pr_err("%s: %s not found\n", __func__, parent_name);
ret = -EINVAL;
goto out;
}

ret = clk_set_parent(fclk, parent);
if (IS_ERR_VALUE(ret))
pr_err("%s: failed to set %s as parent\n", __func__,
parent_name);

clk_put(parent);
out:
clk_put(fclk);

return ret;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/plat-omap/include/plat/dmtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct timer_regs {
};

struct dmtimer_platform_data {
/* set_timer_src - Only used for OMAP1 devices */
int (*set_timer_src)(struct platform_device *pdev, int source);
u32 timer_capability;
};
Expand Down

0 comments on commit 7d8f2d2

Please sign in to comment.