aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-spear/include/plat
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-spear/include/plat')
-rw-r--r--arch/arm/plat-spear/include/plat/clock.h166
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-spear/include/plat/hardware.h23
-rw-r--r--arch/arm/plat-spear/include/plat/system.h4
-rw-r--r--arch/arm/plat-spear/include/plat/uncompress.h6
-rw-r--r--arch/arm/plat-spear/include/plat/vmalloc.h2
6 files changed, 174 insertions, 29 deletions
diff --git a/arch/arm/plat-spear/include/plat/clock.h b/arch/arm/plat-spear/include/plat/clock.h
index 2572260f990f..2ae6606930a6 100644
--- a/arch/arm/plat-spear/include/plat/clock.h
+++ b/arch/arm/plat-spear/include/plat/clock.h
@@ -21,6 +21,7 @@
21/* clk structure flags */ 21/* clk structure flags */
22#define ALWAYS_ENABLED (1 << 0) /* clock always enabled */ 22#define ALWAYS_ENABLED (1 << 0) /* clock always enabled */
23#define RESET_TO_ENABLE (1 << 1) /* reset register bit to enable clk */ 23#define RESET_TO_ENABLE (1 << 1) /* reset register bit to enable clk */
24#define ENABLED_ON_INIT (1 << 2) /* clocks enabled at init */
24 25
25/** 26/**
26 * struct clkops - clock operations 27 * struct clkops - clock operations
@@ -35,13 +36,11 @@ struct clkops {
35/** 36/**
36 * struct pclk_info - parents info 37 * struct pclk_info - parents info
37 * @pclk: pointer to parent clk 38 * @pclk: pointer to parent clk
38 * @pclk_mask: value to be written for selecting this parent 39 * @pclk_val: value to be written for selecting this parent
39 * @scalable: Is parent scalable (1 - YES, 0 - NO)
40 */ 40 */
41struct pclk_info { 41struct pclk_info {
42 struct clk *pclk; 42 struct clk *pclk;
43 u8 pclk_mask; 43 u8 pclk_val;
44 u8 scalable;
45}; 44};
46 45
47/** 46/**
@@ -54,11 +53,23 @@ struct pclk_info {
54struct pclk_sel { 53struct pclk_sel {
55 struct pclk_info *pclk_info; 54 struct pclk_info *pclk_info;
56 u8 pclk_count; 55 u8 pclk_count;
57 unsigned int *pclk_sel_reg; 56 void __iomem *pclk_sel_reg;
58 unsigned int pclk_sel_mask; 57 unsigned int pclk_sel_mask;
59}; 58};
60 59
61/** 60/**
61 * struct rate_config - clk rate configurations
62 * @tbls: array of device specific clk rate tables, in ascending order of rates
63 * @count: size of tbls array
64 * @default_index: default setting when originally disabled
65 */
66struct rate_config {
67 void *tbls;
68 u8 count;
69 u8 default_index;
70};
71
72/**
62 * struct clk - clock structure 73 * struct clk - clock structure
63 * @usage_count: num of users who enabled this clock 74 * @usage_count: num of users who enabled this clock
64 * @flags: flags for clock properties 75 * @flags: flags for clock properties
@@ -67,21 +78,32 @@ struct pclk_sel {
67 * @en_reg_bit: clk enable/disable bit 78 * @en_reg_bit: clk enable/disable bit
68 * @ops: clk enable/disable ops - generic_clkops selected if NULL 79 * @ops: clk enable/disable ops - generic_clkops selected if NULL
69 * @recalc: pointer to clock rate recalculate function 80 * @recalc: pointer to clock rate recalculate function
81 * @set_rate: pointer to clock set rate function
82 * @calc_rate: pointer to clock get rate function for index
83 * @rate_config: rate configuration information, used by set_rate
84 * @div_factor: division factor to parent clock.
70 * @pclk: current parent clk 85 * @pclk: current parent clk
71 * @pclk_sel: pointer to parent selection structure 86 * @pclk_sel: pointer to parent selection structure
72 * @pclk_sel_shift: register shift for selecting parent of this clock 87 * @pclk_sel_shift: register shift for selecting parent of this clock
73 * @children: list for childrens or this clock 88 * @children: list for childrens or this clock
74 * @sibling: node for list of clocks having same parents 89 * @sibling: node for list of clocks having same parents
75 * @private_data: clock specific private data 90 * @private_data: clock specific private data
91 * @node: list to maintain clocks linearly
92 * @cl: clocklook up assoicated with this clock
93 * @dent: object for debugfs
76 */ 94 */
77struct clk { 95struct clk {
78 unsigned int usage_count; 96 unsigned int usage_count;
79 unsigned int flags; 97 unsigned int flags;
80 unsigned long rate; 98 unsigned long rate;
81 unsigned int *en_reg; 99 void __iomem *en_reg;
82 u8 en_reg_bit; 100 u8 en_reg_bit;
83 const struct clkops *ops; 101 const struct clkops *ops;
84 void (*recalc) (struct clk *); 102 int (*recalc) (struct clk *);
103 int (*set_rate) (struct clk *, unsigned long rate);
104 unsigned long (*calc_rate)(struct clk *, int index);
105 struct rate_config rate_config;
106 unsigned int div_factor;
85 107
86 struct clk *pclk; 108 struct clk *pclk;
87 struct pclk_sel *pclk_sel; 109 struct pclk_sel *pclk_sel;
@@ -90,37 +112,137 @@ struct clk {
90 struct list_head children; 112 struct list_head children;
91 struct list_head sibling; 113 struct list_head sibling;
92 void *private_data; 114 void *private_data;
115#ifdef CONFIG_DEBUG_FS
116 struct list_head node;
117 struct clk_lookup *cl;
118 struct dentry *dent;
119#endif
93}; 120};
94 121
95/* pll configuration structure */ 122/* pll configuration structure */
123struct pll_clk_masks {
124 u32 mode_mask;
125 u32 mode_shift;
126
127 u32 norm_fdbk_m_mask;
128 u32 norm_fdbk_m_shift;
129 u32 dith_fdbk_m_mask;
130 u32 dith_fdbk_m_shift;
131 u32 div_p_mask;
132 u32 div_p_shift;
133 u32 div_n_mask;
134 u32 div_n_shift;
135};
136
96struct pll_clk_config { 137struct pll_clk_config {
97 unsigned int *mode_reg; 138 void __iomem *mode_reg;
98 unsigned int *cfg_reg; 139 void __iomem *cfg_reg;
140 struct pll_clk_masks *masks;
141};
142
143/* pll clk rate config structure */
144struct pll_rate_tbl {
145 u8 mode;
146 u16 m;
147 u8 n;
148 u8 p;
99}; 149};
100 150
101/* ahb and apb bus configuration structure */ 151/* ahb and apb bus configuration structure */
152struct bus_clk_masks {
153 u32 mask;
154 u32 shift;
155};
156
102struct bus_clk_config { 157struct bus_clk_config {
103 unsigned int *reg; 158 void __iomem *reg;
104 unsigned int mask; 159 struct bus_clk_masks *masks;
105 unsigned int shift; 160};
161
162/* ahb and apb clk bus rate config structure */
163struct bus_rate_tbl {
164 u8 div;
165};
166
167/* Aux clk configuration structure: applicable to UART and FIRDA */
168struct aux_clk_masks {
169 u32 eq_sel_mask;
170 u32 eq_sel_shift;
171 u32 eq1_mask;
172 u32 eq2_mask;
173 u32 xscale_sel_mask;
174 u32 xscale_sel_shift;
175 u32 yscale_sel_mask;
176 u32 yscale_sel_shift;
106}; 177};
107 178
108/*
109 * Aux clk configuration structure: applicable to GPT, UART and FIRDA
110 */
111struct aux_clk_config { 179struct aux_clk_config {
112 unsigned int *synth_reg; 180 void __iomem *synth_reg;
181 struct aux_clk_masks *masks;
182};
183
184/* aux clk rate config structure */
185struct aux_rate_tbl {
186 u16 xscale;
187 u16 yscale;
188 u8 eq;
189};
190
191/* GPT clk configuration structure */
192struct gpt_clk_masks {
193 u32 mscale_sel_mask;
194 u32 mscale_sel_shift;
195 u32 nscale_sel_mask;
196 u32 nscale_sel_shift;
197};
198
199struct gpt_clk_config {
200 void __iomem *synth_reg;
201 struct gpt_clk_masks *masks;
202};
203
204/* gpt clk rate config structure */
205struct gpt_rate_tbl {
206 u16 mscale;
207 u16 nscale;
208};
209
210/* clcd clk configuration structure */
211struct clcd_synth_masks {
212 u32 div_factor_mask;
213 u32 div_factor_shift;
214};
215
216struct clcd_clk_config {
217 void __iomem *synth_reg;
218 struct clcd_synth_masks *masks;
219};
220
221/* clcd clk rate config structure */
222struct clcd_rate_tbl {
223 u16 div;
113}; 224};
114 225
115/* platform specific clock functions */ 226/* platform specific clock functions */
116void clk_register(struct clk_lookup *cl); 227void clk_register(struct clk_lookup *cl);
117void recalc_root_clocks(void); 228void recalc_root_clocks(void);
118 229
119/* clock recalc functions */ 230/* clock recalc & set rate functions */
120void follow_parent(struct clk *clk); 231int follow_parent(struct clk *clk);
121void pll1_clk_recalc(struct clk *clk); 232unsigned long pll_calc_rate(struct clk *clk, int index);
122void bus_clk_recalc(struct clk *clk); 233int pll_clk_recalc(struct clk *clk);
123void gpt_clk_recalc(struct clk *clk); 234int pll_clk_set_rate(struct clk *clk, unsigned long desired_rate);
124void aux_clk_recalc(struct clk *clk); 235unsigned long bus_calc_rate(struct clk *clk, int index);
236int bus_clk_recalc(struct clk *clk);
237int bus_clk_set_rate(struct clk *clk, unsigned long desired_rate);
238unsigned long gpt_calc_rate(struct clk *clk, int index);
239int gpt_clk_recalc(struct clk *clk);
240int gpt_clk_set_rate(struct clk *clk, unsigned long desired_rate);
241unsigned long aux_calc_rate(struct clk *clk, int index);
242int aux_clk_recalc(struct clk *clk);
243int aux_clk_set_rate(struct clk *clk, unsigned long desired_rate);
244unsigned long clcd_calc_rate(struct clk *clk, int index);
245int clcd_clk_recalc(struct clk *clk);
246int clcd_clk_set_rate(struct clk *clk, unsigned long desired_rate);
125 247
126#endif /* __PLAT_CLOCK_H */ 248#endif /* __PLAT_CLOCK_H */
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index e91270e4f640..8501bbf2c092 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <linux/amba/serial.h> 14#include <linux/amba/serial.h>
15#include <mach/spear.h> 15#include <mach/hardware.h>
16 16
17 .macro addruart, rp, rv 17 .macro addruart, rp, rv
18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base 18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base
diff --git a/arch/arm/plat-spear/include/plat/hardware.h b/arch/arm/plat-spear/include/plat/hardware.h
new file mode 100644
index 000000000000..66d677225d15
--- /dev/null
+++ b/arch/arm/plat-spear/include/plat/hardware.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/plat-spear/include/plat/hardware.h
3 *
4 * Hardware definitions for SPEAr
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_HARDWARE_H
15#define __PLAT_HARDWARE_H
16
17#ifndef __ASSEMBLY__
18#define IOMEM(x) ((void __iomem __force *)(x))
19#else
20#define IOMEM(x) (x)
21#endif
22
23#endif /* __PLAT_HARDWARE_H */
diff --git a/arch/arm/plat-spear/include/plat/system.h b/arch/arm/plat-spear/include/plat/system.h
index 55a4e405d578..a235fa0ca777 100644
--- a/arch/arm/plat-spear/include/plat/system.h
+++ b/arch/arm/plat-spear/include/plat/system.h
@@ -14,9 +14,9 @@
14#ifndef __PLAT_SYSTEM_H 14#ifndef __PLAT_SYSTEM_H
15#define __PLAT_SYSTEM_H 15#define __PLAT_SYSTEM_H
16 16
17#include <asm/hardware/sp810.h>
18#include <linux/io.h> 17#include <linux/io.h>
19#include <mach/spear.h> 18#include <asm/hardware/sp810.h>
19#include <mach/hardware.h>
20 20
21static inline void arch_idle(void) 21static inline void arch_idle(void)
22{ 22{
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/plat-spear/include/plat/uncompress.h
index 99ba6789cc97..1bf84527aee4 100644
--- a/arch/arm/plat-spear/include/plat/uncompress.h
+++ b/arch/arm/plat-spear/include/plat/uncompress.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/amba/serial.h> 15#include <linux/amba/serial.h>
16#include <mach/spear.h> 16#include <mach/hardware.h>
17 17
18#ifndef __PLAT_UNCOMPRESS_H 18#ifndef __PLAT_UNCOMPRESS_H
19#define __PLAT_UNCOMPRESS_H 19#define __PLAT_UNCOMPRESS_H
@@ -24,10 +24,10 @@ static inline void putc(int c)
24{ 24{
25 void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE; 25 void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE;
26 26
27 while (readl(base + UART01x_FR) & UART01x_FR_TXFF) 27 while (readl_relaxed(base + UART01x_FR) & UART01x_FR_TXFF)
28 barrier(); 28 barrier();
29 29
30 writel(c, base + UART01x_DR); 30 writel_relaxed(c, base + UART01x_DR);
31} 31}
32 32
33static inline void flush(void) 33static inline void flush(void)
diff --git a/arch/arm/plat-spear/include/plat/vmalloc.h b/arch/arm/plat-spear/include/plat/vmalloc.h
index 09e9372aea21..8c8b24d07046 100644
--- a/arch/arm/plat-spear/include/plat/vmalloc.h
+++ b/arch/arm/plat-spear/include/plat/vmalloc.h
@@ -14,6 +14,6 @@
14#ifndef __PLAT_VMALLOC_H 14#ifndef __PLAT_VMALLOC_H
15#define __PLAT_VMALLOC_H 15#define __PLAT_VMALLOC_H
16 16
17#define VMALLOC_END 0xF0000000 17#define VMALLOC_END 0xF0000000UL
18 18
19#endif /* __PLAT_VMALLOC_H */ 19#endif /* __PLAT_VMALLOC_H */