All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 13:31 ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Between SPI transactions, all SPI pins are in HiZ state. When using the SS
signal from the SPICC controller it's not an issue because when the
transaction resumes all pins come back to the right state at the same time
as SS.

The problem is when we use CS as a GPIO. In fact, between the GPIO CS
state change and SPI pins state change from idle, you can have a missing or
spurious clock transition.

Set a bias on the clock depending on the clock polarity requested before CS
goes active, by passing a special "idle-low" and "idle-high" pinctrl state
and setting the right state at a start of a message.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
Changes in v4:
- Fixed documentation by defining pinctrl-x.
- Link to v3: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v3-0-89de126fd163@baylibre.com

Changes in v3:
- Fixed documentation by removing pinctrl states as they are not mandatory.
- Link to v2: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v2-0-3e8ae91a1925@baylibre.com

---
Amjad Ouled-Ameur (4):
      spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
      spi: meson-spicc: Use pinctrl to drive CLK line when idle
      arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
      arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK

 .../bindings/spi/amlogic,meson-gx-spicc.yaml       | 75 ++++++++++++++--------
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        | 14 ++++
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         | 14 ++++
 drivers/spi/spi-meson-spicc.c                      | 39 ++++++++++-
 4 files changed, 113 insertions(+), 29 deletions(-)
---
base-commit: e35184f321518acadb681928a016da21a9a20c13
change-id: 20221004-up-aml-fix-spi-c2bb7e78e603

Best regards,
-- 
Amjad Ouled-Ameur <aouledameur@baylibre.com>

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

