Commit 67d2e760 authored by Jon Hunter's avatar Jon Hunter Committed by Tony Lindgren

ARM: OMAP2+: Fix external clock support for dmtimers

Currently, the dmtimer determines whether an timer can support an external
clock source (sys_altclk) for driving the timer by the IP version. Only
OMAP24xx devices can support an external clock source, but the IP version
between OMAP24xx and OMAP3xxx is common and so this incorrectly indicates
that OMAP3 devices can use an external clock source.

Rather than use the IP version, just let the clock framework handle this.
If the "alt_ck" does not exist for a timer then the clock framework will fail
to find the clock and hence will return an error. By doing this we can eliminate
the "timer_ip_version" variable passed as part of the platform data and simplify
the code.

We can also remove the timer IP version from the HWMOD data because the dmtimer
driver uses the TIDR register to determine the IP version.
Signed-off-by: default avatarJon Hunter <jon-hunter@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 139486fa
...@@ -68,7 +68,6 @@ static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = { ...@@ -68,7 +68,6 @@ static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = {
struct omap_hwmod_class omap2xxx_timer_hwmod_class = { struct omap_hwmod_class omap2xxx_timer_hwmod_class = {
.name = "timer", .name = "timer",
.sysc = &omap2xxx_timer_sysc, .sysc = &omap2xxx_timer_sysc,
.rev = OMAP_TIMER_IP_VERSION_1,
}; };
/* /*
......
...@@ -129,7 +129,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = { ...@@ -129,7 +129,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {
static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = { static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = {
.name = "timer", .name = "timer",
.sysc = &omap3xxx_timer_1ms_sysc, .sysc = &omap3xxx_timer_1ms_sysc,
.rev = OMAP_TIMER_IP_VERSION_1,
}; };
static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = { static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
...@@ -145,7 +144,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = { ...@@ -145,7 +144,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
static struct omap_hwmod_class omap3xxx_timer_hwmod_class = { static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
.name = "timer", .name = "timer",
.sysc = &omap3xxx_timer_sysc, .sysc = &omap3xxx_timer_sysc,
.rev = OMAP_TIMER_IP_VERSION_1,
}; };
/* secure timers dev attribute */ /* secure timers dev attribute */
......
...@@ -397,7 +397,6 @@ OMAP_SYS_TIMER(4) ...@@ -397,7 +397,6 @@ OMAP_SYS_TIMER(4)
static int omap2_dm_timer_set_src(struct platform_device *pdev, int source) static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
{ {
int ret; int ret;
struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
struct clk *fclk, *parent; struct clk *fclk, *parent;
char *parent_name = NULL; char *parent_name = NULL;
...@@ -418,14 +417,8 @@ static int omap2_dm_timer_set_src(struct platform_device *pdev, int source) ...@@ -418,14 +417,8 @@ static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
break; break;
case OMAP_TIMER_SRC_EXT_CLK: case OMAP_TIMER_SRC_EXT_CLK:
if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) { parent_name = "alt_ck";
parent_name = "alt_ck"; break;
break;
}
dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
__func__, __LINE__);
clk_put(fclk);
return -EINVAL;
} }
parent = clk_get(&pdev->dev, parent_name); parent = clk_get(&pdev->dev, parent_name);
...@@ -498,7 +491,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused) ...@@ -498,7 +491,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
sscanf(oh->name, "timer%2d", &id); sscanf(oh->name, "timer%2d", &id);
pdata->set_timer_src = omap2_dm_timer_set_src; pdata->set_timer_src = omap2_dm_timer_set_src;
pdata->timer_ip_version = oh->class->rev;
if (timer_dev_attr) if (timer_dev_attr)
pdata->timer_capability = timer_dev_attr->timer_capability; pdata->timer_capability = timer_dev_attr->timer_capability;
......
...@@ -55,12 +55,6 @@ ...@@ -55,12 +55,6 @@
#define OMAP_TIMER_TRIGGER_OVERFLOW 0x01 #define OMAP_TIMER_TRIGGER_OVERFLOW 0x01
#define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 #define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02
/*
* IP revision identifier so that Highlander IP
* in OMAP4 can be distinguished.
*/
#define OMAP_TIMER_IP_VERSION_1 0x1
/* timer capabilities used in hwmod database */ /* timer capabilities used in hwmod database */
#define OMAP_TIMER_SECURE 0x80000000 #define OMAP_TIMER_SECURE 0x80000000
#define OMAP_TIMER_ALWON 0x40000000 #define OMAP_TIMER_ALWON 0x40000000
...@@ -96,7 +90,6 @@ struct timer_regs { ...@@ -96,7 +90,6 @@ struct timer_regs {
struct dmtimer_platform_data { struct dmtimer_platform_data {
int (*set_timer_src)(struct platform_device *pdev, int source); int (*set_timer_src)(struct platform_device *pdev, int source);
int timer_ip_version;
u32 needs_manual_reset:1; u32 needs_manual_reset:1;
bool loses_context; bool loses_context;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment