1./arch/arm/mach-s3c2440/mach-smdk2440.c
s3c24xx_init_io()
2./arch/arm/plat-s3c24xx/cpu.c
s3c_init_cpu()
static struct cpu_table cpu_ids[] = {
{
.idcode = 0x32440000,
.idmask = 0xffffffff,
.map_io = s3c2440_map_io,
.init_clocks = s3c244x_init_clocks,
.init_uarts = s3c244x_init_uarts,
.init = s3c2440_init,
.name = name_s3c2440
},
};
3./arch/arm/plat-s3c24xx/clock.c
struct clk {
struct list_head list;
struct module *owner;
struct clk *parent;
const char *name;
int id;
int usage;
unsigned long rate;
unsigned long ctrlbit;
struct clk_ops *ops;
int (*enable)(struct clk *, int enable);
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
struct dentry *dent; /* For visible tree hierarchy */
#endif
};
4./arch/arm/mach-s3c2440/s3c244x.c s3c244x_init_clocks()
4.1/arch/arm/plat-s3c24xx/clock.c
s3c24xx_register_baseclocks()
s3c24xx_register_clock() struct clk实例(fclk,hclk,pclk)加入clocks链表
4.2/arch/arm/mach-s3c2440/s3c244x.c
s3c244x_setup_clocks() 设置struct clk实例(fclk,hclk,pclk)的rate
4.3/arch/arm/plat-s3c24xx/s3c2410-clock.c s3c2410_baseclk_add()
s3c24xx_register_clock() struct clk实例(nand,adc,i2c...)加入clocks链表,这些时钟都是fclk或hclk或pclk的子时
5.
struct clk *clk = clk_get(NULL, "i2c") 获取时钟
clk_enable(clk) 使能时钟
unsigned long clkin = clk_get_rate(clk) 获取时钟频率
unsigned long clk_get_rate(struct clk *clk)
{
if (IS_ERR(clk))
return 0;
if (clk->rate != 0)
return clk->rate; 获取时钟频率
if (clk->ops != NULL && clk->ops->get_rate != NULL)
return (clk->ops->get_rate)(clk);
if (clk->parent != NULL)
return clk_get_rate(clk->parent); 获取父节点时钟频率
return clk->rate;
}
clk_disable(clk) 关闭时钟
clk_put(clk) 释放时钟
阅读(1307) | 评论(0) | 转发(0) |