ARM: OMAP2+: PRM: add generic API for asserting hardware reset
authorTero Kristo <t-kristo@ti.com>
Mon, 27 Oct 2014 15:39:24 +0000 (08:39 -0700)
committerTony Lindgren <tony@atomide.com>
Mon, 27 Oct 2014 15:39:24 +0000 (08:39 -0700)
PRM driver now has a generic API for asserting hardware resets. SoC
specific support functions are registered through the prm_ll_data.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/prm.h
arch/arm/mach-omap2/prm2xxx.c
arch/arm/mach-omap2/prm2xxx_3xxx.c
arch/arm/mach-omap2/prm2xxx_3xxx.h
arch/arm/mach-omap2/prm33xx.c
arch/arm/mach-omap2/prm33xx.h
arch/arm/mach-omap2/prm3xxx.c
arch/arm/mach-omap2/prm44xx.c
arch/arm/mach-omap2/prm_common.c

index af4482d3d30801cd20fbcc57a821264c0f331cf2..66198e57708f9b3d4b6df6a51e7a1762aa3facf0 100644 (file)
@@ -2914,8 +2914,8 @@ static int _omap4_wait_target_ready(struct omap_hwmod *oh)
 static int _omap2_assert_hardreset(struct omap_hwmod *oh,
                                   struct omap_hwmod_rst_info *ohri)
 {
-       return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
-                                         ohri->rst_shift);
+       return omap_prm_assert_hardreset(ohri->rst_shift, 0,
+                                        oh->prcm.omap2.module_offs, 0);
 }
 
 /**
@@ -2974,10 +2974,10 @@ static int _omap4_assert_hardreset(struct omap_hwmod *oh,
        if (!oh->clkdm)
                return -EINVAL;
 
-       return omap4_prminst_assert_hardreset(ohri->rst_shift,
-                               oh->clkdm->pwrdm.ptr->prcm_partition,
-                               oh->clkdm->pwrdm.ptr->prcm_offs,
-                               oh->prcm.omap4.rstctrl_offs);
+       return omap_prm_assert_hardreset(ohri->rst_shift,
+                                        oh->clkdm->pwrdm.ptr->prcm_partition,
+                                        oh->clkdm->pwrdm.ptr->prcm_offs,
+                                        oh->prcm.omap4.rstctrl_offs);
 }
 
 /**
@@ -3047,9 +3047,9 @@ static int _am33xx_assert_hardreset(struct omap_hwmod *oh,
                                   struct omap_hwmod_rst_info *ohri)
 
 {
-       return am33xx_prm_assert_hardreset(ohri->rst_shift,
-                               oh->clkdm->pwrdm.ptr->prcm_offs,
-                               oh->prcm.omap4.rstctrl_offs);
+       return omap_prm_assert_hardreset(ohri->rst_shift, 0,
+                                        oh->clkdm->pwrdm.ptr->prcm_offs,
+                                        oh->prcm.omap4.rstctrl_offs);
 }
 
 /**
index 9f4d747586162c7fc25b50de3c7cceab5af1ab3f..9b8711b6adde40faeeaf205acb89cd86bddfe335 100644 (file)
@@ -128,6 +128,7 @@ struct prm_reset_src_map {
  * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
  * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
  * @late_init: ptr to the late init function
+ * @assert_hardreset: ptr to the SoC PRM hardreset assert impl
  *
  * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
  * deprecated.
@@ -137,11 +138,13 @@ struct prm_ll_data {
        bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
        void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
        int (*late_init)(void);
+       int (*assert_hardreset)(u8 shift, u8 part, s16 prm_mod, u16 offset);
 };
 
 extern int prm_register(struct prm_ll_data *pld);
 extern int prm_unregister(struct prm_ll_data *pld);
 
+int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset);
 extern u32 prm_read_reset_sources(void);
 extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
 extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
index 86958050547a4a803c6a86604c6ba17b2b5011e7..fa4448b9f716d7b3960ecdca49cb228ccb39b9c4 100644 (file)
@@ -212,6 +212,7 @@ struct pwrdm_ops omap2_pwrdm_operations = {
 
 static struct prm_ll_data omap2xxx_prm_ll_data = {
        .read_reset_sources = &omap2xxx_prm_read_reset_sources,
+       .assert_hardreset = &omap2_prm_assert_hardreset,
 };
 
 int __init omap2xxx_prm_init(void)
index c13b4e293ffaeb3ac89b24baead5a1d2da8adf4c..8758cd6f2eedbd2ca85def20fb6acc6f5427328f 100644 (file)
@@ -39,8 +39,10 @@ int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
 
 /**
  * omap2_prm_assert_hardreset - assert the HW reset line of a submodule
- * @prm_mod: PRM submodule base (e.g. CORE_MOD)
  * @shift: register bit shift corresponding to the reset line to assert
+ * @part: PRM partition, ignored for OMAP2
+ * @prm_mod: PRM submodule base (e.g. CORE_MOD)
+ * @offset: register offset, ignored for OMAP2
  *
  * Some IPs like dsp or iva contain processors that require an HW
  * reset line to be asserted / deasserted in order to fully enable the
@@ -49,7 +51,7 @@ int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
  * place the submodule into reset.  Returns 0 upon success or -EINVAL
  * upon an argument error.
  */
