Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249920
b: refs/heads/master
c: 7ff550d
h: refs/heads/master
v: v3
  • Loading branch information
Russell King committed May 23, 2011
1 parent 3281c16 commit 5815480
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 4 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: fb593cf38fc426331275d761fefe13096070f56a
refs/heads/master: 7ff550de99141cbd3be0129d563cc4554fdde9f6
39 changes: 38 additions & 1 deletion trunk/arch/arm/common/timer-sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/clk.h>
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/io.h>
Expand All @@ -32,8 +34,43 @@
#define TIMER_FREQ_KHZ (1000)
#define TIMER_RELOAD (TIMER_FREQ_KHZ * 1000 / HZ)

static long __init sp804_get_clock_rate(const char *name)
{
struct clk *clk;
long rate;
int err;

clk = clk_get_sys("sp804", name);
if (IS_ERR(clk)) {
pr_err("sp804: %s clock not found: %d\n", name,
(int)PTR_ERR(clk));
return PTR_ERR(clk);
}

err = clk_enable(clk);
if (err) {
pr_err("sp804: %s clock failed to enable: %d\n", name, err);
clk_put(clk);
return err;
}

rate = clk_get_rate(clk);
if (rate < 0) {
pr_err("sp804: %s clock failed to get rate: %ld\n", name, rate);
clk_disable(clk);
clk_put(clk);
}

return rate;
}

void __init sp804_clocksource_init(void __iomem *base, const char *name)
{
long rate = sp804_get_clock_rate(name);

if (rate < 0)
return;

/* setup timer 0 as free-running clocksource */
writel(0, base + TIMER_CTRL);
writel(0xffffffff, base + TIMER_LOAD);
Expand All @@ -42,7 +79,7 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name)
base + TIMER_CTRL);

clocksource_mmio_init(base + TIMER_VALUE, name,
TIMER_FREQ_KHZ * 1000, 200, 32, clocksource_mmio_readl_down);
rate, 200, 32, clocksource_mmio_readl_down);
}


Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/arm/mach-integrator/integrator_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,17 @@ static struct clk cp_auxclk = {
.vcoreg = CM_AUXOSC,
};

static struct clk sp804_clk = {
.rate = 1000000,
};

static struct clk_lookup cp_lookups[] = {
{ /* CLCD */
.dev_id = "mb:c0",
.clk = &cp_auxclk,
}, { /* SP804 timers */
.dev_id = "sp804",
.clk = &sp804_clk,
},
};

Expand Down
9 changes: 8 additions & 1 deletion trunk/arch/arm/mach-realview/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ static struct clk ref24_clk = {
.rate = 24000000,
};

static struct clk sp804_clk = {
.rate = 1000000,
};

static struct clk dummy_apb_pclk;

static struct clk_lookup lookups[] = {
Expand Down Expand Up @@ -357,7 +361,10 @@ static struct clk_lookup lookups[] = {
}, { /* SSP */
.dev_id = "dev:ssp0",
.clk = &ref24_clk,
}
}, { /* SP804 timers */
.dev_id = "sp804",
.clk = &sp804_clk,
},
};

void __init realview_init_early(void)
Expand Down
9 changes: 8 additions & 1 deletion trunk/arch/arm/mach-versatile/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ static struct clk ref24_clk = {
.rate = 24000000,
};

static struct clk sp804_clk = {
.rate = 1000000,
};

static struct clk dummy_apb_pclk;

static struct clk_lookup lookups[] = {
Expand Down Expand Up @@ -411,7 +415,10 @@ static struct clk_lookup lookups[] = {
}, { /* CLCD */
.dev_id = "dev:20",
.clk = &osc4_clk,
}
}, { /* SP804 timers */
.dev_id = "sp804",
.clk = &sp804_clk,
},
};

/*
Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/arm/mach-vexpress/ct-ca9x4.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,18 @@ static struct clk osc1_clk = {
.rate = 24000000,
};

static struct clk ct_sp804_clk = {
.rate = 1000000,
};

static struct clk_lookup lookups[] = {
{ /* CLCD */
.dev_id = "ct:clcd",
.clk = &osc1_clk,
}, { /* SP804 timers */
.dev_id = "sp804",
.con_id = "ct-timer1",
.clk = &ct_sp804_clk,
},
};

Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/arm/mach-vexpress/v2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ static struct clk osc2_clk = {
.rate = 24000000,
};

static struct clk v2m_sp804_clk = {
.rate = 1000000,
};

static struct clk dummy_apb_pclk;

static struct clk_lookup v2m_lookups[] = {
Expand Down Expand Up @@ -363,6 +367,10 @@ static struct clk_lookup v2m_lookups[] = {
}, { /* CLCD */
.dev_id = "mb:clcd",
.clk = &osc1_clk,
}, { /* SP804 timers */
.dev_id = "sp804",
.con_id = "v2m-timer1",
.clk = &v2m_sp804_clk,
},
};

Expand Down

0 comments on commit 5815480

Please sign in to comment.