2022-01-12 10:00:54

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v3 0/4] spi: dt-bindings: samsung: convert to dtschema

Hi,

Changes since v2
================
1. Patch 2: drop child device schema, as Rob suggested.

Changes since v1
================
1. Patch 2: describe devices matching compatible, correct issues pointed out by
Rob, add reviewed-by tag.
2. New patches 3 and 4.

Best regards,
Krzysztof

Krzysztof Kozlowski (4):
ARM: dts: exynos: split dmas into array of phandles in Exynos5250
spi: dt-bindings: samsung: convert to dtschema
spi: dt-bindings: samsung: allow controller-data to be optional
spi: s3c64xx: allow controller-data to be optional

.../spi/samsung,spi-peripheral-props.yaml | 36 ++++
.../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
.../bindings/spi/spi-peripheral-props.yaml | 1 +
.../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
MAINTAINERS | 2 +-
arch/arm/boot/dts/exynos5250.dtsi | 9 +-
drivers/spi/spi-s3c64xx.c | 14 +-
7 files changed, 234 insertions(+), 137 deletions(-)
create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt

--
2.32.0



2022-01-12 10:01:16

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v3 3/4] spi: dt-bindings: samsung: allow controller-data to be optional

The Samsung SoC SPI bindings requires to provide controller-data node
for each of SPI peripheral device nodes. Make this controller-data node
optional, so DTS could be simpler.

Suggested-by: Rob Herring <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/spi/samsung,spi-peripheral-props.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
index aa5a1f48494b..cadc8a5f061f 100644
--- a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
+++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
@@ -28,6 +28,7 @@ properties:
- 3: 270 degree phase shift sampling.
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2, 3]
+ default: 0

required:
- samsung,spi-feedback-delay
--
2.32.0


2022-01-12 10:01:24

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v3 1/4] ARM: dts: exynos: split dmas into array of phandles in Exynos5250