* [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 13:31 ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Between SPI transactions, all SPI pins are in HiZ state. When using the SS
signal from the SPICC controller it's not an issue because when the
transaction resumes all pins come back to the right state at the same time
as SS.

The problem is when we use CS as a GPIO. In fact, between the GPIO CS
state change and SPI pins state change from idle, you can have a missing or
spurious clock transition.

Set a bias on the clock depending on the clock polarity requested before CS
goes active, by passing a special "idle-low" and "idle-high" pinctrl state
and setting the right state at a start of a message.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
Changes in v4:
- Fixed documentation by defining pinctrl-x.
- Link to v3: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v3-0-89de126fd163@baylibre.com

Changes in v3:
- Fixed documentation by removing pinctrl states as they are not mandatory.
- Link to v2: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v2-0-3e8ae91a1925@baylibre.com

---
Amjad Ouled-Ameur (4):
      spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
      spi: meson-spicc: Use pinctrl to drive CLK line when idle
      arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
      arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK

 .../bindings/spi/amlogic,meson-gx-spicc.yaml       | 75 ++++++++++++++--------
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        | 14 ++++
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         | 14 ++++
 drivers/spi/spi-meson-spicc.c                      | 39 ++++++++++-
 4 files changed, 113 insertions(+), 29 deletions(-)
---
base-commit: e35184f321518acadb681928a016da21a9a20c13
change-id: 20221004-up-aml-fix-spi-c2bb7e78e603

Best regards,
-- 
Amjad Ouled-Ameur <aouledameur@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 13:31 ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Between SPI transactions, all SPI pins are in HiZ state. When using the SS
signal from the SPICC controller it's not an issue because when the
transaction resumes all pins come back to the right state at the same time
as SS.

The problem is when we use CS as a GPIO. In fact, between the GPIO CS
state change and SPI pins state change from idle, you can have a missing or
spurious clock transition.

Set a bias on the clock depending on the clock polarity requested before CS
goes active, by passing a special "idle-low" and "idle-high" pinctrl state
and setting the right state at a start of a message.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
Changes in v4:
- Fixed documentation by defining pinctrl-x.
- Link to v3: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v3-0-89de126fd163@baylibre.com

Changes in v3:
- Fixed documentation by removing pinctrl states as they are not mandatory.
- Link to v2: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v2-0-3e8ae91a1925@baylibre.com

---
Amjad Ouled-Ameur (4):
      spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
      spi: meson-spicc: Use pinctrl to drive CLK line when idle
      arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
      arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK

 .../bindings/spi/amlogic,meson-gx-spicc.yaml       | 75 ++++++++++++++--------
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        | 14 ++++
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         | 14 ++++
 drivers/spi/spi-meson-spicc.c                      | 39 ++++++++++-
 4 files changed, 113 insertions(+), 29 deletions(-)
---
base-commit: e35184f321518acadb681928a016da21a9a20c13
change-id: 20221004-up-aml-fix-spi-c2bb7e78e603

Best regards,
-- 
Amjad Ouled-Ameur <aouledameur@baylibre.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
  2022-10-21 13:31 ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  -1 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
pin biais when idle. Therefore define three pinctrl names:
- default: SPI pins are controlled by spi function.
- idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
by spi function.
- idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
by spi function.

Reported-by: Da Xue <da@libre.computer>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 .../bindings/spi/amlogic,meson-gx-spicc.yaml       | 75 ++++++++++++++--------
 1 file changed, 47 insertions(+), 28 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
index 0c10f7678178..53eb6562b979 100644
--- a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
+++ b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
@@ -10,9 +10,6 @@ title: Amlogic Meson SPI Communication Controller
 maintainers:
   - Neil Armstrong <neil.armstrong@linaro.org>
 
-allOf:
-  - $ref: "spi-controller.yaml#"
-
 description: |
   The Meson SPICC is a generic SPI controller for general purpose Full-Duplex
   communications with dedicated 16 words RX/TX PIO FIFOs.
@@ -43,31 +40,53 @@ properties:
     minItems: 1
     maxItems: 2
 
-if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - amlogic,meson-g12a-spicc
-
-then:
-  properties:
-    clocks:
-      minItems: 2
-
-    clock-names:
-      items:
-        - const: core
-        - const: pclk
-
-else:
-  properties:
-    clocks:
-      maxItems: 1
-
-    clock-names:
-      items:
-        - const: core
+allOf:
+  - $ref: "spi-controller.yaml#"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-g12a-spicc
+
+    then:
+      properties:
+        clocks:
+          minItems: 2
+
+        clock-names:
+          items:
+            - const: core
+            - const: pclk
+
+    else:
+      properties:
+        clocks:
+          maxItems: 1
+
+        clock-names:
+          items:
+            - const: core
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-gx-spicc
+
+    then:
+      properties:
+        pinctrl-0: true
+        pinctrl-1: true
+        pinctrl-2: true
+
+        pinctrl-names:
+          minItems: 1
+          items:
+            - const: default
+            - const: idle-high
+            - const: idle-low
 
 required:
   - compatible

-- 
b4 0.10.1

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

* [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
pin biais when idle. Therefore define three pinctrl names:
- default: SPI pins are controlled by spi function.
- idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
by spi function.
- idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
by spi function.

Reported-by: Da Xue <da@libre.computer>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 .../bindings/spi/amlogic,meson-gx-spicc.yaml       | 75 ++++++++++++++--------
 1 file changed, 47 insertions(+), 28 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
index 0c10f7678178..53eb6562b979 100644
--- a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
+++ b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
@@ -10,9 +10,6 @@ title: Amlogic Meson SPI Communication Controller
 maintainers:
   - Neil Armstrong <neil.armstrong@linaro.org>
 
-allOf:
-  - $ref: "spi-controller.yaml#"
-
 description: |
   The Meson SPICC is a generic SPI controller for general purpose Full-Duplex
   communications with dedicated 16 words RX/TX PIO FIFOs.
@@ -43,31 +40,53 @@ properties:
     minItems: 1
     maxItems: 2
 
-if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - amlogic,meson-g12a-spicc
-
-then:
-  properties:
-    clocks:
-      minItems: 2
-
-    clock-names:
-      items:
-        - const: core
-        - const: pclk
-
-else:
-  properties:
-    clocks:
-      maxItems: 1
-
-    clock-names:
-      items:
-        - const: core
+allOf:
+  - $ref: "spi-controller.yaml#"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-g12a-spicc
+
+    then:
+      properties:
+        clocks:
+          minItems: 2
+
+        clock-names:
+          items:
+            - const: core
+            - const: pclk
+
+    else:
+      properties:
+        clocks:
+          maxItems: 1
+
+        clock-names:
+          items:
+            - const: core
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-gx-spicc
+
+    then:
+      properties:
+        pinctrl-0: true
+        pinctrl-1: true
+        pinctrl-2: true
+
+        pinctrl-names:
+          minItems: 1
+          items:
+            - const: default
+            - const: idle-high
+            - const: idle-low
 
 required:
   - compatible

-- 
b4 0.10.1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
pin biais when idle. Therefore define three pinctrl names:
- default: SPI pins are controlled by spi function.
- idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
by spi function.
- idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
by spi function.

Reported-by: Da Xue <da@libre.computer>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 .../bindings/spi/amlogic,meson-gx-spicc.yaml       | 75 ++++++++++++++--------
 1 file changed, 47 insertions(+), 28 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
index 0c10f7678178..53eb6562b979 100644
--- a/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
+++ b/Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
@@ -10,9 +10,6 @@ title: Amlogic Meson SPI Communication Controller
 maintainers:
   - Neil Armstrong <neil.armstrong@linaro.org>
 
-allOf:
-  - $ref: "spi-controller.yaml#"
-
 description: |
   The Meson SPICC is a generic SPI controller for general purpose Full-Duplex
   communications with dedicated 16 words RX/TX PIO FIFOs.
@@ -43,31 +40,53 @@ properties:
     minItems: 1
     maxItems: 2
 
-if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - amlogic,meson-g12a-spicc
-
-then:
-  properties:
-    clocks:
-      minItems: 2
-
-    clock-names:
-      items:
-        - const: core
-        - const: pclk
-
-else:
-  properties:
-    clocks:
-      maxItems: 1
-
-    clock-names:
-      items:
-        - const: core
+allOf:
+  - $ref: "spi-controller.yaml#"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-g12a-spicc
+
+    then:
+      properties:
+        clocks:
+          minItems: 2
+
+        clock-names:
+          items:
+            - const: core
+            - const: pclk
+
+    else:
+      properties:
+        clocks:
+          maxItems: 1
+
+        clock-names:
+          items:
+            - const: core
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-gx-spicc
+
+    then:
+      properties:
+        pinctrl-0: true
+        pinctrl-1: true
+        pinctrl-2: true
+
+        pinctrl-names:
+          minItems: 1
+          items:
+            - const: default
+            - const: idle-high
+            - const: idle-low
 
 required:
   - compatible

-- 
b4 0.10.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
  2022-10-21 13:31 ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  -1 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Between SPI transactions, all SPI pins are in HiZ state. When using the SS
signal from the SPICC controller it's not an issue because when the
transaction resumes all pins come back to the right state at the same time
as SS.

The problem is when we use CS as a GPIO. In fact, between the GPIO CS
state change and SPI pins state change from idle, you can have a missing or
spurious clock transition.

Set a bias on the clock depending on the clock polarity requested before CS
goes active, by passing a special "idle-low" and "idle-high" pinctrl state
and setting the right state at a start of a message

Reported-by: Da Xue <da@libre.computer>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 drivers/spi/spi-meson-spicc.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bad201510a99..ffea38e2339c 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/reset.h>
+#include <linux/pinctrl/consumer.h>
 
 /*
  * The Meson SPICC controller could support DMA based transfers, but is not
@@ -167,6 +168,9 @@ struct meson_spicc_device {
 	unsigned long			tx_remain;
 	unsigned long			rx_remain;
 	unsigned long			xfer_remain;
+	struct pinctrl			*pinctrl;
+	struct pinctrl_state		*pins_idle_high;
+	struct pinctrl_state		*pins_idle_low;
 };
 
 #define pow2_clk_to_spicc(_div) container_of(_div, struct meson_spicc_device, pow2_div)
@@ -175,8 +179,22 @@ static void meson_spicc_oen_enable(struct meson_spicc_device *spicc)
 {
 	u32 conf;
 
-	if (!spicc->data->has_oen)
+	if (!spicc->data->has_oen) {
+		/* Try to get pinctrl states for idle high/low */
+		spicc->pins_idle_high = pinctrl_lookup_state(spicc->pinctrl,
+							     "idle-high");
+		if (IS_ERR(spicc->pins_idle_high)) {
+			dev_warn(&spicc->pdev->dev, "can't get idle-high pinctrl\n");
+			spicc->pins_idle_high = NULL;
+		}
+		spicc->pins_idle_low = pinctrl_lookup_state(spicc->pinctrl,
+							     "idle-low");
+		if (IS_ERR(spicc->pins_idle_low)) {
+			dev_warn(&spicc->pdev->dev, "can't get idle-low pinctrl\n");
+			spicc->pins_idle_low = NULL;
+		}
 		return;
+	}
 
 	conf = readl_relaxed(spicc->base + SPICC_ENH_CTL0) |
 		SPICC_ENH_MOSI_OEN | SPICC_ENH_CLK_OEN | SPICC_ENH_CS_OEN;
@@ -441,6 +459,16 @@ static int meson_spicc_prepare_message(struct spi_master *master,
 	else
 		conf &= ~SPICC_POL;
 
+	if (!spicc->data->has_oen) {
+		if (spi->mode & SPI_CPOL) {
+			if (spicc->pins_idle_high)
+				pinctrl_select_state(spicc->pinctrl, spicc->pins_idle_high);
+		} else {
+			if (spicc->pins_idle_low)
+				pinctrl_select_state(spicc->pinctrl, spicc->pins_idle_low);
+		}
+	}
+
 	if (spi->mode & SPI_CPHA)
 		conf |= SPICC_PHA;
 	else
@@ -487,6 +515,9 @@ static int meson_spicc_unprepare_transfer(struct spi_master *master)
 	/* Set default configuration, keeping datarate field */
 	writel_relaxed(conf, spicc->base + SPICC_CONREG);
 
+	if (!spicc->data->has_oen)
+		pinctrl_select_default_state(&spicc->pdev->dev);
+
 	return 0;
 }
 
@@ -798,6 +829,12 @@ static int meson_spicc_probe(struct platform_device *pdev)
 		goto out_core_clk;
 	}
 
