ARM: OMAP4: hwmod data: add support for lostcontext_mask
authorTero Kristo <t-kristo@ti.com>
Sun, 23 Sep 2012 23:28:19 +0000 (17:28 -0600)
committerPaul Walmsley <paul@pwsan.com>
Sun, 23 Sep 2012 23:28:19 +0000 (17:28 -0600)
Currently hwmod only provides the offset for the context lose
register, and if we attempt to share the same register between two or
more hwmods, the resulting context loss counts get wrong. Thus, we
need a way to specify which bits are used for the context loss
information for each.  This is accomplished by adding a new field to
the omap4 prcm struct, 'lostcontext_mask', which specifies a bit-mask
to use for filtering the register.

Mark the affected hwmods appropriately.  'l4_abe' hwmod uses the
LOSTMEM_AESSMEM bit of RM_ABE_AESS_CONTEXT register, as l4_abe doesn't
have its own dedicated register for this purpose. This register is
shared with 'aess' hwmod, thus both hwmods must also specify which
bits of the register are used for them.

This patch only adds the hwmod data, but a future patch should add
code support such that only the specified bits are read and cleared by
the context lose counter update code. If a hwmod doesn't specify
'lostcontext_mask' (default behavior), the whole contents of the
context register should be used without any filtering.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
[paul@pwsan.com: updated to apply after conversion to use flag bit for
 missing module context-loss register; combined data and code patches;
 dropped code change due to serial driver breakage]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/plat-omap/include/plat/omap_hwmod.h

index 110be87..d3f045b 100644 (file)
@@ -202,6 +202,8 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod = {
        .prcm = {
                .omap4 = {
                        .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET,
+                       .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
+                       .lostcontext_mask = OMAP4430_LOSTMEM_AESSMEM_MASK,
                },
        },
 };
@@ -342,6 +344,7 @@ static struct omap_hwmod omap44xx_aess_hwmod = {
                .omap4 = {
                        .clkctrl_offs = OMAP4_CM1_ABE_AESS_CLKCTRL_OFFSET,
                        .context_offs = OMAP4_RM_ABE_AESS_CONTEXT_OFFSET,
+                       .lostcontext_mask = OMAP4430_LOSTCONTEXT_DFF_MASK,
                        .modulemode   = MODULEMODE_SWCTRL,
                },
        },
index 6eedb36..86b6a4e 100644 (file)
@@ -389,14 +389,21 @@ struct omap_hwmod_omap2_prcm {
  * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
  * @clkctrl_reg: PRCM address of the clock control register
  * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM
+ * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register
  * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM
  * @submodule_wkdep_bit: bit shift of the WKDEP range
+ *
+ * If @lostcontext_mask is not defined, context loss check code uses
+ * whole register without masking. @lostcontext_mask should only be
+ * defined in cases where @context_offs register is shared by two or
+ * more hwmods.
  */
 struct omap_hwmod_omap4_prcm {
        u16             clkctrl_offs;
        u16             rstctrl_offs;
        u16             rstst_offs;
        u16             context_offs;
+       u32             lostcontext_mask;
        u8              submodule_wkdep_bit;
        u8              modulemode;
 };