diff options
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm44xx.c | 93 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm44xx.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prminst44xx.c | 93 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prminst44xx.h | 10 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 3 |
7 files changed, 125 insertions, 113 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index d21f49b87646..a0f7d313e69f 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -149,6 +149,7 @@ | |||
149 | #include "cminst44xx.h" | 149 | #include "cminst44xx.h" |
150 | #include "prm2xxx_3xxx.h" | 150 | #include "prm2xxx_3xxx.h" |
151 | #include "prm44xx.h" | 151 | #include "prm44xx.h" |
152 | #include "prminst44xx.h" | ||
152 | #include "mux.h" | 153 | #include "mux.h" |
153 | 154 | ||
154 | /* Maximum microseconds to wait for OMAP module to softreset */ | 155 | /* Maximum microseconds to wait for OMAP module to softreset */ |
@@ -1187,8 +1188,10 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name) | |||
1187 | return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, | 1188 | return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, |
1188 | ohri.rst_shift); | 1189 | ohri.rst_shift); |
1189 | else if (cpu_is_omap44xx()) | 1190 | else if (cpu_is_omap44xx()) |
1190 | return omap4_prm_assert_hardreset(oh->prcm.omap4.rstctrl_reg, | 1191 | return omap4_prminst_assert_hardreset(ohri.rst_shift, |
1191 | ohri.rst_shift); | 1192 | oh->clkdm->pwrdm.ptr->prcm_partition, |
1193 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
1194 | oh->prcm.omap4.rstctrl_offs); | ||
1192 | else | 1195 | else |
1193 | return -EINVAL; | 1196 | return -EINVAL; |
1194 | } | 1197 | } |
@@ -1223,8 +1226,10 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) | |||
1223 | if (ohri.st_shift) | 1226 | if (ohri.st_shift) |
1224 | pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", | 1227 | pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", |
1225 | oh->name, name); | 1228 | oh->name, name); |
1226 | ret = omap4_prm_deassert_hardreset(oh->prcm.omap4.rstctrl_reg, | 1229 | ret = omap4_prminst_deassert_hardreset(ohri.rst_shift, |
1227 | ohri.rst_shift); | 1230 | oh->clkdm->pwrdm.ptr->prcm_partition, |
1231 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
1232 | oh->prcm.omap4.rstctrl_offs); | ||
1228 | } else { | 1233 | } else { |
1229 | return -EINVAL; | 1234 | return -EINVAL; |
1230 | } | 1235 | } |
@@ -1259,8 +1264,10 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name) | |||
1259 | return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, | 1264 | return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, |
1260 | ohri.st_shift); | 1265 | ohri.st_shift); |
1261 | } else if (cpu_is_omap44xx()) { | 1266 | } else if (cpu_is_omap44xx()) { |
1262 | return omap4_prm_is_hardreset_asserted(oh->prcm.omap4.rstctrl_reg, | 1267 | return omap4_prminst_is_hardreset_asserted(ohri.rst_shift, |
1263 | ohri.rst_shift); | 1268 | oh->clkdm->pwrdm.ptr->prcm_partition, |
1269 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
1270 | oh->prcm.omap4.rstctrl_offs); | ||
1264 | } else { | 1271 | } else { |
1265 | return -EINVAL; | 1272 | return -EINVAL; |
1266 | } | 1273 | } |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 00d7130dd6cb..6a190f5de47c 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -1144,7 +1144,7 @@ static struct omap_hwmod omap44xx_dsp_c0_hwmod = { | |||
1144 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_c0_resets), | 1144 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_c0_resets), |
1145 | .prcm = { | 1145 | .prcm = { |
1146 | .omap4 = { | 1146 | .omap4 = { |
1147 | .rstctrl_reg = OMAP4430_RM_TESLA_RSTCTRL, | 1147 | .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET, |
1148 | }, | 1148 | }, |
1149 | }, | 1149 | }, |
1150 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | 1150 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), |
@@ -1161,7 +1161,7 @@ static struct omap_hwmod omap44xx_dsp_hwmod = { | |||
1161 | .prcm = { | 1161 | .prcm = { |
1162 | .omap4 = { | 1162 | .omap4 = { |
1163 | .clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET, | 1163 | .clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET, |
1164 | .rstctrl_reg = OMAP4430_RM_TESLA_RSTCTRL, | 1164 | .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET, |
1165 | }, | 1165 | }, |
1166 | }, | 1166 | }, |
1167 | .slaves = omap44xx_dsp_slaves, | 1167 | .slaves = omap44xx_dsp_slaves, |
@@ -2526,7 +2526,7 @@ static struct omap_hwmod omap44xx_ipu_c0_hwmod = { | |||
2526 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c0_resets), | 2526 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c0_resets), |
2527 | .prcm = { | 2527 | .prcm = { |
2528 | .omap4 = { | 2528 | .omap4 = { |
2529 | .rstctrl_reg = OMAP4430_RM_DUCATI_RSTCTRL, | 2529 | .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET, |
2530 | }, | 2530 | }, |
2531 | }, | 2531 | }, |
2532 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | 2532 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), |
@@ -2542,7 +2542,7 @@ static struct omap_hwmod omap44xx_ipu_c1_hwmod = { | |||
2542 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c1_resets), | 2542 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c1_resets), |
2543 | .prcm = { | 2543 | .prcm = { |
2544 | .omap4 = { | 2544 | .omap4 = { |
2545 | .rstctrl_reg = OMAP4430_RM_DUCATI_RSTCTRL, | 2545 | .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET, |
2546 | }, | 2546 | }, |
2547 | }, | 2547 | }, |
2548 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | 2548 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), |
@@ -2559,7 +2559,7 @@ static struct omap_hwmod omap44xx_ipu_hwmod = { | |||
2559 | .prcm = { | 2559 | .prcm = { |
2560 | .omap4 = { | 2560 | .omap4 = { |
2561 | .clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET, | 2561 | .clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET, |
2562 | .rstctrl_reg = OMAP4430_RM_DUCATI_RSTCTRL, | 2562 | .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET, |
2563 | }, | 2563 | }, |
2564 | }, | 2564 | }, |
2565 | .slaves = omap44xx_ipu_slaves, | 2565 | .slaves = omap44xx_ipu_slaves, |
@@ -2726,7 +2726,7 @@ static struct omap_hwmod omap44xx_iva_seq0_hwmod = { | |||
2726 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq0_resets), | 2726 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq0_resets), |
2727 | .prcm = { | 2727 | .prcm = { |
2728 | .omap4 = { | 2728 | .omap4 = { |
2729 | .rstctrl_reg = OMAP4430_RM_IVAHD_RSTCTRL, | 2729 | .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET, |
2730 | }, | 2730 | }, |
2731 | }, | 2731 | }, |
2732 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | 2732 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), |
@@ -2742,7 +2742,7 @@ static struct omap_hwmod omap44xx_iva_seq1_hwmod = { | |||
2742 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq1_resets), | 2742 | .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq1_resets), |
2743 | .prcm = { | 2743 | .prcm = { |
2744 | .omap4 = { | 2744 | .omap4 = { |
2745 | .rstctrl_reg = OMAP4430_RM_IVAHD_RSTCTRL, | 2745 | .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET, |
2746 | }, | 2746 | }, |
2747 | }, | 2747 | }, |
2748 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | 2748 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), |
@@ -2759,7 +2759,7 @@ static struct omap_hwmod omap44xx_iva_hwmod = { | |||
2759 | .prcm = { | 2759 | .prcm = { |
2760 | .omap4 = { | 2760 | .omap4 = { |
2761 | .clkctrl_offs = OMAP4_CM_IVAHD_IVAHD_CLKCTRL_OFFSET, | 2761 | .clkctrl_offs = OMAP4_CM_IVAHD_IVAHD_CLKCTRL_OFFSET, |
2762 | .rstctrl_reg = OMAP4430_RM_IVAHD_RSTCTRL, | 2762 | .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET, |
2763 | }, | 2763 | }, |
2764 | }, | 2764 | }, |
2765 | .slaves = omap44xx_iva_slaves, | 2765 | .slaves = omap44xx_iva_slaves, |
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index a2a04bfa9628..faec860ebc0e 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP4 PRM module functions | 2 | * OMAP4 PRM module functions |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2011 Texas Instruments, Inc. |
5 | * Copyright (C) 2010 Nokia Corporation | 5 | * Copyright (C) 2010 Nokia Corporation |
6 | * Benoît Cousson | 6 | * Benoît Cousson |
7 | * Paul Walmsley | 7 | * Paul Walmsley |
@@ -24,12 +24,6 @@ | |||
24 | #include "prm44xx.h" | 24 | #include "prm44xx.h" |
25 | #include "prm-regbits-44xx.h" | 25 | #include "prm-regbits-44xx.h" |
26 | 26 | ||
27 | /* | ||
28 | * Address offset (in bytes) between the reset control and the reset | ||
29 | * status registers: 4 bytes on OMAP4 | ||
30 | */ | ||
31 | #define OMAP4_RST_CTRL_ST_OFFSET 4 | ||
32 | |||
33 | /* PRM low-level functions */ | 27 | /* PRM low-level functions */ |
34 | 28 | ||
35 | /* Read a register in a CM/PRM instance in the PRM module */ | 29 | /* Read a register in a CM/PRM instance in the PRM module */ |
@@ -94,91 +88,6 @@ u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 reg) | |||
94 | return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg); | 88 | return omap4_prm_rmw_inst_reg_bits(bits, 0x0, inst, reg); |
95 | } | 89 | } |
96 | 90 | ||
97 | /** | ||
98 | * omap4_prm_is_hardreset_asserted - read the HW reset line state of | ||
99 | * submodules contained in the hwmod module | ||
100 | * @rstctrl_reg: RM_RSTCTRL register address for this module | ||
101 | * @shift: register bit shift corresponding to the reset line to check | ||
102 | * | ||
103 | * Returns 1 if the (sub)module hardreset line is currently asserted, | ||
104 | * 0 if the (sub)module hardreset line is not currently asserted, or | ||
105 | * -EINVAL upon parameter error. | ||
106 | */ | ||
107 | int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift) | ||
108 | { | ||
109 | if (!cpu_is_omap44xx() || !rstctrl_reg) | ||
110 | return -EINVAL; | ||
111 | |||
112 | return omap4_prm_read_bits_shift(rstctrl_reg, (1 << shift)); | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * omap4_prm_assert_hardreset - assert the HW reset line of a submodule | ||
117 | * @rstctrl_reg: RM_RSTCTRL register address for this module | ||
118 | * @shift: register bit shift corresponding to the reset line to assert | ||
119 | * | ||
120 | * Some IPs like dsp, ipu or iva contain processors that require an HW | ||
121 | * reset line to be asserted / deasserted in order to fully enable the | ||
122 | * IP. These modules may have multiple hard-reset lines that reset | ||
123 | * different 'submodules' inside the IP block. This function will | ||
124 | * place the submodule into reset. Returns 0 upon success or -EINVAL | ||
125 | * upon an argument error. | ||
126 | */ | ||
127 | int omap4_prm_assert_hardreset(void __iomem *rstctrl_reg, u8 shift) | ||
128 | { | ||
129 | u32 mask; | ||
130 | |||
131 | if (!cpu_is_omap44xx() || !rstctrl_reg) | ||
132 | return -EINVAL; | ||
133 | |||
134 | mask = 1 << shift; | ||
135 | omap4_prm_rmw_reg_bits(mask, mask, rstctrl_reg); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * omap4_prm_deassert_hardreset - deassert a submodule hardreset line and wait | ||
142 | * @rstctrl_reg: RM_RSTCTRL register address for this module | ||
143 | * @shift: register bit shift corresponding to the reset line to deassert | ||
144 | * | ||
145 | * Some IPs like dsp, ipu or iva contain processors that require an HW | ||
146 | * reset line to be asserted / deasserted in order to fully enable the | ||
147 | * IP. These modules may have multiple hard-reset lines that reset | ||
148 | * different 'submodules' inside the IP block. This function will | ||
149 | * take the submodule out of reset and wait until the PRCM indicates | ||
150 | * that the reset has completed before returning. Returns 0 upon success or | ||
151 | * -EINVAL upon an argument error, -EEXIST if the submodule was already out | ||
152 | * of reset, or -EBUSY if the submodule did not exit reset promptly. | ||
153 | */ | ||
154 | int omap4_prm_deassert_hardreset(void __iomem *rstctrl_reg, u8 shift) | ||
155 | { | ||
156 | u32 mask; | ||
157 | void __iomem *rstst_reg; | ||
158 | int c; | ||
159 | |||
160 | if (!cpu_is_omap44xx() || !rstctrl_reg) | ||
161 | return -EINVAL; | ||
162 | |||
163 | rstst_reg = rstctrl_reg + OMAP4_RST_CTRL_ST_OFFSET; | ||
164 | |||
165 | mask = 1 << shift; | ||
166 | |||
167 | /* Check the current status to avoid de-asserting the line twice */ | ||
168 | if (omap4_prm_read_bits_shift(rstctrl_reg, mask) == 0) | ||
169 | return -EEXIST; | ||
170 | |||
171 | /* Clear the reset status by writing 1 to the status bit */ | ||
172 | omap4_prm_rmw_reg_bits(0xffffffff, mask, rstst_reg); | ||
173 | /* de-assert the reset control line */ | ||
174 | omap4_prm_rmw_reg_bits(mask, 0, rstctrl_reg); | ||
175 | /* wait the status to be set */ | ||
176 | omap_test_timeout(omap4_prm_read_bits_shift(rstst_reg, mask), | ||
177 | MAX_MODULE_HARDRESET_WAIT, c); | ||
178 | |||
179 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; | ||
180 | } | ||
181 | |||
182 | void omap4_prm_global_warm_sw_reset(void) | 91 | void omap4_prm_global_warm_sw_reset(void) |
183 | { | 92 | { |
184 | u32 v; | 93 | u32 v; |
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h index 6e53120fd6cb..3732e026a22f 100644 --- a/arch/arm/mach-omap2/prm44xx.h +++ b/arch/arm/mach-omap2/prm44xx.h | |||
@@ -755,10 +755,6 @@ extern u32 omap4_prm_set_inst_reg_bits(u32 bits, s16 inst, s16 idx); | |||
755 | extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx); | 755 | extern u32 omap4_prm_clear_inst_reg_bits(u32 bits, s16 inst, s16 idx); |
756 | extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask); | 756 | extern u32 omap4_prm_read_bits_shift(void __iomem *reg, u32 mask); |
757 | 757 | ||
758 | extern int omap4_prm_is_hardreset_asserted(void __iomem *rstctrl_reg, u8 shift); | ||
759 | extern int omap4_prm_assert_hardreset(void __iomem *rstctrl_reg, u8 shift); | ||
760 | extern int omap4_prm_deassert_hardreset(void __iomem *rstctrl_reg, u8 shift); | ||
761 | |||
762 | extern void omap4_prm_global_warm_sw_reset(void); | 758 | extern void omap4_prm_global_warm_sw_reset(void); |
763 | 759 | ||
764 | # endif | 760 | # endif |
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c index a30324297278..35e02aac1de9 100644 --- a/arch/arm/mach-omap2/prminst44xx.c +++ b/arch/arm/mach-omap2/prminst44xx.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * OMAP4 PRM instance functions | 2 | * OMAP4 PRM instance functions |
3 | * | 3 | * |
4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
5 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
5 | * Paul Walmsley | 6 | * Paul Walmsley |
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
@@ -53,7 +54,7 @@ void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx) | |||
53 | 54 | ||
54 | /* Read-modify-write a register in PRM. Caller must lock */ | 55 | /* Read-modify-write a register in PRM. Caller must lock */ |
55 | u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst, | 56 | u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst, |
56 | s16 idx) | 57 | u16 idx) |
57 | { | 58 | { |
58 | u32 v; | 59 | u32 v; |
59 | 60 | ||
@@ -64,3 +65,93 @@ u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst, | |||
64 | 65 | ||
65 | return v; | 66 | return v; |
66 | } | 67 | } |
68 | |||
69 | /* | ||
70 | * Address offset (in bytes) between the reset control and the reset | ||
71 | * status registers: 4 bytes on OMAP4 | ||
72 | */ | ||
73 | #define OMAP4_RST_CTRL_ST_OFFSET 4 | ||
74 | |||
75 | /** | ||
76 | * omap4_prminst_is_hardreset_asserted - read the HW reset line state of | ||
77 | * submodules contained in the hwmod module | ||
78 | * @rstctrl_reg: RM_RSTCTRL register address for this module | ||
79 | * @shift: register bit shift corresponding to the reset line to check | ||
80 | * | ||
81 | * Returns 1 if the (sub)module hardreset line is currently asserted, | ||
82 | * 0 if the (sub)module hardreset line is not currently asserted, or | ||
83 | * -EINVAL upon parameter error. | ||
84 | */ | ||
85 | int omap4_prminst_is_hardreset_asserted(u8 shift, u8 part, s16 inst, | ||
86 | u16 rstctrl_offs) | ||
87 | { | ||
88 | u32 v; | ||
89 | |||
90 | v = omap4_prminst_read_inst_reg(part, inst, rstctrl_offs); | ||
91 | v &= 1 << shift; | ||
92 | v >>= shift; | ||
93 | |||
94 | return v; | ||
95 | } | ||
96 | |||
97 | /** | ||
98 | * omap4_prminst_assert_hardreset - assert the HW reset line of a submodule | ||
99 | * @rstctrl_reg: RM_RSTCTRL register address for this module | ||
100 | * @shift: register bit shift corresponding to the reset line to assert | ||
101 | * | ||
102 | * Some IPs like dsp, ipu or iva contain processors that require an HW | ||
103 | * reset line to be asserted / deasserted in order to fully enable the | ||
104 | * IP. These modules may have multiple hard-reset lines that reset | ||
105 | * different 'submodules' inside the IP block. This function will | ||
106 | * place the submodule into reset. Returns 0 upon success or -EINVAL | ||
107 | * upon an argument error. | ||
108 | */ | ||
109 | int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, | ||
110 | u16 rstctrl_offs) | ||
111 | { | ||
112 | u32 mask = 1 << shift; | ||
113 | |||
114 | omap4_prminst_rmw_inst_reg_bits(mask, mask, part, inst, rstctrl_offs); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and | ||
121 | * wait | ||
122 | * @rstctrl_reg: RM_RSTCTRL register address for this module | ||
123 | * @shift: register bit shift corresponding to the reset line to deassert | ||
124 | * | ||
125 | * Some IPs like dsp, ipu or iva contain processors that require an HW | ||
126 | * reset line to be asserted / deasserted in order to fully enable the | ||
127 | * IP. These modules may have multiple hard-reset lines that reset | ||
128 | * different 'submodules' inside the IP block. This function will | ||
129 | * take the submodule out of reset and wait until the PRCM indicates | ||
130 | * that the reset has completed before returning. Returns 0 upon success or | ||
131 | * -EINVAL upon an argument error, -EEXIST if the submodule was already out | ||
132 | * of reset, or -EBUSY if the submodule did not exit reset promptly. | ||
133 | */ | ||
134 | int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, | ||
135 | u16 rstctrl_offs) | ||
136 | { | ||
137 | int c; | ||
138 | u32 mask = 1 << shift; | ||
139 | u16 rstst_offs = rstctrl_offs + OMAP4_RST_CTRL_ST_OFFSET; | ||
140 | |||
141 | /* Check the current status to avoid de-asserting the line twice */ | ||
142 | if (omap4_prminst_is_hardreset_asserted(shift, part, inst, | ||
143 | rstctrl_offs) == 0) | ||
144 | return -EEXIST; | ||
145 | |||
146 | /* Clear the reset status by writing 1 to the status bit */ | ||
147 | omap4_prminst_rmw_inst_reg_bits(0xffffffff, mask, part, inst, | ||
148 | rstst_offs); | ||
149 | /* de-assert the reset control line */ | ||
150 | omap4_prminst_rmw_inst_reg_bits(mask, 0, part, inst, rstctrl_offs); | ||
151 | /* wait the status to be set */ | ||
152 | omap_test_timeout(omap4_prminst_is_hardreset_asserted(shift, part, inst, | ||
153 | rstst_offs), | ||
154 | MAX_MODULE_HARDRESET_WAIT, c); | ||
155 | |||
156 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; | ||
157 | } | ||
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h index 02dd66ddda8b..c14ae294cd54 100644 --- a/arch/arm/mach-omap2/prminst44xx.h +++ b/arch/arm/mach-omap2/prminst44xx.h | |||
@@ -2,6 +2,7 @@ | |||
2 | * OMAP4 Power/Reset Management (PRM) function prototypes | 2 | * OMAP4 Power/Reset Management (PRM) function prototypes |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Nokia Corporation | 4 | * Copyright (C) 2010 Nokia Corporation |
5 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
5 | * Paul Walmsley | 6 | * Paul Walmsley |
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
@@ -18,8 +19,15 @@ | |||
18 | extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx); | 19 | extern u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx); |
19 | extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx); | 20 | extern void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx); |
20 | extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, | 21 | extern u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, |
21 | s16 inst, s16 idx); | 22 | s16 inst, u16 idx); |
22 | 23 | ||
23 | extern void omap4_prm_global_warm_sw_reset(void); | 24 | extern void omap4_prm_global_warm_sw_reset(void); |
24 | 25 | ||
26 | extern int omap4_prminst_is_hardreset_asserted(u8 shift, u8 part, s16 inst, | ||
27 | u16 rstctrl_offs); | ||
28 | extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, | ||
29 | u16 rstctrl_offs); | ||
30 | extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, | ||
31 | u16 rstctrl_offs); | ||
32 | |||
25 | #endif | 33 | #endif |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index fc54355de729..9ef4424366d2 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -2,6 +2,7 @@ | |||
2 | * omap_hwmod macros, structures | 2 | * omap_hwmod macros, structures |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2011 Nokia Corporation | 4 | * Copyright (C) 2009-2011 Nokia Corporation |
5 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
5 | * Paul Walmsley | 6 | * Paul Walmsley |
6 | * | 7 | * |
7 | * Created in collaboration with (alphabetical order): Benoît Cousson, | 8 | * Created in collaboration with (alphabetical order): Benoît Cousson, |
@@ -361,7 +362,7 @@ struct omap_hwmod_omap2_prcm { | |||
361 | */ | 362 | */ |
362 | struct omap_hwmod_omap4_prcm { | 363 | struct omap_hwmod_omap4_prcm { |
363 | u16 clkctrl_offs; | 364 | u16 clkctrl_offs; |
364 | void __iomem *rstctrl_reg; | 365 | u16 rstctrl_offs; |
365 | u8 submodule_wkdep_bit; | 366 | u8 submodule_wkdep_bit; |
366 | }; | 367 | }; |
367 | 368 | ||