Skip to contentSkip to conversation

i2c: new bus driver for efm32

PATCH New Uwe Kleine-König 2 participants 3 messages Mar 25, 2014 – Apr 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 i2c: new bus driver for efm32

This was tested on a EFM32GG-DK3750 devboard that has a temperature sensor and an eeprom on its i2c bus.

---
Hello,

Quoted 8 lines · Wolfram Sang
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+ depends on OF && (ARCH_EFM32 || COMPILE_TEST)

Is EFM32 DT only? Do we need the dependency on OF?

yes, efm32 is DT only. Still for the COMPILE_TEST branch the OF is needed.

Really? of_* functions should have empty templates if OF is not selected, I'd think.

You're right, I did a compile test on x86's defconfig with COMPILE_TEST=y and it works just fine without OF.

Changes since v3, sent with Message-Id: 1395414236-22647-1-git-send-email-u.kleine-koenig at pengutronix.de:
- Drop dependency on OF
- switch compatible string from "efm32,i2c" to "energymicro,efm32-i2c"
- add missing newline
- drop useless assignment to ddata->msgs

I kept the braces that offend checkpatch.

Best regards
Uwe

 .../devicetree/bindings/i2c/i2c-efm32.txt          |  34 ++
 drivers/i2c/busses/Kconfig                         |   7 +
 drivers/i2c/busses/Makefile                        |   1 +
 drivers/i2c/busses/i2c-efm32.c                     | 481 +++++++++++++++++++++
 4 files changed, 523 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-efm32.txt
 create mode 100644 drivers/i2c/busses/i2c-efm32.c
Documentation/devicetree/bindings/i2c/i2c-efm32.txt new file +34 -0
new file mode 100644
index 000000000000..ead4dd33ab66
@@ -0,0 +1,34 @@
+* Energymicro efm32 i2c controller
+
+Required properties :
+
+ - reg : Offset and length of the register set for the device
+ - compatible : should be "efm32,i2c"
+ - interrupts : the interrupt number
+ - clocks : reference to the module clock
+
+Recommended properties :
+
+ - clock-frequency : maximal I2C bus clock frequency in Hz.
+ - efm32,location : Decides the location of the USART I/O pins.
+   Allowed range : [0 .. 6]
+
+Example:
+	i2c0: i2c at 4000a000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "efm32,i2c";
+		reg = <0x4000a000 0x400>;
+		interrupts = <9>;
+		clocks = <&cmu clk_HFPERCLKI2C0>;
+		clock-frequency = <100000>;
+		status = "disabled";
+		efm32,location = <3>;
+
+		eeprom at 50 {
+			compatible = "microchip,24c02";
+			reg = <0x50>;
+			pagesize = <16>;
+		};
+	};
+
drivers/i2c/busses/Kconfig +7 -0
index f5ed03164d86..c640da419c39 100644
@@ -432,6 +432,13 @@ config I2C_DESIGNWARE_PCI
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-designware-pci.
 
+config I2C_EFM32
+	tristate "EFM32 I2C controller"
+	depends on ARCH_EFM32 || COMPILE_TEST
+	help
+	  This driver supports the i2c block found in Energy Micro's EFM32
+	  SoCs.
+
 config I2C_EG20T
 	tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) I2C"
 	depends on PCI
drivers/i2c/busses/Makefile +1 -0
index a08931fe73e1..2a56ab181851 100644
@@ -41,6 +41,7 @@ obj-$(CONFIG_I2C_DESIGNWARE_PLATFORM)	+= i2c-designware-platform.o
 i2c-designware-platform-objs := i2c-designware-platdrv.o
 obj-$(CONFIG_I2C_DESIGNWARE_PCI)	+= i2c-designware-pci.o
 i2c-designware-pci-objs := i2c-designware-pcidrv.o
+obj-$(CONFIG_I2C_EFM32)		+= i2c-efm32.o
 obj-$(CONFIG_I2C_EG20T)		+= i2c-eg20t.o
 obj-$(CONFIG_I2C_EXYNOS5)	+= i2c-exynos5.o
 obj-$(CONFIG_I2C_GPIO)		+= i2c-gpio.o
drivers/i2c/busses/i2c-efm32.c new file +481 -0

481 lines not on this page · raw message

Signature · 1 line
1.9.1
Applied
#1 lore raw

PATCH v4 1/1 i2c: new bus driver for efm32

Quoted 4 lines · Uwe Kleine-K?nig

This was tested on a EFM32GG-DK3750 devboard that has a temperature sensor and an eeprom on its i2c bus.

Applied to for-next, thanks!

-------------- 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/20140327/ca982022/attachment-0001.sig>

#2 lore raw

PATCH 1/1 fixup! i2c: efm32: new bus driver

In reply to Uwe Kleine-König

Fix dt compatible string in the binding document which was changed during review in the driver, but it seem I messed up to adapt the documentation accordingly.

Also change status from "disabled" to "ok" which makes more sense for an example.

---
 Documentation/devicetree/bindings/i2c/i2c-efm32.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/i2c/i2c-efm32.txt +3 -3
index ead4dd33ab66..fc15ac519437 100644
@@ -3,7 +3,7 @@
 Required properties :
 
  - reg : Offset and length of the register set for the device
- - compatible : should be "efm32,i2c"
+ - compatible : should be "energymicro,efm32-i2c"
  - interrupts : the interrupt number
  - clocks : reference to the module clock
 
@@ -17,12 +17,12 @@ Example:
 	i2c0: i2c at 4000a000 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "efm32,i2c";
+		compatible = "energymicro,efm32-i2c";
 		reg = <0x4000a000 0x400>;
 		interrupts = <9>;
 		clocks = <&cmu clk_HFPERCLKI2C0>;
 		clock-frequency = <100000>;
-		status = "disabled";
+		status = "ok";
 		efm32,location = <3>;
 
 		eeprom at 50 {
Signature · 1 line
1.9.1