Add support for the Mercury+ AA1 module
Subsystems (6)
v2 cover Add support for the Mercury+ AA1 module
The following patches add support for the Mercury+ AA1 with an Arria 10 SoCFPGA.
This version differs from the previous one by removing the spi flash node, renaming the memory and mdio nodes, adding gpio nodes, and adding a bus number property to Synopsys DesignWare i2c controller node.
Paweł Anikiel (4):
i2c: check bus number property in DesignWare I2C Controller
dt-bindings: add bus number property
reset: socfpga: add empty driver allowing consumers to probe
dts: socfpga: Add Mercury+ AA1 devicetree
.../bindings/i2c/snps,designware-i2c.yaml | 5 + arch/arm/boot/dts/Makefile | 1 + .../boot/dts/socfpga_arria10_mercury_aa1.dts | 99 +++++++++++++++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 3 +- drivers/reset/reset-socfpga.c | 26 +++++ 5 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/socfpga_arria10_mercury_aa1.dts
Signature · 1 line
2.25.1
PATCH v2 1/4 i2c: check bus number property in DesignWare I2C Controller
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to /dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (see i2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-platdrv.c +2 -1
@@ -280,7 +280,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) I2C_CLASS_HWMON :I2C_CLASS_DEPRECATED ;ACPI_COMPANION_SET (&adap->dev,ACPI_COMPANION (&pdev->dev)); adap->dev.of_node = pdev->dev.of_node; - adap->nr =-1 ; +if (of_property_read_u32 (pdev->dev.of_node,"busno" , &adap->nr)) + adap->nr =-1 ;if (dev->flags &ACCESS_NO_IRQ_SUSPEND ) { dev_pm_set_driver_flags(&pdev->dev,
Signature · 1 line
2.25.1
Andy Shevchenko
reviewerRe: [PATCH v2 1/4] i2c: check bus number property in DesignWare I2C Controller
Quoted 6 lines · Paweł Anikiel
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to
/dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (seei2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.
Why? This number means nothing, user space has another means to have this being robust. Sorry, but I don't see any even close to good enough justification, NAK.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 2/4 dt-bindings: add bus number property
In reply to Paweł AnikielOn SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to /dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (see i2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.
--- .../devicetree/bindings/i2c/snps,designware-i2c.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/i2c/snps,designware-i2c.yaml +5 -0
@@ -93,6 +93,11 @@ properties: - const: tx - const: rx + busno: + description: | + The property should contain the desired bus number (as opposed to + being assigned automatically) + unevaluatedProperties: false required:
Signature · 1 line
2.25.1
Arnd Bergmann
maintainerRe: [PATCH v2 2/4] dt-bindings: add bus number property
Quoted 9 lines · Paweł Anikiel
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to
/dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (seei2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.Signed-off-by Paweł Anikiel <[email protected]>
I don't see how adding a nonstandard property in one of the i2c bus drivers helps at all. How do you expect this to work when there are multiple i2c controllers in the system using different drivers? What should happen if both an alias and the busno property are set?
Arnd
Alexandre Belloni
maintainerRe: [PATCH v2 2/4] dt-bindings: add bus number property
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Paweł Anikiel
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to
/dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (seei2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.
Quoted 7 lines
Quoted 1 line
Signed-off-by Paweł Anikiel <[email protected]>I don't see how adding a nonstandard property in one of the i2c bus drivers helps at all. How do you expect this to work when there are multiple i2c controllers in the system using different drivers? What should happen if both an alias and the busno property are set?
What happens when two nodes have the same busno property because e.g. one is in a dtsi and the other one is in a dts?
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v2 2/4] dt-bindings: add bus number property
Quoted 12 lines · Alexandre Belloni
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Paweł Anikiel
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to
/dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (seei2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.Signed-off-by Paweł Anikiel <[email protected]>
Quoted 9 lines
Quoted 5 lines
I don't see how adding a nonstandard property in one of the i2c bus drivers helps at all. How do you expect this to work when there are multiple i2c controllers in the system using different drivers? What should happen if both an alias and the busno property are set?
What happens when two nodes have the same busno property because e.g. one is in a dtsi and the other one is in a dts?
If busno is set, the alias is ignored (the code that checks aliases is never reached). If two nodes have the same busno property, we get a WARN in drivers/i2c/i2c-core-base.c:1637, and only on of them gets attached.
What is a better way of doing this then? Is adding aliases to the devicetree like this okay?
aliases {
...
i2c0 = &i2c0;
i2c1 = &i2c1;
};
Arnd Bergmann
maintainerRe: [PATCH v2 2/4] dt-bindings: add bus number property
Quoted 11 lines · Paweł Anikiel
Quoted 3 lines · Alexandre Belloni
What happens when two nodes have the same busno property because e.g. one is in a dtsi and the other one is in a dts?
If busno is set, the alias is ignored (the code that checks aliases is never reached). If two nodes have the same busno property, we get a WARN in
drivers/i2c/i2c-core-base.c:1637, and only on of them gets attached.
Quoted 8 lines
What is a better way of doing this then? Is adding aliases to the devicetree like this okay?
aliases {
...
i2c0 = &i2c0;
i2c1 = &i2c1;
};
Yes, this is the normal way to do it.
The way I tend to think of it is that the soc.dtsi file contains a description of hardware that exists inside of the chip and is as much as possible detached from how an OS uses it or what is connected to it on the outside. You then have the board.dts file that contains everything specific to the board.
The /chosen and /aliases nodes in turn are specific to the individual machine, based on local configuration, installed OS and boot loader, and how the devices on the board are used.
We tend to have the /aliases node populated with a sensible configuration of how we expect them to be used for a given board. So if your machine connects two of the internal i2c buses on the SoC, it makes sense to assign them the aliases i2c0 and i2c1. On the other hand, if one of them is not connected anywhere, you may skip that, or if there is an additional i2c controller in programmable logic or behind some gpio lines, you can make that your i2c0 alias.
Arnd
Re: [PATCH v2 2/4] dt-bindings: add bus number property
In reply to Alexandre BelloniQuoted 13 lines · Alexandre Belloni
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Paweł Anikiel
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to
/dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (seei2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.Signed-off-by Paweł Anikiel <[email protected]>
Quoted 9 lines
Quoted 5 lines
I don't see how adding a nonstandard property in one of the i2c bus drivers helps at all. How do you expect this to work when there are multiple i2c controllers in the system using different drivers? What should happen if both an alias and the busno property are set?
What happens when two nodes have the same busno property because e.g. one is in a dtsi and the other one is in a dts?
If busno is set, the alias is ignored (the code that checks aliases is never reached). If two nodes have the same busno property, we get a WARN in drivers/i2c/i2c-core-base.c:1637, and only on of them gets attached.
What is a better way of doing this then? Is adding aliases to the devicetree like this okay?
aliases {
...
i2c0 = &i2c0;
i2c1 = &i2c1;
};
PATCH v2 3/4 reset: socfpga: add empty driver allowing consumers to probe
In reply to Paweł AnikielThe 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.
--- drivers/reset/reset-socfpga.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/reset/reset-socfpga.c +26 -0
@@ -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);
Signature · 1 line
2.25.1
PATCH v2 4/4 dts: socfpga: Add Mercury+ AA1 devicetree
In reply to Paweł AnikielAdd support for the Mercury+ AA1 module for Arria 10 SoC FPGA.
--- arch/arm/boot/dts/Makefile | 1 + .../boot/dts/socfpga_arria10_mercury_aa1.dts | 111 ++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 arch/arm/boot/dts/socfpga_arria10_mercury_aa1.dts
arch/arm/boot/dts/Makefile +1 -0
@@ -1078,6 +1078,7 @@ dtb-$(CONFIG_ARCH_INTEL_SOCFPGA) += \ socfpga_arria10_socdk_nand.dtb \ socfpga_arria10_socdk_qspi.dtb \ socfpga_arria10_socdk_sdmmc.dtb \ + socfpga_arria10_mercury_aa1.dtb \ socfpga_cyclone5_chameleon96.dtb \ socfpga_cyclone5_mcvevk.dtb \ socfpga_cyclone5_socdk.dtb \
arch/arm/boot/dts/socfpga_arria10_mercury_aa1.dts new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.25.1
A message that is not in the archive (sent off-list or not yet received): 20211005143746.xE5rCkt-P_XlNkn9bJ8ZqYPY4nQQ7doqzSd4FrAlICY@z
Rob Herring
maintainerRe: [PATCH v2 2/4] dt-bindings: add bus number property
Quoted 6 lines · Paweł Anikiel
On SoCFPGA systems, it's desireable to have fixed numbering for i2c busses, while being able to enable/disable them (e.g. have i2c1 be mapped to
/dev/i2c-1, even though i2c0 is disabled). This can also be achieved using devicetree aliases (seei2c_add_adapter). However, having the driver be self-contained without relying on aliases is more robust.
Your header is a bit weird as you have 2 Message-IDs:
Quoted 3 lines
Message-ID: <[email protected]>
X-Mailer: git-send-email 2.25.1
Message-ID: <20211005143746.xE5rCkt-P_XlNkn9bJ8ZqYPY4nQQ7doqzSd4FrAlICY@z>