i2c: new bus driver for efm32
Subsystems (2)
PATCH v2 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.
---
Notes:
Changes since (implicit) v1, sent with Message-Id: 1392027598-29015-1-git-send-email-u.kleine-koenig at pengutronix.de
- drop non-dt support
- drop locking
- don't only use -EIO on error
- drop many dev_dbg
- use reinit_completion instead of (repeated) init_completion
- fix .remove callback to also remove the i2c adapter
- use -EINVAL for clock problems
- use namespace for location property
- don't BUG but reset hardware on unexpected failure
- add dt binding doc
.../devicetree/bindings/i2c/i2c-efm32.txt | 34 ++ drivers/i2c/busses/Kconfig | 7 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-efm32.c | 482 +++++++++++++++++++++ 4 files changed, 524 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 +33 -0
@@ -0,0 +1,33 @@ +* 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>; + efm32,location = <3>; + + eeprom at 50 { + compatible = "microchip,24c02"; + reg = <0x50>; + pagesize = <16>; + }; + }; +
drivers/i2c/busses/Kconfig +7 -0
@@ -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 OF && (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
@@ -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 +482 -0
482 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 1/1 i2c: new bus driver for efm32
Hello,
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.
Signed-off-by Uwe Kleine-K?nig <[email protected]>
I screwed up testing and the driver doesn't even compile. Will send v3 in a moment.
Best regards and sorry,
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |