OMAP: voltage: move plat/voltage.h to mach-omap2/voltage.h
[pandora-kernel.git] / arch / arm / plat-omap / include / plat / omap_hwmod.h
1 /*
2  * omap_hwmod macros, structures
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation
5  * Paul Walmsley
6  *
7  * Created in collaboration with (alphabetical order): BenoĆ®t Cousson,
8  * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari
9  * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2 as
13  * published by the Free Software Foundation.
14  *
15  * These headers and macros are used to define OMAP on-chip module
16  * data and their integration with other OMAP modules and Linux.
17  * Copious documentation and references can also be found in the
18  * omap_hwmod code, in arch/arm/mach-omap2/omap_hwmod.c (as of this
19  * writing).
20  *
21  * To do:
22  * - add interconnect error log structures
23  * - add pinmuxing
24  * - init_conn_id_bit (CONNID_BIT_VECTOR)
25  * - implement default hwmod SMS/SDRC flags?
26  * - move Linux-specific data ("non-ROM data") out
27  *
28  */
29 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H
30 #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H
31
32 #include <linux/kernel.h>
33 #include <linux/list.h>
34 #include <linux/ioport.h>
35 #include <linux/spinlock.h>
36 #include <plat/cpu.h>
37
38 struct omap_device;
39
40 extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1;
41 extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2;
42
43 /*
44  * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant
45  * with the original PRCM protocol defined for OMAP2420
46  */
47 #define SYSC_TYPE1_MIDLEMODE_SHIFT      12
48 #define SYSC_TYPE1_MIDLEMODE_MASK       (0x3 << SYSC_MIDLEMODE_SHIFT)
49 #define SYSC_TYPE1_CLOCKACTIVITY_SHIFT  8
50 #define SYSC_TYPE1_CLOCKACTIVITY_MASK   (0x3 << SYSC_CLOCKACTIVITY_SHIFT)
51 #define SYSC_TYPE1_SIDLEMODE_SHIFT      3
52 #define SYSC_TYPE1_SIDLEMODE_MASK       (0x3 << SYSC_SIDLEMODE_SHIFT)
53 #define SYSC_TYPE1_ENAWAKEUP_SHIFT      2
54 #define SYSC_TYPE1_ENAWAKEUP_MASK       (1 << SYSC_ENAWAKEUP_SHIFT)
55 #define SYSC_TYPE1_SOFTRESET_SHIFT      1
56 #define SYSC_TYPE1_SOFTRESET_MASK       (1 << SYSC_SOFTRESET_SHIFT)
57 #define SYSC_TYPE1_AUTOIDLE_SHIFT       0
58 #define SYSC_TYPE1_AUTOIDLE_MASK        (1 << SYSC_AUTOIDLE_SHIFT)
59
60 /*
61  * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant
62  * with the new PRCM protocol defined for new OMAP4 IPs.
63  */
64 #define SYSC_TYPE2_SOFTRESET_SHIFT      0
65 #define SYSC_TYPE2_SOFTRESET_MASK       (1 << SYSC_TYPE2_SOFTRESET_SHIFT)
66 #define SYSC_TYPE2_SIDLEMODE_SHIFT      2
67 #define SYSC_TYPE2_SIDLEMODE_MASK       (0x3 << SYSC_TYPE2_SIDLEMODE_SHIFT)
68 #define SYSC_TYPE2_MIDLEMODE_SHIFT      4
69 #define SYSC_TYPE2_MIDLEMODE_MASK       (0x3 << SYSC_TYPE2_MIDLEMODE_SHIFT)
70
71 /* OCP SYSSTATUS bit shifts/masks */
72 #define SYSS_RESETDONE_SHIFT            0
73 #define SYSS_RESETDONE_MASK             (1 << SYSS_RESETDONE_SHIFT)
74
75 /* Master standby/slave idle mode flags */
76 #define HWMOD_IDLEMODE_FORCE            (1 << 0)
77 #define HWMOD_IDLEMODE_NO               (1 << 1)
78 #define HWMOD_IDLEMODE_SMART            (1 << 2)
79 /* Slave idle mode flag only */
80 #define HWMOD_IDLEMODE_SMART_WKUP       (1 << 3)
81
82 /**
83  * struct omap_hwmod_mux_info - hwmod specific mux configuration
84  * @pads:              array of omap_device_pad entries
85  * @nr_pads:           number of omap_device_pad entries
86  *
87  * Note that this is currently built during init as needed.
88  */
89 struct omap_hwmod_mux_info {
90         int                             nr_pads;
91         struct omap_device_pad          *pads;
92 };
93
94 /**
95  * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod
96  * @name: name of the IRQ channel (module local name)
97  * @irq_ch: IRQ channel ID
98  *
99  * @name should be something short, e.g., "tx" or "rx".  It is for use
100  * by platform_get_resource_byname().  It is defined locally to the
101  * hwmod.
102  */
103 struct omap_hwmod_irq_info {
104         const char      *name;
105         u16             irq;
106 };
107
108 /**
109  * struct omap_hwmod_dma_info - DMA channels used by the hwmod
110  * @name: name of the DMA channel (module local name)
111  * @dma_req: DMA request ID
112  *
113  * @name should be something short, e.g., "tx" or "rx".  It is for use
114  * by platform_get_resource_byname().  It is defined locally to the
115  * hwmod.
116  */
117 struct omap_hwmod_dma_info {
118         const char      *name;
119         u16             dma_req;
120 };
121
122 /**
123  * struct omap_hwmod_rst_info - IPs reset lines use by hwmod
124  * @name: name of the reset line (module local name)
125  * @rst_shift: Offset of the reset bit
126  *
127  * @name should be something short, e.g., "cpu0" or "rst". It is defined
128  * locally to the hwmod.
129  */
130 struct omap_hwmod_rst_info {
131         const char      *name;
132         u8              rst_shift;
133 };
134
135 /**
136  * struct omap_hwmod_opt_clk - optional clocks used by this hwmod
137  * @role: "sys", "32k", "tv", etc -- for use in clk_get()
138  * @clk: opt clock: OMAP clock name
139  * @_clk: pointer to the struct clk (filled in at runtime)
140  *
141  * The module's interface clock and main functional clock should not
142  * be added as optional clocks.
143  */
144 struct omap_hwmod_opt_clk {
145         const char      *role;
146         const char      *clk;
147         struct clk      *_clk;
148 };
149
150
151 /* omap_hwmod_omap2_firewall.flags bits */
152 #define OMAP_FIREWALL_L3                (1 << 0)
153 #define OMAP_FIREWALL_L4                (1 << 1)
154
155 /**
156  * struct omap_hwmod_omap2_firewall - OMAP2/3 device firewall data
157  * @l3_perm_bit: bit shift for L3_PM_*_PERMISSION_*
158  * @l4_fw_region: L4 firewall region ID
159  * @l4_prot_group: L4 protection group ID
160  * @flags: (see omap_hwmod_omap2_firewall.flags macros above)
161  */
162 struct omap_hwmod_omap2_firewall {
163         u8 l3_perm_bit;
164         u8 l4_fw_region;
165         u8 l4_prot_group;
166         u8 flags;
167 };
168
169
170 /*
171  * omap_hwmod_addr_space.flags bits
172  *
173  * ADDR_MAP_ON_INIT: Map this address space during omap_hwmod init.
174  * ADDR_TYPE_RT: Address space contains module register target data.
175  */
176 #define ADDR_MAP_ON_INIT        (1 << 0)        /* XXX does not belong */
177 #define ADDR_TYPE_RT            (1 << 1)
178
179 /**
180  * struct omap_hwmod_addr_space - MPU address space handled by the hwmod
181  * @pa_start: starting physical address
182  * @pa_end: ending physical address
183  * @flags: (see omap_hwmod_addr_space.flags macros above)
184  *
185  * Address space doesn't necessarily follow physical interconnect
186  * structure.  GPMC is one example.
187  */
188 struct omap_hwmod_addr_space {
189         u32 pa_start;
190         u32 pa_end;
191         u8 flags;
192 };
193
194
195 /*
196  * omap_hwmod_ocp_if.user bits: these indicate the initiators that use this
197  * interface to interact with the hwmod.  Used to add sleep dependencies
198  * when the module is enabled or disabled.
199  */
200 #define OCP_USER_MPU                    (1 << 0)
201 #define OCP_USER_SDMA                   (1 << 1)
202
203 /* omap_hwmod_ocp_if.flags bits */
204 #define OCPIF_SWSUP_IDLE                (1 << 0)
205 #define OCPIF_CAN_BURST                 (1 << 1)
206
207 /**
208  * struct omap_hwmod_ocp_if - OCP interface data
209  * @master: struct omap_hwmod that initiates OCP transactions on this link
210  * @slave: struct omap_hwmod that responds to OCP transactions on this link
211  * @addr: address space associated with this link
212  * @clk: interface clock: OMAP clock name
213  * @_clk: pointer to the interface struct clk (filled in at runtime)
214  * @fw: interface firewall data
215  * @addr_cnt: ARRAY_SIZE(@addr)
216  * @width: OCP data width
217  * @user: initiators using this interface (see OCP_USER_* macros above)
218  * @flags: OCP interface flags (see OCPIF_* macros above)
219  *
220  * It may also be useful to add a tag_cnt field for OCP2.x devices.
221  *
222  * Parameter names beginning with an underscore are managed internally by
223  * the omap_hwmod code and should not be set during initialization.
224  */
225 struct omap_hwmod_ocp_if {
226         struct omap_hwmod               *master;
227         struct omap_hwmod               *slave;
228         struct omap_hwmod_addr_space    *addr;
229         const char                      *clk;
230         struct clk                      *_clk;
231         union {
232                 struct omap_hwmod_omap2_firewall omap2;
233         }                               fw;
234         u8                              addr_cnt;
235         u8                              width;
236         u8                              user;
237         u8                              flags;
238 };
239
240
241 /* Macros for use in struct omap_hwmod_sysconfig */
242
243 /* Flags for use in omap_hwmod_sysconfig.idlemodes */
244 #define MASTER_STANDBY_SHIFT    4
245 #define SLAVE_IDLE_SHIFT        0
246 #define SIDLE_FORCE             (HWMOD_IDLEMODE_FORCE << SLAVE_IDLE_SHIFT)
247 #define SIDLE_NO                (HWMOD_IDLEMODE_NO << SLAVE_IDLE_SHIFT)
248 #define SIDLE_SMART             (HWMOD_IDLEMODE_SMART << SLAVE_IDLE_SHIFT)
249 #define SIDLE_SMART_WKUP        (HWMOD_IDLEMODE_SMART_WKUP << SLAVE_IDLE_SHIFT)
250 #define MSTANDBY_FORCE          (HWMOD_IDLEMODE_FORCE << MASTER_STANDBY_SHIFT)
251 #define MSTANDBY_NO             (HWMOD_IDLEMODE_NO << MASTER_STANDBY_SHIFT)
252 #define MSTANDBY_SMART          (HWMOD_IDLEMODE_SMART << MASTER_STANDBY_SHIFT)
253
254 /* omap_hwmod_sysconfig.sysc_flags capability flags */
255 #define SYSC_HAS_AUTOIDLE       (1 << 0)
256 #define SYSC_HAS_SOFTRESET      (1 << 1)
257 #define SYSC_HAS_ENAWAKEUP      (1 << 2)
258 #define SYSC_HAS_EMUFREE        (1 << 3)
259 #define SYSC_HAS_CLOCKACTIVITY  (1 << 4)
260 #define SYSC_HAS_SIDLEMODE      (1 << 5)
261 #define SYSC_HAS_MIDLEMODE      (1 << 6)
262 #define SYSS_HAS_RESET_STATUS   (1 << 7)
263 #define SYSC_NO_CACHE           (1 << 8)  /* XXX SW flag, belongs elsewhere */
264 #define SYSC_HAS_RESET_STATUS   (1 << 9)
265
266 /* omap_hwmod_sysconfig.clockact flags */
267 #define CLOCKACT_TEST_BOTH      0x0
268 #define CLOCKACT_TEST_MAIN      0x1
269 #define CLOCKACT_TEST_ICLK      0x2
270 #define CLOCKACT_TEST_NONE      0x3
271
272 /**
273  * struct omap_hwmod_sysc_fields - hwmod OCP_SYSCONFIG register field offsets.
274  * @midle_shift: Offset of the midle bit
275  * @clkact_shift: Offset of the clockactivity bit
276  * @sidle_shift: Offset of the sidle bit
277  * @enwkup_shift: Offset of the enawakeup bit
278  * @srst_shift: Offset of the softreset bit
279  * @autoidle_shift: Offset of the autoidle bit
280  */
281 struct omap_hwmod_sysc_fields {
282         u8 midle_shift;
283         u8 clkact_shift;
284         u8 sidle_shift;
285         u8 enwkup_shift;
286         u8 srst_shift;
287         u8 autoidle_shift;
288 };
289
290 /**
291  * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data
292  * @rev_offs: IP block revision register offset (from module base addr)
293  * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
294  * @syss_offs: OCP_SYSSTATUS register offset (from module base addr)
295  * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART}
296  * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported
297  * @clockact: the default value of the module CLOCKACTIVITY bits
298  *
299  * @clockact describes to the module which clocks are likely to be
300  * disabled when the PRCM issues its idle request to the module.  Some
301  * modules have separate clockdomains for the interface clock and main
302  * functional clock, and can check whether they should acknowledge the
303  * idle request based on the internal module functionality that has
304  * been associated with the clocks marked in @clockact.  This field is
305  * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below)
306  *
307  * @sysc_fields: structure containing the offset positions of various bits in
308  * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or
309  * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on
310  * whether the device ip is compliant with the original PRCM protocol
311  * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs.
312  * If the device follows a different scheme for the sysconfig register ,
313  * then this field has to be populated with the correct offset structure.
314  */
315 struct omap_hwmod_class_sysconfig {
316         u16 rev_offs;
317         u16 sysc_offs;
318         u16 syss_offs;
319         u16 sysc_flags;
320         u8 idlemodes;
321         u8 clockact;
322         struct omap_hwmod_sysc_fields *sysc_fields;
323 };
324
325 /**
326  * struct omap_hwmod_omap2_prcm - OMAP2/3-specific PRCM data
327  * @module_offs: PRCM submodule offset from the start of the PRM/CM
328  * @prcm_reg_id: PRCM register ID (e.g., 3 for CM_AUTOIDLE3)
329  * @module_bit: register bit shift for AUTOIDLE, WKST, WKEN, GRPSEL regs
330  * @idlest_reg_id: IDLEST register ID (e.g., 3 for CM_IDLEST3)
331  * @idlest_idle_bit: register bit shift for CM_IDLEST slave idle bit
332  * @idlest_stdby_bit: register bit shift for CM_IDLEST master standby bit
333  *
334  * @prcm_reg_id and @module_bit are specific to the AUTOIDLE, WKST,
335  * WKEN, GRPSEL registers.  In an ideal world, no extra information
336  * would be needed for IDLEST information, but alas, there are some
337  * exceptions, so @idlest_reg_id, @idlest_idle_bit, @idlest_stdby_bit
338  * are needed for the IDLEST registers (c.f. 2430 I2CHS, 3430 USBHOST)
339  */
340 struct omap_hwmod_omap2_prcm {
341         s16 module_offs;
342         u8 prcm_reg_id;
343         u8 module_bit;
344         u8 idlest_reg_id;
345         u8 idlest_idle_bit;
346         u8 idlest_stdby_bit;
347 };
348
349
350 /**
351  * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
352  * @clkctrl_reg: PRCM address of the clock control register
353  * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM
354  * @submodule_wkdep_bit: bit shift of the WKDEP range
355  */
356 struct omap_hwmod_omap4_prcm {
357         void __iomem    *clkctrl_reg;
358         void __iomem    *rstctrl_reg;
359         u8              submodule_wkdep_bit;
360 };
361
362
363 /*
364  * omap_hwmod.flags definitions
365  *
366  * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out
367  *     of idle, rather than relying on module smart-idle
368  * HWMOD_SWSUP_MSTDBY: omap_hwmod code should manually bring module in and out
369  *     of standby, rather than relying on module smart-standby
370  * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for
371  *     SDRAM controller, etc. XXX probably belongs outside the main hwmod file
372  * HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM
373  *     controller, etc. XXX probably belongs outside the main hwmod file
374  * HWMOD_NO_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE)
375  *     when module is enabled, rather than the default, which is to
376  *     enable autoidle
377  * HWMOD_SET_DEFAULT_CLOCKACT: program CLOCKACTIVITY bits at startup
378  * HWMOD_NO_IDLEST: this module does not have idle status - this is the case
379  *     only for few initiator modules on OMAP2 & 3.
380  * HWMOD_CONTROL_OPT_CLKS_IN_RESET: Enable all optional clocks during reset.
381  *     This is needed for devices like DSS that require optional clocks enabled
382  *     in order to complete the reset. Optional clocks will be disabled
383  *     again after the reset.
384  * HWMOD_16BIT_REG: Module has 16bit registers
385  */
386 #define HWMOD_SWSUP_SIDLE                       (1 << 0)
387 #define HWMOD_SWSUP_MSTANDBY                    (1 << 1)
388 #define HWMOD_INIT_NO_RESET                     (1 << 2)
389 #define HWMOD_INIT_NO_IDLE                      (1 << 3)
390 #define HWMOD_NO_OCP_AUTOIDLE                   (1 << 4)
391 #define HWMOD_SET_DEFAULT_CLOCKACT              (1 << 5)
392 #define HWMOD_NO_IDLEST                         (1 << 6)
393 #define HWMOD_CONTROL_OPT_CLKS_IN_RESET         (1 << 7)
394 #define HWMOD_16BIT_REG                         (1 << 8)
395
396 /*
397  * omap_hwmod._int_flags definitions
398  * These are for internal use only and are managed by the omap_hwmod code.
399  *
400  * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module
401  * _HWMOD_WAKEUP_ENABLED: set when the omap_hwmod code has enabled ENAWAKEUP
402  * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached
403  */
404 #define _HWMOD_NO_MPU_PORT                      (1 << 0)
405 #define _HWMOD_WAKEUP_ENABLED                   (1 << 1)
406 #define _HWMOD_SYSCONFIG_LOADED                 (1 << 2)
407
408 /*
409  * omap_hwmod._state definitions
410  *
411  * INITIALIZED: reset (optionally), initialized, enabled, disabled
412  *              (optionally)
413  *
414  *
415  */
416 #define _HWMOD_STATE_UNKNOWN                    0
417 #define _HWMOD_STATE_REGISTERED                 1
418 #define _HWMOD_STATE_CLKS_INITED                2
419 #define _HWMOD_STATE_INITIALIZED                3
420 #define _HWMOD_STATE_ENABLED                    4
421 #define _HWMOD_STATE_IDLE                       5
422 #define _HWMOD_STATE_DISABLED                   6
423
424 /**
425  * struct omap_hwmod_class - the type of an IP block
426  * @name: name of the hwmod_class
427  * @sysc: device SYSCONFIG/SYSSTATUS register data
428  * @rev: revision of the IP class
429  * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown
430  * @reset: ptr to fn to be executed in place of the standard hwmod reset fn
431  *
432  * Represent the class of a OMAP hardware "modules" (e.g. timer,
433  * smartreflex, gpio, uart...)
434  *
435  * @pre_shutdown is a function that will be run immediately before
436  * hwmod clocks are disabled, etc.  It is intended for use for hwmods
437  * like the MPU watchdog, which cannot be disabled with the standard
438  * omap_hwmod_shutdown().  The function should return 0 upon success,
439  * or some negative error upon failure.  Returning an error will cause
440  * omap_hwmod_shutdown() to abort the device shutdown and return an
441  * error.
442  *
443  * If @reset is defined, then the function it points to will be
444  * executed in place of the standard hwmod _reset() code in
445  * mach-omap2/omap_hwmod.c.  This is needed for IP blocks which have
446  * unusual reset sequences - usually processor IP blocks like the IVA.
447  */
448 struct omap_hwmod_class {
449         const char                              *name;
450         struct omap_hwmod_class_sysconfig       *sysc;
451         u32                                     rev;
452         int                                     (*pre_shutdown)(struct omap_hwmod *oh);
453         int                                     (*reset)(struct omap_hwmod *oh);
454 };
455
456 /**
457  * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks)
458  * @name: name of the hwmod
459  * @class: struct omap_hwmod_class * to the class of this hwmod
460  * @od: struct omap_device currently associated with this hwmod (internal use)
461  * @mpu_irqs: ptr to an array of MPU IRQs (see also mpu_irqs_cnt)
462  * @sdma_reqs: ptr to an array of System DMA request IDs (see sdma_reqs_cnt)
463  * @prcm: PRCM data pertaining to this hwmod
464  * @main_clk: main clock: OMAP clock name
465  * @_clk: pointer to the main struct clk (filled in at runtime)
466  * @opt_clks: other device clocks that drivers can request (0..*)
467  * @vdd_name: voltage domain name
468  * @voltdm: pointer to voltage domain (filled in at runtime)
469  * @masters: ptr to array of OCP ifs that this hwmod can initiate on
470  * @slaves: ptr to array of OCP ifs that this hwmod can respond on
471  * @dev_attr: arbitrary device attributes that can be passed to the driver
472  * @_sysc_cache: internal-use hwmod flags
473  * @_mpu_rt_va: cached register target start address (internal use)
474  * @_mpu_port_index: cached MPU register target slave ID (internal use)
475  * @mpu_irqs_cnt: number of @mpu_irqs
476  * @sdma_reqs_cnt: number of @sdma_reqs
477  * @opt_clks_cnt: number of @opt_clks
478  * @master_cnt: number of @master entries
479  * @slaves_cnt: number of @slave entries
480  * @response_lat: device OCP response latency (in interface clock cycles)
481  * @_int_flags: internal-use hwmod flags
482  * @_state: internal-use hwmod state
483  * @_postsetup_state: internal-use state to leave the hwmod in after _setup()
484  * @flags: hwmod flags (documented below)
485  * @omap_chip: OMAP chips this hwmod is present on
486  * @_lock: spinlock serializing operations on this hwmod
487  * @node: list node for hwmod list (internal use)
488  *
489  * @main_clk refers to this module's "main clock," which for our
490  * purposes is defined as "the functional clock needed for register
491  * accesses to complete."  Modules may not have a main clock if the
492  * interface clock also serves as a main clock.
493  *
494  * Parameter names beginning with an underscore are managed internally by
495  * the omap_hwmod code and should not be set during initialization.
496  */
497 struct omap_hwmod {
498         const char                      *name;
499         struct omap_hwmod_class         *class;
500         struct omap_device              *od;
501         struct omap_hwmod_mux_info      *mux;
502         struct omap_hwmod_irq_info      *mpu_irqs;
503         struct omap_hwmod_dma_info      *sdma_reqs;
504         struct omap_hwmod_rst_info      *rst_lines;
505         union {
506                 struct omap_hwmod_omap2_prcm omap2;
507                 struct omap_hwmod_omap4_prcm omap4;
508         }                               prcm;
509         const char                      *main_clk;
510         struct clk                      *_clk;
511         struct omap_hwmod_opt_clk       *opt_clks;
512         char                            *vdd_name;
513         struct voltagedomain            *voltdm;
514         struct omap_hwmod_ocp_if        **masters; /* connect to *_IA */
515         struct omap_hwmod_ocp_if        **slaves;  /* connect to *_TA */
516         void                            *dev_attr;
517         u32                             _sysc_cache;
518         void __iomem                    *_mpu_rt_va;
519         spinlock_t                      _lock;
520         struct list_head                node;
521         u16                             flags;
522         u8                              _mpu_port_index;
523         u8                              response_lat;
524         u8                              mpu_irqs_cnt;
525         u8                              sdma_reqs_cnt;
526         u8                              rst_lines_cnt;
527         u8                              opt_clks_cnt;
528         u8                              masters_cnt;
529         u8                              slaves_cnt;
530         u8                              hwmods_cnt;
531         u8                              _int_flags;
532         u8                              _state;
533         u8                              _postsetup_state;
534         const struct omap_chip_id       omap_chip;
535 };
536
537 int omap_hwmod_init(struct omap_hwmod **ohs);
538 struct omap_hwmod *omap_hwmod_lookup(const char *name);
539 int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
540                         void *data);
541
542 int omap_hwmod_enable(struct omap_hwmod *oh);
543 int _omap_hwmod_enable(struct omap_hwmod *oh);
544 int omap_hwmod_idle(struct omap_hwmod *oh);
545 int _omap_hwmod_idle(struct omap_hwmod *oh);
546 int omap_hwmod_shutdown(struct omap_hwmod *oh);
547
548 int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name);
549 int omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name);
550 int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name);
551
552 int omap_hwmod_enable_clocks(struct omap_hwmod *oh);
553 int omap_hwmod_disable_clocks(struct omap_hwmod *oh);
554
555 int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode);
556
557 int omap_hwmod_reset(struct omap_hwmod *oh);
558 void omap_hwmod_ocp_barrier(struct omap_hwmod *oh);
559
560 void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs);
561 u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs);
562
563 int omap_hwmod_count_resources(struct omap_hwmod *oh);
564 int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
565
566 struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh);
567 void __iomem *omap_hwmod_get_mpu_rt_va(struct omap_hwmod *oh);
568
569 int omap_hwmod_add_initiator_dep(struct omap_hwmod *oh,
570                                  struct omap_hwmod *init_oh);
571 int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh,
572                                  struct omap_hwmod *init_oh);
573
574 int omap_hwmod_set_clockact_both(struct omap_hwmod *oh);
575 int omap_hwmod_set_clockact_main(struct omap_hwmod *oh);
576 int omap_hwmod_set_clockact_iclk(struct omap_hwmod *oh);
577 int omap_hwmod_set_clockact_none(struct omap_hwmod *oh);
578
579 int omap_hwmod_enable_wakeup(struct omap_hwmod *oh);
580 int omap_hwmod_disable_wakeup(struct omap_hwmod *oh);
581
582 int omap_hwmod_for_each_by_class(const char *classname,
583                                  int (*fn)(struct omap_hwmod *oh,
584                                            void *user),
585                                  void *user);
586
587 int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state);
588 u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);
589
590 /*
591  * Chip variant-specific hwmod init routines - XXX should be converted
592  * to use initcalls once the initial boot ordering is straightened out
593  */
594 extern int omap2420_hwmod_init(void);
595 extern int omap2430_hwmod_init(void);
596 extern int omap3xxx_hwmod_init(void);
597 extern int omap44xx_hwmod_init(void);
598
599 #endif