public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties
@ 2023-05-18 22:22 Fabio Estevam
  2023-05-18 22:22 ` [PATCH 2/2] doc: bindings: soft-spi: Remove the usage of deprecated properties Fabio Estevam
  2023-06-11 10:39 ` [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties Jagan Teki
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2023-05-18 22:22 UTC (permalink / raw)
  To: jagan; +Cc: u-boot, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

According to Documentation/devicetree/bindings/spi/spi-gpio.yaml
from Linux, the recommended spio-gpio properties are:

sck-gpios, miso-gpios and mosi-gpios.

gpio-sck, gpio-mosi and gpio-miso are considered deprecated.

Currently, U-Boot only supports the deprecated properties.

Allow the soft_spi driver to support both the new and old properties.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 drivers/spi/soft_spi.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index f3602a25ba30..0fa14339bdcd 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -248,19 +248,32 @@ static int soft_spi_probe(struct udevice *dev)
 	cs_flags = (slave && slave->mode & SPI_CS_HIGH) ? 0 : GPIOD_ACTIVE_LOW;
 	clk_flags = (slave && slave->mode & SPI_CPOL) ? GPIOD_ACTIVE_LOW : 0;
 
-	if (gpio_request_by_name(dev, "cs-gpios", 0, &plat->cs,
-				 GPIOD_IS_OUT | cs_flags) ||
-	    gpio_request_by_name(dev, "gpio-sck", 0, &plat->sclk,
-				 GPIOD_IS_OUT | clk_flags))
+	ret = gpio_request_by_name(dev, "cs-gpios", 0, &plat->cs,
+				   GPIOD_IS_OUT | cs_flags);
+	if (ret)
+		return -EINVAL;
+
+	ret = gpio_request_by_name(dev, "gpio-sck", 0, &plat->sclk,
+				   GPIOD_IS_OUT | clk_flags);
+	if (ret)
+		ret = gpio_request_by_name(dev, "sck-gpios", 0, &plat->sclk,
+					   GPIOD_IS_OUT | clk_flags);
+	if (ret)
 		return -EINVAL;
 
 	ret = gpio_request_by_name(dev, "gpio-mosi", 0, &plat->mosi,
 				   GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+	if (ret)
+		ret = gpio_request_by_name(dev, "mosi-gpios", 0, &plat->mosi,
+					   GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
 	if (ret)
 		plat->flags |= SPI_MASTER_NO_TX;
 
 	ret = gpio_request_by_name(dev, "gpio-miso", 0, &plat->miso,
 				   GPIOD_IS_IN);
+	if (ret)
+		ret = gpio_request_by_name(dev, "gpio-miso", 0, &plat->miso,
+					   GPIOD_IS_IN);
 	if (ret)
 		plat->flags |= SPI_MASTER_NO_RX;
 
-- 
2.34.1


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

* [PATCH 2/2] doc: bindings: soft-spi: Remove the usage of deprecated properties
  2023-05-18 22:22 [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties Fabio Estevam
@ 2023-05-18 22:22 ` Fabio Estevam
  2023-06-11 10:38   ` Jagan Teki
  2023-06-11 10:39 ` [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties Jagan Teki
  1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2023-05-18 22:22 UTC (permalink / raw)
  To: jagan; +Cc: u-boot, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

According to Documentation/devicetree/bindings/spi/spi-gpio.yaml
from Linux, the recommended spio-gpio properties are:

sck-gpios, miso-gpios and mosi-gpios.

gpio-sck, gpio-mosi and gpio-miso are considered deprecated.

Update the bindings to suggest the recommeded properties.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 doc/device-tree-bindings/spi/soft-spi.txt | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/device-tree-bindings/spi/soft-spi.txt b/doc/device-tree-bindings/spi/soft-spi.txt
index dfb50664732f..bdf7e86befb9 100644
--- a/doc/device-tree-bindings/spi/soft-spi.txt
+++ b/doc/device-tree-bindings/spi/soft-spi.txt
@@ -9,10 +9,10 @@ The soft SPI node requires the following properties:
 Mandatory properties:
 compatible: "spi-gpio"
 cs-gpios: GPIOs to use for SPI chip select (output)
-gpio-sck: GPIO to use for SPI clock (output)
+sck-gpios: GPIO to use for SPI clock (output)
 And at least one of:
-gpio-mosi: GPIO to use for SPI MOSI line (output)
-gpio-miso: GPIO to use for SPI MISO line (input)
+mosi-gpios: GPIO to use for SPI MOSI line (output)
+miso-gpios: GPIO to use for SPI MISO line (input)
 
 Optional propertie:
 spi-delay-us: Number of microseconds of delay between each CS transition
@@ -27,9 +27,9 @@ Example:
 	soft-spi {
 		compatible = "spi-gpio";
 		cs-gpios = <&gpio 235 0>;	/* Y43 */
-		gpio-sck = <&gpio 225 0>;	/* Y31 */
-		gpio-mosi = <&gpio 227 0>;	/* Y33 */
-		gpio-miso = <&gpio 224 0>;	/* Y30 */
+		sck-gpios = <&gpio 225 0>;	/* Y31 */
+		mosi-gpios = <&gpio 227 0>;	/* Y33 */
+		miso-gpios = <&gpio 224 0>;	/* Y30 */
 		spi-delay-us = <1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
-- 
2.34.1


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

* Re: [PATCH 2/2] doc: bindings: soft-spi: Remove the usage of deprecated properties
  2023-05-18 22:22 ` [PATCH 2/2] doc: bindings: soft-spi: Remove the usage of deprecated properties Fabio Estevam
@ 2023-06-11 10:38   ` Jagan Teki
  0 siblings, 0 replies; 4+ messages in thread
From: Jagan Teki @ 2023-06-11 10:38 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: u-boot, Fabio Estevam

On Fri, May 19, 2023 at 3:52 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> From: Fabio Estevam <festevam@denx.de>
>
> According to Documentation/devicetree/bindings/spi/spi-gpio.yaml
> from Linux, the recommended spio-gpio properties are:
>
> sck-gpios, miso-gpios and mosi-gpios.
>
> gpio-sck, gpio-mosi and gpio-miso are considered deprecated.
>
> Update the bindings to suggest the recommeded properties.
>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>

Applied to u-boot-spi/master

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

* Re: [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties
  2023-05-18 22:22 [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties Fabio Estevam
  2023-05-18 22:22 ` [PATCH 2/2] doc: bindings: soft-spi: Remove the usage of deprecated properties Fabio Estevam
@ 2023-06-11 10:39 ` Jagan Teki
  1 sibling, 0 replies; 4+ messages in thread
From: Jagan Teki @ 2023-06-11 10:39 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: u-boot, Fabio Estevam

On Fri, May 19, 2023 at 3:52 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> From: Fabio Estevam <festevam@denx.de>
>
> According to Documentation/devicetree/bindings/spi/spi-gpio.yaml
> from Linux, the recommended spio-gpio properties are:
>
> sck-gpios, miso-gpios and mosi-gpios.
>
> gpio-sck, gpio-mosi and gpio-miso are considered deprecated.
>
> Currently, U-Boot only supports the deprecated properties.
>
> Allow the soft_spi driver to support both the new and old properties.
>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>

Applied to u-boot-spi/master

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

end of thread, other threads:[~2023-06-11 10:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-18 22:22 [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties Fabio Estevam
2023-05-18 22:22 ` [PATCH 2/2] doc: bindings: soft-spi: Remove the usage of deprecated properties Fabio Estevam
2023-06-11 10:38   ` Jagan Teki
2023-06-11 10:39 ` [PATCH 1/2] spi: soft_spi: Support the recommended soft spi properties Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox