diff options
Diffstat (limited to 'arch/arm/plat-omap/include/plat')
-rw-r--r-- | arch/arm/plat-omap/include/plat/counter-32k.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/cpu.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/debug-devices.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/dmtimer.h | 143 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/i2c.h | 47 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/sram.h | 16 |
6 files changed, 138 insertions, 73 deletions
diff --git a/arch/arm/plat-omap/include/plat/counter-32k.h b/arch/arm/plat-omap/include/plat/counter-32k.h new file mode 100644 index 000000000000..da000d482ff2 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/counter-32k.h | |||
@@ -0,0 +1 @@ | |||
int omap_init_clocksource_32k(void __iomem *vbase); | |||
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h index ba542ec8d513..b4516aba67ed 100644 --- a/arch/arm/plat-omap/include/plat/cpu.h +++ b/arch/arm/plat-omap/include/plat/cpu.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #define __ASM_ARCH_OMAP_CPU_H | 29 | #define __ASM_ARCH_OMAP_CPU_H |
30 | 30 | ||
31 | #ifdef CONFIG_ARCH_OMAP1 | 31 | #ifdef CONFIG_ARCH_OMAP1 |
32 | #include "../../mach-omap1/soc.h" | 32 | #include <mach/soc.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifdef CONFIG_ARCH_OMAP2PLUS | 35 | #ifdef CONFIG_ARCH_OMAP2PLUS |
diff --git a/arch/arm/plat-omap/include/plat/debug-devices.h b/arch/arm/plat-omap/include/plat/debug-devices.h new file mode 100644 index 000000000000..8fc4287222dd --- /dev/null +++ b/arch/arm/plat-omap/include/plat/debug-devices.h | |||
@@ -0,0 +1,2 @@ | |||
1 | /* for TI reference platforms sharing the same debug card */ | ||
2 | extern int debug_card_init(u32 addr, unsigned gpio); | ||
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h index 85868e98c11c..a3fbc48c332e 100644 --- a/arch/arm/plat-omap/include/plat/dmtimer.h +++ b/arch/arm/plat-omap/include/plat/dmtimer.h | |||
@@ -32,7 +32,6 @@ | |||
32 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 32 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/clk.h> | ||
36 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
37 | #include <linux/io.h> | 36 | #include <linux/io.h> |
38 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
@@ -55,6 +54,10 @@ | |||
55 | #define OMAP_TIMER_TRIGGER_OVERFLOW 0x01 | 54 | #define OMAP_TIMER_TRIGGER_OVERFLOW 0x01 |
56 | #define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 | 55 | #define OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02 |
57 | 56 | ||
57 | /* posted mode types */ | ||
58 | #define OMAP_TIMER_NONPOSTED 0x00 | ||
59 | #define OMAP_TIMER_POSTED 0x01 | ||
60 | |||
58 | /* timer capabilities used in hwmod database */ | 61 | /* timer capabilities used in hwmod database */ |
59 | #define OMAP_TIMER_SECURE 0x80000000 | 62 | #define OMAP_TIMER_SECURE 0x80000000 |
60 | #define OMAP_TIMER_ALWON 0x40000000 | 63 | #define OMAP_TIMER_ALWON 0x40000000 |
@@ -62,16 +65,22 @@ | |||
62 | #define OMAP_TIMER_NEEDS_RESET 0x10000000 | 65 | #define OMAP_TIMER_NEEDS_RESET 0x10000000 |
63 | #define OMAP_TIMER_HAS_DSP_IRQ 0x08000000 | 66 | #define OMAP_TIMER_HAS_DSP_IRQ 0x08000000 |
64 | 67 | ||
68 | /* | ||
69 | * timer errata flags | ||
70 | * | ||
71 | * Errata i103/i767 impacts all OMAP3/4/5 devices including AM33xx. This | ||
72 | * errata prevents us from using posted mode on these devices, unless the | ||
73 | * timer counter register is never read. For more details please refer to | ||
74 | * the OMAP3/4/5 errata documents. | ||
75 | */ | ||
76 | #define OMAP_TIMER_ERRATA_I103_I767 0x80000000 | ||
77 | |||
65 | struct omap_timer_capability_dev_attr { | 78 | struct omap_timer_capability_dev_attr { |
66 | u32 timer_capability; | 79 | u32 timer_capability; |
67 | }; | 80 | }; |
68 | 81 | ||
69 | struct omap_dm_timer; | ||
70 | |||
71 | struct timer_regs { | 82 | struct timer_regs { |
72 | u32 tidr; | 83 | u32 tidr; |
73 | u32 tistat; | ||
74 | u32 tisr; | ||
75 | u32 tier; | 84 | u32 tier; |
76 | u32 twer; | 85 | u32 twer; |
77 | u32 tclr; | 86 | u32 tclr; |
@@ -90,15 +99,35 @@ struct timer_regs { | |||
90 | u32 towr; | 99 | u32 towr; |
91 | }; | 100 | }; |
92 | 101 | ||
93 | struct dmtimer_platform_data { | 102 | struct omap_dm_timer { |
94 | /* set_timer_src - Only used for OMAP1 devices */ | 103 | int id; |
95 | int (*set_timer_src)(struct platform_device *pdev, int source); | 104 | int irq; |
96 | u32 timer_capability; | 105 | struct clk *fclk; |
106 | |||
107 | void __iomem *io_base; | ||
108 | void __iomem *irq_stat; /* TISR/IRQSTATUS interrupt status */ | ||
109 | void __iomem *irq_ena; /* irq enable */ | ||
110 | void __iomem *irq_dis; /* irq disable, only on v2 ip */ | ||
111 | void __iomem *pend; /* write pending */ | ||
112 | void __iomem *func_base; /* function register base */ | ||
113 | |||
114 | unsigned long rate; | ||
115 | unsigned reserved:1; | ||
116 | unsigned posted:1; | ||
117 | struct timer_regs context; | ||
118 | int (*get_context_loss_count)(struct device *); | ||
119 | int ctx_loss_count; | ||
120 | int revision; | ||
121 | u32 capability; | ||
122 | u32 errata; | ||
123 | struct platform_device *pdev; | ||
124 | struct list_head node; | ||
97 | }; | 125 | }; |
98 | 126 | ||
99 | int omap_dm_timer_reserve_systimer(int id); | 127 | int omap_dm_timer_reserve_systimer(int id); |
100 | struct omap_dm_timer *omap_dm_timer_request(void); | 128 | struct omap_dm_timer *omap_dm_timer_request(void); |
101 | struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); | 129 | struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); |
130 | struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap); | ||
102 | int omap_dm_timer_free(struct omap_dm_timer *timer); | 131 | int omap_dm_timer_free(struct omap_dm_timer *timer); |
103 | void omap_dm_timer_enable(struct omap_dm_timer *timer); | 132 | void omap_dm_timer_enable(struct omap_dm_timer *timer); |
104 | void omap_dm_timer_disable(struct omap_dm_timer *timer); | 133 | void omap_dm_timer_disable(struct omap_dm_timer *timer); |
@@ -120,6 +149,7 @@ int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, i | |||
120 | int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); | 149 | int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); |
121 | 150 | ||
122 | int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); | 151 | int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); |
152 | int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask); | ||
123 | 153 | ||
124 | unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); | 154 | unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); |
125 | int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); | 155 | int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); |
@@ -245,33 +275,6 @@ int omap_dm_timers_active(void); | |||
245 | #define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \ | 275 | #define OMAP_TIMER_TICK_INT_MASK_COUNT_REG \ |
246 | (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT)) | 276 | (_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT)) |
247 | 277 | ||
248 | struct omap_dm_timer { | ||
249 | unsigned long phys_base; | ||
250 | int id; | ||
251 | int irq; | ||
252 | struct clk *fclk; | ||
253 | |||
254 | void __iomem *io_base; | ||
255 | void __iomem *sys_stat; /* TISTAT timer status */ | ||
256 | void __iomem *irq_stat; /* TISR/IRQSTATUS interrupt status */ | ||
257 | void __iomem *irq_ena; /* irq enable */ | ||
258 | void __iomem *irq_dis; /* irq disable, only on v2 ip */ | ||
259 | void __iomem *pend; /* write pending */ | ||
260 | void __iomem *func_base; /* function register base */ | ||
261 | |||
262 | unsigned long rate; | ||
263 | unsigned reserved:1; | ||
264 | unsigned posted:1; | ||
265 | struct timer_regs context; | ||
266 | int ctx_loss_count; | ||
267 | int revision; | ||
268 | u32 capability; | ||
269 | struct platform_device *pdev; | ||
270 | struct list_head node; | ||
271 | }; | ||
272 | |||
273 | int omap_dm_timer_prepare(struct omap_dm_timer *timer); | ||
274 | |||
275 | static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg, | 278 | static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg, |
276 | int posted) | 279 | int posted) |
277 | { | 280 | { |
@@ -300,16 +303,13 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer) | |||
300 | tidr = __raw_readl(timer->io_base); | 303 | tidr = __raw_readl(timer->io_base); |
301 | if (!(tidr >> 16)) { | 304 | if (!(tidr >> 16)) { |
302 | timer->revision = 1; | 305 | timer->revision = 1; |
303 | timer->sys_stat = timer->io_base + | ||
304 | OMAP_TIMER_V1_SYS_STAT_OFFSET; | ||
305 | timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; | 306 | timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; |
306 | timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; | 307 | timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; |
307 | timer->irq_dis = NULL; | 308 | timer->irq_dis = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; |
308 | timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; | 309 | timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; |
309 | timer->func_base = timer->io_base; | 310 | timer->func_base = timer->io_base; |
310 | } else { | 311 | } else { |
311 | timer->revision = 2; | 312 | timer->revision = 2; |
312 | timer->sys_stat = NULL; | ||
313 | timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS; | 313 | timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS; |
314 | timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET; | 314 | timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET; |
315 | timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR; | 315 | timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR; |
@@ -320,45 +320,44 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer) | |||
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | /* Assumes the source clock has been set by caller */ | 323 | /* |
324 | static inline void __omap_dm_timer_reset(struct omap_dm_timer *timer, | 324 | * __omap_dm_timer_enable_posted - enables write posted mode |
325 | int autoidle, int wakeup) | 325 | * @timer: pointer to timer instance handle |
326 | * | ||
327 | * Enables the write posted mode for the timer. When posted mode is enabled | ||
328 | * writes to certain timer registers are immediately acknowledged by the | ||
329 | * internal bus and hence prevents stalling the CPU waiting for the write to | ||
330 | * complete. Enabling this feature can improve performance for writing to the | ||
331 | * timer registers. | ||
332 | */ | ||
333 | static inline void __omap_dm_timer_enable_posted(struct omap_dm_timer *timer) | ||
326 | { | 334 | { |
327 | u32 l; | 335 | if (timer->posted) |
336 | return; | ||
328 | 337 | ||
329 | l = __raw_readl(timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET); | 338 | if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) |
330 | l |= 0x02 << 3; /* Set to smart-idle mode */ | 339 | return; |
331 | l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */ | ||
332 | 340 | ||
333 | if (autoidle) | ||
334 | l |= 0x1 << 0; | ||
335 | |||
336 | if (wakeup) | ||
337 | l |= 1 << 2; | ||
338 | |||
339 | __raw_writel(l, timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET); | ||
340 | |||
341 | /* Match hardware reset default of posted mode */ | ||
342 | __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, | 341 | __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, |
343 | OMAP_TIMER_CTRL_POSTED, 0); | 342 | OMAP_TIMER_CTRL_POSTED, 0); |
343 | timer->context.tsicr = OMAP_TIMER_CTRL_POSTED; | ||
344 | timer->posted = OMAP_TIMER_POSTED; | ||
344 | } | 345 | } |
345 | 346 | ||
346 | static inline int __omap_dm_timer_set_source(struct clk *timer_fck, | 347 | /** |
347 | struct clk *parent) | 348 | * __omap_dm_timer_override_errata - override errata flags for a timer |
349 | * @timer: pointer to timer handle | ||
350 | * @errata: errata flags to be ignored | ||
351 | * | ||
352 | * For a given timer, override a timer errata by clearing the flags | ||
353 | * specified by the errata argument. A specific erratum should only be | ||
354 | * overridden for a timer if the timer is used in such a way the erratum | ||
355 | * has no impact. | ||
356 | */ | ||
357 | static inline void __omap_dm_timer_override_errata(struct omap_dm_timer *timer, | ||
358 | u32 errata) | ||
348 | { | 359 | { |
349 | int ret; | 360 | timer->errata &= ~errata; |
350 | |||
351 | clk_disable(timer_fck); | ||
352 | ret = clk_set_parent(timer_fck, parent); | ||
353 | clk_enable(timer_fck); | ||
354 | |||
355 | /* | ||
356 | * When the functional clock disappears, too quick writes seem | ||
357 | * to cause an abort. XXX Is this still necessary? | ||
358 | */ | ||
359 | __delay(300000); | ||
360 | |||
361 | return ret; | ||
362 | } | 361 | } |
363 | 362 | ||
364 | static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer, | 363 | static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer, |
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h new file mode 100644 index 000000000000..7a9028cb5a75 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/i2c.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Helper module for board specific I2C bus registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
18 | * 02110-1301 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef __PLAT_OMAP_I2C_H | ||
23 | #define __PLAT_OMAP_I2C_H | ||
24 | |||
25 | struct i2c_board_info; | ||
26 | struct omap_i2c_bus_platform_data; | ||
27 | |||
28 | int omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata, | ||
29 | int bus_id); | ||
30 | |||
31 | #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) | ||
32 | extern int omap_register_i2c_bus(int bus_id, u32 clkrate, | ||
33 | struct i2c_board_info const *info, | ||
34 | unsigned len); | ||
35 | #else | ||
36 | static inline int omap_register_i2c_bus(int bus_id, u32 clkrate, | ||
37 | struct i2c_board_info const *info, | ||
38 | unsigned len) | ||
39 | { | ||
40 | return 0; | ||
41 | } | ||
42 | #endif | ||
43 | |||
44 | struct omap_hwmod; | ||
45 | int omap_i2c_reset(struct omap_hwmod *oh); | ||
46 | |||
47 | #endif /* __PLAT_OMAP_I2C_H */ | ||
diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h new file mode 100644 index 000000000000..ba4525059a99 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/sram.h | |||
@@ -0,0 +1,16 @@ | |||
1 | int omap_sram_init(void); | ||
2 | |||
3 | void omap_map_sram(unsigned long start, unsigned long size, | ||
4 | unsigned long skip, int cached); | ||
5 | void omap_sram_reset(void); | ||
6 | |||
7 | extern void *omap_sram_push_address(unsigned long size); | ||
8 | |||
9 | /* Macro to push a function to the internal SRAM, using the fncpy API */ | ||
10 | #define omap_sram_push(funcp, size) ({ \ | ||
11 | typeof(&(funcp)) _res = NULL; \ | ||
12 | void *_sram_address = omap_sram_push_address(size); \ | ||
13 | if (_sram_address) \ | ||
14 | _res = fncpy(_sram_address, &(funcp), size); \ | ||
15 | _res; \ | ||
16 | }) | ||