Skip to contentSkip to conversation

ARM: keystone: Enable SPI and I2C support

PATCH Superseded Santosh Shilimkar 2 participants 9 messages Sep 27, 2013 – Sep 30, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: keystone: Enable SPI and I2C support

Here is small set of patches which enables I2C and SPI bus support for Keystone SOCs. The relevant driver updates are already merged in the last merge cycle. Tested on Keystone 2 EVM.

Santosh Shilimkar (4):
ARM: dts: keystone: Add i2c device nodes
ARM: dts: keystone: Add the SPI nodes
spi: davinci: Allow SPI to be build without EDMA support
ARM: keystone: Enable I2C and SPI bus support

 arch/arm/boot/dts/keystone.dts      |   57 +++++++++++++++++++++++++++++++++++
 arch/arm/configs/keystone_defconfig |    2 ++
 drivers/spi/Kconfig                 |    2 +-
 3 files changed, 60 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 ARM: dts: keystone: Add i2c device nodes

Keystone2 based SOCs supports 3 instances of i2c controllers. Add the device nodes for them. The i2c0 child device AT24C1024 EEPROM node is also added. When different board variants are added in future, it can be moved to the supported boards from common SOC file.

---
 arch/arm/boot/dts/keystone.dts |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/boot/dts/keystone.dts +30 -0
index 7d576b5..3f56556 100644
@@ -124,5 +124,35 @@
 			interrupts = <GIC_SPI 280 IRQ_TYPE_EDGE_RISING>;
 		};
 
+		i2c0: i2c at 2530000 {
+			compatible = "ti,davinci-i2c";
+			reg = <0x02530000 0x400>;
+			clock-frequency = <100000>;
+			clocks = <&clki2c>;
+			interrupts = <GIC_SPI 283 IRQ_TYPE_EDGE_RISING>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			dtt at 50 {
+				compatible = "at,24c1024";
+				reg = <0x50>;
+			};
+		};
+
+		i2c1: i2c at 2530400 {
+			compatible = "ti,davinci-i2c";
+			reg = <0x02530400 0x400>;
+			clock-frequency = <100000>;
+			clocks = <&clki2c>;
+			interrupts = <GIC_SPI 286 IRQ_TYPE_EDGE_RISING>;
+		};
+
+		i2c2: i2c at 2530800 {
+			compatible = "ti,davinci-i2c";
+			reg = <0x02530800 0x400>;
+			clock-frequency = <100000>;
+			clocks = <&clki2c>;
+			interrupts = <GIC_SPI 289 IRQ_TYPE_EDGE_RISING>;
+		};
 	};
 };
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 ARM: dts: keystone: Add the SPI nodes

In reply to Santosh Shilimkar

Keystone2 based SOCs supports 3 instances of SPI controllers. Add the device nodes for them.

---
 arch/arm/boot/dts/keystone.dts |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/boot/dts/keystone.dts +27 -0
index 3f56556..8203da5 100644
@@ -154,5 +154,32 @@
 			clocks = <&clki2c>;
 			interrupts = <GIC_SPI 289 IRQ_TYPE_EDGE_RISING>;
 		};
+
+		spi0: spi at 21000400 {
+			compatible = "ti,dm6441-spi";
+			reg = <0x21000400 0x200>;
+			num-cs = <4>;
+			ti,davinci-spi-intr-line = <0>;
+			interrupts = <GIC_SPI 292 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&clkspi>;
+		};
+
+		spi1: spi at 21000600 {
+			compatible = "ti,dm6441-spi";
+			reg = <0x21000600 0x200>;
+			num-cs = <4>;
+			ti,davinci-spi-intr-line = <0>;
+			interrupts = <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&clkspi>;
+		};
+
+		spi2: spi at 21000800 {
+			compatible = "ti,dm6441-spi";
+			reg = <0x21000800 0x200>;
+			num-cs = <4>;
+			ti,davinci-spi-intr-line = <0>;
+			interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&clkspi>;
+		};
 	};
 };
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 spi: davinci: Allow SPI to be build without EDMA support

In reply to Santosh Shilimkar

DaVinci SPI IP works without EDMA support and thats how it has been used on Keystone SOCs currently. Hence keep the EDMA select limited to ARCH_DAVINCI so that Keystone SOCs can use the driver.

Keystone SOC do support EDMA IP as well but the support has not been added and tested so far.

---
Mark,
If you are ok with this trivial change, I will need your ack to carry the patch via arm-soc tree. Without this patch, enabling SPI throws unmet dependency warnings and last patch in the series enables the SPI support.

 drivers/spi/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/Kconfig +1 -1
