On Di, 2025-01-28 at 09:17 +0100, patrice.chotard@xxxxxxxxxxx wrote: > From: Patrice Chotard <patrice.chotard@xxxxxxxxxxx> > > Octo Memory Manager driver (OMM) manages: > - the muxing between 2 OSPI busses and 2 output ports. > There are 4 possible muxing configurations: > - direct mode (no multiplexing): OSPI1 output is on port 1 and OSPI2 > output is on port 2 > - OSPI1 and OSPI2 are multiplexed over the same output port 1 > - swapped mode (no multiplexing), OSPI1 output is on port 2, > OSPI2 output is on port 1 > - OSPI1 and OSPI2 are multiplexed over the same output port 2 > - the split of the memory area shared between the 2 OSPI instances. > - chip select selection override. > - the time between 2 transactions in multiplexed mode. > - check firewall access. > > Signed-off-by: Patrice Chotard <patrice.chotard@xxxxxxxxxxx> > Signed-off-by: Christophe Kerello <christophe.kerello@xxxxxxxxxxx> > --- > drivers/memory/Kconfig | 17 ++ > drivers/memory/Makefile | 1 + > drivers/memory/stm32_omm.c | 509 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 527 insertions(+) > create mode 100644 drivers/memory/stm32_omm.c > [...] > diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c > new file mode 100644 > index 000000000000..6f20fe0183ec > --- /dev/null > +++ b/drivers/memory/stm32_omm.c > @@ -0,0 +1,509 @@ [...] > +static int stm32_omm_configure(struct device *dev) > +{ > + struct stm32_omm *omm = dev_get_drvdata(dev); > + struct reset_control *rstc; > + unsigned long clk_rate, clk_rate_max = 0; > + int ret; > + u8 i; > + u32 mux = 0; > + u32 cssel_ovr = 0; > + u32 req2ack = 0; > + > + omm->clk = devm_clk_get(dev, NULL); > + if (IS_ERR(omm->clk)) { > + dev_err(dev, "Failed to get OMM clock (%ld)\n", > + PTR_ERR(omm->clk)); > + > + return PTR_ERR(omm->clk); > + } > + > + ret = pm_runtime_resume_and_get(dev); > + if (ret < 0) > + return ret; > + > + /* parse children's clock */ > + for (i = 0; i < omm->nb_child; i++) { > + clk_rate = clk_get_rate(omm->child[i].clk); > + if (!clk_rate) { > + dev_err(dev, "Invalid clock rate\n"); > + goto err_clk_disable; > + } > + > + if (clk_rate > clk_rate_max) > + clk_rate_max = clk_rate; > + } > + > + rstc = devm_reset_control_get_optional(dev, NULL); Please use devm_reset_control_get_optional_exclusive() directly. regards Philipp