From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, <linux-spi@vger.kernel.org>,
<devicetree@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <christophe.kerello@foss.st.com>
Subject: Re: [PATCH v3 4/8] memory: Add STM32 Octo Memory Manager driver
Date: Wed, 12 Feb 2025 17:18:30 +0100 [thread overview]
Message-ID: <f56ae1b6-657a-4809-b95c-e318462d4270@foss.st.com> (raw)
In-Reply-To: <CAMuHMdVkFym-3byZkszsi9tRoZ6zNOMCT79c2EgQQjn5xd19ig@mail.gmail.com>
On 2/12/25 13:51, Geert Uytterhoeven wrote:
> Hi Patrice,
>
> On Mon, 10 Feb 2025 at 14:21, <patrice.chotard@foss.st.com> wrote:
>> From: Patrice Chotard <patrice.chotard@foss.st.com>
>>
>> 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@foss.st.com>
>> Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
>
> Thanks for your patch!
>
>> --- a/drivers/memory/Kconfig
>> +++ b/drivers/memory/Kconfig
>> @@ -225,6 +225,23 @@ config STM32_FMC2_EBI
>> devices (like SRAM, ethernet adapters, FPGAs, LCD displays, ...) on
>> SOCs containing the FMC2 External Bus Interface.
>>
>> +config STM32_OMM
>> + tristate "STM32 Octo Memory Manager"
>> + depends on SPI_STM32_OSPI || TEST_COMPILE
>
> COMPILE_TEST
good catch
>
>> + help
>> + This driver manages the muxing between the 2 OSPI busses and
>> + the 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
>> + It also manages :
>> + - the split of the memory area shared between the 2 OSPI instances.
>> + - chip select selection override.
>> + - the time between 2 transactions in multiplexed mode.
>> +
>> source "drivers/memory/samsung/Kconfig"
>> source "drivers/memory/tegra/Kconfig"
>
>> --- /dev/null
>> +++ b/drivers/memory/stm32_omm.c
>
>> +static int stm32_omm_set_amcr(struct device *dev, bool set)
>> +{
>> + struct stm32_omm *omm = dev_get_drvdata(dev);
>> + struct regmap *syscfg_regmap;
>> + struct device_node *node;
>> + struct resource res, res1;
>> + resource_size_t mm_ospi2_size = 0;
>> + static const char * const mm_name[] = { "ospi1", "ospi2" };
>> + u32 amcr_base, amcr_mask;
>> + int ret, i, idx;
>
> unsigned int i
ok
>
>> + unsigned int amcr, read_amcr;
>> +
>> + for (i = 0; i < omm->nb_child; i++) {
>> + idx = of_property_match_string(dev->of_node,
>> + "memory-region-names",
>> + mm_name[i]);
>> + if (idx < 0)
>> + continue;
>> +
>> + /* res1 only used on second loop iteration */
>> + res1.start = res.start;
>> + res1.end = res.end;
>> +
>> + node = of_parse_phandle(dev->of_node, "memory-region", idx);
>> + if (!node)
>> + continue;
>> +
>> + ret = of_address_to_resource(node, 0, &res);
>> + if (ret) {
>> + dev_err(dev, "unable to resolve memory region\n");
>> + return ret;
>> + }
>> +
>> + /* check that memory region fits inside OMM memory map area */
>> + if (!resource_contains(omm->mm_res, &res)) {
>> + dev_err(dev, "%s doesn't fit inside OMM memory map area\n",
>> + mm_name[i]);
>> + dev_err(dev, "[0x%llx-0x%llx] doesn't fit inside [0x%llx-0x%llx]\n",
>> + res.start, res.end,
>> + omm->mm_res->start, omm->mm_res->end);
>
> As reported by the kernel test robot, this fails to build when
> resource_size_t differs from unsigned long long. However, you can
> easily print the full resource instead:
>
> dev_err(dev, "%pR doesn't fit inside %pR\n", &res, omm->mm_res);
>
> https://elixir.bootlin.com/linux/v6.13.2/source/Documentation/core-api/printk-formats.rst#L206
OK, thanks for this tips
Patrice
>
> Gr{oetje,eeting}s,
>
> Geert
>
next prev parent reply other threads:[~2025-02-12 16:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 13:18 [PATCH v3 0/8] Add STM32MP25 SPI NOR support patrice.chotard
2025-02-10 13:18 ` [PATCH v3 1/8] dt-bindings: spi: Add STM32 OSPI controller patrice.chotard
2025-02-13 7:57 ` Krzysztof Kozlowski
2025-02-17 9:17 ` Philipp Zabel
2025-02-18 8:39 ` Patrice CHOTARD
2025-02-10 13:18 ` [PATCH v3 2/8] spi: stm32: Add OSPI driver patrice.chotard
2025-02-10 13:18 ` [PATCH v3 3/8] dt-bindings: memory-controllers: Add STM32 Octo Memory Manager controller patrice.chotard
2025-02-13 8:00 ` Krzysztof Kozlowski
2025-02-18 9:58 ` Patrice CHOTARD
2025-02-10 13:18 ` [PATCH v3 4/8] memory: Add STM32 Octo Memory Manager driver patrice.chotard
2025-02-11 17:04 ` kernel test robot
2025-02-11 17:56 ` kernel test robot
2025-02-11 18:16 ` Christophe JAILLET
2025-02-12 16:17 ` Patrice CHOTARD
2025-02-12 3:19 ` kernel test robot
2025-02-12 12:51 ` Geert Uytterhoeven
2025-02-12 16:18 ` Patrice CHOTARD [this message]
2025-02-10 13:18 ` [PATCH v3 5/8] arm64: dts: st: Add OMM node on stm32mp251 patrice.chotard
2025-02-10 13:18 ` [PATCH v3 6/8] arm64: dts: st: Add ospi port1 pinctrl entries in stm32mp25-pinctrl.dtsi patrice.chotard
2025-02-10 13:18 ` [PATCH v3 7/8] arm64: dts: st: Add SPI NOR flash support on stm32mp257f-ev1 board patrice.chotard
2025-02-10 13:18 ` [PATCH v3 8/8] arm64: defconfig: Enable STM32 Octo Memory Manager and OcstoSPI driver patrice.chotard
2025-02-13 7:56 ` [PATCH v3 0/8] Add STM32MP25 SPI NOR support Krzysztof Kozlowski
2025-02-18 10:39 ` Patrice CHOTARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f56ae1b6-657a-4809-b95c-e318462d4270@foss.st.com \
--to=patrice.chotard@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=christophe.kerello@foss.st.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox