linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features
@ 2022-06-07 11:46 Krishna Yarlagadda
  2022-06-07 11:46 ` [Patch V3 1/3] spi: tegra210-quad: Multi-cs support Krishna Yarlagadda
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Krishna Yarlagadda @ 2022-06-07 11:46 UTC (permalink / raw)
  To: broonie, thierry.reding, jonathanh, linux-spi, linux-tegra,
	ashishsingha, robh+dt
  Cc: skomatineni, ldewangan, devicetree, linux-kernel, Krishna Yarlagadda

Add multiple chip select lines supported on Tegra 241

Changes in v3:
Handle review comments.
Move controller's properties to "nvidia,tegra210-quad.yaml".
Fix style errors in peripheral yaml doc.
Changes in v2:
Split Wait polling changes to be handled later
Change chip name to convention followed (Grace to 241)
Add tegra qspi peripherals yaml file

Krishna Yarlagadda (3):
  spi: tegra210-quad: Multi-cs support
  spi: dt-bindings: split peripheral prods
  spi: dt-bindings: Add compatible for Tegra241 QSPI

 ...nvidia,tegra210-quad-peripheral-props.yaml | 33 +++++++++++++++++++
 .../bindings/spi/nvidia,tegra210-quad.yaml    | 22 +------------
 .../bindings/spi/spi-peripheral-props.yaml    |  1 +
 drivers/spi/spi-tegra210-quad.c               | 33 +++++++++++++++++--
 4 files changed, 66 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml

-- 
2.17.1


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

* [Patch V3 1/3] spi: tegra210-quad: Multi-cs support
  2022-06-07 11:46 [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Krishna Yarlagadda
@ 2022-06-07 11:46 ` Krishna Yarlagadda
  2022-06-07 11:46 ` [Patch V3 2/3] spi: dt-bindings: split peripheral prods Krishna Yarlagadda
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Krishna Yarlagadda @ 2022-06-07 11:46 UTC (permalink / raw)
  To: broonie, thierry.reding, jonathanh, linux-spi, linux-tegra,
	ashishsingha, robh+dt
  Cc: skomatineni, ldewangan, devicetree, linux-kernel, Krishna Yarlagadda

Tegra Grace and later chips can support upto 4 chip select lines
for QUAD SPI. Added new compatible for Tegra Grace.

Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
---
 drivers/spi/spi-tegra210-quad.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index 66f647f32876..c89592b21ffc 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -37,6 +37,16 @@
 #define QSPI_RX_EN				BIT(12)
 #define QSPI_CS_SW_VAL				BIT(20)
 #define QSPI_CS_SW_HW				BIT(21)
+
+#define QSPI_CS_POL_INACTIVE(n)			(1 << (22 + (n)))
+#define QSPI_CS_POL_INACTIVE_MASK		(0xF << 22)
+#define QSPI_CS_SEL_0				(0 << 26)
+#define QSPI_CS_SEL_1				(1 << 26)
+#define QSPI_CS_SEL_2				(2 << 26)
+#define QSPI_CS_SEL_3				(3 << 26)
+#define QSPI_CS_SEL_MASK			(3 << 26)
+#define QSPI_CS_SEL(x)				(((x) & 0x3) << 26)
+
 #define QSPI_CONTROL_MODE_0			(0 << 28)
 #define QSPI_CONTROL_MODE_3			(3 << 28)
 #define QSPI_CONTROL_MODE_MASK			(3 << 28)
@@ -154,6 +164,7 @@
 struct tegra_qspi_soc_data {
 	bool has_dma;
 	bool cmb_xfer_capable;
+	unsigned int cs_count;
 };
 
 struct tegra_qspi_client_data {
@@ -812,6 +823,7 @@ static u32 tegra_qspi_setup_transfer_one(struct spi_device *spi, struct spi_tran
 		tegra_qspi_mask_clear_irq(tqspi);
 
 		command1 = tqspi->def_command1_reg;
+		command1 |= QSPI_CS_SEL(spi->chip_select);
 		command1 |= QSPI_BIT_LENGTH(bits_per_word - 1);
 
 		command1 &= ~QSPI_CONTROL_MODE_MASK;
@@ -941,10 +953,11 @@ static int tegra_qspi_setup(struct spi_device *spi)
 
 	/* keep default cs state to inactive */
 	val = tqspi->def_command1_reg;
+	val |= QSPI_CS_SEL(spi->chip_select);
 	if (spi->mode & SPI_CS_HIGH)
-		val &= ~QSPI_CS_SW_VAL;
+		val &= ~QSPI_CS_POL_INACTIVE(spi->chip_select);
 	else
-		val |= QSPI_CS_SW_VAL;
+		val |= QSPI_CS_POL_INACTIVE(spi->chip_select);
 
 	tqspi->def_command1_reg = val;
 	tegra_qspi_writel(tqspi, tqspi->def_command1_reg, QSPI_COMMAND1);
@@ -1425,16 +1438,25 @@ static irqreturn_t tegra_qspi_isr_thread(int irq, void *context_data)
 static struct tegra_qspi_soc_data tegra210_qspi_soc_data = {
 	.has_dma = true,
 	.cmb_xfer_capable = false,
+	.cs_count = 1,
 };
 
 static struct tegra_qspi_soc_data tegra186_qspi_soc_data = {
 	.has_dma = true,
 	.cmb_xfer_capable = true,
+	.cs_count = 1,
 };
 
 static struct tegra_qspi_soc_data tegra234_qspi_soc_data = {
 	.has_dma = false,
 	.cmb_xfer_capable = true,
+	.cs_count = 1,
+};
+
+static struct tegra_qspi_soc_data tegra241_qspi_soc_data = {
+	.has_dma = false,
+	.cmb_xfer_capable = true,
+	.cs_count = 4,
 };
 
 static const struct of_device_id tegra_qspi_of_match[] = {
@@ -1450,6 +1472,9 @@ static const struct of_device_id tegra_qspi_of_match[] = {
 	}, {
 		.compatible = "nvidia,tegra234-qspi",
 		.data	    = &tegra234_qspi_soc_data,
+	}, {
+		.compatible = "nvidia,tegra241-qspi",
+		.data	    = &tegra241_qspi_soc_data,
 	},
 	{}
 };
@@ -1467,6 +1492,9 @@ static const struct acpi_device_id tegra_qspi_acpi_match[] = {
 	}, {
 		.id = "NVDA1413",
 		.driver_data = (kernel_ulong_t)&tegra234_qspi_soc_data,
+	}, {
+		.id = "NVDA1513",
+		.driver_data = (kernel_ulong_t)&tegra241_qspi_soc_data,
 	},
 	{}
 };
@@ -1506,6 +1534,7 @@ static int tegra_qspi_probe(struct platform_device *pdev)
 	spin_lock_init(&tqspi->lock);
 
 	tqspi->soc_data = device_get_match_data(&pdev->dev);
+	master->num_chipselect = tqspi->soc_data->cs_count;
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	tqspi->base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(tqspi->base))
-- 
2.17.1


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

* [Patch V3 2/3] spi: dt-bindings: split peripheral prods
  2022-06-07 11:46 [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Krishna Yarlagadda
  2022-06-07 11:46 ` [Patch V3 1/3] spi: tegra210-quad: Multi-cs support Krishna Yarlagadda
