aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/include/plat/omap_hwmod.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/include/plat/omap_hwmod.h')
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h136
1 files changed, 100 insertions, 36 deletions
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 921990e2a29..440b4164f2f 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Paul Walmsley 5 * Paul Walmsley
6 * 6 *
7 * Created in collaboration with (alphabetical order): Benoit Cousson, 7 * Created in collaboration with (alphabetical order): Benoît Cousson,
8 * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari 8 * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari
9 * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff 9 * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff
10 * 10 *
@@ -33,25 +33,42 @@
33#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H 33#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H
34 34
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/list.h>
36#include <linux/ioport.h> 37#include <linux/ioport.h>
37
38#include <plat/cpu.h> 38#include <plat/cpu.h>
39 39
40struct omap_device; 40struct omap_device;
41 41
42/* OCP SYSCONFIG bit shifts/masks */ 42extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1;
43#define SYSC_MIDLEMODE_SHIFT 12 43extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2;
44#define SYSC_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT) 44
45#define SYSC_CLOCKACTIVITY_SHIFT 8 45/*
46#define SYSC_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT) 46 * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant
47#define SYSC_SIDLEMODE_SHIFT 3 47 * with the original PRCM protocol defined for OMAP2420
48#define SYSC_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT) 48 */
49#define SYSC_ENAWAKEUP_SHIFT 2 49#define SYSC_TYPE1_MIDLEMODE_SHIFT 12
50#define SYSC_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT) 50#define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT)
51#define SYSC_SOFTRESET_SHIFT 1 51#define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8
52#define SYSC_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT) 52#define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT)
53#define SYSC_AUTOIDLE_SHIFT 0 53#define SYSC_TYPE1_SIDLEMODE_SHIFT 3
54#define SYSC_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT) 54#define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT)
55#define SYSC_TYPE1_ENAWAKEUP_SHIFT 2
56#define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT)
57#define SYSC_TYPE1_SOFTRESET_SHIFT 1
58#define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT)
59#define SYSC_TYPE1_AUTOIDLE_SHIFT 0
60#define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT)
61
62/*
63 * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant
64 * with the new PRCM protocol defined for new OMAP4 IPs.
65 */
66#define SYSC_TYPE2_SOFTRESET_SHIFT 0
67#define SYSC_TYPE2_SOFTRESET_MASK (1 << SYSC_TYPE2_SOFTRESET_SHIFT)
68#define SYSC_TYPE2_SIDLEMODE_SHIFT 2
69#define SYSC_TYPE2_SIDLEMODE_MASK (0x3 << SYSC_TYPE2_SIDLEMODE_SHIFT)
70#define SYSC_TYPE2_MIDLEMODE_SHIFT 4
71#define SYSC_TYPE2_MIDLEMODE_MASK (0x3 << SYSC_TYPE2_MIDLEMODE_SHIFT)
55 72
56/* OCP SYSSTATUS bit shifts/masks */ 73/* OCP SYSSTATUS bit shifts/masks */
57#define SYSS_RESETDONE_SHIFT 0 74#define SYSS_RESETDONE_SHIFT 0
@@ -62,7 +79,6 @@ struct omap_device;
62#define HWMOD_IDLEMODE_NO (1 << 1) 79#define HWMOD_IDLEMODE_NO (1 << 1)
63#define HWMOD_IDLEMODE_SMART (1 << 2) 80#define HWMOD_IDLEMODE_SMART (1 << 2)
64 81
65
66/** 82/**
67 * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod 83 * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod
68 * @name: name of the IRQ channel (module local name) 84 * @name: name of the IRQ channel (module local name)
@@ -94,8 +110,7 @@ struct omap_hwmod_dma_info {
94/** 110/**
95 * struct omap_hwmod_opt_clk - optional clocks used by this hwmod 111 * struct omap_hwmod_opt_clk - optional clocks used by this hwmod
96 * @role: "sys", "32k", "tv", etc -- for use in clk_get() 112 * @role: "sys", "32k", "tv", etc -- for use in clk_get()
97 * @clkdev_dev_id: opt clock: clkdev dev_id string 113 * @clk: opt clock: OMAP clock name
98 * @clkdev_con_id: opt clock: clkdev con_id string
99 * @_clk: pointer to the struct clk (filled in at runtime) 114 * @_clk: pointer to the struct clk (filled in at runtime)
100 * 115 *
101 * The module's interface clock and main functional clock should not 116 * The module's interface clock and main functional clock should not
@@ -103,8 +118,7 @@ struct omap_hwmod_dma_info {
103 */ 118 */
104struct omap_hwmod_opt_clk { 119struct omap_hwmod_opt_clk {
105 const char *role; 120 const char *role;
106 const char *clkdev_dev_id; 121 const char *clk;
107 const char *clkdev_con_id;
108 struct clk *_clk; 122 struct clk *_clk;
109}; 123};
110 124
@@ -171,8 +185,7 @@ struct omap_hwmod_addr_space {
171 * @master: struct omap_hwmod that initiates OCP transactions on this link 185 * @master: struct omap_hwmod that initiates OCP transactions on this link
172 * @slave: struct omap_hwmod that responds to OCP transactions on this link 186 * @slave: struct omap_hwmod that responds to OCP transactions on this link
173 * @addr: address space associated with this link 187 * @addr: address space associated with this link
174 * @clkdev_dev_id: interface clock: clkdev dev_id string 188 * @clk: interface clock: OMAP clock name
175 * @clkdev_con_id: interface clock: clkdev con_id string
176 * @_clk: pointer to the interface struct clk (filled in at runtime) 189 * @_clk: pointer to the interface struct clk (filled in at runtime)
177 * @fw: interface firewall data 190 * @fw: interface firewall data
178 * @addr_cnt: ARRAY_SIZE(@addr) 191 * @addr_cnt: ARRAY_SIZE(@addr)
@@ -191,8 +204,7 @@ struct omap_hwmod_ocp_if {
191 struct omap_hwmod *master; 204 struct omap_hwmod *master;
192 struct omap_hwmod *slave; 205 struct omap_hwmod *slave;
193 struct omap_hwmod_addr_space *addr; 206 struct omap_hwmod_addr_space *addr;
194 const char *clkdev_dev_id; 207 const char *clk;
195 const char *clkdev_con_id;
196 struct clk *_clk; 208 struct clk *_clk;
197 union { 209 union {
198 struct omap_hwmod_omap2_firewall omap2; 210 struct omap_hwmod_omap2_firewall omap2;
@@ -236,7 +248,25 @@ struct omap_hwmod_ocp_if {
236#define CLOCKACT_TEST_NONE 0x3 248#define CLOCKACT_TEST_NONE 0x3
237 249
238/** 250/**
239 * struct omap_hwmod_sysconfig - hwmod OCP_SYSCONFIG/OCP_SYSSTATUS data 251 * struct omap_hwmod_sysc_fields - hwmod OCP_SYSCONFIG register field offsets.
252 * @midle_shift: Offset of the midle bit
253 * @clkact_shift: Offset of the clockactivity bit
254 * @sidle_shift: Offset of the sidle bit
255 * @enwkup_shift: Offset of the enawakeup bit
256 * @srst_shift: Offset of the softreset bit
257 * @autoidle_shift: Offset of the autoidle bit
258 */
259struct omap_hwmod_sysc_fields {
260 u8 midle_shift;
261 u8 clkact_shift;
262 u8 sidle_shift;
263 u8 enwkup_shift;
264 u8 srst_shift;
265 u8 autoidle_shift;
266};
267
268/**
269 * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data
240 * @rev_offs: IP block revision register offset (from module base addr) 270 * @rev_offs: IP block revision register offset (from module base addr)
241 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 271 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
242 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) 272 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr)
@@ -252,14 +282,22 @@ struct omap_hwmod_ocp_if {
252 * been associated with the clocks marked in @clockact. This field is 282 * been associated with the clocks marked in @clockact. This field is
253 * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) 283 * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below)
254 * 284 *
285 * @sysc_fields: structure containing the offset positions of various bits in
286 * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or
287 * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on
288 * whether the device ip is compliant with the original PRCM protocol
289 * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs.
290 * If the device follows a different scheme for the sysconfig register ,
291 * then this field has to be populated with the correct offset structure.
255 */ 292 */
256struct omap_hwmod_sysconfig { 293struct omap_hwmod_class_sysconfig {
257 u16 rev_offs; 294 u16 rev_offs;
258 u16 sysc_offs; 295 u16 sysc_offs;
259 u16 syss_offs; 296 u16 syss_offs;
260 u8 idlemodes; 297 u8 idlemodes;
261 u8 sysc_flags; 298 u8 sysc_flags;
262 u8 clockact; 299 u8 clockact;
300 struct omap_hwmod_sysc_fields *sysc_fields;
263}; 301};
264 302
265/** 303/**
@@ -352,19 +390,33 @@ struct omap_hwmod_omap4_prcm {
352#define _HWMOD_STATE_DISABLED 6 390#define _HWMOD_STATE_DISABLED 6
353 391
354/** 392/**
393 * struct omap_hwmod_class - the type of an IP block
394 * @name: name of the hwmod_class
395 * @sysc: device SYSCONFIG/SYSSTATUS register data
396 * @rev: revision of the IP class
397 *
398 * Represent the class of a OMAP hardware "modules" (e.g. timer,
399 * smartreflex, gpio, uart...)
400 */
401struct omap_hwmod_class {
402 const char *name;
403 struct omap_hwmod_class_sysconfig *sysc;
404 u32 rev;
405};
406
407/**
355 * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) 408 * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks)
356 * @name: name of the hwmod 409 * @name: name of the hwmod
410 * @class: struct omap_hwmod_class * to the class of this hwmod
357 * @od: struct omap_device currently associated with this hwmod (internal use) 411 * @od: struct omap_device currently associated with this hwmod (internal use)
358 * @mpu_irqs: ptr to an array of MPU IRQs (see also mpu_irqs_cnt) 412 * @mpu_irqs: ptr to an array of MPU IRQs (see also mpu_irqs_cnt)
359 * @sdma_chs: ptr to an array of SDMA channel IDs (see also sdma_chs_cnt) 413 * @sdma_chs: ptr to an array of SDMA channel IDs (see also sdma_chs_cnt)
360 * @prcm: PRCM data pertaining to this hwmod 414 * @prcm: PRCM data pertaining to this hwmod
361 * @clkdev_dev_id: main clock: clkdev dev_id string 415 * @main_clk: main clock: OMAP clock name
362 * @clkdev_con_id: main clock: clkdev con_id string
363 * @_clk: pointer to the main struct clk (filled in at runtime) 416 * @_clk: pointer to the main struct clk (filled in at runtime)
364 * @opt_clks: other device clocks that drivers can request (0..*) 417 * @opt_clks: other device clocks that drivers can request (0..*)
365 * @masters: ptr to array of OCP ifs that this hwmod can initiate on 418 * @masters: ptr to array of OCP ifs that this hwmod can initiate on
366 * @slaves: ptr to array of OCP ifs that this hwmod can respond on 419 * @slaves: ptr to array of OCP ifs that this hwmod can respond on
367 * @sysconfig: device SYSCONFIG/SYSSTATUS register data
368 * @dev_attr: arbitrary device attributes that can be passed to the driver 420 * @dev_attr: arbitrary device attributes that can be passed to the driver
369 * @_sysc_cache: internal-use hwmod flags 421 * @_sysc_cache: internal-use hwmod flags
370 * @_rt_va: cached register target start address (internal use) 422 * @_rt_va: cached register target start address (internal use)
@@ -383,16 +435,17 @@ struct omap_hwmod_omap4_prcm {
383 * @omap_chip: OMAP chips this hwmod is present on 435 * @omap_chip: OMAP chips this hwmod is present on
384 * @node: list node for hwmod list (internal use) 436 * @node: list node for hwmod list (internal use)
385 * 437 *
386 * @clkdev_dev_id, @clkdev_con_id, and @clk all refer to this module's "main 438 * @main_clk refers to this module's "main clock," which for our
387 * clock," which for our purposes is defined as "the functional clock needed 439 * purposes is defined as "the functional clock needed for register
388 * for register accesses to complete." Modules may not have a main clock if 440 * accesses to complete." Modules may not have a main clock if the
389 * the interface clock also serves as a main clock. 441 * interface clock also serves as a main clock.
390 * 442 *
391 * Parameter names beginning with an underscore are managed internally by 443 * Parameter names beginning with an underscore are managed internally by
392 * the omap_hwmod code and should not be set during initialization. 444 * the omap_hwmod code and should not be set during initialization.
393 */ 445 */
394struct omap_hwmod { 446struct omap_hwmod {
395 const char *name; 447 const char *name;
448 struct omap_hwmod_class *class;
396 struct omap_device *od; 449 struct omap_device *od;
397 struct omap_hwmod_irq_info *mpu_irqs; 450 struct omap_hwmod_irq_info *mpu_irqs;
398 struct omap_hwmod_dma_info *sdma_chs; 451 struct omap_hwmod_dma_info *sdma_chs;
@@ -400,13 +453,11 @@ struct omap_hwmod {
400 struct omap_hwmod_omap2_prcm omap2; 453 struct omap_hwmod_omap2_prcm omap2;
401 struct omap_hwmod_omap4_prcm omap4; 454 struct omap_hwmod_omap4_prcm omap4;
402 } prcm; 455 } prcm;
403 const char *clkdev_dev_id; 456 const char *main_clk;
404 const char *clkdev_con_id;
405 struct clk *_clk; 457 struct clk *_clk;
406 struct omap_hwmod_opt_clk *opt_clks; 458 struct omap_hwmod_opt_clk *opt_clks;
407 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 459 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
408 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 460 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */
409 struct omap_hwmod_sysconfig *sysconfig;
410 void *dev_attr; 461 void *dev_attr;
411 u32 _sysc_cache; 462 u32 _sysc_cache;
412 void __iomem *_rt_va; 463 void __iomem *_rt_va;
@@ -467,4 +518,17 @@ int omap_hwmod_set_clockact_none(struct omap_hwmod *oh);
467int omap_hwmod_enable_wakeup(struct omap_hwmod *oh); 518int omap_hwmod_enable_wakeup(struct omap_hwmod *oh);
468int omap_hwmod_disable_wakeup(struct omap_hwmod *oh); 519int omap_hwmod_disable_wakeup(struct omap_hwmod *oh);
469 520
521int omap_hwmod_for_each_by_class(const char *classname,
522 int (*fn)(struct omap_hwmod *oh,
523 void *user),
524 void *user);
525
526/*
527 * Chip variant-specific hwmod init routines - XXX should be converted
528 * to use initcalls once the initial boot ordering is straightened out
529 */
530extern int omap2420_hwmod_init(void);
531extern int omap2430_hwmod_init(void);
532extern int omap3xxx_hwmod_init(void);
533
470#endif 534#endif