2008-10-21 15:06:43 +02:00
|
|
|
/* linux/arch/arm/plat-s3c/include/plat/clock.h
|
2005-04-17 00:20:36 +02:00
|
|
|
*
|
|
|
|
* Copyright (c) 2004-2005 Simtec Electronics
|
|
|
|
* http://www.simtec.co.uk/products/SWLINUX/
|
|
|
|
* Written by Ben Dooks, <ben@simtec.co.uk>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2011-08-19 14:12:19 +02:00
|
|
|
#ifndef __ASM_PLAT_CLOCK_H
|
|
|
|
#define __ASM_PLAT_CLOCK_H __FILE__
|
|
|
|
|
2008-10-21 15:06:37 +02:00
|
|
|
#include <linux/spinlock.h>
|
2011-06-14 12:12:26 +02:00
|
|
|
#include <linux/clkdev.h>
|
2008-10-21 15:06:37 +02:00
|
|
|
|
2009-12-01 02:24:37 +01:00
|
|
|
struct clk;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct clk_ops - standard clock operations
|
|
|
|
* @set_rate: set the clock rate, see clk_set_rate().
|
|
|
|
* @get_rate: get the clock rate, see clk_get_rate().
|
|
|
|
* @round_rate: round a given clock rate, see clk_round_rate().
|
|
|
|
* @set_parent: set the clock's parent, see clk_set_parent().
|
|
|
|
*
|
|
|
|
* Group the common clock implementations together so that we
|
2011-03-31 03:57:33 +02:00
|
|
|
* don't have to keep setting the same fields again. We leave
|
2009-12-01 02:24:37 +01:00
|
|
|
* enable in struct clk.
|
|
|
|
*
|
|
|
|
* Adding an extra layer of indirection into the process should
|
|
|
|
* not be a problem as it is unlikely these operations are going
|
|
|
|
* to need to be called quickly.
|
|
|
|
*/
|
|
|
|
struct clk_ops {
|
|
|
|
int (*set_rate)(struct clk *c, unsigned long rate);
|
|
|
|
unsigned long (*get_rate)(struct clk *c);
|
|
|
|
unsigned long (*round_rate)(struct clk *c, unsigned long rate);
|
|
|
|
int (*set_parent)(struct clk *c, struct clk *parent);
|
|
|
|
};
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
struct clk {
|
|
|
|
struct list_head list;
|
|
|
|
struct module *owner;
|
|
|
|
struct clk *parent;
|
|
|
|
const char *name;
|
2011-06-14 12:12:26 +02:00
|
|
|
const char *devname;
|
2005-04-17 00:20:36 +02:00
|
|
|
int id;
|
2006-02-08 22:09:05 +01:00
|
|
|
int usage;
|
2005-04-17 00:20:36 +02:00
|
|
|
unsigned long rate;
|
|
|
|
unsigned long ctrlbit;
|
2006-03-20 18:10:04 +01:00
|
|
|
|
2009-12-01 02:24:37 +01:00
|
|
|
struct clk_ops *ops;
|
2005-04-17 00:20:36 +02:00
|
|
|
int (*enable)(struct clk *, int enable);
|
2011-06-14 12:12:26 +02:00
|
|
|
struct clk_lookup lookup;
|
2011-01-12 05:40:04 +01:00
|
|
|
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
|
|
|
|
struct dentry *dent; /* For visible tree hierarchy */
|
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* other clocks which may be registered by board support */
|
|
|
|
|
|
|
|
extern struct clk s3c24xx_dclk0;
|
|
|
|
extern struct clk s3c24xx_dclk1;
|
|
|
|
extern struct clk s3c24xx_clkout0;
|
|
|
|
extern struct clk s3c24xx_clkout1;
|
|
|
|
extern struct clk s3c24xx_uclk;
|
|
|
|
|
2006-03-20 22:00:48 +01:00
|
|
|
extern struct clk clk_usb_bus;
|
|
|
|
|
2006-06-22 23:18:20 +02:00
|
|
|
/* core clock support */
|
|
|
|
|
|
|
|
extern struct clk clk_f;
|
|
|
|
extern struct clk clk_h;
|
|
|
|
extern struct clk clk_p;
|
2006-06-24 22:21:29 +02:00
|
|
|
extern struct clk clk_mpll;
|
2006-06-22 23:18:20 +02:00
|
|
|
extern struct clk clk_upll;
|
2008-10-21 15:07:00 +02:00
|
|
|
extern struct clk clk_epll;
|
2006-06-24 22:21:29 +02:00
|
|
|
extern struct clk clk_xtal;
|
2008-10-21 15:07:00 +02:00
|
|
|
extern struct clk clk_ext;
|
|
|
|
|
2012-01-27 08:16:19 +01:00
|
|
|
/* S3C2443/S3C2416 specific clocks */
|
|
|
|
extern struct clksrc_clk clk_epllref;
|
|
|
|
extern struct clksrc_clk clk_esysclk;
|
|
|
|
|
2008-10-21 15:07:00 +02:00
|
|
|
/* S3C64XX specific clocks */
|
2009-03-05 04:43:13 +01:00
|
|
|
extern struct clk clk_h2;
|
2008-10-21 15:07:00 +02:00
|
|
|
extern struct clk clk_27m;
|
|
|
|
extern struct clk clk_48m;
|
2010-05-17 20:17:42 +02:00
|
|
|
extern struct clk clk_xusbxti;
|
2006-06-22 23:18:20 +02:00
|
|
|
|
2010-01-14 04:50:23 +01:00
|
|
|
extern int clk_default_setrate(struct clk *clk, unsigned long rate);
|
|
|
|
extern struct clk_ops clk_ops_def_setrate;
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* exports for arch/arm/mach-s3c2410
|
|
|
|
*
|
|
|
|
* Please DO NOT use these outside of arch/arm/mach-s3c2410
|
|
|
|
*/
|
|
|
|
|
2008-10-21 15:06:37 +02:00
|
|
|
extern spinlock_t clocks_lock;
|
2006-03-20 22:00:48 +01:00
|
|
|
|
2006-06-22 23:18:20 +02:00
|
|
|
extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
extern int s3c24xx_register_clock(struct clk *clk);
|
2007-04-20 12:15:27 +02:00
|
|
|
extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-01-05 17:21:38 +01:00
|
|
|
extern void s3c_register_clocks(struct clk *clk, int nr_clks);
|
2010-04-28 05:58:13 +02:00
|
|
|
extern void s3c_disable_clocks(struct clk *clkp, int nr_clks);
|
2010-01-05 17:21:38 +01:00
|
|
|
|
2008-10-21 15:06:38 +02:00
|
|
|
extern int s3c24xx_register_baseclocks(unsigned long xtal);
|
|
|
|
|
2010-01-14 00:13:37 +01:00
|
|
|
extern void s5p_register_clocks(unsigned long xtal_freq);
|
2008-10-21 15:07:00 +02:00
|
|
|
|
2008-10-21 15:06:38 +02:00
|
|
|
extern void s3c24xx_setup_clocks(unsigned long fclk,
|
|
|
|
unsigned long hclk,
|
|
|
|
unsigned long pclk);
|
|
|
|
|
|
|
|
extern void s3c2410_setup_clocks(void);
|
|
|
|
extern void s3c2412_setup_clocks(void);
|
|
|
|
extern void s3c244x_setup_clocks(void);
|
|
|
|
|
2012-01-27 08:22:57 +01:00
|
|
|
/* S3C2410 specific clock functions */
|
|
|
|
|
|
|
|
extern int s3c2410_baseclk_add(void);
|
|
|
|
|
2012-01-27 08:16:19 +01:00
|
|
|
/* S3C2443/S3C2416 specific clock functions */
|
|
|
|
|
|
|
|
typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base);
|
|
|
|
|
|
|
|
extern void s3c2443_common_setup_clocks(pll_fn get_mpll);
|
|
|
|
extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
|
|
|
|
unsigned int *divs, int nr_divs,
|
|
|
|
int divmask);
|
|
|
|
|
|
|
|
extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable);
|
|
|
|
extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);
|
|
|
|
extern int s3c2443_clkcon_enable_s(struct clk *clk, int enable);
|
|
|
|
|
2008-10-21 15:07:02 +02:00
|
|
|
/* S3C64XX specific functions and clocks */
|
|
|
|
|
|
|
|
extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
|
2008-11-21 11:36:05 +01:00
|
|
|
|
|
|
|
/* Init for pwm clock code */
|
|
|
|
|
|
|
|
extern void s3c_pwmclk_init(void);
|
|
|
|
|
2011-09-05 13:10:06 +02:00
|
|
|
/* Global watchdog clock used by arch_wtd_reset() callback */
|
|
|
|
|
|
|
|
extern struct clk *s3c2410_wdtclk;
|
2011-08-19 14:12:19 +02:00
|
|
|
|
|
|
|
#endif /* __ASM_PLAT_CLOCK_H */
|