spi: s3c64xx: add support exynos990-spi to new port config data
Subsystems (4)
v2 cover spi: s3c64xx: add support exynos990-spi to new port config data
Exynos990 uses the same version of USI SPI (v2.1) as the GS101. Removed fifo_lvl_mask and rx_lvl_offset, and changed to the new data configuration port.
The difference from other new port configuration data is that fifo_depth is only specified in fifo-depth in DT.
Exynos 990 data for SPI:
- The depth of the FIFO is not the same size on all nodes.
A depth of 64 bytes is used on most nodes,
while a depth of 256 bytes is used on 3 specific nodes (SPI 8/9/10).
- The Exynos 990 only allows access to 32-bit registers.
If access is attempted with a different size, an error interrupt is generated. Therefore, it is necessary to perform write accesses to registers in 32-bit blocks.
Changes in v2:
- Added a default "fifo_depth = 64" to prevent crashes when "fifo-depth" is missing in the device tree (avoids divide-by-zero issues).
- No other functional changes.
Denzeel Oliva (2):
spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
spi: s3c64xx: add support exynos990-spi to new port config data
.../devicetree/bindings/spi/samsung,spi.yaml | 1 + drivers/spi/spi-s3c64xx.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
Signature · 1 line
2.48.1
PATCH v2 1/2 spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
Add "samsung,exynos990-spi" dedicated compatible for the SPI controller on Exynos990 SoC. This ensures proper representation of the hardware in the device tree.
--- Documentation/devicetree/bindings/spi/samsung,spi.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/spi/samsung,spi.yaml +1 -0
@@ -24,6 +24,7 @@ properties: - samsung,exynos4210-spi - samsung,exynos5433-spi - samsung,exynos850-spi + - samsung,exynos990-spi - samsung,exynosautov9-spi - tesla,fsd-spi - items:
Signature · 1 line
2.48.1
Re: [PATCH v2 1/2] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
Quoted 7 lines · Denzeel Oliva
Add "samsung,exynos990-spi" dedicated compatible for the SPI controller on Exynos990 SoC. This ensures proper representation of the hardware in the device tree.
Signed-off-by Denzeel Oliva <[email protected]>---
Quoted 19 lines
Documentation/devicetree/bindings/spi/samsung,spi.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/spi/samsung,spi.yaml +1
-1@@ -24,6 +24,7 @@ properties: - samsung,exynos4210-spi - samsung,exynos5433-spi - samsung,exynos850-spi + - samsung,exynos990-spi - samsung,exynosautov9-spi - tesla,fsd-spi - items: --2.48.1
PATCH v2 2/2 spi: s3c64xx: add support exynos990-spi to new port config data
In reply to Denzeel OlivaExynos990 uses the same version of USI SPI (v2.1) as the GS101. Removed fifo_lvl_mask and rx_lvl_offset, and changed to the new data configuration port.
The difference from other new port configuration data is that fifo_depth is only specified in fifo-depth in DT.
Exynos 990 data for SPI:
- The depth of the FIFO is not the same size on all nodes.
A depth of 64 bytes is used on most nodes,
while a depth of 256 bytes is used on 3 specific nodes (SPI 8/9/10).
- The Exynos 990 only allows access to 32-bit registers.
If access is attempted with a different size, an error interrupt is generated. Therefore, it is necessary to perform write accesses to registers in 32-bit blocks.
- To prevent potential issues when fifo-depth is not explicitly set in DT, a default value of 64 is assigned to ensure stable operation.
--- drivers/spi/spi-s3c64xx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/spi/spi-s3c64xx.c +17 -0
@@ -1586,6 +1586,20 @@ static const struct s3c64xx_spi_port_config exynos850_spi_port_config = { .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, }; +static const struct s3c64xx_spi_port_config exynos990_spi_port_config = { +/* If not specified in DT, defaults to 64 */ + .fifo_depth =64 , + .rx_fifomask =S3C64XX_SPI_ST_RX_FIFO_RDY_V2 , + .tx_fifomask =S3C64XX_SPI_ST_TX_FIFO_RDY_V2 , + .tx_st_done =25 , + .clk_div =4 , + .high_speed = true, + .clk_from_cmu = true, + .has_loopback = true, + .use_32bit_io = true, + .quirks =S3C64XX_SPI_QUIRK_CS_AUTO , +}; +static const struct s3c64xx_spi_port_config exynosautov9_spi_port_config = {/* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = {0x1ff ,0x1ff ,0x7f ,0x7f ,0x7f ,0x7f ,0x1ff ,0x7f ,
@@ -1664,6 +1678,9 @@ static const struct of_device_id s3c64xx_spi_dt_match[] = { { .compatible = "samsung,exynos850-spi", .data = &exynos850_spi_port_config, }, + { .compatible = "samsung,exynos990-spi", + .data = &exynos990_spi_port_config, + }, { .compatible = "samsung,exynosautov9-spi", .data = &exynosautov9_spi_port_config, },
Signature · 1 line
2.48.1
Quoted 8 lines · Denzeel Oliva
Exynos990 uses the same version of USI SPI (v2.1) as the GS101. Removed
fifo_lvl_maskandrx_lvl_offset, and changed to the new data configuration port.The difference from other new port configuration data is that
fifo_depthis only specified in fifo-depth in DT.
In the code below I can see this bit:
/* If not specified in DT, defaults to 64 */
.fifo_depth = 64,Is that intentional or is it some leftover that was meant to be removed before the submission? From s3c64xx_spi_probe() it looks like the "fifo-depth" DT property is ignored if .fifo_depth is set in the port_config:
if (sdd->port_conf->fifo_depth)
sdd->fifo_depth = sdd->port_conf->fifo_depth;
else if (of_property_read_u32(pdev->dev.of_node, "fifo-depth",
&sdd->fifo_depth))
sdd->fifo_depth = FIFO_DEPTH(sdd);Btw, wouldn't it be reasonable to flip this probe() code the other way around? So that the fact that the DT property is available is prioritized, not its port_config counterpart. That would make it possible to provide a sensible default in the port_config structure and at the same time be able to override it by specifying the DT property for nodes where it's needed. Just a thought, not strictly related to this patch.
Quoted 21 lines
Exynos 990 data for SPI:
- The depth of the FIFO is not the same size on all nodes.
A depth of 64 bytes is used on most nodes,
while a depth of 256 bytes is used on 3 specific nodes (SPI 8/9/10).
- The Exynos 990 only allows access to 32-bit registers.
If access is attempted with a different size, an error interrupt is generated. Therefore, it is necessary to perform write accesses to registers in 32-bit blocks.
- To prevent potential issues when fifo-depth is not explicitly set in DT, a default value of 64 is assigned to ensure stable operation.Signed-off-by Denzeel Oliva <[email protected]>--- drivers/spi/spi-s3c64xx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/spi/spi-s3c64xx.c +0
-0
drivers/spi/spi-s3c64xx.c static const struct s3c64xx_spi_port_config exynos850_spi_port_config = { · line 1591
Quoted 6 lines
drivers/spi/spi-s3c64xx.c +3
-0@@ -1586,6 +1586,20 @@ static const struct s3c64xx_spi_port_config exynos850_spi_port_config = { .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, }; +static const struct s3c64xx_spi_port_config exynos990_spi_port_config = { +/* If not specified in DT, defaults to 64 */ + .fifo_depth =64 ,
Talking about this line here.
Quoted 28 lines
drivers/spi/spi-s3c64xx.c +14
-1+ .rx_fifomask = S3C64XX_SPI_ST_RX_FIFO_RDY_V2, + .tx_fifomask = S3C64XX_SPI_ST_TX_FIFO_RDY_V2, + .tx_st_done = 25, + .clk_div = 4, + .high_speed = true, + .clk_from_cmu = true, + .has_loopback = true, + .use_32bit_io = true, + .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, +}; +static const struct s3c64xx_spi_port_config exynosautov9_spi_port_config = {/* fifo_lvl_mask is deprecated. Use {rx, tx}_fifomask instead. */ .fifo_lvl_mask = {0x1ff ,0x1ff ,0x7f ,0x7f ,0x7f ,0x7f ,0x1ff ,0x7f ,@@ -1664,6 +1678,9 @@ static const struct of_device_id s3c64xx_spi_dt_match[] = { { .compatible = "samsung,exynos850-spi", .data = &exynos850_spi_port_config, }, + { .compatible = "samsung,exynos990-spi", + .data = &exynos990_spi_port_config, + }, { .compatible = "samsung,exynosautov9-spi", .data = &exynosautov9_spi_port_config, }, --2.48.1
Tudor Ambarus
reviewerHi, Sam,
Quoted 12 lines · Sam Protsenko
Quoted 8 lines · Denzeel Oliva
Exynos990 uses the same version of USI SPI (v2.1) as the GS101. Removed
fifo_lvl_maskandrx_lvl_offset, and changed to the new data configuration port.The difference from other new port configuration data is that
fifo_depthis only specified in fifo-depth in DT.In the code below I can see this bit:
Quoted 7 lines
/* If not specified in DT, defaults to 64 */ .fifo_depth = 64,Is that intentional or is it some leftover that was meant to be removed before the submission? From
s3c64xx_spi_probe()it looks like the "fifo-depth" DT property is ignored if .fifo_depth is set in theport_config:
fifo-depth in port config is intended for IPs where all their instances use the same FIFO depth. fifo-depth from DT is ignored because the compatible knows better than what developers may in DT in this case, it is intentional.
Quoted 8 lines
if (sdd->port_conf->fifo_depth) sdd->fifo_depth = sdd->port_conf->fifo_depth; else if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", &sdd->fifo_depth)) sdd->fifo_depth = FIFO_DEPTH(sdd);Btw, wouldn't it be reasonable to flip this
probe()code the other way
No, please. IPs that have instances with different FIFO depths shall rely only on DT to specify their FIFO depths.
Cheers,
ta
Quoted 36 lines · Tudor Ambarus
Hi, Sam,
Quoted 12 lines · Sam Protsenko
Quoted 8 lines · Denzeel Oliva
Exynos990 uses the same version of USI SPI (v2.1) as the GS101. Removed
fifo_lvl_maskandrx_lvl_offset, and changed to the new data configuration port.The difference from other new port configuration data is that
fifo_depthis only specified in fifo-depth in DT.In the code below I can see this bit:
Quoted 7 lines
/* If not specified in DT, defaults to 64 */ .fifo_depth = 64,Is that intentional or is it some leftover that was meant to be removed before the submission? From
s3c64xx_spi_probe()it looks like the "fifo-depth" DT property is ignored if .fifo_depth is set in theport_config:fifo-depth in port config is intended for IPs where all their instances use the same FIFO depth. fifo-depth from DT is ignored because the compatible knows better than what developers may in DT in this case, it is intentional.
Quoted 7 lines
if (sdd->port_conf->fifo_depth) sdd->fifo_depth = sdd->port_conf->fifo_depth; else if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", &sdd->fifo_depth)) sdd->fifo_depth = FIFO_DEPTH(sdd);
Quoted 5 lines
Quoted 1 line
Btw, wouldn't it be reasonable to flip this
probe()code the other wayNo, please. IPs that have instances with different FIFO depths shall rely only on DT to specify their FIFO depths.
Fair enough. Does it mean the port_config.fifo_depth should be made obsolete? Or it makes sense for older SoCs where FIFO depth is fixed, or something like that?
Quoted 2 lines
Cheers,
ta
Tudor Ambarus
reviewerQuoted 2 lines · Denzeel Oliva
- Added a default "
fifo_depth= 64" to prevent crashes when "fifo-depth" is missing in the device tree (avoids divide-by-zero issues).
no, you shouldn't use fifo_depth as a fallback, it's misleading. fifo_depth shall be used only if all your SPI instances use the same FIFO size. If that's not the case, as in yours, you specify the FIFO depth via DT.
You need to determine whether your IP works with 0 sized FIFOs and if not, make the the DT fifo-depth mandatory and check that its value is > 0.
If the IP works with 0 sized FIFOs, you need to update the driver to allow that and let the fifo-depth property optional in DT.