Skip to contentSkip to conversation

Enable SPI flash support on da850-evm DT kernel

PATCH Superseded Manjunathappa, Prakash 2 participants 10 messages Mar 12, 2013 – Mar 14, 2013

Subsystems (5)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Enable SPI flash support on da850-evm DT kernel

Patch enables support for m25p64 SPI flash support on da850-EVM.

Testing information:
da850-evm comes with partitions specified in DT blob.
Able to mount/umount and create/delete files on filesystem partition.

Depends on below patch in spi-next branch of git://git.secretlab.ca/git/linux-2.6.git.
"spi/davinci: add OF support for the spi controller"

Applies on top of v3.9/dt-2 branch of linux_davinci tree:
git://gitorious.org/linux-davinci/linux-davinci.git

Since v2:
Fix compatible property DT naming convention.

Since v1:
Look for m25p64 instead of m25p80 flash chip and correct partition information. Dropped below accepted patch:
"spi/davinci: fix module build error"
Considered below missed out patch:
spi/davinci: add DT binding documentation

Manjunathappa, Prakash (4):
spi/davinci: no wildcards in DT compatible property
ARM: davinci: da850: add SPI1 DT node
ARM: davinci: da850: override SPI DT node device name
ARM: davinci: da850-evm: add SPI flash support

Murali Karicheri (1):
spi/davinci: add DT binding documentation

 .../devicetree/bindings/spi/spi-davinci.txt        |   51 ++++++++++++++++++++
 arch/arm/boot/dts/da850-evm.dts                    |   40 +++++++++++++++
 arch/arm/boot/dts/da850.dtsi                       |   18 +++++++
 arch/arm/mach-davinci/da8xx-dt.c                   |    1 +
 drivers/spi/spi-davinci.c                          |    4 +-
 5 files changed, 112 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v3 1/5 spi/davinci: no wildcards in DT compatible property

Follow DT naming convention for compatible property of the blob. Use first chip name that introduced the specific version of the device.

---
New patch in this series.

 drivers/spi/spi-davinci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-davinci.c +2 -2