-int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
+int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
 {
        u32 mask;
 
index 1a3a96392b97be45567ce162d23f26b1433a70e7..967496220f5834aad1c37951d48378cd93b73e08 100644 (file)
@@ -101,7 +101,8 @@ static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
 
 /* These omap2_ PRM functions apply to both OMAP2 and 3 */
 extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
-extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
+int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod,
+                              u16 offset);
 extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
 
 extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
index f149e7c9f948064448c4f71b75c5708fbbcdaf3b..992a40e722849e9b4507acc0a179de06825f2182 100644 (file)
@@ -73,6 +73,7 @@ int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, u16 rstctrl_offs)
 /**
  * am33xx_prm_assert_hardreset - assert the HW reset line of a submodule
  * @shift: register bit shift corresponding to the reset line to assert
+ * @part: CM partition, ignored for AM33xx
  * @inst: CM instance register offset (*_INST macro)
  * @rstctrl_reg: RM_RSTCTRL register address for this module
  *
@@ -83,7 +84,8 @@ int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, u16 rstctrl_offs)
  * place the submodule into reset.  Returns 0 upon success or -EINVAL
  * upon an argument error.
  */
-int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs)
+static int am33xx_prm_assert_hardreset(u8 shift, u8 part, s16 inst,
+                                      u16 rstctrl_offs)
 {
        u32 mask = 1 << shift;
 
@@ -343,7 +345,9 @@ struct pwrdm_ops am33xx_pwrdm_operations = {
        .pwrdm_has_voltdm               = am33xx_check_vcvp,
 };
 
-static struct prm_ll_data am33xx_prm_ll_data;
+static struct prm_ll_data am33xx_prm_ll_data = {
+       .assert_hardreset               = am33xx_prm_assert_hardreset,
+};
 
 int __init am33xx_prm_init(void)
 {
index 5cdfdc02c342d4d0c223c07fbb09ab19ca70d6cb..1d9aad8e84f3e050fd8ba761f8065342e2e57e14 100644 (file)
@@ -124,7 +124,6 @@ extern u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
 extern void am33xx_prm_global_warm_sw_reset(void);
 extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst,
                u16 rstctrl_offs);
-extern int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs);
 extern int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, s16 inst,
                u16 rstctrl_offs, u16 rstst_offs);
 int am33xx_prm_init(void);
index ff08da385a2dd2facc58784957a55e09571fd33b..8d9a7d49d6dc753656880d28071b3b50e11fbdbc 100644 (file)
@@ -664,6 +664,7 @@ static int omap3xxx_prm_late_init(void);
 static struct prm_ll_data omap3xxx_prm_ll_data = {
        .read_reset_sources = &omap3xxx_prm_read_reset_sources,
        .late_init = &omap3xxx_prm_late_init,
+       .assert_hardreset = &omap2_prm_assert_hardreset,
 };
 
 int __init omap3xxx_prm_init(void)
index 76e75aa91c4fdf5a5eaf20184e99049cec164610..1c86270014edf2cf62096d3aa590a34667d48526 100644 (file)
@@ -688,6 +688,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
        .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
        .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
        .late_init = &omap44xx_prm_late_init,
+       .assert_hardreset       = omap4_prminst_assert_hardreset,
 };
 
 int __init omap44xx_prm_init(void)
index ee2b5222eac07f279e87a6126d7ed5a864d12d73..4f8c22075d397d2911ad1dbd3b18a4bc2cb5de26 100644 (file)
@@ -422,6 +422,26 @@ void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx)
                          __func__);
 }
 
+/**
+ * omap_prm_assert_hardreset - assert hardreset for an IP block
+ * @shift: register bit shift corresponding to the reset line
+ * @part: PRM partition
+ * @prm_mod: PRM submodule base or instance offset
+ * @offset: register offset
+ *
+ * Asserts a hardware reset line for an IP block.
+ */
+int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
+{
+       if (!prm_ll_data->assert_hardreset) {
+               WARN_ONCE(1, "prm: %s: no mapping function defined\n",
+                         __func__);
+               return -EINVAL;
+       }
+
+       return prm_ll_data->assert_hardreset(shift, part, prm_mod, offset);
+}
+
 /**
  * prm_register - register per-SoC low-level data with the PRM
  * @pld: low-level per-SoC OMAP PRM data & function pointers to register
This page took 0.030728 seconds and 5 git commands to generate.