linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data
@ 2025-02-14  4:33 Denzeel Oliva
  2025-02-14  4:33 ` [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible Denzeel Oliva
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Denzeel Oliva @ 2025-02-14  4:33 UTC (permalink / raw)
  To: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel
  Cc: 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.

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(-)

-- 
2.48.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
  2025-02-14  4:33 [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
@ 2025-02-14  4:33 ` Denzeel Oliva
  2025-02-14  8:16   ` Krzysztof Kozlowski
  2025-02-14 15:25   ` Sam Protsenko
  2025-02-14  4:33 ` [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config Denzeel Oliva
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Denzeel Oliva @ 2025-02-14  4:33 UTC (permalink / raw)
  To: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel
  Cc: 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 <wachiturroxd150@gmail.com>
---
 Documentation/devicetree/bindings/spi/samsung,spi.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spi/samsung,spi.yaml b/Documentation/devicetree/bindings/spi/samsung,spi.yaml
index 3c206a64d..1d3c95bd2 100644
--- a/Documentation/devicetree/bindings/spi/samsung,spi.yaml
+++ b/Documentation/devicetree/bindings/spi/samsung,spi.yaml
@@ -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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config
  2025-02-14  4:33 [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
  2025-02-14  4:33 ` [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible Denzeel Oliva
@ 2025-02-14  4:33 ` Denzeel Oliva
  2025-02-14  7:10   ` Tudor Ambarus
  2025-02-14  4:33 ` [PATCH v3 3/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
  2025-02-14  5:31 ` [PATCH v3 0/3] " Denzeel Oliva
  3 siblings, 1 reply; 9+ messages in thread
From: Denzeel Oliva @ 2025-02-14  4:33 UTC (permalink / raw)
  To: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel
  Cc: 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.

Signed-off-by: Denzeel Oliva <wachiturroxd150@gmail.com>
---
 drivers/spi/spi-s3c64xx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 389275dbc..dae63a105 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -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);
 
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 3/3] spi: s3c64xx: add support exynos990-spi to new port config data
  2025-02-14  4:33 [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
  2025-02-14  4:33 ` [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible Denzeel Oliva
  2025-02-14  4:33 ` [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config Denzeel Oliva
@ 2025-02-14  4:33 ` Denzeel Oliva
  2025-02-14  5:31 ` [PATCH v3 0/3] " Denzeel Oliva
  3 siblings, 0 replies; 9+ messages in thread
From: Denzeel Oliva @ 2025-02-14  4:33 UTC (permalink / raw)
  To: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel
  Cc: 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.

Signed-off-by: Denzeel Oliva <wachiturroxd150@gmail.com>
---
 drivers/spi/spi-s3c64xx.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index dae63a105..88d751c69 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -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,
 	},
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data
  2025-02-14  4:33 [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
                   ` (2 preceding siblings ...)
  2025-02-14  4:33 ` [PATCH v3 3/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
@ 2025-02-14  5:31 ` Denzeel Oliva
  2025-02-14  6:53   ` Tudor Ambarus
  3 siblings, 1 reply; 9+ messages in thread
From: Denzeel Oliva @ 2025-02-14  5:31 UTC (permalink / raw)
  To: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel
  Cc: alim.akhtar, andi.shyti, broonie, conor+dt, devicetree, krzk+dt,
	linux-arm-kernel, linux-kernel, linux-spi, robh

On Fri, Feb 14, 2025 at 04:33:40AM +0000, Denzeel Oliva wrote:
> 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data
  2025-02-14  5:31 ` [PATCH v3 0/3] " Denzeel Oliva
@ 2025-02-14  6:53   ` Tudor Ambarus
  0 siblings, 0 replies; 9+ messages in thread
From: Tudor Ambarus @ 2025-02-14  6:53 UTC (permalink / raw)
  To: Denzeel Oliva, andi.shyti, broonie, robh, krzk+dt, conor+dt,
	alim.akhtar, linux-spi, linux-samsung-soc, devicetree,
	linux-kernel, linux-arm-kernel



On 2/14/25 5:31 AM, Denzeel Oliva wrote:
> On Fri, Feb 14, 2025 at 04:33:40AM +0000, Denzeel Oliva wrote:
>> 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
> 

Why does this prove that the IP works?

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config
  2025-02-14  4:33 ` [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config Denzeel Oliva
@ 2025-02-14  7:10   ` Tudor Ambarus
  0 siblings, 0 replies; 9+ messages in thread
From: Tudor Ambarus @ 2025-02-14  7:10 UTC (permalink / raw)
  To: Denzeel Oliva, andi.shyti, broonie, robh, krzk+dt, conor+dt,
	alim.akhtar, linux-spi, linux-samsung-soc, devicetree,
	linux-kernel, linux-arm-kernel



On 2/14/25 4:33 AM, Denzeel Oliva wrote:
> 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/fbd06330-ccf3-485b-800f-83f624a7c90e@kernel.org/

Please provide prove of testing in v4.

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
  2025-02-14  4:33 ` [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible Denzeel Oliva
@ 2025-02-14  8:16   ` Krzysztof Kozlowski
  2025-02-14 15:25   ` Sam Protsenko
  1 sibling, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-14  8:16 UTC (permalink / raw)
  To: Denzeel Oliva
  Cc: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel

On Fri, Feb 14, 2025 at 04:33:41AM +0000, Denzeel Oliva wrote:
> 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 <wachiturroxd150@gmail.com>
> ---
>  Documentation/devicetree/bindings/spi/samsung,spi.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

<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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible
  2025-02-14  4:33 ` [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible Denzeel Oliva
  2025-02-14  8:16   ` Krzysztof Kozlowski
@ 2025-02-14 15:25   ` Sam Protsenko
  1 sibling, 0 replies; 9+ messages in thread
From: Sam Protsenko @ 2025-02-14 15:25 UTC (permalink / raw)
  To: Denzeel Oliva
  Cc: andi.shyti, broonie, robh, krzk+dt, conor+dt, alim.akhtar,
	linux-spi, linux-samsung-soc, devicetree, linux-kernel,
	linux-arm-kernel

On Thu, Feb 13, 2025 at 10:34 PM Denzeel Oliva
<wachiturroxd150@gmail.com> wrote:
>
> 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 <wachiturroxd150@gmail.com>

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.

> ---

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

>  Documentation/devicetree/bindings/spi/samsung,spi.yaml | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi.yaml b/Documentation/devicetree/bindings/spi/samsung,spi.yaml
> index 3c206a64d..1d3c95bd2 100644
> --- a/Documentation/devicetree/bindings/spi/samsung,spi.yaml
> +++ b/Documentation/devicetree/bindings/spi/samsung,spi.yaml
> @@ -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
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-14 15:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14  4:33 [PATCH v3 0/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
2025-02-14  4:33 ` [PATCH v3 1/3] spi: dt-bindings: samsung: add samsung,exynos990-spi compatible Denzeel Oliva
2025-02-14  8:16   ` Krzysztof Kozlowski
2025-02-14 15:25   ` Sam Protsenko
2025-02-14  4:33 ` [PATCH v3 2/3] spi: s3c64xx: prioritize fifo-depth from DT over port_config Denzeel Oliva
2025-02-14  7:10   ` Tudor Ambarus
2025-02-14  4:33 ` [PATCH v3 3/3] spi: s3c64xx: add support exynos990-spi to new port config data Denzeel Oliva
2025-02-14  5:31 ` [PATCH v3 0/3] " Denzeel Oliva
2025-02-14  6:53   ` Tudor Ambarus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).