index b30064b..07517c0 100644
@@ -763,10 +763,10 @@ rx_dma_failed:
 #if defined(CONFIG_OF)
 static const struct of_device_id davinci_spi_of_match[] = {
 	{
-		.compatible = "ti,dm644x-spi",
+		.compatible = "ti,dm6441-spi",
 	},
 	{
-		.compatible = "ti,da8xx-spi",
+		.compatible = "ti,da830-spi",
 		.data = (void *)SPI_VERSION_2,
 	},
 	{ },
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH v3 2/5 spi/davinci: add DT binding documentation

In reply to Manjunathappa, Prakash

From: Murali Karicheri <[email protected]>

Get back missed out binding documentation submitted along with below patch:
"spi/davinci: add OF support for the spi controller"

[prakash.pm at ti.com: Follow DT naming convention for compatible property]
---
 .../devicetree/bindings/spi/spi-davinci.txt        |   51 ++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +51 -0
new file mode 100644
index 0000000..75ad9ac
@@ -0,0 +1,51 @@
+Davinci SPI controller device bindings
+
+Required properties:
+- #address-cells: number of cells required to define a chip select
+	address on the SPI bus. Should be set to 1.
+- #size-cells: should be zero.
+- compatible:
+	- "ti,dm6441-spi" for SPI used similar to that on DM644x SoC family
+	- "ti,da830-spi" for SPI used similar to that on DA8xx SoC family
+- reg: Offset and length of SPI controller register space
+- num-cs: Number of chip selects
+- ti,davinci-spi-intr-line: interrupt line used to connect the SPI
+	IP to the interrupt controller withn the SoC. Possible values
+	are 0 and 1. Manual says one of the two possible interrupt
+	lines can be tied to the interrupt controller. Set this
+	based on a specifc SoC configuration.
+- interrupts: interrupt number mapped to CPU.
+- clocks: spi clk phandle
+
+Example of a NOR flash slave device (n25q032) connected to DaVinci
+SPI controller device over the SPI bus.
+
+spi0:spi at 20BF0000 {
+	#address-cells	 = <1>;
+	#size-cells	 = <0>;
+	compatible	 = "ti,dm6446-spi";
+	reg	 = <0x20BF0000 0x1000>;
+	num-cs	 = <4>;
+	ti,davinci-spi-intr-line	= <0>;
+	interrupts	 = <338>;
+	clocks	 = <&clkspi>;
+
+	flash: n25q032 at 0 {
+	 #address-cells = <1>;
+	 #size-cells = <1>;
+	 compatible = "st,m25p32";
+	 spi-max-frequency = <25000000>;
+	 reg = <0>;
+
+	 partition at 0 {
+	 label = "u-boot-spl";
+	 reg = <0x0 0x80000>;
+	 read-only;
+	 };
+
+	 partition at 1 {
+	 label = "test";
+	 reg = <0x80000 0x380000>;
+	 };
+	};
+};
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH v3 2/5 spi/davinci: add DT binding documentation

Quoted 5 lines · Prakash

From: Murali Karicheri <[email protected]>

Get back missed out binding documentation submitted along with below patch:
"spi/davinci: add OF support for the spi controller"

This is not really the correct description of this patch. Years later its mostly irrelevant that binding documentation did not get applied along with the actual usage.

Quoted 56 lines
[prakash.pm at ti.com: Follow DT naming convention for compatible property]
---
 .../devicetree/bindings/spi/spi-davinci.txt        |   51 ++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +40 -0
new file mode 100644
index 0000000..75ad9ac
@@ -0,0 +1,51 @@
+Davinci SPI controller device bindings
+
+Required properties:
+- #address-cells: number of cells required to define a chip select
+	address on the SPI bus. Should be set to 1.
+- #size-cells: should be zero.
+- compatible:
+	- "ti,dm6441-spi" for SPI used similar to that on DM644x SoC family
+	- "ti,da830-spi" for SPI used similar to that on DA8xx SoC family
+- reg: Offset and length of SPI controller register space
+- num-cs: Number of chip selects
+- ti,davinci-spi-intr-line: interrupt line used to connect the SPI
+	IP to the interrupt controller withn the SoC. Possible values
+	are 0 and 1. Manual says one of the two possible interrupt
+	lines can be tied to the interrupt controller. Set this
+	based on a specifc SoC configuration.
+- interrupts: interrupt number mapped to CPU.
+- clocks: spi clk phandle
+
+Example of a NOR flash slave device (n25q032) connected to DaVinci
+SPI controller device over the SPI bus.
+
+spi0:spi at 20BF0000 {
+	#address-cells	 = <1>;
+	#size-cells	 = <0>;
+	compatible	 = "ti,dm6446-spi";
+	reg	 = <0x20BF0000 0x1000>;
+	num-cs	 = <4>;
+	ti,davinci-spi-intr-line	= <0>;
+	interrupts	 = <338>;
+	clocks	 = <&clkspi>;
+
+	flash: n25q032 at 0 {
+	 #address-cells = <1>;
+	 #size-cells = <1>;
+	 compatible = "st,m25p32";
+	 spi-max-frequency = <25000000>;
+	 reg = <0>;
+
+	 partition at 0 {

Documentation/devicetree/bindings/spi/spi-davinci.txt line 50

Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +10 -0
+	 label = "u-boot-spl";
+	 reg = <0x0 0x80000>;
+	 read-only;
+	 };
+
+	 partition at 1 {
+	 label = "test";
+	 reg = <0x80000 0x380000>;
+	 };
+	};

Looks like the tabs were messed up when you took Murali's patch.

Thanks,
Sekhar

#4 lore raw

PATCH v3 2/5 spi/davinci: add DT binding documentation

Hi Sekhar,

Quoted 11 lines · Sekhar
Quoted 5 lines · Prakash

From: Murali Karicheri <[email protected]>

Get back missed out binding documentation submitted along with below patch:
"spi/davinci: add OF support for the spi controller"

This is not really the correct description of this patch. Years later its mostly irrelevant that binding documentation did not get applied along with the actual usage.

Agreed, I will change the commit message. This could have been below scissors lines

Quoted 60 lines
Quoted 60 lines
[prakash.pm at ti.com: Follow DT naming convention for compatible property]
---
 .../devicetree/bindings/spi/spi-davinci.txt        |   51 ++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +44 -0
new file mode 100644
index 0000000..75ad9ac
@@ -0,0 +1,51 @@
+Davinci SPI controller device bindings
+
+Required properties:
+- #address-cells: number of cells required to define a chip select
+	address on the SPI bus. Should be set to 1.
+- #size-cells: should be zero.
+- compatible:
+	- "ti,dm6441-spi" for SPI used similar to that on DM644x SoC family
+	- "ti,da830-spi" for SPI used similar to that on DA8xx SoC family
+- reg: Offset and length of SPI controller register space
+- num-cs: Number of chip selects
+- ti,davinci-spi-intr-line: interrupt line used to connect the SPI
+	IP to the interrupt controller withn the SoC. Possible values
+	are 0 and 1. Manual says one of the two possible interrupt
+	lines can be tied to the interrupt controller. Set this
+	based on a specifc SoC configuration.
+- interrupts: interrupt number mapped to CPU.
+- clocks: spi clk phandle
+
+Example of a NOR flash slave device (n25q032) connected to DaVinci
+SPI controller device over the SPI bus.
+
+spi0:spi at 20BF0000 {
+	#address-cells	 = <1>;
+	#size-cells	 = <0>;
+	compatible	 = "ti,dm6446-spi";
+	reg	 = <0x20BF0000 0x1000>;
+	num-cs	 = <4>;
+	ti,davinci-spi-intr-line	= <0>;
+	interrupts	 = <338>;
+	clocks	 = <&clkspi>;
+
+	flash: n25q032 at 0 {
+	 #address-cells = <1>;
+	 #size-cells = <1>;
+	 compatible = "st,m25p32";
+	 spi-max-frequency = <25000000>;
+	 reg = <0>;
+
+	 partition at 0 {
+	 label = "u-boot-spl";
+	 reg = <0x0 0x80000>;
+	 read-only;
+	 };
Quoted 9 lines

Documentation/devicetree/bindings/spi/spi-davinci.txt line 50

Quoted 6 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +6 -0
+
+	 partition at 1 {
+	 label = "test";
+	 reg = <0x80000 0x380000>;
+	 };
+	};

Looks like the tabs were messed up when you took Murali's patch.

Ok I will fix this.

Thanks,
Prakash

#5 lore raw

PATCH v3 3/5 ARM: davinci: da850: add SPI1 DT node

In reply to Manjunathappa, Prakash

Patch adds SPI1 DT node along with pinmux data.

---
 arch/arm/boot/dts/da850.dtsi |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/da850.dtsi +18 -0
index 3ec1bda..327fb06 100644
@@ -62,6 +62,14 @@
 					0x10 0x00002200 0x0000ff00
 				>;
 			};
+			spi1_pins: pinmux_spi_pins {
+				pinctrl-single,bits = <
+					/* SIMO, SOMI, ENA,
+					 * CLK, CS[0], CS[1]
+					 */
+					0x14 0x00111111 0x00ffffff
+				>;
+			};
 		};
 		serial0: serial at 1c42000 {
 			compatible = "ns16550a";
@@ -107,6 +115,16 @@
 			reg = <0x21000 0x1000>;
 			status = "disabled";
 		};
+		spi1: spi at 1f0e000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "ti,da830-spi";
+			reg = <0x30e000 0x1000>;
+			num-cs = <4>;
+			ti,davinci-spi-intr-line = <1>;
+			interrupts = <56>;
+			status = "disabled";
+		};
 	};
 	nand_cs3 at 62000000 {
 		compatible = "ti,davinci-nand";
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH v3 4/5 ARM: davinci: da850: override SPI DT node device name

In reply to Manjunathappa, Prakash

Populate OF_DEV_AUXDATA with desired device name expected by spi-davinci driver. Without this clk_get of spi-davinci DT driver fails.

---
 arch/arm/mach-davinci/da8xx-dt.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da8xx-dt.c +1 -0
index 5404e92..e049f07 100644
@@ -40,6 +40,7 @@ static void __init da8xx_init_irq(void)
 struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
 	OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+	OF_DEV_AUXDATA("ti,da830-spi", 0x01f0e000, "spi_davinci.1", NULL),
 	{}
 };
 
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH v3 5/5 ARM: davinci: da850-evm: add SPI flash support

