Skip to content

Commit 6ef733a

Browse files
GseoCPatrice Chotard
authored andcommitted
misc: stm32_omm: manage RIF semaphores release
Manage the release of the RIF semaphore at the end of the OMM probe. There should be no further access after this. Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Change-Id: Idaced89150e5e73d34f5458976c08c2dd3940aad Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/457632 Reviewed-by: Gatien CHEVALLIER <gatien.chevallier@st.com> ACI: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com> ACI: CIBUILD <MDG-smet-aci-builds@list.st.com> Domain-Review: Patrice CHOTARD <patrice.chotard@foss.st.com> Tested-by: Gatien CHEVALLIER <gatien.chevallier@st.com>
1 parent 6d0626c commit 6ef733a

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

drivers/misc/stm32_omm.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ static int stm32_omm_enable_child_clock(struct udevice *dev, ofnode child)
167167
return ret;
168168
}
169169

170+
static void stm32_omm_release_childs(ofnode *child_list, u8 nb_child)
171+
{
172+
u8 i;
173+
174+
for (i = 0; i < nb_child; i++)
175+
stm32_rifsc_release_access(child_list[i]);
176+
}
177+
170178
static int stm32_omm_probe(struct udevice *dev) {
171179
struct stm32_omm_plat *plat = dev_get_plat(dev);
172180
ofnode child_list[OMM_CHILD_NB];
@@ -210,20 +218,20 @@ static int stm32_omm_probe(struct udevice *dev) {
210218
/* check if OMM's ressource access is granted */
211219
ret = stm32_rifsc_check_access(dev_ofnode(dev));
212220
if (ret < 0 && ret != -EACCES)
213-
return ret;
221+
goto end;
214222

215223
/* All child's access are granted ? */
216224
if (!ret && child_access_granted == nb_child) {
217225
/* Ensure both OSPI instance are disabled before configuring OMM */
218226
for (i = 0; i < nb_child; i++) {
219227
ret = stm32_omm_disable_child(dev, child_list[i]);
220228
if (ret)
221-
return ret;
229+
goto end;
222230
}
223231

224232
ret = stm32_omm_configure(dev);
225233
if (ret)
226-
return ret;
234+
goto end;
227235

228236
if (plat->mux & CR_MUXEN) {
229237
/*
@@ -234,7 +242,7 @@ static int stm32_omm_probe(struct udevice *dev) {
234242
for (i = 0; i < nb_child; i++) {
235243
ret = stm32_omm_enable_child_clock(dev, child_list[i]);
236244
if (ret)
237-
return ret;
245+
goto end;
238246
}
239247
}
240248
} else {
@@ -246,6 +254,10 @@ static int stm32_omm_probe(struct udevice *dev) {
246254
ret = stm32_omm_set_amcr(dev, false);
247255
}
248256

257+
end:
258+
stm32_omm_release_childs(child_list, nb_child);
259+
stm32_rifsc_release_access(dev_ofnode(dev));
260+
249261
return ret;
250262
}
251263

0 commit comments

Comments
 (0)