diff mbox

[U-Boot,03/25] sandbox: dts: Add a SPI device and cros_ec device

Message ID 1405385792-4469-4-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Simon Glass July 15, 2014, 12:56 a.m. UTC
Add a SPI device which can be used for testing SPI flash features in
sandbox.

Also add a cros_ec device since with driver model the Chrome OS EC
emulation will not otherwise be available.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/dts/sandbox.dts                | 25 +++++++++++++++++++++++++
 doc/device-tree-bindings/mtd/spi/m25p80.txt | 29 +++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 doc/device-tree-bindings/mtd/spi/m25p80.txt

Comments

Jagan Teki Aug. 25, 2014, 9:32 a.m. UTC | #1
Hi Simon,

On 15 July 2014 06:26, Simon Glass <sjg@chromium.org> wrote:
> Add a SPI device which can be used for testing SPI flash features in
> sandbox.
>
> Also add a cros_ec device since with driver model the Chrome OS EC
> emulation will not otherwise be available.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/sandbox/dts/sandbox.dts                | 25 +++++++++++++++++++++++++
>  doc/device-tree-bindings/mtd/spi/m25p80.txt | 29 +++++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+)
>  create mode 100644 doc/device-tree-bindings/mtd/spi/m25p80.txt
>
> diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
> index daf5e73..fad1fae 100644
> --- a/arch/sandbox/dts/sandbox.dts
> +++ b/arch/sandbox/dts/sandbox.dts
> @@ -1,6 +1,9 @@
>  /dts-v1/;
>
>  / {
> +       #address-cells = <1>;
> +       #size-cells = <0>;
> +
>         aliases {
>                 console = "/serial";
>         };
> @@ -131,5 +134,27 @@
>                 num-gpios = <20>;
>         };
>
> +       spi@0 {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               reg = <0>;
> +               compatible = "sandbox,spi";
> +               cs-gpios = <0>, <&gpio_a 0>;
> +               flash@0 {
> +                       reg = <0>;
> +                       compatible = "spansion,m25p16", "sandbox,spi-flash";
> +                       spi-max-frequency = <40000000>;
> +                       sandbox,filename = "spi.bin";
> +               };
> +       };
> +
> +       cros-ec@0 {
> +               compatible = "google,cros-ec";
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               firmware_storage_spi: flash@0 {
> +                       reg = <0 0x400000>;
> +               };
> +       };
>
>  };
> diff --git a/doc/device-tree-bindings/mtd/spi/m25p80.txt b/doc/device-tree-bindings/mtd/spi/m25p80.txt
> new file mode 100644
> index 0000000..6d3d576
> --- /dev/null
> +++ b/doc/device-tree-bindings/mtd/spi/m25p80.txt
> @@ -0,0 +1,29 @@
> +* MTD SPI driver for ST M25Pxx (and similar) serial flash chips
> +
> +Required properties:
> +- #address-cells, #size-cells : Must be present if the device has sub-nodes
> +  representing partitions.
> +- compatible : Should be the manufacturer and the name of the chip. Bear in mind
> +               the DT binding is not Linux-only, but in case of Linux, see the
> +               "m25p_ids" table in drivers/mtd/devices/m25p80.c for the list of
> +               supported chips.
> +- reg : Chip-Select number
> +- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at
> +
> +Optional properties:
> +- m25p,fast-read : Use the "fast read" opcode to read data from the chip instead
> +                   of the usual "read" opcode. This opcode is not supported by
> +                   all chips and support for it can not be detected at runtime.
> +                   Refer to your chips' datasheet to check if this is supported
> +                   by your chip.
> +
> +Example:
> +
> +       flash: m25p80@0 {
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               compatible = "spansion,m25p80";
> +               reg = <0>;
> +               spi-max-frequency = <40000000>;
> +               m25p,fast-read;
> +       };
> --
> 2.0.0.526.g5318336
>

Please add doc-binding stuff more specific to your usage and w/o
having any Linux stuff/terminologies as of now.

thanks!
diff mbox

Patch

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index daf5e73..fad1fae 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -1,6 +1,9 @@ 
 /dts-v1/;
 
 / {
+	#address-cells = <1>;
+	#size-cells = <0>;
+
 	aliases {
 		console = "/serial";
 	};
@@ -131,5 +134,27 @@ 
 		num-gpios = <20>;
 	};
 
+	spi@0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+		compatible = "sandbox,spi";
+		cs-gpios = <0>, <&gpio_a 0>;
+		flash@0 {
+			reg = <0>;
+			compatible = "spansion,m25p16", "sandbox,spi-flash";
+			spi-max-frequency = <40000000>;
+			sandbox,filename = "spi.bin";
+		};
+	};
+
+	cros-ec@0 {
+		compatible = "google,cros-ec";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		firmware_storage_spi: flash@0 {
+			reg = <0 0x400000>;
+		};
+	};
 
 };
diff --git a/doc/device-tree-bindings/mtd/spi/m25p80.txt b/doc/device-tree-bindings/mtd/spi/m25p80.txt
new file mode 100644
index 0000000..6d3d576
--- /dev/null
+++ b/doc/device-tree-bindings/mtd/spi/m25p80.txt
@@ -0,0 +1,29 @@ 
+* MTD SPI driver for ST M25Pxx (and similar) serial flash chips
+
+Required properties:
+- #address-cells, #size-cells : Must be present if the device has sub-nodes
+  representing partitions.
+- compatible : Should be the manufacturer and the name of the chip. Bear in mind
+               the DT binding is not Linux-only, but in case of Linux, see the
+               "m25p_ids" table in drivers/mtd/devices/m25p80.c for the list of
+               supported chips.
+- reg : Chip-Select number
+- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at
+
+Optional properties:
+- m25p,fast-read : Use the "fast read" opcode to read data from the chip instead
+                   of the usual "read" opcode. This opcode is not supported by
+                   all chips and support for it can not be detected at runtime.
+                   Refer to your chips' datasheet to check if this is supported
+                   by your chip.
+
+Example:
+
+	flash: m25p80@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spansion,m25p80";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		m25p,fast-read;
+	};