2009-07-03 01:06:47 +07:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-nomadik/clock.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Alessandro Rubini
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/clk.h>
|
2010-11-17 16:04:33 +07:00
|
|
|
#include <linux/clkdev.h>
|
2009-07-03 01:06:47 +07:00
|
|
|
#include "clock.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The nomadik board uses generic clocks, but the serial pl011 file
|
|
|
|
* calls clk_enable(), clk_disable(), clk_get_rate(), so we provide them
|
|
|
|
*/
|
|
|
|
unsigned long clk_get_rate(struct clk *clk)
|
|
|
|
{
|
|
|
|
return clk->rate;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(clk_get_rate);
|
|
|
|
|
|
|
|
/* enable and disable do nothing */
|
|
|
|
int clk_enable(struct clk *clk)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(clk_enable);
|
|
|
|
|
|
|
|
void clk_disable(struct clk *clk)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(clk_disable);
|
|
|
|
|
2010-05-26 13:38:54 +07:00
|
|
|
static struct clk clk_24 = {
|
|
|
|
.rate = 2400000,
|
|
|
|
};
|
|
|
|
|
2010-05-06 16:47:25 +07:00
|
|
|
static struct clk clk_48 = {
|
|
|
|
.rate = 48 * 1000 * 1000,
|
|
|
|
};
|
|
|
|
|
2010-05-06 17:14:17 +07:00
|
|
|
/*
|
|
|
|
* Catch-all default clock to satisfy drivers using the clk API. We don't
|
|
|
|
* model the actual hardware clocks yet.
|
|
|
|
*/
|
|
|
|
static struct clk clk_default;
|
|
|
|
|
2010-05-06 16:47:25 +07:00
|
|
|
#define CLK(_clk, dev) \
|
|
|
|
{ \
|
|
|
|
.clk = _clk, \
|
|
|
|
.dev_id = dev, \
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct clk_lookup lookups[] = {
|
2010-07-15 17:01:17 +07:00
|
|
|
{
|
|
|
|
.con_id = "apb_pclk",
|
|
|
|
.clk = &clk_default,
|
|
|
|
},
|
2010-05-26 13:38:54 +07:00
|
|
|
CLK(&clk_24, "mtu0"),
|
|
|
|
CLK(&clk_24, "mtu1"),
|
2010-05-06 16:47:25 +07:00
|
|
|
CLK(&clk_48, "uart0"),
|
|
|
|
CLK(&clk_48, "uart1"),
|
2010-05-06 17:14:17 +07:00
|
|
|
CLK(&clk_default, "gpio.0"),
|
|
|
|
CLK(&clk_default, "gpio.1"),
|
|
|
|
CLK(&clk_default, "gpio.2"),
|
|
|
|
CLK(&clk_default, "gpio.3"),
|
2010-05-19 12:49:13 +07:00
|
|
|
CLK(&clk_default, "rng"),
|
2010-05-06 16:47:25 +07:00
|
|
|
};
|
2009-07-03 01:06:47 +07:00
|
|
|
|
2010-05-26 13:38:54 +07:00
|
|
|
int __init clk_init(void)
|
2010-05-06 16:47:25 +07:00
|
|
|
{
|
|
|
|
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
|
2009-07-03 01:06:47 +07:00
|
|
|
return 0;
|
|
|
|
}
|