2021-09-20 21:12:50

by Paweł Anikiel

[permalink] [raw]
Subject: [PATCH 0/3] Add support for the Mercury+ AA1 module

The following patches add support for the Mercury+ AA1 with an
Arria 10 SoCFPGA, namely a device tree, and a fix regarding the
Arria 10 reset manager driver.

Paweł Anikiel (3):
dt-bindings: mtd: spi-nor: add n25q00 schema
dts: socfpga: Add Mercury+ AA1 devicetree
reset: socfpga: add empty driver allowing consumers to probe

.../bindings/mtd/jedec,spi-nor.yaml | 2 +-
arch/arm/boot/dts/Makefile | 1 +
.../boot/dts/socfpga_arria10_mercury_aa1.dts | 127 ++++++++++++++++++
drivers/reset/reset-socfpga.c | 26 ++++
4 files changed, 155 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/boot/dts/socfpga_arria10_mercury_aa1.dts

--
2.25.1


2021-09-20 21:41:17

by Paweł Anikiel

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: mtd: spi-nor: add n25q00 schema

Add schema for the n25q00 NOR flash memory.

Signed-off-by: Paweł Anikiel <[email protected]>
---
Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
index ed590d7c6e37..efb3c5e05c5a 100644
--- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
+++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
@@ -18,7 +18,7 @@ properties:
- items:
- pattern: "^((((micron|spansion|st),)?\
(m25p(40|80|16|32|64|128)|\
- n25q(32b|064|128a11|128a13|256a|512a|164k)))|\
+ n25q(00|32b|064|128a11|128a13|256a|512a|164k)))|\
atmel,at25df(321a|641|081a)|\
everspin,mr25h(10|40|128|256)|\
(mxicy|macronix),mx25l(4005a|1606e|6405d|8005|12805d|25635e)|\
--
2.25.1

2021-09-20 21:44:05

by Paweł Anikiel

[permalink] [raw]
Subject: [PATCH 3/3] reset: socfpga: add empty driver allowing consumers to probe

The early reset driver doesn't ever probe, which causes consuming
devices to be unable to probe. Add an empty driver to set this device
as available, allowing consumers to probe.

Signed-off-by: Paweł Anikiel <[email protected]>
---
drivers/reset/reset-socfpga.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 2a72f861f798..8c6492e5693c 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -92,3 +92,29 @@ void __init socfpga_reset_init(void)
for_each_matching_node(np, socfpga_early_reset_dt_ids)
a10_reset_init(np);
}
+
+/*
+ * The early driver is problematic, because it doesn't register
+ * itself as a driver. This causes certain device links to prevent
+ * consumer devices from probing. The hacky solution is to register
+ * an empty driver, whose only job is to attach itself to the reset
+ * manager and call probe.
+ */
+static const struct of_device_id socfpga_reset_dt_ids[] = {
+ { .compatible = "altr,rst-mgr", },
+ { /* sentinel */ },
+};
+
+static int reset_simple_probe(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static struct platform_driver reset_socfpga_driver = {
+ .probe = reset_simple_probe,
+ .driver = {
+ .name = "socfpga-reset",
+ .of_match_table = socfpga_reset_dt_ids,
+ },
+};
+builtin_platform_driver(reset_socfpga_driver);
--
2.25.1

2021-09-23 17:00:46

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: mtd: spi-nor: add n25q00 schema

On Mon, 20 Sep 2021 14:41:39 +0200, Paweł Anikiel wrote:
> Add schema for the n25q00 NOR flash memory.
>
> Signed-off-by: Paweł Anikiel <[email protected]>
> ---
> Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Acked-by: Rob Herring <[email protected]>

2021-09-23 19:01:37

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: mtd: spi-nor: add n25q00 schema

+Tudor

On 20/09/21 02:41PM, Paweł Anikiel wrote:
> Add schema for the n25q00 NOR flash memory.
>
> Signed-off-by: Paweł Anikiel <[email protected]>
> ---
> Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> index ed590d7c6e37..efb3c5e05c5a 100644
> --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
> @@ -18,7 +18,7 @@ properties:
> - items:
> - pattern: "^((((micron|spansion|st),)?\
> (m25p(40|80|16|32|64|128)|\
> - n25q(32b|064|128a11|128a13|256a|512a|164k)))|\
> + n25q(00|32b|064|128a11|128a13|256a|512a|164k)))|\

IIUC this is supposed to only be for legacy/old flashes that started out
using flash-specific compatibles. Any new flashes should simply use
jedec,spi-nor unless there is a legitimate reason to do so.

Until you justify that reason,

Nacked-by: Pratyush Yadav <[email protected]>

> atmel,at25df(321a|641|081a)|\
> everspin,mr25h(10|40|128|256)|\
> (mxicy|macronix),mx25l(4005a|1606e|6405d|8005|12805d|25635e)|\
> --
> 2.25.1

--
Regards,
Pratyush Yadav
Texas Instruments Inc.

2021-10-05 09:35:37

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH 3/3] reset: socfpga: add empty driver allowing consumers to probe

