Skip to contentSkip to conversation

spi: s3c64xx: add support exynos990-spi to new port config data

PATCH In review Denzeel Oliva 4 participants 9 messages Feb 14, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 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.

Changes in v3:
- Reordered fifo_depth handling in s3c64xx_spi_probe() so that the DT property takes precedence over the default value in port_config. This allows node-specific FIFO depths to be applied correctly while preserving a fallback.

Denzeel Oliva (3):
spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
spi: s3c64xx: prioritize fifo-depth from DT over port_config
spi: s3c64xx: add support exynos990-spi to new port config data

 .../devicetree/bindings/spi/samsung,spi.yaml  |  1 +
 drivers/spi/spi-s3c64xx.c                     | 29 +++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH v3 1/3 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
index 3c206a64d..1d3c95bd2 100644
@@ -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
#4 lore raw

PATCH v3 2/3 spi: s3c64xx: prioritize fifo-depth from DT over port_config

In reply to Denzeel Oliva

Rearrange s3c64xx_spi_probe() to ensure that the 'fifo-depth' property from the device tree (DT) is always prioritized over the fallback values in port_config.

Previously, if port_config had a fifo_depth value, it would override the DT property. This prevented DT from correctly setting the depth per node.

This ensures flexibility for device tree configurations while keeping a safe fallback.

---
 drivers/spi/spi-s3c64xx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/spi/spi-s3c64xx.c +7 -5
index 389275dbc..dae63a105 100644
@@ -1283,11 +1283,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	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);
+	if (of_property_read_u32(pdev->dev.of_node, "fifo-depth",
+				&sdd->fifo_depth)) {
+		if (sdd->port_conf->fifo_depth)
+			sdd->fifo_depth = sdd->port_conf->fifo_depth;
+		else
+			sdd->fifo_depth = FIFO_DEPTH(sdd);
+	}
 
 	s3c64xx_spi_set_fifomask(sdd);
 
Signature · 1 line
2.48.1
#6 lore raw

PATCH v3 3/3 spi: s3c64xx: add support exynos990-spi to new port config data

In reply to Denzeel Oliva

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.

---
 drivers/spi/spi-s3c64xx.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/spi/spi-s3c64xx.c +17 -0
index dae63a105..88d751c69 100644
@@ -1588,6 +1588,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,
@@ -1666,6 +1680,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
#7 lore raw
In reply to Denzeel Oliva
Quoted 5 lines · Denzeel Oliva

Changes in v3:
- Reordered fifo_depth handling in s3c64xx_spi_probe() so that the DT property takes precedence over the default value in port_config. This allows node-specific FIFO depths to be applied correctly while preserving a fallback.

Showing evidence:

[    0.339111] s3c64xx-spi 10920000.spi: spi bus clock parent not specified, using clock at index 0 as parent
[    0.339119] s3c64xx-spi 10920000.spi: number of chip select lines not specified, assuming 1 chip select line
[    0.339467] s3c64xx-spi 10920000.spi: registered host spi0
[    0.339589] s3c64xx-spi 10920000.spi: Samsung SoC SPI Driver loaded for Bus SPI-0 with 1 Targets attached
[    0.339597] s3c64xx-spi 10920000.spi:        IOmem=[[mem 0x10920000-0x1092002f]]     FIFO 256bytes
-------------------------------------------------------------------------------------------------------------
[    0.587452] s3c64xx-spi 10650000.spi: spi bus clock parent not specified, using clock at index 0 as parent
[    0.587462] s3c64xx-spi 10650000.spi: number of chip select lines not specified, assuming 1 chip select line
[    0.587847] s3c64xx-spi 10650000.spi: registered host spi1
[    0.587986] s3c64xx-spi 10650000.spi: Samsung SoC SPI Driver loaded for Bus SPI-1 with 1 Targets attached
[    0.587997] s3c64xx-spi 10650000.spi:        IOmem=[[mem 0x10650000-0x1065002f]]     FIFO 64bytes
reviewer
#8 lore raw
Quoted 8 lines · Denzeel Oliva
Quoted 5 lines · Denzeel Oliva

Changes in v3:
- Reordered fifo_depth handling in s3c64xx_spi_probe() so that the DT property takes precedence over the default value in port_config. This allows node-specific FIFO depths to be applied correctly while preserving a fallback.

Showing evidence:

Quoted 12 lines
[    0.339111] s3c64xx-spi 10920000.spi: spi bus clock parent not specified, using clock at index 0 as parent
[    0.339119] s3c64xx-spi 10920000.spi: number of chip select lines not specified, assuming 1 chip select line
[    0.339467] s3c64xx-spi 10920000.spi: registered host spi0
[    0.339589] s3c64xx-spi 10920000.spi: Samsung SoC SPI Driver loaded for Bus SPI-0 with 1 Targets attached
[    0.339597] s3c64xx-spi 10920000.spi:        IOmem=[[mem 0x10920000-0x1092002f]]     FIFO 256bytes
-------------------------------------------------------------------------------------------------------------
[    0.587452] s3c64xx-spi 10650000.spi: spi bus clock parent not specified, using clock at index 0 as parent
[    0.587462] s3c64xx-spi 10650000.spi: number of chip select lines not specified, assuming 1 chip select line
[    0.587847] s3c64xx-spi 10650000.spi: registered host spi1
[    0.587986] s3c64xx-spi 10650000.spi: Samsung SoC SPI Driver loaded for Bus SPI-1 with 1 Targets attached
[    0.587997] s3c64xx-spi 10650000.spi:        IOmem=[[mem 0x10650000-0x1065002f]]     FIFO 64bytes

Why does this prove that the IP works?

Can you do a loopback test? See drivers/spi/spi-loopback-test.c

reviewer
#5 lore raw

Re: [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config

In reply to Denzeel Oliva
Quoted 7 lines · Denzeel Oliva

Rearrange s3c64xx_spi_probe() to ensure that the 'fifo-depth' property from the device tree (DT) is always prioritized over the fallback values in port_config.

Previously, if port_config had a fifo_depth value, it would override the DT property. This prevented DT from correctly setting the depth per node.

sigh. You had a fifo_depth of 0 in the driver at v1, this proves you didn't test your patches, otherwise you would get a divide by zero.

You can't do that, you risk to get your contributions ignored:
https://lore.kernel.org/linux-samsung-soc/[email protected]/

Please provide prove of testing in v4.

Anyway, you shouldn't prioritize dt over compatible driver data, see my replies in your v2.

maintainer Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible

In reply to Denzeel Oliva
Quoted 9 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.

---
 Documentation/devicetree/bindings/spi/samsung,spi.yaml | 1 +
 1 file changed, 1 insertion(+)

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible

In reply to Denzeel Oliva
Quoted 6 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.

If someone gives you any tags (like Reviewed-by, Acked-by, etc.) during previous patch version review round, you should collect them and add those around here. Only tags for the final patch series version (which is picked up by a maintainer) will be handled by the maintainer.

Quoted 1 line

---

Please always add a change log for each patch version under "---" line, it helps reviewers and maintainers understand what to look for while reviewing. Something like:

Changes in v3:
- none
Changes in v2:
- changed this
- changed that

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
index 3c206a64d..1d3c95bd2 100644
@@ -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