linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4)
@ 2018-11-13 12:12 Lukasz Majewski
  2018-11-26 14:36 ` Shawn Guo
  2018-12-09 21:50 ` [PATCH v2] ARM: dts: vf610-bk4: Provide support for reading ID code from MVB device Lukasz Majewski
  0 siblings, 2 replies; 7+ messages in thread
From: Lukasz Majewski @ 2018-11-13 12:12 UTC (permalink / raw)
  To: Shawn Guo, Rob Herring, Mark Rutland
  Cc: Sascha Hauer, devicetree, linux-kernel, linux-arm-kernel,
	Pengutronix Kernel Team, Stefan Agner, Fabio Estevam,
	Fabio Estevam, Lukasz Majewski

The procedure to read this ID value is as follows:

rmmod spi_fsl_dspi
insmod spi-gpio.ko

echo 504 > /sys/class/gpio/export
cat /sys/class/gpio/gpio504/value
...
echo 511 > /sys/class/gpio/export
cat /sys/class/gpio/gpio511/value

rmmod spi-gpio.ko
insmod spi_fsl_dspi

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/boot/dts/vf610-bk4.dts | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-bk4.dts b/arch/arm/boot/dts/vf610-bk4.dts
index cab95714c058..f01c735807ae 100644
--- a/arch/arm/boot/dts/vf610-bk4.dts
+++ b/arch/arm/boot/dts/vf610-bk4.dts
@@ -59,6 +59,29 @@
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 	};
+
+	spi_gpio {
+		compatible = "spi-gpio";
+		pinctrl-0 = <&pinctrl_gpio_spi>;
+		pinctrl-names = "default";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		/* PTD12 ->RPIO[91] */
+		sck-gpios  = <&gpio2 27 GPIO_ACTIVE_LOW>;
+		/* PTD10 ->RPIO[89] */
+		miso-gpios = <&gpio2 25 GPIO_ACTIVE_HIGH>;
+		num-chipselects = <0>;
+
+		72xx165@0 {
+			compatible = "pisosr-gpio";
+			reg = <0>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			/* PTB18 -> RGPIO[40] */
+			load-gpios  = <&gpio1 8 GPIO_ACTIVE_LOW>;
+			spi-max-frequency = <100000>;
+		};
+	};
 };
 
 &adc0 {
@@ -430,6 +453,14 @@
 		>;
 	};
 