@ 2022-06-07 11:46 ` Krishna Yarlagadda
  2022-06-09 20:13   ` Rob Herring
  2022-06-07 11:46 ` [Patch V3 3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI Krishna Yarlagadda
  2022-06-13 17:24 ` [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Krishna Yarlagadda @ 2022-06-07 11:46 UTC (permalink / raw)
  To: broonie, thierry.reding, jonathanh, linux-spi, linux-tegra,
	ashishsingha, robh+dt
  Cc: skomatineni, ldewangan, devicetree, linux-kernel, Krishna Yarlagadda

Move peripheral properties for Tegra QSPI controller to
nvidia,tegra210-quad-peripheral-props.yaml and add reference
to spi-peripheral-props.yaml file.

Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
---
 ...nvidia,tegra210-quad-peripheral-props.yaml | 33 +++++++++++++++++++
 .../bindings/spi/nvidia,tegra210-quad.yaml    | 21 ------------
 .../bindings/spi/spi-peripheral-props.yaml    |  1 +
 3 files changed, 34 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml

diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml
new file mode 100644
index 000000000000..24e0c2181d25
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/nvidia,tegra210-quad-peripheral-props.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Peripheral properties for Tegra Quad SPI Controller
+
+maintainers:
+  - Thierry Reding <thierry.reding@gmail.com>
+  - Jonathan Hunter <jonathanh@nvidia.com>
+
+properties:
+  nvidia,tx-clk-tap-delay:
+    description:
+      Delays the clock going out to device with this tap value.
+      Tap value varies based on platform design trace lengths from Tegra
+      QSPI to corresponding slave device.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 31
+
+  nvidia,rx-clk-tap-delay:
+    description:
+      Delays the clock coming in from the device with this tap value.
+      Tap value varies based on platform design trace lengths from Tegra
+      QSPI to corresponding slave device.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 255
+
+unevaluatedProperties: true
+
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml
index 0296edd1de22..e79f0b2560a4 100644
--- a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml
+++ b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml
@@ -57,27 +57,6 @@ patternProperties:
       spi-tx-bus-width:
         enum: [1, 2, 4]
 
-      nvidia,tx-clk-tap-delay:
-        description:
-          Delays the clock going out to device with this tap value.
-          Tap value varies based on platform design trace lengths from Tegra
-          QSPI to corresponding slave device.
-        $ref: /schemas/types.yaml#/definitions/uint32
-        minimum: 0
-        maximum: 31
-
-      nvidia,rx-clk-tap-delay:
-        description:
-          Delays the clock coming in from the device with this tap value.
-          Tap value varies based on platform design trace lengths from Tegra
-          QSPI to corresponding slave device.
-        $ref: /schemas/types.yaml#/definitions/uint32
-        minimum: 0
-        maximum: 255
-
-    required:
-      - reg
-
 required:
   - compatible
   - reg
diff --git a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
index 5e32928c4fc3..cf589d17b0f5 100644
--- a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
@@ -112,5 +112,6 @@ properties:
 allOf:
   - $ref: cdns,qspi-nor-peripheral-props.yaml#
   - $ref: samsung,spi-peripheral-props.yaml#
+  - $ref: nvidia,tegra210-quad-peripheral-props.yaml#
 
 additionalProperties: true
-- 
2.17.1


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

* [Patch V3 3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI
  2022-06-07 11:46 [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Krishna Yarlagadda
  2022-06-07 11:46 ` [Patch V3 1/3] spi: tegra210-quad: Multi-cs support Krishna Yarlagadda
  2022-06-07 11:46 ` [Patch V3 2/3] spi: dt-bindings: split peripheral prods Krishna Yarlagadda
@ 2022-06-07 11:46 ` Krishna Yarlagadda
  2022-06-09 20:13   ` Rob Herring
  2022-06-13 17:24 ` [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Krishna Yarlagadda @ 2022-06-07 11:46 UTC (permalink / raw)
  To: broonie, thierry.reding, jonathanh, linux-spi, linux-tegra,
	ashishsingha, robh+dt
  Cc: skomatineni, ldewangan, devicetree, linux-kernel, Krishna Yarlagadda

Add new compatible for Tegra241 QSPI controller which has
multiple chip select lines.

Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
---
 Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml
index e79f0b2560a4..6b733e5c1163 100644
--- a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml
+++ b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml
@@ -20,6 +20,7 @@ properties:
       - nvidia,tegra186-qspi
       - nvidia,tegra194-qspi
       - nvidia,tegra234-qspi
+      - nvidia,tegra241-qspi
 
   reg:
     maxItems: 1
-- 
2.17.1


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

* Re: [Patch V3 2/3] spi: dt-bindings: split peripheral prods
  2022-06-07 11:46 ` [Patch V3 2/3] spi: dt-bindings: split peripheral prods Krishna Yarlagadda
@ 2022-06-09 20:13   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-06-09 20:13 UTC (permalink / raw)
  To: Krishna Yarlagadda
  Cc: broonie, thierry.reding, jonathanh, linux-spi, linux-tegra,
	ashishsingha, skomatineni, ldewangan, devicetree, linux-kernel

On Tue, Jun 07, 2022 at 05:16:58PM +0530, Krishna Yarlagadda wrote:
> Move peripheral properties for Tegra QSPI controller to
> nvidia,tegra210-quad-peripheral-props.yaml and add reference
> to spi-peripheral-props.yaml file.

What are 'peripheral prods'?

> 
> Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
> ---
>  ...nvidia,tegra210-quad-peripheral-props.yaml | 33 +++++++++++++++++++
>  .../bindings/spi/nvidia,tegra210-quad.yaml    | 21 ------------
>  .../bindings/spi/spi-peripheral-props.yaml    |  1 +
>  3 files changed, 34 insertions(+), 21 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml

Otherwise,

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [Patch V3 3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI
  2022-06-07 11:46 ` [Patch V3 3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI Krishna Yarlagadda
@ 2022-06-09 20:13   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-06-09 20:13 UTC (permalink / raw)
  To: Krishna Yarlagadda
  Cc: broonie, linux-spi, ldewangan, devicetree, linux-tegra,
	skomatineni, thierry.reding, jonathanh, robh+dt, ashishsingha,
	linux-kernel

On Tue, 07 Jun 2022 17:16:59 +0530, Krishna Yarlagadda wrote:
> Add new compatible for Tegra241 QSPI controller which has
> multiple chip select lines.
> 
> Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
> ---
>  Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features
  2022-06-07 11:46 [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Krishna Yarlagadda
                   ` (2 preceding siblings ...)
  2022-06-07 11:46 ` [Patch V3 3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI Krishna Yarlagadda
@ 2022-06-13 17:24 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-06-13 17:24 UTC (permalink / raw)
  To: jonathanh, linux-tegra, ashishsingha, robh+dt, linux-spi,
	thierry.reding, kyarlagadda
  Cc: skomatineni, devicetree, ldewangan, linux-kernel

On Tue, 7 Jun 2022 17:16:56 +0530, Krishna Yarlagadda wrote:
> Add multiple chip select lines supported on Tegra 241
> 
> Changes in v3:
> Handle review comments.
> Move controller's properties to "nvidia,tegra210-quad.yaml".
> Fix style errors in peripheral yaml doc.
> Changes in v2:
> Split Wait polling changes to be handled later
> Change chip name to convention followed (Grace to 241)
> Add tegra qspi peripherals yaml file
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: tegra210-quad: Multi-cs support
      commit: b76134178168b5104851b3c72d9b1092b7414ff9
[2/3] spi: dt-bindings: split peripheral prods
      commit: e23917822d3cb1f5270ab0d327da713cda72f8f2
[3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI
      commit: 4f37809f4cdf0cdb8d4431e779f56d1f0dec3fb5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2022-06-13 19:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 11:46 [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Krishna Yarlagadda
2022-06-07 11:46 ` [Patch V3 1/3] spi: tegra210-quad: Multi-cs support Krishna Yarlagadda
2022-06-07 11:46 ` [Patch V3 2/3] spi: dt-bindings: split peripheral prods Krishna Yarlagadda
2022-06-09 20:13   ` Rob Herring
2022-06-07 11:46 ` [Patch V3 3/3] spi: dt-bindings: Add compatible for Tegra241 QSPI Krishna Yarlagadda
2022-06-09 20:13   ` Rob Herring
2022-06-13 17:24 ` [Patch V3 0/3] spi: tegra quad: Add Tegra Grace features Mark Brown

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