aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-10-27 11:39:25 -0400
committerTony Lindgren <tony@atomide.com>2014-10-27 11:39:25 -0400
commit37fb59d7e0b471f3aacd26bfdbb64a4dc71f189b (patch)
tree638df549fcb8505e9197c1877b7de47892b87f78 /arch/arm
parentefd44dc35f550e0cedd983d13e180da5e0d368a9 (diff)
ARM: OMAP2+: PRM: add generic API for deasserting hardware reset
PRM driver now has a generic API for deasserting 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>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c22
-rw-r--r--arch/arm/mach-omap2/prm.h7
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c1
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c7
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h4
-rw-r--r--arch/arm/mach-omap2/prm33xx.c8
-rw-r--r--arch/arm/mach-omap2/prm33xx.h2
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c1
-rw-r--r--arch/arm/mach-omap2/prm44xx.c1
-rw-r--r--arch/arm/mach-omap2/prm_common.c24
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c10
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h5
12 files changed, 69 insertions, 23 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 66198e57708f..4159368edfe7 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2932,9 +2932,8 @@ static int _omap2_assert_hardreset(struct omap_hwmod *oh,
2932static int _omap2_deassert_hardreset(struct omap_hwmod *oh, 2932static int _omap2_deassert_hardreset(struct omap_hwmod *oh,
2933 struct omap_hwmod_rst_info *ohri) 2933 struct omap_hwmod_rst_info *ohri)
2934{ 2934{
2935 return omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs, 2935 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0,
2936 ohri->rst_shift, 2936 oh->prcm.omap2.module_offs, 0, 0);
2937 ohri->st_shift);
2938} 2937}
2939 2938
2940/** 2939/**
@@ -3001,10 +3000,10 @@ static int _omap4_deassert_hardreset(struct omap_hwmod *oh,
3001 if (ohri->st_shift) 3000 if (ohri->st_shift)
3002 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", 3001 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
3003 oh->name, ohri->name); 3002 oh->name, ohri->name);
3004 return omap4_prminst_deassert_hardreset(ohri->rst_shift, 3003 return omap_prm_deassert_hardreset(ohri->rst_shift, 0,
3005 oh->clkdm->pwrdm.ptr->prcm_partition, 3004 oh->clkdm->pwrdm.ptr->prcm_partition,
3006 oh->clkdm->pwrdm.ptr->prcm_offs, 3005 oh->clkdm->pwrdm.ptr->prcm_offs,
3007 oh->prcm.omap4.rstctrl_offs); 3006 oh->prcm.omap4.rstctrl_offs, 0);
3008} 3007}
3009 3008
3010/** 3009/**
@@ -3067,11 +3066,10 @@ static int _am33xx_assert_hardreset(struct omap_hwmod *oh,
3067static int _am33xx_deassert_hardreset(struct omap_hwmod *oh, 3066static int _am33xx_deassert_hardreset(struct omap_hwmod *oh,
3068 struct omap_hwmod_rst_info *ohri) 3067 struct omap_hwmod_rst_info *ohri)
3069{ 3068{
3070 return am33xx_prm_deassert_hardreset(ohri->rst_shift, 3069 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0,
3071 ohri->st_shift, 3070 oh->clkdm->pwrdm.ptr->prcm_offs,
3072 oh->clkdm->pwrdm.ptr->prcm_offs, 3071 oh->prcm.omap4.rstctrl_offs,
3073 oh->prcm.omap4.rstctrl_offs, 3072 oh->prcm.omap4.rstst_offs);
3074 oh->prcm.omap4.rstst_offs);
3075} 3073}
3076 3074
3077/** 3075/**
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 9b8711b6adde..26bf3e604d3c 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -129,6 +129,7 @@ struct prm_reset_src_map {
129 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn 129 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
130 * @late_init: ptr to the late init function 130 * @late_init: ptr to the late init function
131 * @assert_hardreset: ptr to the SoC PRM hardreset assert impl 131 * @assert_hardreset: ptr to the SoC PRM hardreset assert impl
132 * @deassert_hardreset: ptr to the SoC PRM hardreset deassert impl
132 * 133 *
133 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are 134 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
134 * deprecated. 135 * deprecated.
@@ -139,12 +140,18 @@ struct prm_ll_data {
139 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); 140 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
140 int (*late_init)(void); 141 int (*late_init)(void);
141 int (*assert_hardreset)(u8 shift, u8 part, s16 prm_mod, u16 offset); 142 int (*assert_hardreset)(u8 shift, u8 part, s16 prm_mod, u16 offset);
143 int (*deassert_hardreset)(u8 shift, u8 st_shift, u8 part, s16 prm_mod,
144 u16 offset, u16 st_offset);
145 int (*is_hardreset_asserted)(u8 shift, u8 part, s16 prm_mod,
146 u16 offset);
142}; 147};
143 148
144extern int prm_register(struct prm_ll_data *pld); 149extern int prm_register(struct prm_ll_data *pld);
145extern int prm_unregister(struct prm_ll_data *pld); 150extern int prm_unregister(struct prm_ll_data *pld);
146 151
147int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset); 152int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset);
153int omap_prm_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 prm_mod,
154 u16 offset, u16 st_offset);
148extern u32 prm_read_reset_sources(void); 155extern u32 prm_read_reset_sources(void);
149extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx); 156extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
150extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx); 157extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index fa4448b9f716..343fc734c61e 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -213,6 +213,7 @@ struct pwrdm_ops omap2_pwrdm_operations = {
213static struct prm_ll_data omap2xxx_prm_ll_data = { 213static struct prm_ll_data omap2xxx_prm_ll_data = {
214 .read_reset_sources = &omap2xxx_prm_read_reset_sources, 214 .read_reset_sources = &omap2xxx_prm_read_reset_sources,
215 .assert_hardreset = &omap2_prm_assert_hardreset, 215 .assert_hardreset = &omap2_prm_assert_hardreset,
216 .deassert_hardreset = &omap2_prm_deassert_hardreset,
216}; 217};
217 218
218int __init omap2xxx_prm_init(void) 219int __init omap2xxx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 8758cd6f2eed..9466b1ea63a9 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -66,6 +66,10 @@ int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
66 * @prm_mod: PRM submodule base (e.g. CORE_MOD) 66 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
67 * @rst_shift: register bit shift corresponding to the reset line to deassert 67 * @rst_shift: register bit shift corresponding to the reset line to deassert
68 * @st_shift: register bit shift for the status of the deasserted submodule 68 * @st_shift: register bit shift for the status of the deasserted submodule
69 * @part: PRM partition, not used for OMAP2
70 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
71 * @rst_offset: reset register offset, not used for OMAP2
72 * @st_offset: reset status register offset, not used for OMAP2
69 * 73 *
70 * Some IPs like dsp or iva contain processors that require an HW 74 * Some IPs like dsp or iva contain processors that require an HW
71 * reset line to be asserted / deasserted in order to fully enable the 75 * reset line to be asserted / deasserted in order to fully enable the
@@ -76,7 +80,8 @@ int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
76 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 80 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
77 * of reset, or -EBUSY if the submodule did not exit reset promptly. 81 * of reset, or -EBUSY if the submodule did not exit reset promptly.
78 */ 82 */
79int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift) 83int omap2_prm_deassert_hardreset(u8 rst_shift, u8 st_shift, u8 part,
84 s16 prm_mod, u16 rst_offset, u16 st_offset)
80{ 85{
81 u32 rst, st; 86 u32 rst, st;
82 int c; 87 int c;
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 967496220f58..253d4148737d 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -103,7 +103,9 @@ static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); 103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
104int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, 104int omap2_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod,
105 u16 offset); 105 u16 offset);
106extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); 106int omap2_prm_deassert_hardreset(u8 rst_shift, u8 st_shift, u8 part,
107 s16 prm_mod, u16 reset_offset,
108 u16 st_offset);
107 109
108extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); 110extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
109extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm); 111extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 992a40e72284..ea0fea68e36c 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -98,6 +98,8 @@ static int am33xx_prm_assert_hardreset(u8 shift, u8 part, s16 inst,
98 * am33xx_prm_deassert_hardreset - deassert a submodule hardreset line and 98 * am33xx_prm_deassert_hardreset - deassert a submodule hardreset line and
99 * wait 99 * wait
100 * @shift: register bit shift corresponding to the reset line to deassert 100 * @shift: register bit shift corresponding to the reset line to deassert
101 * @st_shift: reset status register bit shift corresponding to the reset line
102 * @part: PRM partition, not used for AM33xx
101 * @inst: CM instance register offset (*_INST macro) 103 * @inst: CM instance register offset (*_INST macro)
102 * @rstctrl_reg: RM_RSTCTRL register address for this module 104 * @rstctrl_reg: RM_RSTCTRL register address for this module
103 * @rstst_reg: RM_RSTST register address for this module 105 * @rstst_reg: RM_RSTST register address for this module
@@ -111,8 +113,9 @@ static int am33xx_prm_assert_hardreset(u8 shift, u8 part, s16 inst,
111 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 113 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
112 * of reset, or -EBUSY if the submodule did not exit reset promptly. 114 * of reset, or -EBUSY if the submodule did not exit reset promptly.
113 */ 115 */
114int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, s16 inst, 116static int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, u8 part,
115 u16 rstctrl_offs, u16 rstst_offs) 117 s16 inst, u16 rstctrl_offs,
118 u16 rstst_offs)
116{ 119{
117 int c; 120 int c;
118 u32 mask = 1 << st_shift; 121 u32 mask = 1 << st_shift;
@@ -347,6 +350,7 @@ struct pwrdm_ops am33xx_pwrdm_operations = {
347 350
348static struct prm_ll_data am33xx_prm_ll_data = { 351static struct prm_ll_data am33xx_prm_ll_data = {
349 .assert_hardreset = am33xx_prm_assert_hardreset, 352 .assert_hardreset = am33xx_prm_assert_hardreset,
353 .deassert_hardreset = am33xx_prm_deassert_hardreset,
350}; 354};
351 355
352int __init am33xx_prm_init(void) 356int __init am33xx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm33xx.h b/arch/arm/mach-omap2/prm33xx.h
index 1d9aad8e84f3..6d483e02c104 100644
--- a/arch/arm/mach-omap2/prm33xx.h
+++ b/arch/arm/mach-omap2/prm33xx.h
@@ -124,8 +124,6 @@ extern u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
124extern void am33xx_prm_global_warm_sw_reset(void); 124extern void am33xx_prm_global_warm_sw_reset(void);
125extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, 125extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst,
126 u16 rstctrl_offs); 126 u16 rstctrl_offs);
127extern int am33xx_prm_deassert_hardreset(u8 shift, u8 st_shift, s16 inst,
128 u16 rstctrl_offs, u16 rstst_offs);
129int am33xx_prm_init(void); 127int am33xx_prm_init(void);
130 128
131#endif /* ASSEMBLER */ 129#endif /* ASSEMBLER */
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 8d9a7d49d6dc..7298311c9ab7 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -665,6 +665,7 @@ static struct prm_ll_data omap3xxx_prm_ll_data = {
665 .read_reset_sources = &omap3xxx_prm_read_reset_sources, 665 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
666 .late_init = &omap3xxx_prm_late_init, 666 .late_init = &omap3xxx_prm_late_init,
667 .assert_hardreset = &omap2_prm_assert_hardreset, 667 .assert_hardreset = &omap2_prm_assert_hardreset,
668 .deassert_hardreset = &omap2_prm_deassert_hardreset,
668}; 669};
669 670
670int __init omap3xxx_prm_init(void) 671int __init omap3xxx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 1c86270014ed..0da2ba854412 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -689,6 +689,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
689 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old, 689 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
690 .late_init = &omap44xx_prm_late_init, 690 .late_init = &omap44xx_prm_late_init,
691 .assert_hardreset = omap4_prminst_assert_hardreset, 691 .assert_hardreset = omap4_prminst_assert_hardreset,
692 .deassert_hardreset = omap4_prminst_deassert_hardreset,
692}; 693};
693 694
694int __init omap44xx_prm_init(void) 695int __init omap44xx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 4f8c22075d39..912d99c4d75d 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -443,6 +443,30 @@ int omap_prm_assert_hardreset(u8 shift, u8 part, s16 prm_mod, u16 offset)
443} 443}
444 444
445/** 445/**
446 * omap_prm_deassert_hardreset - deassert hardreset for an IP block
447 * @shift: register bit shift corresponding to the reset line
448 * @st_shift: reset status bit shift corresponding to the reset line
449 * @part: PRM partition
450 * @prm_mod: PRM submodule base or instance offset
451 * @offset: register offset
452 * @st_offset: status register offset
453 *
454 * Deasserts a hardware reset line for an IP block.
455 */
456int omap_prm_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 prm_mod,
457 u16 offset, u16 st_offset)
458{
459 if (!prm_ll_data->deassert_hardreset) {
460 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
461 __func__);
462 return -EINVAL;
463 }
464
465 return prm_ll_data->deassert_hardreset(shift, st_shift, part, prm_mod,
466 offset, st_offset);
467}
468
469/**
446 * prm_register - register per-SoC low-level data with the PRM 470 * prm_register - register per-SoC low-level data with the PRM
447 * @pld: low-level per-SoC OMAP PRM data & function pointers to register 471 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
448 * 472 *
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 225e0258d76d..8adf7b1a1dce 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -148,8 +148,12 @@ int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
148/** 148/**
149 * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and 149 * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and
150 * wait 150 * wait
151 * @rstctrl_reg: RM_RSTCTRL register address for this module
152 * @shift: register bit shift corresponding to the reset line to deassert 151 * @shift: register bit shift corresponding to the reset line to deassert
152 * @st_shift: status bit offset, not used for OMAP4+
153 * @part: PRM partition
154 * @inst: PRM instance offset
155 * @rstctrl_offs: reset register offset
156 * @st_offs: reset status register offset, not used for OMAP4+
153 * 157 *
154 * Some IPs like dsp, ipu or iva contain processors that require an HW 158 * Some IPs like dsp, ipu or iva contain processors that require an HW
155 * reset line to be asserted / deasserted in order to fully enable the 159 * reset line to be asserted / deasserted in order to fully enable the
@@ -160,8 +164,8 @@ int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
160 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 164 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
161 * of reset, or -EBUSY if the submodule did not exit reset promptly. 165 * of reset, or -EBUSY if the submodule did not exit reset promptly.
162 */ 166 */
163int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 167int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 inst,
164 u16 rstctrl_offs) 168 u16 rstctrl_offs, u16 st_offs)
165{ 169{
166 int c; 170 int c;
167 u32 mask = 1 << shift; 171 u32 mask = 1 << shift;
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 583aa3774571..fb1c9d7a2f9d 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -30,8 +30,9 @@ extern int omap4_prminst_is_hardreset_asserted(u8 shift, u8 part, s16 inst,
30 u16 rstctrl_offs); 30 u16 rstctrl_offs);
31extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, 31extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
32 u16 rstctrl_offs); 32 u16 rstctrl_offs);
33extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 33int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part,
34 u16 rstctrl_offs); 34 s16 inst, u16 rstctrl_offs,
35 u16 rstst_offs);
35 36
36extern void omap_prm_base_init(void); 37extern void omap_prm_base_init(void);
37 38