linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: dts: Add spidev nodes for Exynos Chromebooks
@ 2014-11-17 17:43 Javier Martinez Canillas
  2014-11-17 17:43 ` [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards Javier Martinez Canillas
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-17 17:43 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Doug Anderson, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Javier Martinez Canillas

Exynos Snow and Peach Pit/Pi Chromebooks have a serial dataflash that
is accessed through SPI. This series add spidev nodes in the Device
Tree source files so the flash can be accessed from user-space.

The series is composed of the following patches taken from the ChromeOS tree:

Doug Anderson (1):
  ARM: dts: Add spidev registration to exynos5250-snow

Javier Martinez Canillas (1):
  ARM: exynos_defconfig: Enable user mode SPI device support

Simon Glass (1):
  ARM: dts: Add SPI flash node for Peach boards

 arch/arm/boot/dts/exynos5250-snow.dts      | 20 ++++++++++++++++++++
 arch/arm/boot/dts/exynos5420-peach-pit.dts | 26 ++++++++++++++++++++++++++
 arch/arm/boot/dts/exynos5800-peach-pi.dts  | 26 ++++++++++++++++++++++++++
 arch/arm/configs/exynos_defconfig          |  1 +
 4 files changed, 73 insertions(+)

Patch #1 adds the spidev node for the Snow Chromebook, patch #2
adds the spidev node for Peach Chromebooks and peach #3 enables
support for the user mode SPI device driver.

The series were tested on Snow and Peach using:

$ flashrom -p linux_spi:dev=/dev/spidev1.0 --get-size
$ flashrom -p linux_spi:dev=/dev/spidev1.0 --flash-name

and verify that the flash can be accessed

$ set_gbb_flags 0x39

and verify that the GBB flags could be written.

Best regards,
Javier

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

* [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-17 17:43 [PATCH 0/3] ARM: dts: Add spidev nodes for Exynos Chromebooks Javier Martinez Canillas
@ 2014-11-17 17:43 ` Javier Martinez Canillas
  2014-11-18 17:50   ` Doug Anderson
  2014-11-17 17:43 ` [PATCH 2/3] ARM: dts: Add spidev registration to exynos5250-snow Javier Martinez Canillas
  2014-11-17 17:43 ` [PATCH 3/3] ARM: exynos_defconfig: Enable user mode SPI device support Javier Martinez Canillas
  2 siblings, 1 reply; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-17 17:43 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Doug Anderson, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Javier Martinez Canillas

From: Simon Glass <sjg@chromium.org>

Peach Pit and Pi machines have a SPI flash memory that is used to store
firmware data and different system parameters.

Add a spidev node so the flash chip can be accessed by user-space tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
[javier.martinez: Extend commit message]
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 arch/arm/boot/dts/exynos5420-peach-pit.dts | 26 ++++++++++++++++++++++++++
 arch/arm/boot/dts/exynos5800-peach-pi.dts  | 26 ++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index 9a050e1..e7c2a9f 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -703,6 +703,13 @@
 		samsung,pin-drv = <2>;
 	};
 
+	spi_flash_cs: spi-flash-cs {
+		samsung,pins = "gpa2-5";
+		samsung,pin-function = <1>;
+		samsung,pin-pud = <0>;
+		samsung,pin-drv = <3>;
+	};
+
 	usb300_vbus_en: usb300-vbus-en {
 		samsung,pins = "gph0-0";
 		samsung,pin-function = <1>;
@@ -732,6 +739,25 @@
 	clock-names = "rtc", "rtc_src";
 };
 
+&spi_1 {
+	status = "okay";
+	samsung,spi-src-clk = <0>;
+	num-cs = <1>;
+	cs-gpios = <&gpa2 5 0>;
+
+	spidev@0 {
+		compatible = "spidev";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&spi_flash_cs>;
+
+		controller-data {
+			samsung,spi-feedback-delay = <2>;
+		};
+	};
+};
+
 &spi_2 {
 	status = "okay";
 	num-cs = <1>;
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index e8fdda8..7a0a2a6 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -691,6 +691,13 @@
 		samsung,pin-drv = <2>;
 	};
 
+	spi_flash_cs: spi-flash-cs {
+		samsung,pins = "gpa2-5";
+		samsung,pin-function = <1>;
+		samsung,pin-pud = <0>;
+		samsung,pin-drv = <3>;
+	};
+
 	usb300_vbus_en: usb300-vbus-en {
 		samsung,pins = "gph0-0";
 		samsung,pin-function = <1>;
@@ -720,6 +727,25 @@
 	clock-names = "rtc", "rtc_src";
 };
 
+&spi_1 {
+	status = "okay";
+	samsung,spi-src-clk = <0>;
+	num-cs = <1>;
+	cs-gpios = <&gpa2 5 0>;
+
+	spidev@0 {
+		compatible = "spidev";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&spi_flash_cs>;
+
+		controller-data {
+			samsung,spi-feedback-delay = <2>;
+		};
+	};
+};
+
 &spi_2 {
 	status = "okay";
 	num-cs = <1>;
-- 
2.1.0


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

* [PATCH 2/3] ARM: dts: Add spidev registration to exynos5250-snow
  2014-11-17 17:43 [PATCH 0/3] ARM: dts: Add spidev nodes for Exynos Chromebooks Javier Martinez Canillas
  2014-11-17 17:43 ` [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards Javier Martinez Canillas
@ 2014-11-17 17:43 ` Javier Martinez Canillas
  2014-11-17 17:43 ` [PATCH 3/3] ARM: exynos_defconfig: Enable user mode SPI device support Javier Martinez Canillas
  2 siblings, 0 replies; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-17 17:43 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Doug Anderson, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Javier Martinez Canillas

From: Doug Anderson <dianders@chromium.org>

Exynos5250 Snow machine has a SPI flash memory that is used to store
firmware data and different system parameters.

Add a spidev node so the flash chip can be accessed by user-space tools.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
[javier.martinez: Extend commit message]
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 arch/arm/boot/dts/exynos5250-snow.dts | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index f9bc04b..bb0e04e 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -554,6 +554,13 @@
 		samsung,pin-drv = <0>;
 	};
 
