2 * TI DaVinci clock definitions
4 * Copyright (C) 2006-2007 Texas Instruments.
5 * Copyright (C) 2008-2009 Deep Root Systems, LLC
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #ifndef __ARCH_ARM_DAVINCI_CLOCK_H
13 #define __ARCH_ARM_DAVINCI_CLOCK_H
15 #define DAVINCI_PLL1_BASE 0x01c40800
16 #define DAVINCI_PLL2_BASE 0x01c40c00
19 /* PLL/Reset register offsets */
21 #define PLLCTL_PLLEN BIT(0)
22 #define PLLCTL_PLLPWRDN BIT(1)
23 #define PLLCTL_PLLRST BIT(3)
24 #define PLLCTL_PLLDIS BIT(4)
25 #define PLLCTL_PLLENSRC BIT(5)
26 #define PLLCTL_CLKMODE BIT(8)
29 #define PLLM_PLLM_MASK 0xff
39 #define PLLALNCTL 0x140
40 #define PLLDCHANGE 0x144
42 #define PLLCKSTAT 0x14c
43 #define PLLSYSTAT 0x150
50 #define PLLDIV_EN BIT(15)
51 #define PLLDIV_RATIO_MASK 0x1f
54 * OMAP-L138 system reference guide recommends a wait for 4 OSCIN/CLKIN
55 * cycles to ensure that the PLLC has switched to bypass mode. Delay of 1us
56 * ensures we are good for all > 4MHz OSCIN/CLKIN inputs. Typically the input
57 * is ~25MHz. Units are micro seconds.
59 #define PLL_BYPASS_TIME 1
60 /* From OMAP-L138 datasheet table 6-4. Units are micro seconds */
61 #define PLL_RESET_TIME 1
63 * From OMAP-L138 datasheet table 6-4; assuming prediv = 1, sqrt(pllm) = 4
64 * Units are micro seconds.
66 #define PLL_LOCK_TIME 20
70 #include <linux/list.h>
71 #include <linux/clkdev.h>
73 #define PLLSTAT_GOSTAT BIT(0)
74 #define PLLCMD_GOSET BIT(0)
84 #define PLL_HAS_PREDIV 0x01
85 #define PLL_HAS_POSTDIV 0x02
88 struct list_head node
;
92 unsigned long maxrate
; /* H/W supported max rate */
99 struct list_head children
; /* list of children */
100 struct list_head childnode
; /* parent's child list node */
101 struct pll_data
*pll_data
;
103 unsigned long (*recalc
) (struct clk
*);
104 int (*set_rate
) (struct clk
*clk
, unsigned long rate
);
105 int (*round_rate
) (struct clk
*clk
, unsigned long rate
);
106 int (*reset
) (struct clk
*clk
, bool reset
);
107 void (*clk_enable
) (struct clk
*clk
);
108 void (*clk_disable
) (struct clk
*clk
);
111 /* Clock flags: SoC-specific flags start at BIT(16) */
112 #define ALWAYS_ENABLED BIT(1)
113 #define CLK_PSC BIT(2)
114 #define CLK_PLL BIT(3) /* PLL-derived clock */
115 #define PRE_PLL BIT(4) /* source is before PLL mult/div */
116 #define PSC_SWRSTDISABLE BIT(5) /* Disable state is SwRstDisable */
117 #define PSC_FORCE BIT(6) /* Force module state transtition */
118 #define PSC_LRST BIT(8) /* Use local reset on enable/disable */
120 #define CLK(dev, con, ck) \
127 int davinci_clk_init(struct clk_lookup *clocks);
128 int davinci_set_pllrate(struct pll_data
*pll
, unsigned int prediv
,
129 unsigned int mult
, unsigned int postdiv
);
130 int davinci_set_sysclk_rate(struct clk
*clk
, unsigned long rate
);
131 int davinci_set_refclk_rate(unsigned long rate
);
132 int davinci_simple_set_rate(struct clk
*clk
, unsigned long rate
);
133 int davinci_clk_reset(struct clk
*clk
, bool reset
);
135 extern struct platform_device davinci_wdt_device
;
136 extern void davinci_watchdog_reset(struct platform_device
*);