"dmas" property should be rather an array of phandles, as dtschema
points.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
---
arch/arm/boot/dts/exynos5250.dtsi | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 139778928b93..102bb57bf704 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -496,8 +496,7 @@ spi_0: spi@12d20000 {
status = "disabled";
reg = <0x12d20000 0x100>;
interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
- dmas = <&pdma0 5
- &pdma0 4>;
+ dmas = <&pdma0 5>, <&pdma0 4>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
@@ -512,8 +511,7 @@ spi_1: spi@12d30000 {
status = "disabled";
reg = <0x12d30000 0x100>;
interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
- dmas = <&pdma1 5
- &pdma1 4>;
+ dmas = <&pdma1 5>, <&pdma1 4>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
@@ -528,8 +526,7 @@ spi_2: spi@12d40000 {
status = "disabled";
reg = <0x12d40000 0x100>;
interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
- dmas = <&pdma0 7
- &pdma0 6>;
+ dmas = <&pdma0 7>, <&pdma0 6>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
--
2.32.0


2022-01-12 10:01:48

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v3 4/4] spi: s3c64xx: allow controller-data to be optional

The Samsung SoC SPI driver requires to provide controller-data node
for each of SPI peripheral device nodes. Make this controller-data node
optional, so DTS could be simpler.

Suggested-by: Rob Herring <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-s3c64xx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 8755cd85e83c..769d958a2f86 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -796,16 +796,14 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
return ERR_PTR(-EINVAL);
}

- data_np = of_get_child_by_name(slave_np, "controller-data");
- if (!data_np) {
- dev_err(&spi->dev, "child node 'controller-data' not found\n");
- return ERR_PTR(-EINVAL);
- }
-
cs = kzalloc(sizeof(*cs), GFP_KERNEL);
- if (!cs) {
- of_node_put(data_np);
+ if (!cs)
return ERR_PTR(-ENOMEM);
+
+ data_np = of_get_child_by_name(slave_np, "controller-data");
+ if (!data_np) {
+ dev_info(&spi->dev, "child node 'controller-data' not found, using defaults\n");
+ return cs;
}

of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
--
2.32.0


2022-01-12 10:01:55

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
controller bindings to DT schema format

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Sam Protsenko <[email protected]>
---
.../spi/samsung,spi-peripheral-props.yaml | 35 ++++
.../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
.../bindings/spi/spi-peripheral-props.yaml | 1 +
.../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
MAINTAINERS | 2 +-
5 files changed, 224 insertions(+), 123 deletions(-)
create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt

diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
new file mode 100644
index 000000000000..aa5a1f48494b
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
+
+maintainers:
+ - Krzysztof Kozlowski <[email protected]>
+
+description:
+ See spi-peripheral-props.yaml for more info.
+
+properties:
+ controller-data:
+ type: object
+ additionalProperties: false
+
+ properties:
+ samsung,spi-feedback-delay:
+ description: |
+ The sampling phase shift to be applied on the miso line (to account
+ for any lag in the miso line). Valid values:
+ - 0: No phase shift.
+ - 1: 90 degree phase shift sampling.
+ - 2: 180 degree phase shift sampling.
+ - 3: 270 degree phase shift sampling.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [0, 1, 2, 3]
+
+ required:
+ - samsung,spi-feedback-delay
+
+additionalProperties: true
diff --git a/Documentation/devicetree/bindings/spi/samsung,spi.yaml b/Documentation/devicetree/bindings/spi/samsung,spi.yaml
new file mode 100644
index 000000000000..61c77088e8ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/samsung,spi.yaml
@@ -0,0 +1,187 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/samsung,spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S3C/S5P/Exynos SoC SPI controller
+
+maintainers:
+ - Krzysztof Kozlowski <[email protected]>
+
+description:
+ All the SPI controller nodes should be represented in the aliases node using
+ the following format 'spi{n}' where n is a unique number for the alias.
+
+properties:
+ compatible:
+ oneOf:
+ - enum:
+ - samsung,s3c2443-spi # for S3C2443, S3C2416 and S3C2450
+ - samsung,s3c6410-spi
+ - samsung,s5pv210-spi # for S5PV210 and S5PC110
+ - samsung,exynos5433-spi
+ - const: samsung,exynos7-spi
+ deprecated: true
+
+ clocks:
+ minItems: 2
+ maxItems: 3
+
+ clock-names:
+ minItems: 2
+ maxItems: 3
+
+ cs-gpios: true
+
+ dmas:
+ minItems: 2
+ maxItems: 2
+
+ dma-names:
+ items:
+ - const: tx
+ - const: rx
+
+ interrupts:
+ maxItems: 1
+
+ no-cs-readback:
+ description:
+ The CS line is disconnected, therefore the device should not operate
+ based on CS signalling.
+ type: boolean
+
+ num-cs:
+ minimum: 1
+ maximum: 4
+ default: 1
+
+ samsung,spi-src-clk:
+ description:
+ If the spi controller includes a internal clock mux to select the clock
+ source for the spi bus clock, this property can be used to indicate the
+ clock to be used for driving the spi bus clock. If not specified, the
+ clock number 0 is used as default.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 0
+
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - clocks
+ - clock-names
+ - dmas
+ - dma-names
+ - interrupts
+ - reg
+
+allOf:
+ - $ref: spi-controller.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: samsung,exynos5433-spi
+ then:
+ properties:
+ clocks:
+ minItems: 3
+ maxItems: 3
+ clock-names:
+ items:
+ - const: spi
+ - enum:
+ - spi_busclk0
+ - spi_busclk1
+ - spi_busclk2
+ - spi_busclk3
+ - const: spi_ioclk
+ else:
+ properties:
+ clocks:
+ minItems: 2
+ maxItems: 2
+ clock-names:
+ items:
+ - const: spi
+ - enum:
+ - spi_busclk0
+ - spi_busclk1
+ - spi_busclk2
+ - spi_busclk3
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/exynos5433.h>
+ #include <dt-bindings/clock/samsung,s2mps11.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/gpio/gpio.h>
+
+ spi@14d30000 {
+ compatible = "samsung,exynos5433-spi";
+ reg = <0x14d30000 0x100>;
+ interrupts = <GIC_SPI 433 IRQ_TYPE_LEVEL_HIGH>;
+ dmas = <&pdma0 11>, <&pdma0 10>;
+ dma-names = "tx", "rx";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clocks = <&cmu_peric CLK_PCLK_SPI1>,
+ <&cmu_peric CLK_SCLK_SPI1>,
+ <&cmu_peric CLK_SCLK_IOCLK_SPI1>;
+ clock-names = "spi",
+ "spi_busclk0",
+ "spi_ioclk";
+ samsung,spi-src-clk = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi1_bus>;
+ num-cs = <1>;
+
+ cs-gpios = <&gpd6 3 GPIO_ACTIVE_HIGH>;
+
+ audio-codec@0 {
+ compatible = "wlf,wm5110";
+ reg = <0x0>;
+ spi-max-frequency = <20000000>;
+ interrupt-parent = <&gpa0>;
+ interrupts = <4 IRQ_TYPE_NONE>;
+ clocks = <&pmu_system_controller 0>,
+ <&s2mps13_osc S2MPS11_CLK_BT>;
+ clock-names = "mclk1", "mclk2";
+
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+
+ wlf,micd-detect-debounce = <300>;
+ wlf,micd-bias-start-time = <0x1>;
+ wlf,micd-rate = <0x7>;
+ wlf,micd-dbtime = <0x2>;
+ wlf,micd-force-micbias;
+ wlf,micd-configs = <0x0 1 0>;
+ wlf,hpdet-channel = <1>;
+ wlf,gpsw = <0x1>;
+ wlf,inmode = <2 0 2 0>;
+
+ wlf,reset = <&gpc0 7 GPIO_ACTIVE_HIGH>;
+ wlf,ldoena = <&gpf0 0 GPIO_ACTIVE_HIGH>;
+
+ /* core supplies */
+ AVDD-supply = <&ldo18_reg>;
+ DBVDD1-supply = <&ldo18_reg>;
+ CPVDD-supply = <&ldo18_reg>;
+ DBVDD2-supply = <&ldo18_reg>;
+ DBVDD3-supply = <&ldo18_reg>;
+ SPKVDDL-supply = <&ldo18_reg>;
+ SPKVDDR-supply = <&ldo18_reg>;
+
+ controller-data {
+ samsung,spi-feedback-delay = <0>;
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
index 5dd209206e88..df885eeb144f 100644
--- a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
@@ -85,5 +85,6 @@ properties:
# The controller specific properties go here.
allOf:
- $ref: cdns,qspi-nor-peripheral-props.yaml#
+ - $ref: samsung,spi-peripheral-props.yaml#

additionalProperties: true
diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
deleted file mode 100644
index 49028a4f5df1..000000000000
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ /dev/null
@@ -1,122 +0,0 @@
-* Samsung SPI Controller
-
-The Samsung SPI controller is used to interface with various devices such as flash
-and display controllers using the SPI communication interface.
-
-Required SoC Specific Properties:
-
-- compatible: should be one of the following.
- - samsung,s3c2443-spi: for s3c2443, s3c2416 and s3c2450 platforms
- - samsung,s3c6410-spi: for s3c6410 platforms
- - samsung,s5pv210-spi: for s5pv210 and s5pc110 platforms
- - samsung,exynos5433-spi: for exynos5433 compatible controllers
- - samsung,exynos7-spi: for exynos7 platforms <DEPRECATED>
-
-- reg: physical base address of the controller and length of memory mapped
- region.
-
-- interrupts: The interrupt number to the cpu. The interrupt specifier format
- depends on the interrupt controller.
-
-- dmas : Two or more DMA channel specifiers following the convention outlined
- in bindings/dma/dma.txt
-
-- dma-names: Names for the dma channels. There must be at least one channel
- named "tx" for transmit and named "rx" for receive.
-
-- clocks: specifies the clock IDs provided to the SPI controller; they are
- required for interacting with the controller itself, for synchronizing the bus
- and as I/O clock (the latter is required by exynos5433 and exynos7).
-
-- clock-names: string names of the clocks in the 'clocks' property; for all the
- the devices the names must be "spi", "spi_busclkN" (where N is determined by
- "samsung,spi-src-clk"), while Exynos5433 should specify a third clock
- "spi_ioclk" for the I/O clock.
-
-Required Board Specific Properties:
-
-- #address-cells: should be 1.
-- #size-cells: should be 0.
-
-Optional Board Specific Properties:
-
-- samsung,spi-src-clk: If the spi controller includes a internal clock mux to
- select the clock source for the spi bus clock, this property can be used to
- indicate the clock to be used for driving the spi bus clock. If not specified,
- the clock number 0 is used as default.
-
-- num-cs: Specifies the number of chip select lines supported. If
- not specified, the default number of chip select lines is set to 1.
-
-- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
-
-- no-cs-readback: the CS line is disconnected, therefore the device should not
- operate based on CS signalling.
-
-SPI Controller specific data in SPI slave nodes:
-
-- The spi slave nodes should provide the following information which is required
- by the spi controller.
-
- - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
- miso line (to account for any lag in the miso line). The following are the
- valid values.
-
- - 0: No phase shift.
- - 1: 90 degree phase shift sampling.
- - 2: 180 degree phase shift sampling.
- - 3: 270 degree phase shift sampling.
-
-Aliases:
-
-- All the SPI controller nodes should be represented in the aliases node using
- the following format 'spi{n}' where n is a unique number for the alias.
-
-
-Example:
-
-- SoC Specific Portion:
-
- spi_0: spi@12d20000 {
- compatible = "samsung,exynos4210-spi";
- reg = <0x12d20000 0x100>;
- interrupts = <0 66 0>;
- dmas = <&pdma0 5
- &pdma0 4>;
- dma-names = "tx", "rx";
- #address-cells = <1>;
- #size-cells = <0>;
- };
-
-- Board Specific Portion:
-
- spi_0: spi@12d20000 {
- #address-cells = <1>;
- #size-cells = <0>;
- pinctrl-names = "default";
- pinctrl-0 = <&spi0_bus>;
- cs-gpios = <&gpa2 5 0>;
-
- w25q80bw@0 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "w25x80";
- reg = <0>;
- spi-max-frequency = <10000>;
-
- controller-data {
- samsung,spi-feedback-delay = <0>;
- };
-
- partition@0 {
- label = "U-Boot";
- reg = <0x0 0x40000>;
- read-only;
- };
-
- partition@40000 {
- label = "Kernel";
- reg = <0x40000 0xc0000>;
- };
- };
- };
diff --git a/MAINTAINERS b/MAINTAINERS
index 5ea5655a29c3..1f951bc877f0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17054,7 +17054,7 @@ M: Andi Shyti <[email protected]>
L: [email protected]
L: [email protected]
S: Maintained
-F: Documentation/devicetree/bindings/spi/spi-samsung.txt
+F: Documentation/devicetree/bindings/spi/samsung,spi*.yaml
F: drivers/spi/spi-s3c*
F: include/linux/platform_data/spi-s3c64xx.h
F: include/linux/spi/s3c24xx-fiq.h
--
2.32.0


2022-01-14 05:58:04

by Chanho Park

[permalink] [raw]
Subject: RE: [PATCH v3 4/4] spi: s3c64xx: allow controller-data to be optional

> -----Original Message-----
> From: Krzysztof Kozlowski <[email protected]>
> Sent: Wednesday, January 12, 2022 7:01 PM
> To: Krzysztof Kozlowski <[email protected]>; Andi Shyti
> <[email protected]>; Mark Brown <[email protected]>; Rob Herring
> <[email protected]>; Pratyush Yadav <[email protected]>; linux-
> [email protected]; [email protected];
> [email protected]; [email protected]; linux-arm-
> [email protected]
> Cc: Sam Protsenko <[email protected]>; Rob Herring
> <[email protected]>
> Subject: [PATCH v3 4/4] spi: s3c64xx: allow controller-data to be optional
>
> The Samsung SoC SPI driver requires to provide controller-data node for
> each of SPI peripheral device nodes. Make this controller-data node
> optional, so DTS could be simpler.
>
> Suggested-by: Rob Herring <[email protected]>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: Chanho Park <[email protected]>


2022-01-14 22:49:17

by Sam Protsenko

[permalink] [raw]
Subject: Re: [PATCH v3 4/4] spi: s3c64xx: allow controller-data to be optional

On Wed, 12 Jan 2022 at 12:00, Krzysztof Kozlowski
<[email protected]> wrote:
>
> The Samsung SoC SPI driver requires to provide controller-data node
> for each of SPI peripheral device nodes. Make this controller-data node
> optional, so DTS could be simpler.
>
> Suggested-by: Rob Herring <[email protected]>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Reviewed-by: Sam Protsenko <[email protected]>

> drivers/spi/spi-s3c64xx.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 8755cd85e83c..769d958a2f86 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -796,16 +796,14 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
> return ERR_PTR(-EINVAL);
> }
>
> - data_np = of_get_child_by_name(slave_np, "controller-data");
> - if (!data_np) {
> - dev_err(&spi->dev, "child node 'controller-data' not found\n");
> - return ERR_PTR(-EINVAL);
> - }
> -
> cs = kzalloc(sizeof(*cs), GFP_KERNEL);
> - if (!cs) {
> - of_node_put(data_np);
> + if (!cs)
> return ERR_PTR(-ENOMEM);
> +
> + data_np = of_get_child_by_name(slave_np, "controller-data");
> + if (!data_np) {
> + dev_info(&spi->dev, "child node 'controller-data' not found, using defaults\n");
> + return cs;
> }
>
> of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
> --
> 2.32.0
>

2022-01-17 08:26:54

by Alim Akhtar

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] ARM: dts: exynos: split dmas into array of phandles in Exynos5250

On Thu, Jan 13, 2022 at 4:19 AM Krzysztof Kozlowski
<[email protected]> wrote:
>
> "dmas" property should be rather an array of phandles, as dtschema
> points.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> Reviewed-by: Andi Shyti <[email protected]>
> ---

Reviewed-by: Alim Akhtar <[email protected]>

> arch/arm/boot/dts/exynos5250.dtsi | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
> index 139778928b93..102bb57bf704 100644
> --- a/arch/arm/boot/dts/exynos5250.dtsi
> +++ b/arch/arm/boot/dts/exynos5250.dtsi
> @@ -496,8 +496,7 @@ spi_0: spi@12d20000 {
> status = "disabled";
> reg = <0x12d20000 0x100>;
> interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
> - dmas = <&pdma0 5
> - &pdma0 4>;
> + dmas = <&pdma0 5>, <&pdma0 4>;
> dma-names = "tx", "rx";
> #address-cells = <1>;
> #size-cells = <0>;
> @@ -512,8 +511,7 @@ spi_1: spi@12d30000 {
> status = "disabled";
> reg = <0x12d30000 0x100>;
> interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
> - dmas = <&pdma1 5
> - &pdma1 4>;
> + dmas = <&pdma1 5>, <&pdma1 4>;
> dma-names = "tx", "rx";
> #address-cells = <1>;
> #size-cells = <0>;
> @@ -528,8 +526,7 @@ spi_2: spi@12d40000 {
> status = "disabled";
> reg = <0x12d40000 0x100>;
> interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
> - dmas = <&pdma0 7
> - &pdma0 6>;
> + dmas = <&pdma0 7>, <&pdma0 6>;
> dma-names = "tx", "rx";
> #address-cells = <1>;
> #size-cells = <0>;
> --
> 2.32.0
>


--
Regards,
Alim

2022-01-21 19:59:37

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
> controller bindings to DT schema format
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> Reviewed-by: Sam Protsenko <[email protected]>
> ---
> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
> .../bindings/spi/spi-peripheral-props.yaml | 1 +
> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
> MAINTAINERS | 2 +-
> 5 files changed, 224 insertions(+), 123 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
>
> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> new file mode 100644
> index 000000000000..aa5a1f48494b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> @@ -0,0 +1,35 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
> +
> +maintainers:
> + - Krzysztof Kozlowski <[email protected]>
> +
> +description:
> + See spi-peripheral-props.yaml for more info.
> +
> +properties:
> + controller-data:
> + type: object
> + additionalProperties: false
> +
> + properties:
> + samsung,spi-feedback-delay:
> + description: |
> + The sampling phase shift to be applied on the miso line (to account
> + for any lag in the miso line). Valid values:
> + - 0: No phase shift.
> + - 1: 90 degree phase shift sampling.
> + - 2: 180 degree phase shift sampling.
> + - 3: 270 degree phase shift sampling.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + enum: [0, 1, 2, 3]
> +
> + required:
> + - samsung,spi-feedback-delay

I am not quite sure if this required would work here. Let's say another
controller also uses a controller-data node, but it contains a different
set of properties. Won't this cause an error to be raised for that
controller since this property is not there?

--
Regards,
Pratyush Yadav
Texas Instruments Inc.

2022-01-21 20:01:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On 19/01/2022 20:31, Pratyush Yadav wrote:
> On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
>> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
>> controller bindings to DT schema format
>>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>> Reviewed-by: Sam Protsenko <[email protected]>
>> ---
>> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
>> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
>> .../bindings/spi/spi-peripheral-props.yaml | 1 +
>> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
>> MAINTAINERS | 2 +-
>> 5 files changed, 224 insertions(+), 123 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
>> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
>>
>> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
>> new file mode 100644
>> index 000000000000..aa5a1f48494b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
>> @@ -0,0 +1,35 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
>> +
>> +maintainers:
>> + - Krzysztof Kozlowski <[email protected]>
>> +
>> +description:
>> + See spi-peripheral-props.yaml for more info.
>> +
>> +properties:
>> + controller-data:
>> + type: object
>> + additionalProperties: false
>> +
>> + properties:
>> + samsung,spi-feedback-delay:
>> + description: |
>> + The sampling phase shift to be applied on the miso line (to account
>> + for any lag in the miso line). Valid values:
>> + - 0: No phase shift.
>> + - 1: 90 degree phase shift sampling.
>> + - 2: 180 degree phase shift sampling.
>> + - 3: 270 degree phase shift sampling.
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + enum: [0, 1, 2, 3]
>> +
>> + required:
>> + - samsung,spi-feedback-delay
>
> I am not quite sure if this required would work here. Let's say another
> controller also uses a controller-data node, but it contains a different
> set of properties. Won't this cause an error to be raised for that
> controller since this property is not there?

The controller-data is Samsung SPI specific (does not exist in any other
binding), so why would controller-data get added to a different controller?

Best regards,
Krzysztof

2022-01-21 21:07:37

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On 19/01/22 08:49PM, Krzysztof Kozlowski wrote:
> On 19/01/2022 20:31, Pratyush Yadav wrote:
> > On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
> >> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
> >> controller bindings to DT schema format
> >>
> >> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> >> Reviewed-by: Sam Protsenko <[email protected]>
> >> ---
> >> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
> >> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
> >> .../bindings/spi/spi-peripheral-props.yaml | 1 +
> >> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
> >> MAINTAINERS | 2 +-
> >> 5 files changed, 224 insertions(+), 123 deletions(-)
> >> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> >> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
> >> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> >> new file mode 100644
> >> index 000000000000..aa5a1f48494b
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> >> @@ -0,0 +1,35 @@
> >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
> >> +
> >> +maintainers:
> >> + - Krzysztof Kozlowski <[email protected]>
> >> +
> >> +description:
> >> + See spi-peripheral-props.yaml for more info.
> >> +
> >> +properties:
> >> + controller-data:
> >> + type: object
> >> + additionalProperties: false
> >> +
> >> + properties:
> >> + samsung,spi-feedback-delay:
> >> + description: |
> >> + The sampling phase shift to be applied on the miso line (to account
> >> + for any lag in the miso line). Valid values:
> >> + - 0: No phase shift.
> >> + - 1: 90 degree phase shift sampling.
> >> + - 2: 180 degree phase shift sampling.
> >> + - 3: 270 degree phase shift sampling.
> >> + $ref: /schemas/types.yaml#/definitions/uint32
> >> + enum: [0, 1, 2, 3]
> >> +
> >> + required:
> >> + - samsung,spi-feedback-delay
> >
> > I am not quite sure if this required would work here. Let's say another
> > controller also uses a controller-data node, but it contains a different
> > set of properties. Won't this cause an error to be raised for that
> > controller since this property is not there?
>
> The controller-data is Samsung SPI specific (does not exist in any other
> binding), so why would controller-data get added to a different controller?

It does not as of now, but the name is fairly generic and some
controller in the future might use it. I do not think it is a good idea
to list required properties in X-peripheral-props.yaml in general since
all those will be collected by spi-peripheral-props.yaml and so will
apply to _all_ controllers that reference it.

--
Regards,
Pratyush Yadav
Texas Instruments Inc.

2022-01-21 21:09:04

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On 20/01/2022 08:06, Pratyush Yadav wrote:
> On 19/01/22 08:49PM, Krzysztof Kozlowski wrote:
>> On 19/01/2022 20:31, Pratyush Yadav wrote:
>>> On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
>>>> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
>>>> controller bindings to DT schema format
>>>>
>>>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>>>> Reviewed-by: Sam Protsenko <[email protected]>
>>>> ---
>>>> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
>>>> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
>>>> .../bindings/spi/spi-peripheral-props.yaml | 1 +
>>>> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
>>>> MAINTAINERS | 2 +-
>>>> 5 files changed, 224 insertions(+), 123 deletions(-)
>>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
>>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
>>>> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
>>>> new file mode 100644
>>>> index 000000000000..aa5a1f48494b
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
>>>> @@ -0,0 +1,35 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
>>>> +
>>>> +maintainers:
>>>> + - Krzysztof Kozlowski <[email protected]>
>>>> +
>>>> +description:
>>>> + See spi-peripheral-props.yaml for more info.
>>>> +
>>>> +properties:
>>>> + controller-data:
>>>> + type: object
>>>> + additionalProperties: false
>>>> +
>>>> + properties:
>>>> + samsung,spi-feedback-delay:
>>>> + description: |
>>>> + The sampling phase shift to be applied on the miso line (to account
>>>> + for any lag in the miso line). Valid values:
>>>> + - 0: No phase shift.
>>>> + - 1: 90 degree phase shift sampling.
>>>> + - 2: 180 degree phase shift sampling.
>>>> + - 3: 270 degree phase shift sampling.
>>>> + $ref: /schemas/types.yaml#/definitions/uint32
>>>> + enum: [0, 1, 2, 3]
>>>> +
>>>> + required:
>>>> + - samsung,spi-feedback-delay
>>>
>>> I am not quite sure if this required would work here. Let's say another
>>> controller also uses a controller-data node, but it contains a different
>>> set of properties. Won't this cause an error to be raised for that
>>> controller since this property is not there?
>>
>> The controller-data is Samsung SPI specific (does not exist in any other
>> binding), so why would controller-data get added to a different controller?
>
> It does not as of now, but the name is fairly generic and some
> controller in the future might use it. I do not think it is a good idea
> to list required properties in X-peripheral-props.yaml in general since
> all those will be collected by spi-peripheral-props.yaml and so will
> apply to _all_ controllers that reference it.

Right, but have in mind this is merely a bindings conversion. These were
made like this long time ago.

I think we can drop the "required:" entirely with the commit 3/4 which
makes it optional.



Best regards,
Krzysztof

2022-01-21 21:12:03

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On 20/01/22 08:36AM, Krzysztof Kozlowski wrote:
> On 20/01/2022 08:06, Pratyush Yadav wrote:
> > On 19/01/22 08:49PM, Krzysztof Kozlowski wrote:
> >> On 19/01/2022 20:31, Pratyush Yadav wrote:
> >>> On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
> >>>> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
> >>>> controller bindings to DT schema format
> >>>>
> >>>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> >>>> Reviewed-by: Sam Protsenko <[email protected]>
> >>>> ---
> >>>> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
> >>>> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
> >>>> .../bindings/spi/spi-peripheral-props.yaml | 1 +
> >>>> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
> >>>> MAINTAINERS | 2 +-
> >>>> 5 files changed, 224 insertions(+), 123 deletions(-)
> >>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> >>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
> >>>> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> >>>> new file mode 100644
> >>>> index 000000000000..aa5a1f48494b
> >>>> --- /dev/null
> >>>> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> >>>> @@ -0,0 +1,35 @@
> >>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> >>>> +%YAML 1.2
> >>>> +---
> >>>> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
> >>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >>>> +
> >>>> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
> >>>> +
> >>>> +maintainers:
> >>>> + - Krzysztof Kozlowski <[email protected]>
> >>>> +
> >>>> +description:
> >>>> + See spi-peripheral-props.yaml for more info.
> >>>> +
> >>>> +properties:
> >>>> + controller-data:
> >>>> + type: object
> >>>> + additionalProperties: false
> >>>> +
> >>>> + properties:
> >>>> + samsung,spi-feedback-delay:
> >>>> + description: |
> >>>> + The sampling phase shift to be applied on the miso line (to account
> >>>> + for any lag in the miso line). Valid values:
> >>>> + - 0: No phase shift.
> >>>> + - 1: 90 degree phase shift sampling.
> >>>> + - 2: 180 degree phase shift sampling.
> >>>> + - 3: 270 degree phase shift sampling.
> >>>> + $ref: /schemas/types.yaml#/definitions/uint32
> >>>> + enum: [0, 1, 2, 3]
> >>>> +
> >>>> + required:
> >>>> + - samsung,spi-feedback-delay
> >>>
> >>> I am not quite sure if this required would work here. Let's say another
> >>> controller also uses a controller-data node, but it contains a different
> >>> set of properties. Won't this cause an error to be raised for that
> >>> controller since this property is not there?
> >>
> >> The controller-data is Samsung SPI specific (does not exist in any other
> >> binding), so why would controller-data get added to a different controller?
> >
> > It does not as of now, but the name is fairly generic and some
> > controller in the future might use it. I do not think it is a good idea
> > to list required properties in X-peripheral-props.yaml in general since
> > all those will be collected by spi-peripheral-props.yaml and so will
> > apply to _all_ controllers that reference it.
>
> Right, but have in mind this is merely a bindings conversion. These were
> made like this long time ago.

Yes, but the bindings infrastructure is not capable of handling these
required properties as of now. So even if your next patch was _not_
making it optional, I would still say you should drop the "required:".
Even though the property is actually a required one, we currently do not
have the means to express that.

>
> I think we can drop the "required:" entirely with the commit 3/4 which
> makes it optional.

I would prefer you never add it in the first place.

--
Regards,
Pratyush Yadav
Texas Instruments Inc.

2022-01-21 21:13:05

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On Thu, Jan 20, 2022 at 02:30:02PM +0530, Pratyush Yadav wrote:
> On 20/01/22 08:36AM, Krzysztof Kozlowski wrote:
> > On 20/01/2022 08:06, Pratyush Yadav wrote:
> > > On 19/01/22 08:49PM, Krzysztof Kozlowski wrote:
> > >> On 19/01/2022 20:31, Pratyush Yadav wrote:
> > >>> On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
> > >>>> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
> > >>>> controller bindings to DT schema format
> > >>>>
> > >>>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> > >>>> Reviewed-by: Sam Protsenko <[email protected]>
> > >>>> ---
> > >>>> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
> > >>>> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
> > >>>> .../bindings/spi/spi-peripheral-props.yaml | 1 +
> > >>>> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
> > >>>> MAINTAINERS | 2 +-
> > >>>> 5 files changed, 224 insertions(+), 123 deletions(-)
> > >>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> > >>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
> > >>>> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
> > >>>>
> > >>>> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> > >>>> new file mode 100644
> > >>>> index 000000000000..aa5a1f48494b
> > >>>> --- /dev/null
> > >>>> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> > >>>> @@ -0,0 +1,35 @@
> > >>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > >>>> +%YAML 1.2
> > >>>> +---
> > >>>> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
> > >>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > >>>> +
> > >>>> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
> > >>>> +
> > >>>> +maintainers:
> > >>>> + - Krzysztof Kozlowski <[email protected]>
> > >>>> +
> > >>>> +description:
> > >>>> + See spi-peripheral-props.yaml for more info.
> > >>>> +
> > >>>> +properties:
> > >>>> + controller-data:
> > >>>> + type: object
> > >>>> + additionalProperties: false
> > >>>> +
> > >>>> + properties:
> > >>>> + samsung,spi-feedback-delay:
> > >>>> + description: |
> > >>>> + The sampling phase shift to be applied on the miso line (to account
> > >>>> + for any lag in the miso line). Valid values:
> > >>>> + - 0: No phase shift.
> > >>>> + - 1: 90 degree phase shift sampling.
> > >>>> + - 2: 180 degree phase shift sampling.
> > >>>> + - 3: 270 degree phase shift sampling.
> > >>>> + $ref: /schemas/types.yaml#/definitions/uint32
> > >>>> + enum: [0, 1, 2, 3]
> > >>>> +
> > >>>> + required:
> > >>>> + - samsung,spi-feedback-delay
> > >>>
> > >>> I am not quite sure if this required would work here. Let's say another
> > >>> controller also uses a controller-data node, but it contains a different
> > >>> set of properties. Won't this cause an error to be raised for that
> > >>> controller since this property is not there?
> > >>
> > >> The controller-data is Samsung SPI specific (does not exist in any other
> > >> binding), so why would controller-data get added to a different controller?
> > >
> > > It does not as of now, but the name is fairly generic and some
> > > controller in the future might use it. I do not think it is a good idea
> > > to list required properties in X-peripheral-props.yaml in general since
> > > all those will be collected by spi-peripheral-props.yaml and so will
> > > apply to _all_ controllers that reference it.
> >
> > Right, but have in mind this is merely a bindings conversion. These were
> > made like this long time ago.
>
> Yes, but the bindings infrastructure is not capable of handling these
> required properties as of now. So even if your next patch was _not_
> making it optional, I would still say you should drop the "required:".
> Even though the property is actually a required one, we currently do not
> have the means to express that.
>
> >
> > I think we can drop the "required:" entirely with the commit 3/4 which
> > makes it optional.
>
> I would prefer you never add it in the first place.

If I understand correctly, you propose to squash next patch making it
optional to this conversion? I believe there is a value in splitting
conversion of existing bindings from making changes to the bindings, but
I don't mind squashing them if that is desired.

Best regards,
Krzysztof

2022-01-21 21:16:17

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] spi: dt-bindings: samsung: convert to dtschema

On 20/01/22 10:24AM, Krzysztof Kozlowski wrote:
> On Thu, Jan 20, 2022 at 02:30:02PM +0530, Pratyush Yadav wrote:
> > On 20/01/22 08:36AM, Krzysztof Kozlowski wrote:
> > > On 20/01/2022 08:06, Pratyush Yadav wrote:
> > > > On 19/01/22 08:49PM, Krzysztof Kozlowski wrote:
> > > >> On 19/01/2022 20:31, Pratyush Yadav wrote:
> > > >>> On 12/01/22 11:00AM, Krzysztof Kozlowski wrote:
> > > >>>> Convert the Samsung SoC (S3C24xx, S3C64xx, S5Pv210, Exynos) SPI
> > > >>>> controller bindings to DT schema format
> > > >>>>
> > > >>>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> > > >>>> Reviewed-by: Sam Protsenko <[email protected]>
> > > >>>> ---
> > > >>>> .../spi/samsung,spi-peripheral-props.yaml | 35 ++++
> > > >>>> .../devicetree/bindings/spi/samsung,spi.yaml | 187 ++++++++++++++++++
> > > >>>> .../bindings/spi/spi-peripheral-props.yaml | 1 +
> > > >>>> .../devicetree/bindings/spi/spi-samsung.txt | 122 ------------
> > > >>>> MAINTAINERS | 2 +-
> > > >>>> 5 files changed, 224 insertions(+), 123 deletions(-)
> > > >>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> > > >>>> create mode 100644 Documentation/devicetree/bindings/spi/samsung,spi.yaml
> > > >>>> delete mode 100644 Documentation/devicetree/bindings/spi/spi-samsung.txt
> > > >>>>
> > > >>>> diff --git a/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> > > >>>> new file mode 100644
> > > >>>> index 000000000000..aa5a1f48494b
> > > >>>> --- /dev/null
> > > >>>> +++ b/Documentation/devicetree/bindings/spi/samsung,spi-peripheral-props.yaml
> > > >>>> @@ -0,0 +1,35 @@
> > > >>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > > >>>> +%YAML 1.2
> > > >>>> +---
> > > >>>> +$id: http://devicetree.org/schemas/spi/samsung,spi-peripheral-props.yaml#
> > > >>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > >>>> +
> > > >>>> +title: Peripheral-specific properties for Samsung S3C/S5P/Exynos SoC SPI controller
> > > >>>> +
> > > >>>> +maintainers:
> > > >>>> + - Krzysztof Kozlowski <[email protected]>
> > > >>>> +
> > > >>>> +description:
> > > >>>> + See spi-peripheral-props.yaml for more info.
> > > >>>> +
> > > >>>> +properties:
> > > >>>> + controller-data:
> > > >>>> + type: object
> > > >>>> + additionalProperties: false
> > > >>>> +
> > > >>>> + properties:
> > > >>>> + samsung,spi-feedback-delay:
> > > >>>> + description: |
> > > >>>> + The sampling phase shift to be applied on the miso line (to account
> > > >>>> + for any lag in the miso line). Valid values:
> > > >>>> + - 0: No phase shift.
> > > >>>> + - 1: 90 degree phase shift sampling.
> > > >>>> + - 2: 180 degree phase shift sampling.
> > > >>>> + - 3: 270 degree phase shift sampling.
> > > >>>> + $ref: /schemas/types.yaml#/definitions/uint32
> > > >>>> + enum: [0, 1, 2, 3]
> > > >>>> +
> > > >>>> + required:
> > > >>>> + - samsung,spi-feedback-delay
> > > >>>
> > > >>> I am not quite sure if this required would work here. Let's say another
> > > >>> controller also uses a controller-data node, but it contains a different
> > > >>> set of properties. Won't this cause an error to be raised for that
> > > >>> controller since this property is not there?
> > > >>
> > > >> The controller-data is Samsung SPI specific (does not exist in any other
> > > >> binding), so why would controller-data get added to a different controller?
> > > >
> > > > It does not as of now, but the name is fairly generic and some
> > > > controller in the future might use it. I do not think it is a good idea
> > > > to list required properties in X-peripheral-props.yaml in general since
> > > > all those will be collected by spi-peripheral-props.yaml and so will
> > > > apply to _all_ controllers that reference it.
> > >
> > > Right, but have in mind this is merely a bindings conversion. These were
> > > made like this long time ago.
> >
> > Yes, but the bindings infrastructure is not capable of handling these
> > required properties as of now. So even if your next patch was _not_
> > making it optional, I would still say you should drop the "required:".
> > Even though the property is actually a required one, we currently do not
> > have the means to express that.
> >
> > >
> > > I think we can drop the "required:" entirely with the commit 3/4 which
> > > makes it optional.
> >
> > I would prefer you never add it in the first place.
>
> If I understand correctly, you propose to squash next patch making it
> optional to this conversion? I believe there is a value in splitting
> conversion of existing bindings from making changes to the bindings, but
> I don't mind squashing them if that is desired.

No, I don't want you to squash the next patch. I want you to just drop
the "required:" property and call it a lossy conversion since there is
no way as of now to express that. In the ideal world you would have kept
it, and removed it in the next patch.

>
> Best regards,
> Krzysztof
>

--
Regards,
Pratyush Yadav
Texas Instruments Inc.