+	spi_cs: spi-cs {
+		samsung,pins = "gpa2-5";
+		samsung,pin-function = <1>;
+		samsung,pin-pud = <0>;
+		samsung,pin-drv = <3>;
+	};
+
 	tps65090_irq: tps65090-irq {
 		samsung,pins = "gpx2-6";
 		samsung,pin-function = <0>;
@@ -622,6 +629,19 @@
 	status = "okay";
 	samsung,spi-src-clk = <0>;
 	num-cs = <1>;
+	cs-gpios = <&gpa2 5 0>;
+
+	spidev@0 {
+		compatible = "spidev";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&spi_cs>;
+
+		controller-data {
+			samsung,spi-feedback-delay = <2>;
+		};
+	};
 };
 
 &usbdrd_phy {
-- 
2.1.0


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

* [PATCH 3/3] ARM: exynos_defconfig: Enable user mode SPI device support
  2014-11-17 17:43 [PATCH 0/3] ARM: dts: Add spidev nodes for Exynos Chromebooks Javier Martinez Canillas
  2014-11-17 17:43 ` [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards Javier Martinez Canillas
  2014-11-17 17:43 ` [PATCH 2/3] ARM: dts: Add spidev registration to exynos5250-snow Javier Martinez Canillas
@ 2014-11-17 17:43 ` Javier Martinez Canillas
  2 siblings, 0 replies; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-17 17:43 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Doug Anderson, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Javier Martinez Canillas

Some Exynos boards have SPI devices such as flash memories that can be
accessed from user-space. Enable support for the SPI usermode interface.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 arch/arm/configs/exynos_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index da7e9cf..5de8b58 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -80,6 +80,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SPI=y
 CONFIG_SPI_S3C64XX=y
 CONFIG_I2C_S3C2410=y
+CONFIG_SPI_SPIDEV=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_BATTERY_SBS=y
-- 
2.1.0


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

* Re: [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-17 17:43 ` [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards Javier Martinez Canillas
@ 2014-11-18 17:50   ` Doug Anderson
  2014-11-19 10:07     ` Javier Martinez Canillas
  0 siblings, 1 reply; 10+ messages in thread
From: Doug Anderson @ 2014-11-18 17:50 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Kukjin Kim, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Tomasz Figa, Mark Brown

Javier,

On Mon, Nov 17, 2014 at 9:43 AM, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> +&spi_1 {
> +       status = "okay";
> +       samsung,spi-src-clk = <0>;
> +       num-cs = <1>;
> +       cs-gpios = <&gpa2 5 0>;
> +
> +       spidev@0 {
> +               compatible = "spidev";

This is common practice in the Chrome OS tree, but we've gotten
pushback from upstream questioning about whether "spidev" is really a
physical device.  See:

http://www.spinics.net/lists/linux-samsung-soc/msg29563.html


I don't really have an answer for something better to do here but I
figured I'd at least bring up the point.

-Doug

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

* Re: [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-18 17:50   ` Doug Anderson
@ 2014-11-19 10:07     ` Javier Martinez Canillas
  2014-11-19 17:19       ` Doug Anderson
  0 siblings, 1 reply; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-19 10:07 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Kukjin Kim, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Tomasz Figa, Mark Brown

Hello Doug,

Thanks for your feedback.

On 11/18/2014 06:50 PM, Doug Anderson wrote:
> This is common practice in the Chrome OS tree, but we've gotten
> pushback from upstream questioning about whether "spidev" is really a
> physical device.  See:
> 
> http://www.spinics.net/lists/linux-samsung-soc/msg29563.html
> 

I see, I thought that it was a common practice in the mainline kernel
too since I saw that many board DTS currently have a spidev node:

$ git grep 'compatible = "spidev"' arch/arm/boot/dts/ | wc -l
19

> 
> I don't really have an answer for something better to do here but I
> figured I'd at least bring up the point.
> 

I wonder how the spidev user-space interface is supposed to be used
when booting with Device Trees.

Best regards,
Javier

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

* Re: [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-19 10:07     ` Javier Martinez Canillas
@ 2014-11-19 17:19       ` Doug Anderson
  2014-11-19 17:29         ` Javier Martinez Canillas
  2014-11-19 17:47         ` Mark Brown
  0 siblings, 2 replies; 10+ messages in thread
From: Doug Anderson @ 2014-11-19 17:19 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Kukjin Kim, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Tomasz Figa, Mark Brown

Javier,

On Wed, Nov 19, 2014 at 2:07 AM, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> Hello Doug,
>
> Thanks for your feedback.
>
> On 11/18/2014 06:50 PM, Doug Anderson wrote:
>> This is common practice in the Chrome OS tree, but we've gotten
>> pushback from upstream questioning about whether "spidev" is really a
>> physical device.  See:
>>
>> http://www.spinics.net/lists/linux-samsung-soc/msg29563.html
>>
>
> I see, I thought that it was a common practice in the mainline kernel
> too since I saw that many board DTS currently have a spidev node:
>
> $ git grep 'compatible = "spidev"' arch/arm/boot/dts/ | wc -l
> 19
>
>>
>> I don't really have an answer for something better to do here but I
>> figured I'd at least bring up the point.
>>
>
> I wonder how the spidev user-space interface is supposed to be used
> when booting with Device Trees.

OK.  Please don't take my comments as a NAK on this patch.  I should
have done the same grep myself before sending--sorry.  I just
remembered the old conversation and looked for that instead.

If the convention is to use "spidev" like this then I guess we're OK.
I do wish it was a little more like "i2c" myself where you could get a
direct access interface no matter what driver was bound underneath
(and also if no drivers were bound underneath).  ...but I could just
be naive.  ;)

-Doug

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

* Re: [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-19 17:19       ` Doug Anderson
@ 2014-11-19 17:29         ` Javier Martinez Canillas
  2014-11-19 17:47         ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-19 17:29 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Kukjin Kim, Simon Glass, Olof Johansson, linux-samsung-soc,
	linux-arm-kernel, linux-kernel, Tomasz Figa, Mark Brown

Hello Doug,

On 11/19/2014 06:19 PM, Doug Anderson wrote:
>>
>> I wonder how the spidev user-space interface is supposed to be used
>> when booting with Device Trees.
> 
> OK.  Please don't take my comments as a NAK on this patch.  I should
> have done the same grep myself before sending--sorry.  I just
> remembered the old conversation and looked for that instead.
>

Ok, let's see what others say. At the very least documentation about the
spidev DT binding should be added to Documentation/devicetree/bindings/
 
> If the convention is to use "spidev" like this then I guess we're OK.
> I do wish it was a little more like "i2c" myself where you could get a
> direct access interface no matter what driver was bound underneath
> (and also if no drivers were bound underneath).  ...but I could just
> be naive.  ;)
> 

+1

> -Doug
> 

Best regards,
Javier

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

* Re: [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-19 17:19       ` Doug Anderson
  2014-11-19 17:29         ` Javier Martinez Canillas
@ 2014-11-19 17:47         ` Mark Brown
  2014-11-19 17:59           ` Javier Martinez Canillas
  1 sibling, 1 reply; 10+ messages in thread
From: Mark Brown @ 2014-11-19 17:47 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Javier Martinez Canillas, linux-samsung-soc, Simon Glass,
	linux-kernel, Tomasz Figa, Kukjin Kim, Olof Johansson,
	linux-arm-kernel

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

On Wed, Nov 19, 2014 at 09:19:13AM -0800, Doug Anderson wrote:

Please stop CCing my work address for upstream things.

> On Wed, Nov 19, 2014 at 2:07 AM, Javier Martinez Canillas

> > I see, I thought that it was a common practice in the mainline kernel
> > too since I saw that many board DTS currently have a spidev node:

> > $ git grep 'compatible = "spidev"' arch/arm/boot/dts/ | wc -l
> > 19

These are bugs.  The device tree should describe the hardware, spidev is
a Linux implementation detail.  Provide a compatible string for the
device that is there just as you would for any other device.

> OK.  Please don't take my comments as a NAK on this patch.  I should
> have done the same grep myself before sending--sorry.  I just
> remembered the old conversation and looked for that instead.

Please take this as one.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards
  2014-11-19 17:47         ` Mark Brown
@ 2014-11-19 17:59           ` Javier Martinez Canillas
  0 siblings, 0 replies; 10+ messages in thread
From: Javier Martinez Canillas @ 2014-11-19 17:59 UTC (permalink / raw)
  To: Mark Brown, Doug Anderson
  Cc: linux-samsung-soc, Simon Glass, linux-kernel, Tomasz Figa,
	Kukjin Kim, Olof Johansson, linux-arm-kernel

Hello Mark,

On 11/19/2014 06:47 PM, Mark Brown wrote:
> These are bugs.  The device tree should describe the hardware, spidev is
> a Linux implementation detail.  Provide a compatible string for the
> device that is there just as you would for any other device.
>

Thanks a lot for your explanation.
 
>> OK.  Please don't take my comments as a NAK on this patch.  I should
>> have done the same grep myself before sending--sorry.  I just
>> remembered the old conversation and looked for that instead.
> 
> Please take this as one.
> 

Ok

Best regards,
Javier

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

end of thread, other threads:[~2014-11-19 17:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 17:43 [PATCH 0/3] ARM: dts: Add spidev nodes for Exynos Chromebooks Javier Martinez Canillas
2014-11-17 17:43 ` [PATCH 1/3] ARM: dts: Add SPI flash node for Peach boards Javier Martinez Canillas
2014-11-18 17:50   ` Doug Anderson
2014-11-19 10:07     ` Javier Martinez Canillas
2014-11-19 17:19       ` Doug Anderson
2014-11-19 17:29         ` Javier Martinez Canillas
2014-11-19 17:47         ` Mark Brown
2014-11-19 17:59           ` Javier Martinez Canillas
2014-11-17 17:43 ` [PATCH 2/3] ARM: dts: Add spidev registration to exynos5250-snow Javier Martinez Canillas
2014-11-17 17:43 ` [PATCH 3/3] ARM: exynos_defconfig: Enable user mode SPI device support Javier Martinez Canillas

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