Enable SPI flash support on da850-evm DT kernel
Subsystems (5)
v2 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 v1:
Look for m25p64 instead of m25p80 flash chip and correct partition information.
Dropping below accepted patch:
"spi/davinci: fix module build error"
Considered below missed out patch:
spi/davinci: add DT binding documentation
Manjunathappa, Prakash (3):
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 + 4 files changed, 110 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/spi-davinci.txt
Signature · 1 line
1.7.4.1
PATCH v2 1/4 spi/davinci: add DT binding documentation
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"
---
Resubmitting it as it is missed out while merging.
.../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
@@ -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,dm644x-spi" for SPI used similar to that on DM644x SoC family + - "ti,da8xx-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 offset at the irq parent +- 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,dm644x-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
PATCH v2 1/4 spi/davinci: add DT binding documentation
Quoted 6 lines · Prakash
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +0
-0
Documentation/devicetree/bindings/spi/spi-davinci.txt line 9
Quoted 9 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +9
-0@@ -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,dm644x-spi" for SPI used similar to that on DM644x SoC family + - "ti,da8xx-spi" for SPI used similar to that on DA8xx SoC family
In general, you should avoid wildcards in "compatible" properties. Better use the number of the first chip that introduced the specific version of the device.
Documentation/devicetree/bindings/spi/spi-davinci.txt line 17
Quoted 8 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +8
-0+- 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 offset at the irq parent
I would not call this an "offset". It is an interrupt descriptor which may be something other than a simple number.
Unfortunately, there is no way to provide an "invalid" interrupt, otherwise you could just list both interrupts, out of which at least one should be valid, and drop the ti,davinci-spi-intr-line property.
One thing you could do instead though is to use the "interrupt-names" property to define "irq0" and "irq1" interrupts, and in the implementation use the first one you find.
Arnd
PATCH v2 1/4 spi/davinci: add DT binding documentation
Hi Arnd,
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · Prakash
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +5
-0@@ -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.
Quoted 9 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt line 9
Quoted 4 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +4
-0+- #size-cells: should be zero. +- compatible: + - "ti,dm644x-spi" for SPI used similar to that on DM644x SoC family + - "ti,da8xx-spi" for SPI used similar to that on DA8xx SoC familyIn general, you should avoid wildcards in "compatible" properties. Better use the number of the first chip that introduced the specific version of the device.
Correct, will accommodate this change.
Quoted 12 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt line 17
Quoted 8 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +8
-0+- 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 offset at the irq parentI would not call this an "offset". It is an interrupt descriptor which may be something other than a simple number.
I am planning to drop from this documentation as it is common property.
Quoted 5 lines
Unfortunately, there is no way to provide an "invalid" interrupt, otherwise you could just list both interrupts, out of which at least one should be valid, and drop the ti,davinci-spi-intr-line property.
This is different from interrupt number, this is used to specifies out of 2 lines from SPI IP which is tied to INTC. Some discussion about it:
https://lkml.org/lkml/2012/11/16/404
Quoted 4 lines
One thing you could do instead though is to use the "interrupt-names" property to define "irq0" and "irq1" interrupts, and in the implementation use the first one you find.
In IP specification it is mentioned as spi-intr-line, I prefer to retain this property as davinci-spi-intr-line.
Thanks,
Prakash
PATCH v2 1/4 spi/davinci: add DT binding documentation
Quoted 25 lines · Prakash
Hi Arnd,
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · Prakash
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +5
-0@@ -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.Quoted 9 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt line 9
Quoted 4 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +4
-0+- #size-cells: should be zero. +- compatible: + - "ti,dm644x-spi" for SPI used similar to that on DM644x SoC family + - "ti,da8xx-spi" for SPI used similar to that on DA8xx SoC familyIn general, you should avoid wildcards in "compatible" properties. Better use the number of the first chip that introduced the specific version of the device.
Quoted 1 line
Correct, will accommodate this change.
But note that this patch is just documenting bindings already accepted and part of kernel. You probably need another patch which fixes the incorrect bindings and this one can then document in fixed bindings.
Thanks,
Sekhar
PATCH v2 1/4 spi/davinci: add DT binding documentation
Quoted 28 lines · Sekhar
Quoted 25 lines · Prakash
Hi Arnd,
Quoted 21 lines · Arnd Bergmann
Quoted 6 lines · Prakash
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +0
-0Documentation/devicetree/bindings/spi/spi-davinci.txt line 9
Quoted 9 lines
Documentation/devicetree/bindings/spi/spi-davinci.txt new file +9
-0@@ -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,dm644x-spi" for SPI used similar to that on DM644x SoC family + - "ti,da8xx-spi" for SPI used similar to that on DA8xx SoC familyIn general, you should avoid wildcards in "compatible" properties. Better use the number of the first chip that introduced the specific version of the device.
Quoted 6 lines
Quoted 1 line
Correct, will accommodate this change.
But note that this patch is just documenting bindings already accepted and part of kernel. You probably need another patch which fixes the incorrect bindings and this one can then document in fixed bindings.
Correct Sekhar I meant the same. I will have patch for driver to accommodate above change and a patch for missing binding document.
Thanks,
Prakash
Quoted 3 lines
Thanks,
Sekhar
PATCH v2 1/4 spi/davinci: add DT binding documentation
In reply to Manjunathappa, PrakashQuoted 15 lines · Prakash
Quoted 13 lines · Arnd Bergmann
Documentation/devicetree/bindings/spi/spi-davinci.txt line 17
Quoted 8 lines · Prakash
+- 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 SPIDocumentation/devicetree/bindings/spi/spi-davinci.txt new file +5
-0+ 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 offset at the irq parentI would not call this an "offset". It is an interrupt descriptor which may be something other than a simple number.
Quoted 1 line
I am planning to drop from this documentation as it is common property.
I think it makese sense to document the fact that there should be exactly one interrupt listed in the interrupts property, especially since the hardware has two outputs.
Arnd
PATCH v2 1/4 spi/davinci: add DT binding documentation
Quoted 16 lines · Arnd Bergmann
Quoted 15 lines · Prakash
Quoted 13 lines · Arnd Bergmann
Documentation/devicetree/bindings/spi/spi-davinci.txt line 17
Quoted 8 lines · Prakash
+- 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 SPIDocumentation/devicetree/bindings/spi/spi-davinci.txt new file +5
-0+ 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 offset at the irq parentI would not call this an "offset". It is an interrupt descriptor which may be something other than a simple number.
Quoted 6 lines
Quoted 1 line
I am planning to drop from this documentation as it is common property.
I think it makese sense to document the fact that there should be exactly one interrupt listed in the interrupts property, especially since the hardware has two outputs.
Agreed, will consider this property for documenting.
Thanks,
Prakash
PATCH v2 2/4 ARM: davinci: da850: add SPI1 DT node
In reply to Manjunathappa, PrakashPatch 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
@@ -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,da8xx-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
PATCH v2 3/4 ARM: davinci: da850: override SPI DT node device name
In reply to Manjunathappa, PrakashPopulate 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
@@ -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,da8xx-spi" ,0x01f0e000 ,"spi_davinci.1" ,NULL ), {} };
Signature · 1 line
1.7.4.1
PATCH v2 4/4 ARM: davinci: da850-evm: add SPI flash support
In reply to Manjunathappa, PrakashEnable m25p64 SPI flash support on da850-EVM. Also add partition information of SPI flash.
---
Since v1:
Look for m25p64 instead of m25p80.
Corrected the filesystem partition information.
arch/arm/boot/dts/da850-evm.dts | 40 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/boot/dts/da850-evm.dts +40 -0
@@ -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 = <0x00720000 0x00010000>; + read-only; + }; + }; + }; }; nand_cs3 at 62000000 { status = "okay";
Signature · 1 line
1.7.4.1
PATCH v2 4/4 ARM: davinci: da850-evm: add SPI flash support
Quoted 46 lines · Prakash
Enable m25p64 SPI flash support on da850-EVM. Also add partition information of SPI flash.
Signed-off-by Manjunathappa, Prakash <[email protected]>---
Since v1:
Look for m25p64 instead of m25p80.
Corrected the filesystem partition information.arch/arm/boot/dts/da850-evm.dts | 40 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-)arch/arm/boot/dts/da850-evm.dts +26
-0@@ -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 {
arch/arm/boot/dts/da850-evm.dts line 79
Quoted 10 lines
arch/arm/boot/dts/da850-evm.dts +10
-0+ label = "Kernel"; + reg = <0x000a0000 0x00280000>; + }; + partition at 4 { + label = "Filesystem"; + reg = <0x00320000 0x00400000>; + }; + partition at 5 { + label = "MAC-Address"; + reg = <0x00720000 0x00010000>;
Ah... MAC address is at the end of 8MB flash. Need to change above:
reg = <0x007f0000 0x00010000>;
Will send v3 for this.
Thanks,
Prakash
Quoted 11 lines
arch/arm/boot/dts/da850-evm.dts +4
-0+ read-only; + }; + }; + }; }; nand_cs3 at 62000000 { status = "okay";Signature · 1 line
1.7.4.1