+	spicc->pinctrl = devm_pinctrl_get(&pdev->dev);
+	if (IS_ERR(spicc->pinctrl)) {
+		ret = PTR_ERR(spicc->pinctrl);
+		goto out_clk;
+	}
+
 	device_reset_optional(&pdev->dev);
 
 	master->num_chipselect = 4;

-- 
b4 0.10.1

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

* [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Between SPI transactions, all SPI pins are in HiZ state. When using the SS
signal from the SPICC controller it's not an issue because when the
transaction resumes all pins come back to the right state at the same time
as SS.

The problem is when we use CS as a GPIO. In fact, between the GPIO CS
state change and SPI pins state change from idle, you can have a missing or
spurious clock transition.

Set a bias on the clock depending on the clock polarity requested before CS
goes active, by passing a special "idle-low" and "idle-high" pinctrl state
and setting the right state at a start of a message

Reported-by: Da Xue <da@libre.computer>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 drivers/spi/spi-meson-spicc.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bad201510a99..ffea38e2339c 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/reset.h>
+#include <linux/pinctrl/consumer.h>
 
 /*
  * The Meson SPICC controller could support DMA based transfers, but is not
@@ -167,6 +168,9 @@ struct meson_spicc_device {
 	unsigned long			tx_remain;
 	unsigned long			rx_remain;
 	unsigned long			xfer_remain;
+	struct pinctrl			*pinctrl;
+	struct pinctrl_state		*pins_idle_high;
+	struct pinctrl_state		*pins_idle_low;
 };
 
 #define pow2_clk_to_spicc(_div) container_of(_div, struct meson_spicc_device, pow2_div)
@@ -175,8 +179,22 @@ static void meson_spicc_oen_enable(struct meson_spicc_device *spicc)
 {
 	u32 conf;
 
-	if (!spicc->data->has_oen)
+	if (!spicc->data->has_oen) {
+		/* Try to get pinctrl states for idle high/low */
+		spicc->pins_idle_high = pinctrl_lookup_state(spicc->pinctrl,
+							     "idle-high");
+		if (IS_ERR(spicc->pins_idle_high)) {
+			dev_warn(&spicc->pdev->dev, "can't get idle-high pinctrl\n");
+			spicc->pins_idle_high = NULL;
+		}
+		spicc->pins_idle_low = pinctrl_lookup_state(spicc->pinctrl,
+							     "idle-low");
+		if (IS_ERR(spicc->pins_idle_low)) {
+			dev_warn(&spicc->pdev->dev, "can't get idle-low pinctrl\n");
+			spicc->pins_idle_low = NULL;
+		}
 		return;
+	}
 
 	conf = readl_relaxed(spicc->base + SPICC_ENH_CTL0) |
 		SPICC_ENH_MOSI_OEN | SPICC_ENH_CLK_OEN | SPICC_ENH_CS_OEN;