+	pinctrl_gpio_spi: pinctrl-gpio-spi {
+		fsl,pins = <
+			VF610_PAD_PTB18__GPIO_40        0x1183
+			VF610_PAD_PTD10__GPIO_89        0x1183
+			VF610_PAD_PTD12__GPIO_91        0x1183
+		>;
+	};
+
 	pinctrl_i2c2: i2c2grp {
 		fsl,pins = <
 			VF610_PAD_PTA22__I2C2_SCL               0x34df
-- 
2.11.0


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

* Re: [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4)
  2018-11-13 12:12 [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4) Lukasz Majewski
@ 2018-11-26 14:36 ` Shawn Guo
  2018-12-03  9:33   ` Lukasz Majewski
  2018-12-09 21:50 ` [PATCH v2] ARM: dts: vf610-bk4: Provide support for reading ID code from MVB device Lukasz Majewski
  1 sibling, 1 reply; 7+ messages in thread
From: Shawn Guo @ 2018-11-26 14:36 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Rob Herring, Mark Rutland, Sascha Hauer, devicetree,
	linux-kernel, linux-arm-kernel, Pengutronix Kernel Team,
	Stefan Agner, Fabio Estevam, Fabio Estevam

On Tue, Nov 13, 2018 at 01:12:13PM +0100, Lukasz Majewski wrote:
> The procedure to read this ID value is as follows:
> 
> rmmod spi_fsl_dspi
> insmod spi-gpio.ko
> 
> echo 504 > /sys/class/gpio/export
> cat /sys/class/gpio/gpio504/value
> ...
> echo 511 > /sys/class/gpio/export
> cat /sys/class/gpio/gpio511/value
> 
> rmmod spi-gpio.ko
> insmod spi_fsl_dspi
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

A prefix like 'ARM: dts: vf610-bk4: ...' might be better.

> ---
>  arch/arm/boot/dts/vf610-bk4.dts | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/vf610-bk4.dts b/arch/arm/boot/dts/vf610-bk4.dts
> index cab95714c058..f01c735807ae 100644
> --- a/arch/arm/boot/dts/vf610-bk4.dts
> +++ b/arch/arm/boot/dts/vf610-bk4.dts
> @@ -59,6 +59,29 @@
>  		regulator-min-microvolt = <3300000>;
>  		regulator-max-microvolt = <3300000>;
>  	};
> +
> +	spi_gpio {

We recommend hyphen rather than underscore be used in node name.

> +		compatible = "spi-gpio";
> +		pinctrl-0 = <&pinctrl_gpio_spi>;
> +		pinctrl-names = "default";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		/* PTD12 ->RPIO[91] */
> +		sck-gpios  = <&gpio2 27 GPIO_ACTIVE_LOW>;
> +		/* PTD10 ->RPIO[89] */
> +		miso-gpios = <&gpio2 25 GPIO_ACTIVE_HIGH>;
> +		num-chipselects = <0>;
> +
> +		72xx165@0 {

Please use a generic name for the node.

Shawn

> +			compatible = "pisosr-gpio";
> +			reg = <0>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +			/* PTB18 -> RGPIO[40] */
> +			load-gpios  = <&gpio1 8 GPIO_ACTIVE_LOW>;
> +			spi-max-frequency = <100000>;
> +		};
> +	};
>  };
>  
>  &adc0 {
> @@ -430,6 +453,14 @@
>  		>;
>  	};
>  
> +	pinctrl_gpio_spi: pinctrl-gpio-spi {
> +		fsl,pins = <
> +			VF610_PAD_PTB18__GPIO_40        0x1183
> +			VF610_PAD_PTD10__GPIO_89        0x1183
> +			VF610_PAD_PTD12__GPIO_91        0x1183
> +		>;
> +	};
> +
>  	pinctrl_i2c2: i2c2grp {
>  		fsl,pins = <
>  			VF610_PAD_PTA22__I2C2_SCL               0x34df
> -- 
> 2.11.0
> 

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

* Re: [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4)
  2018-11-26 14:36 ` Shawn Guo
@ 2018-12-03  9:33   ` Lukasz Majewski
  2018-12-03 11:13     ` Fabio Estevam
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2018-12-03  9:33 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Rob Herring, Mark Rutland, Sascha Hauer, devicetree,
	linux-kernel, linux-arm-kernel, Pengutronix Kernel Team,
	Stefan Agner, Fabio Estevam, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 3183 bytes --]

Hi Shawn,

Thank you for the review.

> On Tue, Nov 13, 2018 at 01:12:13PM +0100, Lukasz Majewski wrote:
> > The procedure to read this ID value is as follows:
> > 
> > rmmod spi_fsl_dspi
> > insmod spi-gpio.ko
> > 
> > echo 504 > /sys/class/gpio/export
> > cat /sys/class/gpio/gpio504/value
> > ...
> > echo 511 > /sys/class/gpio/export
> > cat /sys/class/gpio/gpio511/value
> > 
> > rmmod spi-gpio.ko
> > insmod spi_fsl_dspi
> > 
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> 
> A prefix like 'ARM: dts: vf610-bk4: ...' might be better.

Ok.

