2009-01-20 14:15:18 +08:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-mmp/clock.h
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2010-11-17 17:04:33 +08:00
|
|
|
#include <linux/clkdev.h>
|
2009-01-20 14:15:18 +08:00
|
|
|
|
|
|
|
struct clkops {
|
|
|
|
void (*enable)(struct clk *);
|
|
|
|
void (*disable)(struct clk *);
|
|
|
|
unsigned long (*getrate)(struct clk *);
|
2011-04-08 20:15:38 +08:00
|
|
|
int (*setrate)(struct clk *, unsigned long);
|
2009-01-20 14:15:18 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct clk {
|
|
|
|
const struct clkops *ops;
|
|
|
|
|
|
|
|
void __iomem *clk_rst; /* clock reset control register */
|
|
|
|
int fnclksel; /* functional clock select (APBC) */
|
|
|
|
uint32_t enable_val; /* value for clock enable (APMU) */
|
|
|
|
unsigned long rate;
|
|
|
|
int enabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct clkops apbc_clk_ops;
|
2009-09-10 14:01:22 +08:00
|
|
|
extern struct clkops apmu_clk_ops;
|
2009-01-20 14:15:18 +08:00
|
|
|
|
|
|
|
#define APBC_CLK(_name, _reg, _fnclksel, _rate) \
|
|
|
|
struct clk clk_##_name = { \
|
2011-10-02 04:03:45 +08:00
|
|
|
.clk_rst = APBC_##_reg, \
|
2009-01-20 14:15:18 +08:00
|
|
|
.fnclksel = _fnclksel, \
|
|
|
|
.rate = _rate, \
|
|
|
|
.ops = &apbc_clk_ops, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define APBC_CLK_OPS(_name, _reg, _fnclksel, _rate, _ops) \
|
|
|
|
struct clk clk_##_name = { \
|
2011-10-02 04:03:45 +08:00
|
|
|
.clk_rst = APBC_##_reg, \
|
2009-01-20 14:15:18 +08:00
|
|
|
.fnclksel = _fnclksel, \
|
|
|
|
.rate = _rate, \
|
|
|
|
.ops = _ops, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define APMU_CLK(_name, _reg, _eval, _rate) \
|
|
|
|
struct clk clk_##_name = { \
|
2011-10-02 04:03:45 +08:00
|
|
|
.clk_rst = APMU_##_reg, \
|
2009-01-20 14:15:18 +08:00
|
|
|
.enable_val = _eval, \
|
|
|
|
.rate = _rate, \
|
|
|
|
.ops = &apmu_clk_ops, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define APMU_CLK_OPS(_name, _reg, _eval, _rate, _ops) \
|
|
|
|
struct clk clk_##_name = { \
|
2011-10-02 04:03:45 +08:00
|
|
|
.clk_rst = APMU_##_reg, \
|
2009-01-20 14:15:18 +08:00
|
|
|
.enable_val = _eval, \
|
|
|
|
.rate = _rate, \
|
|
|
|
.ops = _ops, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define INIT_CLKREG(_clk, _devname, _conname) \
|
|
|
|
{ \
|
|
|
|
.clk = _clk, \
|
|
|
|
.dev_id = _devname, \
|
|
|
|
.con_id = _conname, \
|
|
|
|
}
|
|
|
|
|
|
|
|
extern struct clk clk_pxa168_gpio;
|
|
|
|
extern struct clk clk_pxa168_timers;
|