@@ -441,6 +459,16 @@ static int meson_spicc_prepare_message(struct spi_master *master,
 	else
 		conf &= ~SPICC_POL;
 
+	if (!spicc->data->has_oen) {
+		if (spi->mode & SPI_CPOL) {
+			if (spicc->pins_idle_high)
+				pinctrl_select_state(spicc->pinctrl, spicc->pins_idle_high);
+		} else {
+			if (spicc->pins_idle_low)
+				pinctrl_select_state(spicc->pinctrl, spicc->pins_idle_low);
+		}
+	}
+
 	if (spi->mode & SPI_CPHA)
 		conf |= SPICC_PHA;
 	else
@@ -487,6 +515,9 @@ static int meson_spicc_unprepare_transfer(struct spi_master *master)
 	/* Set default configuration, keeping datarate field */
 	writel_relaxed(conf, spicc->base + SPICC_CONREG);
 
+	if (!spicc->data->has_oen)
+		pinctrl_select_default_state(&spicc->pdev->dev);
+
 	return 0;
 }
 
@@ -798,6 +829,12 @@ static int meson_spicc_probe(struct platform_device *pdev)
 		goto out_core_clk;
 	}
 
+	spicc->pinctrl = devm_pinctrl_get(&pdev->dev);
+	if (IS_ERR(spicc->pinctrl)) {
+		ret = PTR_ERR(spicc->pinctrl);
+		goto out_clk;
+	}
+
 	device_reset_optional(&pdev->dev);
 
 	master->num_chipselect = 4;

-- 
b4 0.10.1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Between SPI transactions, all SPI pins are in HiZ state. When using the SS
signal from the SPICC controller it's not an issue because when the
transaction resumes all pins come back to the right state at the same time
as SS.

The problem is when we use CS as a GPIO. In fact, between the GPIO CS
state change and SPI pins state change from idle, you can have a missing or
spurious clock transition.

Set a bias on the clock depending on the clock polarity requested before CS
goes active, by passing a special "idle-low" and "idle-high" pinctrl state
and setting the right state at a start of a message

Reported-by: Da Xue <da@libre.computer>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 drivers/spi/spi-meson-spicc.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index bad201510a99..ffea38e2339c 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/reset.h>
+#include <linux/pinctrl/consumer.h>
 
 /*
  * The Meson SPICC controller could support DMA based transfers, but is not
@@ -167,6 +168,9 @@ struct meson_spicc_device {
 	unsigned long			tx_remain;
 	unsigned long			rx_remain;
 	unsigned long			xfer_remain;
+	struct pinctrl			*pinctrl;
+	struct pinctrl_state		*pins_idle_high;
+	struct pinctrl_state		*pins_idle_low;
 };
 
 #define pow2_clk_to_spicc(_div) container_of(_div, struct meson_spicc_device, pow2_div)
@@ -175,8 +179,22 @@ static void meson_spicc_oen_enable(struct meson_spicc_device *spicc)
 {
 	u32 conf;
 
-	if (!spicc->data->has_oen)
+	if (!spicc->data->has_oen) {
+		/* Try to get pinctrl states for idle high/low */
+		spicc->pins_idle_high = pinctrl_lookup_state(spicc->pinctrl,
+							     "idle-high");
+		if (IS_ERR(spicc->pins_idle_high)) {
+			dev_warn(&spicc->pdev->dev, "can't get idle-high pinctrl\n");
+			spicc->pins_idle_high = NULL;
+		}
+		spicc->pins_idle_low = pinctrl_lookup_state(spicc->pinctrl,
+							     "idle-low");
+		if (IS_ERR(spicc->pins_idle_low)) {
+			dev_warn(&spicc->pdev->dev, "can't get idle-low pinctrl\n");
+			spicc->pins_idle_low = NULL;
+		}
 		return;
+	}
 
 	conf = readl_relaxed(spicc->base + SPICC_ENH_CTL0) |
 		SPICC_ENH_MOSI_OEN | SPICC_ENH_CLK_OEN | SPICC_ENH_CS_OEN;
@@ -441,6 +459,16 @@ static int meson_spicc_prepare_message(struct spi_master *master,
 	else
 		conf &= ~SPICC_POL;
 
+	if (!spicc->data->has_oen) {
+		if (spi->mode & SPI_CPOL) {
+			if (spicc->pins_idle_high)
+				pinctrl_select_state(spicc->pinctrl, spicc->pins_idle_high);
+		} else {
+			if (spicc->pins_idle_low)
+				pinctrl_select_state(spicc->pinctrl, spicc->pins_idle_low);
+		}
+	}
+
 	if (spi->mode & SPI_CPHA)
 		conf |= SPICC_PHA;
 	else
@@ -487,6 +515,9 @@ static int meson_spicc_unprepare_transfer(struct spi_master *master)
 	/* Set default configuration, keeping datarate field */
 	writel_relaxed(conf, spicc->base + SPICC_CONREG);
 
+	if (!spicc->data->has_oen)
+		pinctrl_select_default_state(&spicc->pdev->dev);
+
 	return 0;
 }
 
