mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 01:22:07 +00:00
0a0300dc8c
Most machine classes want some way to register a block of clk_lookup structures, and most do it by implementing a clks_register() type function which walks an array, or by open-coding a loop. Consolidate all this into clkdev_add_table(). Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com> Acked-by: Eric Miao <eric.y.miao@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
71 lines
1.7 KiB
C
71 lines
1.7 KiB
C
/*
|
|
* 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.
|
|
*/
|
|
|
|
#include <asm/clkdev.h>
|
|
|
|
struct clkops {
|
|
void (*enable)(struct clk *);
|
|
void (*disable)(struct clk *);
|
|
unsigned long (*getrate)(struct clk *);
|
|
};
|
|
|
|
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;
|
|
extern struct clkops apmu_clk_ops;
|
|
|
|
#define APBC_CLK(_name, _reg, _fnclksel, _rate) \
|
|
struct clk clk_##_name = { \
|
|
.clk_rst = (void __iomem *)APBC_##_reg, \
|
|
.fnclksel = _fnclksel, \
|
|
.rate = _rate, \
|
|
.ops = &apbc_clk_ops, \
|
|
}
|
|
|
|
#define APBC_CLK_OPS(_name, _reg, _fnclksel, _rate, _ops) \
|
|
struct clk clk_##_name = { \
|
|
.clk_rst = (void __iomem *)APBC_##_reg, \
|
|
.fnclksel = _fnclksel, \
|
|
.rate = _rate, \
|
|
.ops = _ops, \
|
|
}
|
|
|
|
#define APMU_CLK(_name, _reg, _eval, _rate) \
|
|
struct clk clk_##_name = { \
|
|
.clk_rst = (void __iomem *)APMU_##_reg, \
|
|
.enable_val = _eval, \
|
|
.rate = _rate, \
|
|
.ops = &apmu_clk_ops, \
|
|
}
|
|
|
|
#define APMU_CLK_OPS(_name, _reg, _eval, _rate, _ops) \
|
|
struct clk clk_##_name = { \
|
|
.clk_rst = (void __iomem *)APMU_##_reg, \
|
|
.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;
|