index b9c53cc..514d883 100644
@@ -159,7 +159,7 @@ config SPI_DAVINCI
 	tristate "Texas Instruments DaVinci/DA8x/OMAP-L/AM1x SoC SPI controller"
 	depends on ARCH_DAVINCI || ARCH_KEYSTONE
 	select SPI_BITBANG
-	select TI_EDMA
+	select TI_EDMA if ARCH_DAVINCI
 	help
 	  SPI master controller for DaVinci/DA8x/OMAP-L/AM1x SPI modules.
 
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

PATCH 3/4 spi: davinci: Allow SPI to be build without EDMA support

Quoted 6 lines · Santosh Shilimkar

DaVinci SPI IP works without EDMA support and thats how it has been used on Keystone SOCs currently. Hence keep the EDMA select limited to ARCH_DAVINCI so that Keystone SOCs can use the driver.

Keystone SOC do support EDMA IP as well but the support has not been added and tested so far.

If there's no hard dependency on EDMA then the driver probably ought to
be marked as COMPILE_TEST so that it can be build tested on other
systems. Is that possible?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130929/ab65c9b9/attachment.sig>

#5 lore raw

PATCH 3/4 spi: davinci: Allow SPI to be build without EDMA support

Quoted 6 lines · Mark Brown
Quoted 3 lines · Santosh Shilimkar

DaVinci SPI IP works without EDMA support and thats how it has been used on Keystone SOCs currently. Hence keep the EDMA select limited to ARCH_DAVINCI so that Keystone SOCs can use the driver.

Quoted 7 lines
Quoted 2 lines

Keystone SOC do support EDMA IP as well but the support has not been added and tested so far.

If there's no hard dependency on EDMA then the driver probably ought to be marked as COMPILE_TEST so that it can be build tested on other systems. Is that possible?

EDMA is already getting tested for DAVINCI builds and there are patches coming AMXXXX SOC support. So probably marking it COMPILE_TEST isn't needed since it has been in use already for other SOCs.

Regards,
Santosh

maintainer
#6 lore raw

PATCH 3/4 spi: davinci: Allow SPI to be build without EDMA support

Quoted 9 lines · Santosh Shilimkar
Quoted 3 lines · Mark Brown

If there's no hard dependency on EDMA then the driver probably ought to be marked as COMPILE_TEST so that it can be build tested on other systems. Is that possible?

EDMA is already getting tested for DAVINCI builds and there are patches coming AMXXXX SOC support. So probably marking it COMPILE_TEST isn't needed since it has been in use already for other SOCs.

It'd make life easier for general subsystem development if we were able
to get build coverage without having to build a specific config, even if
it's never actually going to be run.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130930/bcaa17e5/attachment.sig>

#7 lore raw

PATCH 3/4 spi: davinci: Allow SPI to be build without EDMA support

Quoted 7 lines · Mark Brown
Quoted 5 lines · Santosh Shilimkar
Quoted 3 lines · Mark Brown

If there's no hard dependency on EDMA then the driver probably ought to be marked as COMPILE_TEST so that it can be build tested on other systems. Is that possible?

Quoted 8 lines
Quoted 3 lines

EDMA is already getting tested for DAVINCI builds and there are patches coming AMXXXX SOC support. So probably marking it COMPILE_TEST isn't needed since it has been in use already for other SOCs.

It'd make life easier for general subsystem development if we were able to get build coverage without having to build a specific config, even if it's never actually going to be run.

So after your comments, I actually checked whether the driver works with EDMA enabled but no EDMA node/data information from DT for SPI driver. It seems to work.

So I am going to drop this patch and rather allow the EDMA to be built for Keystone SOCs as well. Not sure why I didn't looked at this as an option first place.

Thanks for your comments Mark.

Regards,
Santosh

#8 lore raw

PATCH 4/4 ARM: keystone: Enable I2C and SPI bus support

In reply to Santosh Shilimkar

Keystone I2C dnd SPI driver updates are already merged so lets enable them in config.

---
 arch/arm/configs/keystone_defconfig |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/keystone_defconfig +2 -0
index 1f36b82..9943e5d 100644
@@ -123,7 +123,9 @@ CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_I2C=y
 # CONFIG_I2C_COMPAT is not set
 CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_DAVINCI=y
 CONFIG_SPI=y
+CONFIG_SPI_DAVINCI=y
 CONFIG_SPI_SPIDEV=y
 # CONFIG_HWMON is not set
 CONFIG_WATCHDOG=y
Signature · 1 line
1.7.9.5