Hi Paweł,

On Mon, 2021-09-20 at 14:41 +0200, Paweł Anikiel wrote:
> The early reset driver doesn't ever probe, which causes consuming
> devices to be unable to probe. Add an empty driver to set this device
> as available, allowing consumers to probe.
>
> Signed-off-by: Paweł Anikiel <[email protected]>
> ---
> drivers/reset/reset-socfpga.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> index 2a72f861f798..8c6492e5693c 100644
> --- a/drivers/reset/reset-socfpga.c
> +++ b/drivers/reset/reset-socfpga.c
> @@ -92,3 +92,29 @@ void __init socfpga_reset_init(void)
> for_each_matching_node(np, socfpga_early_reset_dt_ids)
> a10_reset_init(np);
> }
> +
> +/*
> + * The early driver is problematic, because it doesn't register
> + * itself as a driver. This causes certain device links to prevent
> + * consumer devices from probing. The hacky solution is to register
> + * an empty driver, whose only job is to attach itself to the reset
> + * manager and call probe.
> + */
> +static const struct of_device_id socfpga_reset_dt_ids[] = {
> + { .compatible = "altr,rst-mgr", },
> + { /* sentinel */ },
> +};
> +
> +static int reset_simple_probe(struct platform_device *pdev)
> +{
> + return 0;
> +}
> +
> +static struct platform_driver reset_socfpga_driver = {
> + .probe = reset_simple_probe,
> + .driver = {
> + .name = "socfpga-reset",
> + .of_match_table = socfpga_reset_dt_ids,
> + },
> +};
> +builtin_platform_driver(reset_socfpga_driver);

If we can just let devlink delay all consumers until the empty driver is
probed, does the reset controller have to be registered early at all?

regards
Philipp

2021-10-05 10:13:24

by Paweł Anikiel

[permalink] [raw]
Subject: Re: [PATCH 3/3] reset: socfpga: add empty driver allowing consumers to probe

On Tue, Oct 5, 2021 at 11:34 AM Philipp Zabel <[email protected]> wrote:
>
> Hi Paweł,
>
> On Mon, 2021-09-20 at 14:41 +0200, Paweł Anikiel wrote:
> > The early reset driver doesn't ever probe, which causes consuming
> > devices to be unable to probe. Add an empty driver to set this device
> > as available, allowing consumers to probe.
> >
> > Signed-off-by: Paweł Anikiel <[email protected]>
> > ---
> > drivers/reset/reset-socfpga.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> > index 2a72f861f798..8c6492e5693c 100644
> > --- a/drivers/reset/reset-socfpga.c
> > +++ b/drivers/reset/reset-socfpga.c
> > @@ -92,3 +92,29 @@ void __init socfpga_reset_init(void)
> > for_each_matching_node(np, socfpga_early_reset_dt_ids)
> > a10_reset_init(np);
> > }
> > +
> > +/*
> > + * The early driver is problematic, because it doesn't register
> > + * itself as a driver. This causes certain device links to prevent
> > + * consumer devices from probing. The hacky solution is to register
> > + * an empty driver, whose only job is to attach itself to the reset
> > + * manager and call probe.
> > + */
> > +static const struct of_device_id socfpga_reset_dt_ids[] = {
> > + { .compatible = "altr,rst-mgr", },
> > + { /* sentinel */ },
> > +};
> > +
> > +static int reset_simple_probe(struct platform_device *pdev)
> > +{
> > + return 0;
> > +}
> > +
> > +static struct platform_driver reset_socfpga_driver = {
> > + .probe = reset_simple_probe,
> > + .driver = {
> > + .name = "socfpga-reset",
> > + .of_match_table = socfpga_reset_dt_ids,
> > + },
> > +};
> > +builtin_platform_driver(reset_socfpga_driver);
>
> If we can just let devlink delay all consumers until the empty driver is
> probed, does the reset controller have to be registered early at all?
>
> regards
> Philipp

I asked Dinh if the reset controller code needs to be called early:

