diff options
author | Paul Walmsley <paul@pwsan.com> | 2010-02-23 00:09:34 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-02-24 19:45:14 -0500 |
commit | 43b40992ce21def8d5957f32d7ddb728af89bfce (patch) | |
tree | 2e6f25d2d3d5cfbea42564d25cd887279ee8ab00 /arch/arm/plat-omap | |
parent | 7359154e94623f6a5a68a77b9fcfbef40633c93f (diff) |
OMAP hwmod: add hwmod class support
Add support for categorizing and iterating over hardware IP blocks by
the "class" of the IP block. The class is the type of the IP block:
e.g., "timer", "timer1ms", etc. Move the OCP_SYSCONFIG/SYSSTATUS data
from the struct omap_hwmod into the struct omap_hwmod_class, since
it's expected to stay consistent for each class. While here, fix some
comments.
The hwmod_class structures in this patch were designed and proposed by
Benoît Cousson <b-cousson@ti.com> and were refined in a discussion
between Thara Gopinath <thara@ti.com>, Kevin Hilman
<khilman@deeprootsystems.com>, and myself.
This patch uses WARN() lines that are longer than 80 characters, as
Kevin noted a broader lkml consensus to increase greppability by
keeping the messages all on one line.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Benoît Cousson <b-cousson@ti.com>
Cc: Thara Gopinath <thara@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index d2241fc6379a..440b4164f2f6 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 | * |
@@ -254,7 +254,7 @@ struct omap_hwmod_ocp_if { | |||
254 | * @sidle_shift: Offset of the sidle bit | 254 | * @sidle_shift: Offset of the sidle bit |
255 | * @enwkup_shift: Offset of the enawakeup bit | 255 | * @enwkup_shift: Offset of the enawakeup bit |
256 | * @srst_shift: Offset of the softreset bit | 256 | * @srst_shift: Offset of the softreset bit |
257 | * @autoidle_shift: Offset of the autoidle bit. | 257 | * @autoidle_shift: Offset of the autoidle bit |
258 | */ | 258 | */ |
259 | struct omap_hwmod_sysc_fields { | 259 | struct omap_hwmod_sysc_fields { |
260 | u8 midle_shift; | 260 | u8 midle_shift; |
@@ -266,7 +266,7 @@ struct omap_hwmod_sysc_fields { | |||
266 | }; | 266 | }; |
267 | 267 | ||
268 | /** | 268 | /** |
269 | * struct omap_hwmod_sysconfig - hwmod OCP_SYSCONFIG/OCP_SYSSTATUS data | 269 | * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data |
270 | * @rev_offs: IP block revision register offset (from module base addr) | 270 | * @rev_offs: IP block revision register offset (from module base addr) |
271 | * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) | 271 | * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) |
272 | * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) | 272 | * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) |
@@ -282,16 +282,15 @@ struct omap_hwmod_sysc_fields { | |||
282 | * been associated with the clocks marked in @clockact. This field is | 282 | * been associated with the clocks marked in @clockact. This field is |
283 | * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) | 283 | * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) |
284 | * | 284 | * |
285 | * | ||
286 | * @sysc_fields: structure containing the offset positions of various bits in | 285 | * @sysc_fields: structure containing the offset positions of various bits in |
287 | * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or | 286 | * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or |
288 | * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on | 287 | * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on |
289 | * whether the device ip is compliant with the original PRCM protocol | 288 | * whether the device ip is compliant with the original PRCM protocol |
290 | * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs. | 289 | * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs. |
291 | * If the device follows a differnt scheme for the sysconfig register , | 290 | * If the device follows a different scheme for the sysconfig register , |
292 | * then this field has to be populated with the correct offset structure. | 291 | * then this field has to be populated with the correct offset structure. |
293 | */ | 292 | */ |
294 | struct omap_hwmod_sysconfig { | 293 | struct omap_hwmod_class_sysconfig { |
295 | u16 rev_offs; | 294 | u16 rev_offs; |
296 | u16 sysc_offs; | 295 | u16 sysc_offs; |
297 | u16 syss_offs; | 296 | u16 syss_offs; |
@@ -391,8 +390,24 @@ struct omap_hwmod_omap4_prcm { | |||
391 | #define _HWMOD_STATE_DISABLED 6 | 390 | #define _HWMOD_STATE_DISABLED 6 |
392 | 391 | ||
393 | /** | 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 | */ | ||
401 | struct omap_hwmod_class { | ||
402 | const char *name; | ||
403 | struct omap_hwmod_class_sysconfig *sysc; | ||
404 | u32 rev; | ||
405 | }; | ||
406 | |||
407 | /** | ||
394 | * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) | 408 | * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) |
395 | * @name: name of the hwmod | 409 | * @name: name of the hwmod |
410 | * @class: struct omap_hwmod_class * to the class of this hwmod | ||
396 | * @od: struct omap_device currently associated with this hwmod (internal use) | 411 | * @od: struct omap_device currently associated with this hwmod (internal use) |
397 | * @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) |
398 | * @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) |
@@ -402,7 +417,6 @@ struct omap_hwmod_omap4_prcm { | |||
402 | * @opt_clks: other device clocks that drivers can request (0..*) | 417 | * @opt_clks: other device clocks that drivers can request (0..*) |
403 | * @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 |
404 | * @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 |
405 | * @sysconfig: device SYSCONFIG/SYSSTATUS register data | ||
406 | * @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 |
407 | * @_sysc_cache: internal-use hwmod flags | 421 | * @_sysc_cache: internal-use hwmod flags |
408 | * @_rt_va: cached register target start address (internal use) | 422 | * @_rt_va: cached register target start address (internal use) |
@@ -431,6 +445,7 @@ struct omap_hwmod_omap4_prcm { | |||
431 | */ | 445 | */ |
432 | struct omap_hwmod { | 446 | struct omap_hwmod { |
433 | const char *name; | 447 | const char *name; |
448 | struct omap_hwmod_class *class; | ||
434 | struct omap_device *od; | 449 | struct omap_device *od; |
435 | struct omap_hwmod_irq_info *mpu_irqs; | 450 | struct omap_hwmod_irq_info *mpu_irqs; |
436 | struct omap_hwmod_dma_info *sdma_chs; | 451 | struct omap_hwmod_dma_info *sdma_chs; |
@@ -443,7 +458,6 @@ struct omap_hwmod { | |||
443 | struct omap_hwmod_opt_clk *opt_clks; | 458 | struct omap_hwmod_opt_clk *opt_clks; |
444 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ | 459 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ |
445 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ | 460 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ |
446 | struct omap_hwmod_sysconfig *sysconfig; | ||
447 | void *dev_attr; | 461 | void *dev_attr; |
448 | u32 _sysc_cache; | 462 | u32 _sysc_cache; |
449 | void __iomem *_rt_va; | 463 | void __iomem *_rt_va; |
@@ -504,6 +518,11 @@ int omap_hwmod_set_clockact_none(struct omap_hwmod *oh); | |||
504 | int omap_hwmod_enable_wakeup(struct omap_hwmod *oh); | 518 | int omap_hwmod_enable_wakeup(struct omap_hwmod *oh); |
505 | int omap_hwmod_disable_wakeup(struct omap_hwmod *oh); | 519 | int omap_hwmod_disable_wakeup(struct omap_hwmod *oh); |
506 | 520 | ||
521 | int omap_hwmod_for_each_by_class(const char *classname, | ||
522 | int (*fn)(struct omap_hwmod *oh, | ||
523 | void *user), | ||
524 | void *user); | ||
525 | |||
507 | /* | 526 | /* |
508 | * Chip variant-specific hwmod init routines - XXX should be converted | 527 | * Chip variant-specific hwmod init routines - XXX should be converted |
509 | * to use initcalls once the initial boot ordering is straightened out | 528 | * to use initcalls once the initial boot ordering is straightened out |