In reply to Manjunathappa, Prakash

Enable m25p64 SPI flash support on da850-EVM. Also add partition information of SPI flash.

---
 arch/arm/boot/dts/da850-evm.dts |   40 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/boot/dts/da850-evm.dts +40 -0
index c359872..fe2bbe7 100644
@@ -41,6 +41,46 @@
 		wdt: wdt at 1c21000 {
 			status = "okay";
 		};
+		spi1: spi at 1f0e000 {
+			status = "okay";
+			pinctrl-names = "default";
+			pinctrl-0 = <&spi1_pins>;
+			flash: m25p80 at 0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "m25p64";
+				spi-max-frequency = <30000000>;
+				reg = <0>;
+				partition at 0 {
+					label = "U-Boot-SPL";
+					reg = <0x00000000 0x00010000>;
+					read-only;
+				};
+				partition at 1 {
+					label = "U-Boot";
+					reg = <0x00010000 0x00080000>;
+					read-only;
+				};
+				partition at 2 {
+					label = "U-Boot-Env";
+					reg = <0x00090000 0x00010000>;
+					read-only;
+				};
+				partition at 3 {
+					label = "Kernel";
+					reg = <0x000a0000 0x00280000>;
+				};
+				partition at 4 {
+					label = "Filesystem";
+					reg = <0x00320000 0x00400000>;
+				};
+				partition at 5 {
+					label = "MAC-Address";
+					reg = <0x007f0000 0x00010000>;
+					read-only;
+				};
+			};
+		};
 	};
 	nand_cs3 at 62000000 {
 		status = "okay";
Signature · 1 line
1.7.4.1
#8 lore raw

v3 cover Enable SPI flash support on da850-evm DT kernel

In reply to Manjunathappa, Prakash
Quoted 2 lines · Prakash

Patch enables support for m25p64 SPI flash support on da850-EVM.

This patch set looks good to me except the comments I had on 2/5. I tested it using SPI flash on DA850 EVM and it worked fine on basic read/write tests.

Grant,

With your ack I would like to merge the series through DaVinci tree so its easy to manage the conflicts in DT files.

Quoted 7 lines

Testing information:
da850-evm comes with partitions specified in DT blob.
Able to mount/umount and create/delete files on filesystem partition.

Depends on below patch in spi-next branch of git://git.secretlab.ca/git/linux-2.6.git.
"spi/davinci: add OF support for the spi controller"

Prakash, there is no need to mention this dependency. The patch is already in mainline.

Thanks,
Sekhar

#9 lore raw

v3 cover Enable SPI flash support on da850-evm DT kernel

Quoted 8 lines · Sekhar
Quoted 2 lines · Prakash

Patch enables support for m25p64 SPI flash support on da850-EVM.

This patch set looks good to me except the comments I had on 2/5. I tested it using SPI flash on DA850 EVM and it worked fine on basic read/write tests.

Thanks I will add your Reviewed-by.

Quoted 10 lines

Grant,

With your ack I would like to merge the series through DaVinci tree so its easy to manage the conflicts in DT files.

Quoted 5 lines

Testing information:
da850-evm comes with partitions specified in DT blob.
Able to mount/umount and create/delete files on filesystem partition.

Quoted 6 lines
Quoted 2 lines

Depends on below patch in spi-next branch of git://git.secretlab.ca/git/linux-2.6.git.
"spi/davinci: add OF support for the spi controller"

Prakash, there is no need to mention this dependency. The patch is already in mainline.

Yes, I mentioned it here as my patches were based on linux-davinci: v3.9/dt-2 branch. Will rebase my next versions on davinci/master.

Thanks,
Prakash