Add MP25 SOC support in stm32_fmc2 drivers:
- Update stm32-fmc2-ebi driver to support FMC2 revision 2 and MP25 SOC.
- Update stm32_fmc2_nand driver to support FMC2 revision 2 and MP25 SOC.
Christophe Kerello (11):
dt-bindings: memory-controller: st,stm32: add MP25 support
memory: stm32-fmc2-ebi: add a platform data structure
memory: stm32-fmc2-ebi: add MP25 support
memory: stm32-fmc2-ebi: update the driver to support revision 2
memory: stm32-fmc2-ebi: add RIF support
memory: stm32-fmc2-ebi: add runtime PM support
dt-bindings: mtd: st,stm32: add MP25 support
mtd: rawnand: stm32_fmc2: use dma_get_slave_caps to get DMA max burst
mtd: rawnand: stm32_fmc2: add a platform data structure
mtd: rawnand: stm32_fmc2: add MP25 support
mtd: rawnand: stm32_fmc2: update the driver to support revision 2
Patrick Delaunay (1):
dt-bindings: memory-controller: st,stm32: add 'power-domains' property
.../memory-controllers/st,stm32-fmc2-ebi.yaml | 7 +-
.../bindings/mtd/st,stm32-fmc2-nand.yaml | 58 ++-
drivers/memory/stm32-fmc2-ebi.c | 445 ++++++++++++++++--
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 108 ++++-
4 files changed, 547 insertions(+), 71 deletions(-)
--
2.25.1
From: Patrick Delaunay <[email protected]>
On STM32MP25 SOC, STM32 FMC2 memory controller is in a power domain.
Allow a single 'power-domains' entry for STM32 FMC2.
Signed-off-by: Patrick Delaunay <[email protected]>
Signed-off-by: Christophe Kerello <[email protected]>
---
.../bindings/memory-controllers/st,stm32-fmc2-ebi.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml b/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
index 12e6afeceffd..84ac6f50a6fc 100644
--- a/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
+++ b/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
@@ -36,6 +36,9 @@ properties:
resets:
maxItems: 1
+ power-domains:
+ maxItems: 1
+
"#address-cells":
const: 2
--
2.25.1
Before the introduction of MP25 SOC, let's use a platform data
structure for parameters that will differ (number of chip select).
The FMC2 NAND can support up to 4 chips select. On MP1 SOCs, only 2
chip select are available.
Signed-off-by: Christophe Kerello <[email protected]>
---
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 32 +++++++++++++++++++++-----
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index a7db7b675514..c5bdb43f7221 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -16,6 +16,7 @@
#include <linux/module.h>
#include <linux/mtd/rawnand.h>
#include <linux/of_address.h>
+#include <linux/of_device.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
@@ -37,7 +38,7 @@
#define FMC2_MAX_SG 16
/* Max chip enable */
-#define FMC2_MAX_CE 2
+#define FMC2_MAX_CE 4
/* Max ECC buffer length */
#define FMC2_MAX_ECC_BUF_LEN (FMC2_BCHDSRS_LEN * FMC2_MAX_SG)
@@ -243,6 +244,10 @@ static inline struct stm32_fmc2_nand *to_fmc2_nand(struct nand_chip *chip)
return container_of(chip, struct stm32_fmc2_nand, chip);
}
+struct stm32_fmc2_nfc_data {
+ int max_ncs;
+};
+
struct stm32_fmc2_nfc {
struct nand_controller base;
struct stm32_fmc2_nand nand;
@@ -256,6 +261,7 @@ struct stm32_fmc2_nfc {
phys_addr_t data_phys_addr[FMC2_MAX_CE];
struct clk *clk;
u8 irq_state;
+ const struct stm32_fmc2_nfc_data *data;
struct dma_chan *dma_tx_ch;
struct dma_chan *dma_rx_ch;
@@ -1809,7 +1815,7 @@ static int stm32_fmc2_nfc_parse_child(struct stm32_fmc2_nfc *nfc,
return ret;
}
- if (cs >= FMC2_MAX_CE) {
+ if (cs >= nfc->data->max_ncs) {
dev_err(nfc->dev, "invalid reg value: %d\n", cs);
return -EINVAL;
}
@@ -1915,6 +1921,10 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev)
nand_controller_init(&nfc->base);
nfc->base.ops = &stm32_fmc2_nfc_controller_ops;
+ nfc->data = of_device_get_match_data(dev);
+ if (!nfc->data)
+ return -EINVAL;
+
ret = stm32_fmc2_nfc_set_cdev(nfc);
if (ret)
return ret;
@@ -1936,7 +1946,7 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev)
if (nfc->dev == nfc->cdev)
start_region = 1;
- for (chip_cs = 0, mem_region = start_region; chip_cs < FMC2_MAX_CE;
+ for (chip_cs = 0, mem_region = start_region; chip_cs < nfc->data->max_ncs;
chip_cs++, mem_region += 3) {
if (!(nfc->cs_assigned & BIT(chip_cs)))
continue;
@@ -2092,7 +2102,7 @@ static int __maybe_unused stm32_fmc2_nfc_resume(struct device *dev)
stm32_fmc2_nfc_wp_disable(nand);
- for (chip_cs = 0; chip_cs < FMC2_MAX_CE; chip_cs++) {
+ for (chip_cs = 0; chip_cs < nfc->data->max_ncs; chip_cs++) {
if (!(nfc->cs_assigned & BIT(chip_cs)))
continue;
@@ -2105,9 +2115,19 @@ static int __maybe_unused stm32_fmc2_nfc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(stm32_fmc2_nfc_pm_ops, stm32_fmc2_nfc_suspend,
stm32_fmc2_nfc_resume);
+static const struct stm32_fmc2_nfc_data stm32_fmc2_nfc_mp1_data = {
+ .max_ncs = 2,
+};
+
static const struct of_device_id stm32_fmc2_nfc_match[] = {
- {.compatible = "st,stm32mp15-fmc2"},
- {.compatible = "st,stm32mp1-fmc2-nfc"},
+ {
+ .compatible = "st,stm32mp15-fmc2",
+ .data = &stm32_fmc2_nfc_mp1_data,
+ },
+ {
+ .compatible = "st,stm32mp1-fmc2-nfc",
+ .data = &stm32_fmc2_nfc_mp1_data,
+ },
{}
};
MODULE_DEVICE_TABLE(of, stm32_fmc2_nfc_match);
--
2.25.1
On Mon, Feb 12, 2024 at 06:48:12PM +0100, Christophe Kerello wrote:
> From: Patrick Delaunay <[email protected]>
>
> On STM32MP25 SOC, STM32 FMC2 memory controller is in a power domain.
> Allow a single 'power-domains' entry for STM32 FMC2.
This should be squashed with patch 1, since they both modify the same
file and this power-domain is part of the addition of mp25 support.
If the mp1 doesn't have power domains, shouldn't you constrain the
property to mp25 only?
Cheers,
Conor.
>
> Signed-off-by: Patrick Delaunay <[email protected]>
> Signed-off-by: Christophe Kerello <[email protected]>
> ---
> .../bindings/memory-controllers/st,stm32-fmc2-ebi.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml b/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
> index 12e6afeceffd..84ac6f50a6fc 100644
> --- a/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
> +++ b/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
> @@ -36,6 +36,9 @@ properties:
> resets:
> maxItems: 1
>
> + power-domains:
> + maxItems: 1
> +
> "#address-cells":
> const: 2
>
> --
> 2.25.1
>
On 12/02/2024 18:48, Christophe Kerello wrote:
> Add MP25 SOC support in stm32_fmc2 drivers:
> - Update stm32-fmc2-ebi driver to support FMC2 revision 2 and MP25 SOC.
> - Update stm32_fmc2_nand driver to support FMC2 revision 2 and MP25 SOC
Why do you combine memory controller driver and NAND in one patchset if
there is no dependency? On any further submissions, please split
independent works.
Best regards,
Krzysztof
On 2/12/24 19:33, Conor Dooley wrote:
> On Mon, Feb 12, 2024 at 06:48:12PM +0100, Christophe Kerello wrote:
>> From: Patrick Delaunay <[email protected]>
>>
>> On STM32MP25 SOC, STM32 FMC2 memory controller is in a power domain.
>> Allow a single 'power-domains' entry for STM32 FMC2.
>
> This should be squashed with patch 1, since they both modify the same
> file and this power-domain is part of the addition of mp25 support.
Hi Conor,
Ok, I will squash this patch with patch 1.
>
> If the mp1 doesn't have power domains, shouldn't you constrain the
> property to mp25 only?
>
As this property is optional, I do not see the need to constrain the
property to MP25 only, but if you think that it should be the case, I
will do it.
Regards,
Christophe Kerello.
> Cheers,
> Conor.
> >>
>> Signed-off-by: Patrick Delaunay <[email protected]>
>> Signed-off-by: Christophe Kerello <[email protected]>
>> ---
>> .../bindings/memory-controllers/st,stm32-fmc2-ebi.yaml | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml b/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
>> index 12e6afeceffd..84ac6f50a6fc 100644
>> --- a/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
>> +++ b/Documentation/devicetree/bindings/memory-controllers/st,stm32-fmc2-ebi.yaml
>> @@ -36,6 +36,9 @@ properties:
>> resets:
>> maxItems: 1
>>
>> + power-domains:
>> + maxItems: 1
>> +
>> "#address-cells":
>> const: 2
>>
>> --
>> 2.25.1
>>
>>
>> ______________________________________________________
>> Linux MTD discussion mailing list
>> http://lists.infradead.org/mailman/listinfo/linux-mtd/
On 13/02/2024 11:57, Christophe Kerello wrote:
>
>
> On 2/12/24 19:33, Conor Dooley wrote:
>> On Mon, Feb 12, 2024 at 06:48:12PM +0100, Christophe Kerello wrote:
>>> From: Patrick Delaunay <[email protected]>
>>>
>>> On STM32MP25 SOC, STM32 FMC2 memory controller is in a power domain.
>>> Allow a single 'power-domains' entry for STM32 FMC2.
>>
>> This should be squashed with patch 1, since they both modify the same
>> file and this power-domain is part of the addition of mp25 support.
>
> Hi Conor,
>
> Ok, I will squash this patch with patch 1.
>
>>
>> If the mp1 doesn't have power domains, shouldn't you constrain the
>> property to mp25 only?
>>
>
> As this property is optional, I do not see the need to constrain the
> property to MP25 only, but if you think that it should be the case, I
> will do it.
The question is: is this property valid for the old/existing variant?
Best regards,
Krzysztof
On 2/13/24 08:34, Krzysztof Kozlowski wrote:
> On 12/02/2024 18:48, Christophe Kerello wrote:
>> Add MP25 SOC support in stm32_fmc2 drivers:
>> - Update stm32-fmc2-ebi driver to support FMC2 revision 2 and MP25 SOC.
>> - Update stm32_fmc2_nand driver to support FMC2 revision 2 and MP25 SOC
>
> Why do you combine memory controller driver and NAND in one patchset if
> there is no dependency? On any further submissions, please split
> independent works.
Hi Krzysztof,
NAND driver patch 11 refers to the compatible described for the memory
controller (so there is a dependency), but anyway, I am going to split
this patchet.
Regards,
Christophe Kerello.
>
> Best regards,
> Krzysztof
>
On 2/13/24 12:57, Krzysztof Kozlowski wrote:
> On 13/02/2024 11:57, Christophe Kerello wrote:
>>
>>
>> On 2/12/24 19:33, Conor Dooley wrote:
>>> On Mon, Feb 12, 2024 at 06:48:12PM +0100, Christophe Kerello wrote:
>>>> From: Patrick Delaunay <[email protected]>
>>>>
>>>> On STM32MP25 SOC, STM32 FMC2 memory controller is in a power domain.
>>>> Allow a single 'power-domains' entry for STM32 FMC2.
>>>
>>> This should be squashed with patch 1, since they both modify the same
>>> file and this power-domain is part of the addition of mp25 support.
>>
>> Hi Conor,
>>
>> Ok, I will squash this patch with patch 1.
>>
>>>
>>> If the mp1 doesn't have power domains, shouldn't you constrain the
>>> property to mp25 only?
>>>
>>
>> As this property is optional, I do not see the need to constrain the
>> property to MP25 only, but if you think that it should be the case, I
>> will do it.
>
> The question is: is this property valid for the old/existing variant?
>
Hi Krzysztof,
It is not currently valid but there is a plan to move MP1 on PSCI
OS-initiated.
Regards,
Christophe Kerello.
> Best regards,
> Krzysztof
>
On 13/02/2024 16:57, Christophe Kerello wrote:
>
>
> On 2/13/24 12:57, Krzysztof Kozlowski wrote:
>> On 13/02/2024 11:57, Christophe Kerello wrote:
>>>
>>>
>>> On 2/12/24 19:33, Conor Dooley wrote:
>>>> On Mon, Feb 12, 2024 at 06:48:12PM +0100, Christophe Kerello wrote:
>>>>> From: Patrick Delaunay <[email protected]>
>>>>>
>>>>> On STM32MP25 SOC, STM32 FMC2 memory controller is in a power domain.
>>>>> Allow a single 'power-domains' entry for STM32 FMC2.
>>>>
>>>> This should be squashed with patch 1, since they both modify the same
>>>> file and this power-domain is part of the addition of mp25 support.
>>>
>>> Hi Conor,
>>>
>>> Ok, I will squash this patch with patch 1.
>>>
>>>>
>>>> If the mp1 doesn't have power domains, shouldn't you constrain the
>>>> property to mp25 only?
>>>>
>>>
>>> As this property is optional, I do not see the need to constrain the
>>> property to MP25 only, but if you think that it should be the case, I
>>> will do it.
>>
>> The question is: is this property valid for the old/existing variant?
>>
>
> Hi Krzysztof,
>
> It is not currently valid but there is a plan to move MP1 on PSCI
> OS-initiated.
OK
Best regards,
Krzysztof
On 13/02/2024 13:09, Christophe Kerello wrote:
>
>
> On 2/13/24 08:34, Krzysztof Kozlowski wrote:
>> On 12/02/2024 18:48, Christophe Kerello wrote:
>>> Add MP25 SOC support in stm32_fmc2 drivers:
>>> - Update stm32-fmc2-ebi driver to support FMC2 revision 2 and MP25 SOC.
>>> - Update stm32_fmc2_nand driver to support FMC2 revision 2 and MP25 SOC
>>
>> Why do you combine memory controller driver and NAND in one patchset if
>> there is no dependency? On any further submissions, please split
>> independent works.
>
> Hi Krzysztof,
>
> NAND driver patch 11 refers to the compatible described for the memory
Eh, it shouldn't really. This does not scale - you will keep growing
that 'if' clause? And other drivers should not include other device
compatibles.
But anyway that's not a real subsystem dependency. Just mention in patch
changelog (so ---) that compatible is documented somewhere at URL xyz.
Best regards,
Krzysztof
On 2/12/24 18:48, Christophe Kerello wrote:
> Add MP25 SOC support in stm32_fmc2 drivers:
> - Update stm32-fmc2-ebi driver to support FMC2 revision 2 and MP25 SOC.
> - Update stm32_fmc2_nand driver to support FMC2 revision 2 and MP25 SOC.
>
Hi Miquel,
Don't waste time reviewing this first patchset because I rewrote the
NAND part.
Patch V2 will be sent next week.
Regards,
Christophe Kerello.
> Christophe Kerello (11):
> dt-bindings: memory-controller: st,stm32: add MP25 support
> memory: stm32-fmc2-ebi: add a platform data structure
> memory: stm32-fmc2-ebi: add MP25 support
> memory: stm32-fmc2-ebi: update the driver to support revision 2
> memory: stm32-fmc2-ebi: add RIF support
> memory: stm32-fmc2-ebi: add runtime PM support
> dt-bindings: mtd: st,stm32: add MP25 support
> mtd: rawnand: stm32_fmc2: use dma_get_slave_caps to get DMA max burst
> mtd: rawnand: stm32_fmc2: add a platform data structure
> mtd: rawnand: stm32_fmc2: add MP25 support
> mtd: rawnand: stm32_fmc2: update the driver to support revision 2
>
> Patrick Delaunay (1):
> dt-bindings: memory-controller: st,stm32: add 'power-domains' property
>
> .../memory-controllers/st,stm32-fmc2-ebi.yaml | 7 +-
> .../bindings/mtd/st,stm32-fmc2-nand.yaml | 58 ++-
> drivers/memory/stm32-fmc2-ebi.c | 445 ++++++++++++++++--
> drivers/mtd/nand/raw/stm32_fmc2_nand.c | 108 ++++-
> 4 files changed, 547 insertions(+), 71 deletions(-)
>