> 
> > ---
> >  arch/arm/boot/dts/vf610-bk4.dts | 31
> > +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/vf610-bk4.dts
> > b/arch/arm/boot/dts/vf610-bk4.dts index cab95714c058..f01c735807ae
> > 100644 --- a/arch/arm/boot/dts/vf610-bk4.dts
> > +++ b/arch/arm/boot/dts/vf610-bk4.dts
> > @@ -59,6 +59,29 @@
> >  		regulator-min-microvolt = <3300000>;
> >  		regulator-max-microvolt = <3300000>;
> >  	};
> > +
> > +	spi_gpio {
> 
> We recommend hyphen rather than underscore be used in node name.

Ok. I will change it to spi-gpio

> 
> > +		compatible = "spi-gpio";
> > +		pinctrl-0 = <&pinctrl_gpio_spi>;
> > +		pinctrl-names = "default";
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +		/* PTD12 ->RPIO[91] */
> > +		sck-gpios  = <&gpio2 27 GPIO_ACTIVE_LOW>;
> > +		/* PTD10 ->RPIO[89] */
> > +		miso-gpios = <&gpio2 25 GPIO_ACTIVE_HIGH>;
> > +		num-chipselects = <0>;
> > +
> > +		72xx165@0 {
> 
> Please use a generic name for the node.

This is a bit tricky.

Other DTS definitions for this compatible:

sn65hvs882: sn65hvs882@0 {
	compatible = "pisosr-gpio";
	...
	}

They use the exact used IC name - sn65hvs882, which IMHO is the way how
this node shall be described.

The reason is that the compatible is "pisosr-gpio" -> parallel input
serial output shift regsiter - gpio.

By adding the exact name of connected electronic IC - sn65hvs882 and in
my case IC from the 72xx165 family provides good description of the HW.

Maybe you have other idea how to provide the name of the IC connected?

> 
> Shawn
> 
> > +			compatible = "pisosr-gpio";
> > +			reg = <0>;
> > +			gpio-controller;
> > +			#gpio-cells = <2>;
> > +			/* PTB18 -> RGPIO[40] */
> > +			load-gpios  = <&gpio1 8 GPIO_ACTIVE_LOW>;
> > +			spi-max-frequency = <100000>;
> > +		};
> > +	};
> >  };
> >  
> >  &adc0 {
> > @@ -430,6 +453,14 @@
> >  		>;
> >  	};
> >  
> > +	pinctrl_gpio_spi: pinctrl-gpio-spi {
> > +		fsl,pins = <
> > +			VF610_PAD_PTB18__GPIO_40        0x1183
> > +			VF610_PAD_PTD10__GPIO_89        0x1183
> > +			VF610_PAD_PTD12__GPIO_91        0x1183
> > +		>;
> > +	};
> > +
> >  	pinctrl_i2c2: i2c2grp {
> >  		fsl,pins = <
> >  			VF610_PAD_PTA22__I2C2_SCL
> > 0x34df -- 
> > 2.11.0
> > 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4)
  2018-12-03  9:33   ` Lukasz Majewski
@ 2018-12-03 11:13     ` Fabio Estevam
  2018-12-05 16:40       ` Lukasz Majewski
  0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2018-12-03 11:13 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Shawn Guo, Rob Herring, Mark Rutland, Sascha Hauer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Sascha Hauer, Stefan Agner, Fabio Estevam

Hi Lukasz,

On Mon, Dec 3, 2018 at 7:33 AM Lukasz Majewski <lukma@denx.de> wrote:

> > > +           72xx165@0 {
> >
> > Please use a generic name for the node.
>
> This is a bit tricky.

What about using 'gpio@0' like described in
Documentation/devicetree/bindings/gpio/gpio-pisosr.txt ?

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

* Re: [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4)
  2018-12-03 11:13     ` Fabio Estevam
@ 2018-12-05 16:40       ` Lukasz Majewski
  0 siblings, 0 replies; 7+ messages in thread
From: Lukasz Majewski @ 2018-12-05 16:40 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Shawn Guo, Rob Herring, Mark Rutland, Sascha Hauer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Sascha Hauer, Stefan Agner, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

Hi Fabio,

> Hi Lukasz,
> 
> On Mon, Dec 3, 2018 at 7:33 AM Lukasz Majewski <lukma@denx.de> wrote:
> 
> > > > +           72xx165@0 {  
> > >
> > > Please use a generic name for the node.  
> >
> > This is a bit tricky.  
> 
> What about using 'gpio@0' like described in
> Documentation/devicetree/bindings/gpio/gpio-pisosr.txt ?

Seems like a good idea. Thanks.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH v2] ARM: dts: vf610-bk4: Provide support for reading ID code from MVB device
  2018-11-13 12:12 [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4) Lukasz Majewski
  2018-11-26 14:36 ` Shawn Guo
@ 2018-12-09 21:50 ` Lukasz Majewski
  2019-01-10 13:22   ` Shawn Guo
  1 sibling, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2018-12-09 21:50 UTC (permalink / raw)
  To: Shawn Guo, Rob Herring, Mark Rutland
  Cc: Sascha Hauer, devicetree, linux-kernel, linux-arm-kernel,
	Pengutronix Kernel Team, Stefan Agner, Fabio Estevam,
	Fabio Estevam, Lukasz Majewski