@@ -798,6 +829,12 @@ static int meson_spicc_probe(struct platform_device *pdev)
 		goto out_core_clk;
 	}
 
+	spicc->pinctrl = devm_pinctrl_get(&pdev->dev);
+	if (IS_ERR(spicc->pinctrl)) {
+		ret = PTR_ERR(spicc->pinctrl);
+		goto out_clk;
+	}
+
 	device_reset_optional(&pdev->dev);
 
 	master->num_chipselect = 4;

-- 
b4 0.10.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
  2022-10-21 13:31 ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  -1 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXL
SoCs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index c3ac531c4f84..04e9d0f1bde0 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -429,6 +429,20 @@ mux {
 			};
 		};
 
+		spi_idle_high_pins: spi-idle-high-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-up;
+			};
+		};
+
+		spi_idle_low_pins: spi-idle-low-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-down;
+			};
+		};
+
 		spi_ss0_pins: spi-ss0 {
 			mux {
 				groups = "spi_ss0";

-- 
b4 0.10.1

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

* [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXL
SoCs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index c3ac531c4f84..04e9d0f1bde0 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -429,6 +429,20 @@ mux {
 			};
 		};
 
+		spi_idle_high_pins: spi-idle-high-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-up;
+			};
+		};
+
+		spi_idle_low_pins: spi-idle-low-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-down;
+			};
+		};
+
 		spi_ss0_pins: spi-ss0 {
 			mux {
 				groups = "spi_ss0";

-- 
b4 0.10.1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXL
SoCs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index c3ac531c4f84..04e9d0f1bde0 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -429,6 +429,20 @@ mux {
 			};
 		};
 
+		spi_idle_high_pins: spi-idle-high-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-up;
+			};
+		};
+
+		spi_idle_low_pins: spi-idle-low-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-down;
+			};
+		};
+
 		spi_ss0_pins: spi-ss0 {
 			mux {
 				groups = "spi_ss0";

-- 
b4 0.10.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
  2022-10-21 13:31 ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  -1 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
SoCs.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..923d2d8bbb9c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -427,6 +427,20 @@ mux {
 			};
 		};
 
+		spi_idle_high_pins: spi-idle-high-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-up;
+			};
+		};
+
+		spi_idle_low_pins: spi-idle-low-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-down;
+			};
+		};
+
 		spi_ss0_pins: spi-ss0 {
 			mux {
 				groups = "spi_ss0";

-- 
b4 0.10.1

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

* [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
SoCs.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..923d2d8bbb9c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -427,6 +427,20 @@ mux {
 			};
 		};
 
+		spi_idle_high_pins: spi-idle-high-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-up;
+			};
+		};
+
+		spi_idle_low_pins: spi-idle-low-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-down;
+			};
+		};
+
 		spi_ss0_pins: spi-ss0 {
 			mux {
 				groups = "spi_ss0";

-- 
b4 0.10.1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
@ 2022-10-21 13:31   ` Amjad Ouled-Ameur
  0 siblings, 0 replies; 39+ messages in thread
From: Amjad Ouled-Ameur @ 2022-10-21 13:31 UTC (permalink / raw)
  To: Kevin Hilman, Jerome Brunet, Rob Herring, Martin Blumenstingl,
	Neil Armstrong, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Neil Armstrong, Amjad Ouled-Ameur, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
SoCs.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..923d2d8bbb9c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -427,6 +427,20 @@ mux {
 			};
 		};
 
+		spi_idle_high_pins: spi-idle-high-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-up;
+			};
+		};
+
+		spi_idle_low_pins: spi-idle-low-pins {
+			mux {
+				groups = "spi_sclk";
+				bias-pull-down;
+			};
+		};
+
 		spi_ss0_pins: spi-ss0 {
 			mux {
 				groups = "spi_ss0";

-- 
b4 0.10.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
  2022-10-21 13:31   ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 13:44     ` Neil Armstrong
  -1 siblings, 0 replies; 39+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:44 UTC (permalink / raw)
  To: Amjad Ouled-Ameur, Kevin Hilman, Jerome Brunet, Rob Herring,
	Martin Blumenstingl, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Da Xue, linux-spi, devicetree, linux-kernel,
	linux-arm-kernel

On 21/10/2022 15:31, Amjad Ouled-Ameur wrote:
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
> SoCs.
> 
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
> ---
>   arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> index 7c029f552a23..923d2d8bbb9c 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> @@ -427,6 +427,20 @@ mux {
>   			};
>   		};
>   
> +		spi_idle_high_pins: spi-idle-high-pins {
> +			mux {
> +				groups = "spi_sclk";
> +				bias-pull-up;
> +			};
> +		};
> +
> +		spi_idle_low_pins: spi-idle-low-pins {
> +			mux {
> +				groups = "spi_sclk";
> +				bias-pull-down;
> +			};
> +		};
> +
>   		spi_ss0_pins: spi-ss0 {
>   			mux {
>   				groups = "spi_ss0";
> 


Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

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

* Re: [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
@ 2022-10-21 13:44     ` Neil Armstrong
  0 siblings, 0 replies; 39+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:44 UTC (permalink / raw)
  To: Amjad Ouled-Ameur, Kevin Hilman, Jerome Brunet, Rob Herring,
	Martin Blumenstingl, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Da Xue, linux-spi, devicetree, linux-kernel,
	linux-arm-kernel

On 21/10/2022 15:31, Amjad Ouled-Ameur wrote:
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
> SoCs.
> 
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
> ---
>   arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> index 7c029f552a23..923d2d8bbb9c 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> @@ -427,6 +427,20 @@ mux {
>   			};
>   		};
>   
> +		spi_idle_high_pins: spi-idle-high-pins {
> +			mux {
> +				groups = "spi_sclk";
> +				bias-pull-up;
> +			};
> +		};
> +
> +		spi_idle_low_pins: spi-idle-low-pins {
> +			mux {
> +				groups = "spi_sclk";
> +				bias-pull-down;
> +			};
> +		};
> +
>   		spi_ss0_pins: spi-ss0 {
>   			mux {
>   				groups = "spi_ss0";
> 


Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
@ 2022-10-21 13:44     ` Neil Armstrong
  0 siblings, 0 replies; 39+ messages in thread
From: Neil Armstrong @ 2022-10-21 13:44 UTC (permalink / raw)
  To: Amjad Ouled-Ameur, Kevin Hilman, Jerome Brunet, Rob Herring,
	Martin Blumenstingl, Krzysztof Kozlowski, Mark Brown
  Cc: linux-amlogic, Da Xue, linux-spi, devicetree, linux-kernel,
	linux-arm-kernel

On 21/10/2022 15:31, Amjad Ouled-Ameur wrote:
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
> SoCs.
> 
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
> ---
>   arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> index 7c029f552a23..923d2d8bbb9c 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> @@ -427,6 +427,20 @@ mux {
>   			};
>   		};
>   
> +		spi_idle_high_pins: spi-idle-high-pins {
> +			mux {
> +				groups = "spi_sclk";
> +				bias-pull-up;
> +			};
> +		};
> +
> +		spi_idle_low_pins: spi-idle-low-pins {
> +			mux {
> +				groups = "spi_sclk";
> +				bias-pull-down;
> +			};
> +		};
> +
>   		spi_ss0_pins: spi-ss0 {
>   			mux {
>   				groups = "spi_ss0";
> 


Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
  2022-10-21 13:31   ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 13:55     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 39+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-21 13:55 UTC (permalink / raw)
  To: Amjad Ouled-Ameur, Kevin Hilman, Jerome Brunet, Rob Herring,
	Martin Blumenstingl, Neil Armstrong, Krzysztof Kozlowski,
	Mark Brown
  Cc: linux-amlogic, Da Xue, linux-spi, devicetree, linux-kernel,
	linux-arm-kernel

On 21/10/2022 09:31, Amjad Ouled-Ameur wrote:
> SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
> pin biais when idle. Therefore define three pinctrl names:
> - default: SPI pins are controlled by spi function.
> - idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
> by spi function.
> - idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
> by spi function.
> 
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>


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

Best regards,
Krzysztof


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

* Re: [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
@ 2022-10-21 13:55     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 39+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-21 13:55 UTC (permalink / raw)
  To: Amjad Ouled-Ameur, Kevin Hilman, Jerome Brunet, Rob Herring,
	Martin Blumenstingl, Neil Armstrong, Krzysztof Kozlowski,
	Mark Brown
  Cc: linux-amlogic, Da Xue, linux-spi, devicetree, linux-kernel,
	linux-arm-kernel

On 21/10/2022 09:31, Amjad Ouled-Ameur wrote:
> SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
> pin biais when idle. Therefore define three pinctrl names:
> - default: SPI pins are controlled by spi function.
> - idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
> by spi function.
> - idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
> by spi function.
> 
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>


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

Best regards,
Krzysztof


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
@ 2022-10-21 13:55     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 39+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-21 13:55 UTC (permalink / raw)
  To: Amjad Ouled-Ameur, Kevin Hilman, Jerome Brunet, Rob Herring,
	Martin Blumenstingl, Neil Armstrong, Krzysztof Kozlowski,
	Mark Brown
  Cc: linux-amlogic, Da Xue, linux-spi, devicetree, linux-kernel,
	linux-arm-kernel

On 21/10/2022 09:31, Amjad Ouled-Ameur wrote:
> SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
> pin biais when idle. Therefore define three pinctrl names:
> - default: SPI pins are controlled by spi function.
> - idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
> by spi function.
> - idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
> by spi function.
> 
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>


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

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
  2022-10-21 13:31 ` Amjad Ouled-Ameur
  (?)
@ 2022-10-21 16:15   ` Mark Brown
  -1 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2022-10-21 16:15 UTC (permalink / raw)
  To: Martin Blumenstingl, Krzysztof Kozlowski, Rob Herring,
	Neil Armstrong, Jerome Brunet, Amjad Ouled-Ameur, Kevin Hilman
  Cc: linux-amlogic, Da Xue, linux-arm-kernel, linux-spi, linux-kernel,
	Neil Armstrong, devicetree

On Fri, 21 Oct 2022 15:31:24 +0200, Amjad Ouled-Ameur wrote:
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
> 
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
> 
> [...]

Applied to

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

Thanks!

[1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
      commit: 031837826886e254fefff7d8b849dc63b6a7e2b9
[2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
      commit: f4567b28fdd4bede7cab0810200d567a1f03ec5e

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] 39+ messages in thread

* Re: (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 16:15   ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2022-10-21 16:15 UTC (permalink / raw)
  To: Martin Blumenstingl, Krzysztof Kozlowski, Rob Herring,
	Neil Armstrong, Jerome Brunet, Amjad Ouled-Ameur, Kevin Hilman
  Cc: linux-amlogic, Da Xue, linux-arm-kernel, linux-spi, linux-kernel,
	Neil Armstrong, devicetree

On Fri, 21 Oct 2022 15:31:24 +0200, Amjad Ouled-Ameur wrote:
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
> 
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
> 
> [...]

Applied to

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

Thanks!

[1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
      commit: 031837826886e254fefff7d8b849dc63b6a7e2b9
[2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
      commit: f4567b28fdd4bede7cab0810200d567a1f03ec5e

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-21 16:15   ` Mark Brown
  0 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2022-10-21 16:15 UTC (permalink / raw)
  To: Martin Blumenstingl, Krzysztof Kozlowski, Rob Herring,
	Neil Armstrong, Jerome Brunet, Amjad Ouled-Ameur, Kevin Hilman
  Cc: linux-amlogic, Da Xue, linux-arm-kernel, linux-spi, linux-kernel,
	Neil Armstrong, devicetree

On Fri, 21 Oct 2022 15:31:24 +0200, Amjad Ouled-Ameur wrote:
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
> 
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
> 
> [...]

Applied to

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

Thanks!

[1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
      commit: 031837826886e254fefff7d8b849dc63b6a7e2b9
[2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
      commit: f4567b28fdd4bede7cab0810200d567a1f03ec5e

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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
  2022-10-21 13:31   ` Amjad Ouled-Ameur
  (?)
@ 2022-10-22 10:13     ` Martin Blumenstingl
  -1 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:13 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
> pin biais when idle. Therefore define three pinctrl names:
s/biais/bias/
> - default: SPI pins are controlled by spi function.
> - idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
> by spi function.
> - idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
> by spi function.
>
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Other than the typo:
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
@ 2022-10-22 10:13     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:13 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
> pin biais when idle. Therefore define three pinctrl names:
s/biais/bias/
> - default: SPI pins are controlled by spi function.
> - idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
> by spi function.
> - idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
> by spi function.
>
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Other than the typo:
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>


Best regards,
Martin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states
@ 2022-10-22 10:13     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:13 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> SPI pins of the SPICC Controller in Meson-GX needs to be controlled by
> pin biais when idle. Therefore define three pinctrl names:
s/biais/bias/
> - default: SPI pins are controlled by spi function.
> - idle-high: SCLK pin is pulled-up, but MOSI/MISO are still controlled
> by spi function.
> - idle-low: SCLK pin is pulled-down, but MOSI/MISO are still controlled
> by spi function.
>
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Other than the typo:
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>


Best regards,
Martin

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

* Re: [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
  2022-10-21 13:31   ` Amjad Ouled-Ameur
  (?)
@ 2022-10-22 10:13     ` Martin Blumenstingl
  -1 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:13 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
>
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
>
> Set a bias on the clock depending on the clock polarity requested before CS
> goes active, by passing a special "idle-low" and "idle-high" pinctrl state
> and setting the right state at a start of a message
>
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-22 10:13     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:13 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
>
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
>
> Set a bias on the clock depending on the clock polarity requested before CS
> goes active, by passing a special "idle-low" and "idle-high" pinctrl state
> and setting the right state at a start of a message
>
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-22 10:13     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:13 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
>
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
>
> Set a bias on the clock depending on the clock polarity requested before CS
> goes active, by passing a special "idle-low" and "idle-high" pinctrl state
> and setting the right state at a start of a message
>
> Reported-by: Da Xue <da@libre.computer>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

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

* Re: [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
  2022-10-21 13:31   ` Amjad Ouled-Ameur
  (?)
@ 2022-10-22 10:14     ` Martin Blumenstingl
  -1 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:14 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXL
> SoCs.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
@ 2022-10-22 10:14     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:14 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXL
> SoCs.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
@ 2022-10-22 10:14     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:14 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXL
> SoCs.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

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

* Re: [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
  2022-10-21 13:31   ` Amjad Ouled-Ameur
  (?)
@ 2022-10-22 10:14     ` Martin Blumenstingl
  -1 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:14 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
> SoCs.
>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
@ 2022-10-22 10:14     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:14 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
> SoCs.
>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4 4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
@ 2022-10-22 10:14     ` Martin Blumenstingl
  0 siblings, 0 replies; 39+ messages in thread
From: Martin Blumenstingl @ 2022-10-22 10:14 UTC (permalink / raw)
  To: Amjad Ouled-Ameur
  Cc: Kevin Hilman, Jerome Brunet, Rob Herring, Neil Armstrong,
	Krzysztof Kozlowski, Mark Brown, linux-amlogic, Da Xue,
	linux-spi, devicetree, linux-kernel, linux-arm-kernel

On Fri, Oct 21, 2022 at 3:31 PM Amjad Ouled-Ameur
<aouledameur@baylibre.com> wrote:
>
> Add SPICC Controller pin nodes for CLK line when idle for Amlogic GXBB
> SoCs.
>
> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

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

* Re: (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
  2022-10-21 13:31 ` Amjad Ouled-Ameur
  (?)
@ 2022-10-25 14:46   ` Neil Armstrong
  -1 siblings, 0 replies; 39+ messages in thread
From: Neil Armstrong @ 2022-10-25 14:46 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown, Amjad Ouled-Ameur, Rob Herring,
	Krzysztof Kozlowski, Kevin Hilman, Martin Blumenstingl
  Cc: linux-amlogic, linux-spi, linux-kernel, Da Xue, devicetree,
	linux-arm-kernel

Hi,

On Fri, 21 Oct 2022 15:31:24 +0200, Amjad Ouled-Ameur wrote:
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
> 
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
> 
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.2/arm64-dt)

[3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
      https://git.kernel.org/amlogic/c/2ba370bb98b53b7565493083699d82da5ef2cec8
[4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
      https://git.kernel.org/amlogic/c/ce759829b8fffac891780611b54a6be26a2d5a5f

These changes has been applied on the intermediate git tree [1].

The v6.2/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers
for inclusion in their intermediate git branches in order to be sent to Linus during
the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate
kernel and as soon they appear on the Linux master branch they will be
backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3],
people are encouraged testing these pre-release kernels and report issues on the
relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert
patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

-- 
Neil

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

* Re: (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-25 14:46   ` Neil Armstrong
  0 siblings, 0 replies; 39+ messages in thread
From: Neil Armstrong @ 2022-10-25 14:46 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown, Amjad Ouled-Ameur, Rob Herring,
	Krzysztof Kozlowski, Kevin Hilman, Martin Blumenstingl
  Cc: linux-amlogic, linux-spi, linux-kernel, Da Xue, devicetree,
	linux-arm-kernel

Hi,

On Fri, 21 Oct 2022 15:31:24 +0200, Amjad Ouled-Ameur wrote:
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
> 
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
> 
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.2/arm64-dt)

[3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
      https://git.kernel.org/amlogic/c/2ba370bb98b53b7565493083699d82da5ef2cec8
[4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
      https://git.kernel.org/amlogic/c/ce759829b8fffac891780611b54a6be26a2d5a5f

These changes has been applied on the intermediate git tree [1].

The v6.2/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers
for inclusion in their intermediate git branches in order to be sent to Linus during
the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate
kernel and as soon they appear on the Linux master branch they will be
backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3],
people are encouraged testing these pre-release kernels and report issues on the
relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert
patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

-- 
Neil

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle
@ 2022-10-25 14:46   ` Neil Armstrong
  0 siblings, 0 replies; 39+ messages in thread
From: Neil Armstrong @ 2022-10-25 14:46 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown, Amjad Ouled-Ameur, Rob Herring,
	Krzysztof Kozlowski, Kevin Hilman, Martin Blumenstingl
  Cc: linux-amlogic, linux-spi, linux-kernel, Da Xue, devicetree,
	linux-arm-kernel

Hi,

On Fri, 21 Oct 2022 15:31:24 +0200, Amjad Ouled-Ameur wrote:
> Between SPI transactions, all SPI pins are in HiZ state. When using the SS
> signal from the SPICC controller it's not an issue because when the
> transaction resumes all pins come back to the right state at the same time
> as SS.
> 
> The problem is when we use CS as a GPIO. In fact, between the GPIO CS
> state change and SPI pins state change from idle, you can have a missing or
> spurious clock transition.
> 
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v6.2/arm64-dt)

[3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK
      https://git.kernel.org/amlogic/c/2ba370bb98b53b7565493083699d82da5ef2cec8
[4/4] arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK
      https://git.kernel.org/amlogic/c/ce759829b8fffac891780611b54a6be26a2d5a5f

These changes has been applied on the intermediate git tree [1].

The v6.2/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers
for inclusion in their intermediate git branches in order to be sent to Linus during
the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate
kernel and as soon they appear on the Linux master branch they will be
backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3],
people are encouraged testing these pre-release kernels and report issues on the
relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert
patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

-- 
Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2022-10-25 14:48 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 13:31 [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle Amjad Ouled-Ameur
2022-10-21 13:31 ` Amjad Ouled-Ameur
2022-10-21 13:31 ` Amjad Ouled-Ameur
2022-10-21 13:31 ` [PATCH v4 1/4] spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-21 13:55   ` Krzysztof Kozlowski
2022-10-21 13:55     ` Krzysztof Kozlowski
2022-10-21 13:55     ` Krzysztof Kozlowski
2022-10-22 10:13   ` Martin Blumenstingl
2022-10-22 10:13     ` Martin Blumenstingl
2022-10-22 10:13     ` Martin Blumenstingl
2022-10-21 13:31 ` [PATCH v4 2/4] spi: meson-spicc: Use pinctrl to drive CLK line when idle Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-22 10:13   ` Martin Blumenstingl
2022-10-22 10:13     ` Martin Blumenstingl
2022-10-22 10:13     ` Martin Blumenstingl
2022-10-21 13:31 ` [PATCH v4 3/4] arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-22 10:14   ` Martin Blumenstingl
2022-10-22 10:14     ` Martin Blumenstingl
2022-10-22 10:14     ` Martin Blumenstingl
2022-10-21 13:31 ` [PATCH v4 4/4] arm64: dts: meson-gxbb: " Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-21 13:31   ` Amjad Ouled-Ameur
2022-10-21 13:44   ` Neil Armstrong
2022-10-21 13:44     ` Neil Armstrong
2022-10-21 13:44     ` Neil Armstrong
2022-10-22 10:14   ` Martin Blumenstingl
2022-10-22 10:14     ` Martin Blumenstingl
2022-10-22 10:14     ` Martin Blumenstingl
2022-10-21 16:15 ` (subset) [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle Mark Brown
2022-10-21 16:15   ` Mark Brown
2022-10-21 16:15   ` Mark Brown
2022-10-25 14:46 ` Neil Armstrong
2022-10-25 14:46   ` Neil Armstrong
2022-10-25 14:46   ` Neil Armstrong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.