>That's correct. It's for one of the SP timers.
>
>On 9/16/21 6:13 AM, Paweł Anikiel wrote:
>> Hi,
>>
>> I would like to ask you about the following commit:
>>> commit b3ca9888f35fa6919569cf27c929dc0ac49e9716
>>> Author: Dinh Nguyen <[email protected]>
>>> Date: Tue Nov 13 12:50:48 2018 -0600
>>>
>>> reset: socfpga: add an early reset driver for SoCFPGA
>>>
>>> Create a separate reset driver that uses the reset operations in
>>> reset-simple. The reset driver for the SoCFPGA platform needs to
>>> register early in order to be able bring online timers that needed
>>> early in the kernel bootup.
>>> [...]
>> Which online timers is this commit message referring to? I couldn't find
>> any information about this. Without this patch the kernel seems to work
>> fine on an Arria 10 (with Mercury AA1 module). What's the exact reason
>> a regular platform driver isn't sufficient?
>>
>> Best regards,
>> Paweł
>>

2021-10-05 10:26:38

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH 3/3] reset: socfpga: add empty driver allowing consumers to probe

On Tue, 2021-10-05 at 13:12 +0200, Paweł Anikiel wrote:
> On Tue, Oct 5, 2021 at 11:34 AM Philipp Zabel <[email protected]> wrote:
> > Hi Paweł,
> >
> > On Mon, 2021-09-20 at 14:41 +0200, Paweł Anikiel wrote:
> > > The early reset driver doesn't ever probe, which causes consuming
> > > devices to be unable to probe. Add an empty driver to set this device
> > > as available, allowing consumers to probe.
> > >
> > > Signed-off-by: Paweł Anikiel <[email protected]>
> > > ---
> > > drivers/reset/reset-socfpga.c | 26 ++++++++++++++++++++++++++
> > > 1 file changed, 26 insertions(+)
> > >
> > > diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> > > index 2a72f861f798..8c6492e5693c 100644
> > > --- a/drivers/reset/reset-socfpga.c
> > > +++ b/drivers/reset/reset-socfpga.c
> > > @@ -92,3 +92,29 @@ void __init socfpga_reset_init(void)
> > > for_each_matching_node(np, socfpga_early_reset_dt_ids)
> > > a10_reset_init(np);
> > > }
> > > +
> > > +/*
> > > + * The early driver is problematic, because it doesn't register
> > > + * itself as a driver. This causes certain device links to prevent
> > > + * consumer devices from probing. The hacky solution is to register
> > > + * an empty driver, whose only job is to attach itself to the reset
> > > + * manager and call probe.
> > > + */
> > > +static const struct of_device_id socfpga_reset_dt_ids[] = {
> > > + { .compatible = "altr,rst-mgr", },
> > > + { /* sentinel */ },
> > > +};
> > > +
> > > +static int reset_simple_probe(struct platform_device *pdev)
> > > +{
> > > + return 0;
> > > +}
> > > +
> > > +static struct platform_driver reset_socfpga_driver = {
> > > + .probe = reset_simple_probe,
> > > + .driver = {
> > > + .name = "socfpga-reset",
> > > + .of_match_table = socfpga_reset_dt_ids,
> > > + },
> > > +};
> > > +builtin_platform_driver(reset_socfpga_driver);
> >
> > If we can just let devlink delay all consumers until the empty driver is
> > probed, does the reset controller have to be registered early at all?
> >
> > regards
> > Philipp
>
> I asked Dinh if the reset controller code needs to be called early:
>
> > That's correct. It's for one of the SP timers.

Ah, right, those call of_reset_control_get() from TIMER_OF_DECLARE().
Thank you, I'll apply this to reset/fixes.

regards
Philipp

2021-10-05 12:01:30

by Tudor Ambarus

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: mtd: spi-nor: add n25q00 schema

On 9/23/21 9:59 PM, Pratyush Yadav wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> +Tudor
>
> On 20/09/21 02:41PM, Paweł Anikiel wrote:
>> Add schema for the n25q00 NOR flash memory.
>>
>> Signed-off-by: Paweł Anikiel <[email protected]>
>> ---
>> Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
>> index ed590d7c6e37..efb3c5e05c5a 100644
>> --- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
>> +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
>> @@ -18,7 +18,7 @@ properties:
>> - items:
>> - pattern: "^((((micron|spansion|st),)?\
>> (m25p(40|80|16|32|64|128)|\
>> - n25q(32b|064|128a11|128a13|256a|512a|164k)))|\
>> + n25q(00|32b|064|128a11|128a13|256a|512a|164k)))|\
>
> IIUC this is supposed to only be for legacy/old flashes that started out
> using flash-specific compatibles. Any new flashes should simply use
> jedec,spi-nor unless there is a legitimate reason to do so.

that's correct, the generic compatible should suffice for these flashes.

>
> Until you justify that reason,
>
> Nacked-by: Pratyush Yadav <[email protected]>

I agree.

Cheers,
ta