The procedure to read this ID value is as follows:

rmmod spi_fsl_dspi
insmod spi-gpio.ko

echo 504 > /sys/class/gpio/export
cat /sys/class/gpio/gpio504/value
...
echo 511 > /sys/class/gpio/export
cat /sys/class/gpio/gpio511/value

rmmod spi-gpio.ko
insmod spi_fsl_dspi

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---
Changes for v2:
- Add 'vf610-bk4:' to mail topic
- Change spi_gpio -> spi-gpio node name
- Change '72xx165' -> 'gpio' as described in
Documentation/devicetree/bindings/gpio/gpio-pisosr.txt
---
 arch/arm/boot/dts/vf610-bk4.dts | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/vf610-bk4.dts b/arch/arm/boot/dts/vf610-bk4.dts
index cab95714c058..c59a8922ccd5 100644
--- a/arch/arm/boot/dts/vf610-bk4.dts
+++ b/arch/arm/boot/dts/vf610-bk4.dts
@@ -59,6 +59,29 @@
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 	};
+
+	spi-gpio {
+		compatible = "spi-gpio";
+		pinctrl-0 = <&pinctrl_gpio_spi>;
+		pinctrl-names = "default";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		/* PTD12 ->RPIO[91] */
+		sck-gpios  = <&gpio2 27 GPIO_ACTIVE_LOW>;
+		/* PTD10 ->RPIO[89] */
+		miso-gpios = <&gpio2 25 GPIO_ACTIVE_HIGH>;
+		num-chipselects = <0>;
+
+		gpio@0 {
+			compatible = "pisosr-gpio";
+			reg = <0>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			/* PTB18 -> RGPIO[40] */
+			load-gpios  = <&gpio1 8 GPIO_ACTIVE_LOW>;
+			spi-max-frequency = <100000>;
+		};
+	};
 };
 
 &adc0 {
@@ -430,6 +453,14 @@
 		>;
 	};
 
+	pinctrl_gpio_spi: pinctrl-gpio-spi {
+		fsl,pins = <
+			VF610_PAD_PTB18__GPIO_40        0x1183
+			VF610_PAD_PTD10__GPIO_89        0x1183
+			VF610_PAD_PTD12__GPIO_91        0x1183
+		>;
+	};
+
 	pinctrl_i2c2: i2c2grp {
 		fsl,pins = <
 			VF610_PAD_PTA22__I2C2_SCL               0x34df
-- 
2.11.0


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

* Re: [PATCH v2] ARM: dts: vf610-bk4: Provide support for reading ID code from MVB device
  2018-12-09 21:50 ` [PATCH v2] ARM: dts: vf610-bk4: Provide support for reading ID code from MVB device Lukasz Majewski
@ 2019-01-10 13:22   ` Shawn Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2019-01-10 13:22 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Rob Herring, Mark Rutland, Sascha Hauer, devicetree,
	linux-kernel, linux-arm-kernel, Pengutronix Kernel Team,
	Stefan Agner, Fabio Estevam, Fabio Estevam

On Sun, Dec 09, 2018 at 10:50:56PM +0100, Lukasz Majewski wrote:
> The procedure to read this ID value is as follows:
> 
> rmmod spi_fsl_dspi
> insmod spi-gpio.ko
> 
> echo 504 > /sys/class/gpio/export
> cat /sys/class/gpio/gpio504/value
> ...
> echo 511 > /sys/class/gpio/export
> cat /sys/class/gpio/gpio511/value
> 
> rmmod spi-gpio.ko
> insmod spi_fsl_dspi
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

Applied, thanks.

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

end of thread, other threads:[~2019-01-10 13:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-13 12:12 [PATCH] ARM: dts: Provide support for reading ID code from MVB device (BK4) Lukasz Majewski
2018-11-26 14:36 ` Shawn Guo
2018-12-03  9:33   ` Lukasz Majewski
2018-12-03 11:13     ` Fabio Estevam
2018-12-05 16:40       ` Lukasz Majewski
2018-12-09 21:50 ` [PATCH v2] ARM: dts: vf610-bk4: Provide support for reading ID code from MVB device Lukasz Majewski
2019-01-10 13:22   ` Shawn Guo

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