Skip to contentSkip to conversation

i2c: add driver for Amlogic Meson I2C controller

PATCH Applied Beniamino Galvani 3 participants 9 messages Nov 13, 2014 – Nov 18, 2014

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

v3 cover i2c: add driver for Amlogic Meson I2C controller

Hi,

this patchset adds a driver for the I2C controller available in Amlogic Meson SoCs. It has been tested on a Meson8 based board with the following devices:
- Ricoh RN5T618 PMIC
- NXP PCF8564 RTC

Changes since v2:
- fixed token generation for split reads
- simplified meson_i2c_prepare_xfer()
- added DTS patch

Changes since v1:
- factored common code for token list setup

Beniamino Galvani (3):
i2c: meson: add device tree bindings documentation
i2c: add support for Amlogic Meson I2C controller
ARM: dts: meson: add I2C controller nodes

 .../devicetree/bindings/i2c/i2c-meson.txt          |  24 +
 arch/arm/boot/dts/meson.dtsi                       |  30 ++
 drivers/i2c/busses/Kconfig                         |   7 +
 drivers/i2c/busses/Makefile                        |   1 +
 drivers/i2c/busses/i2c-meson.c                     | 492 +++++++++++++++++++++
 5 files changed, 554 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-meson.txt
 create mode 100644 drivers/i2c/busses/i2c-meson.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/3 i2c: meson: add device tree bindings documentation

This commit adds device tree bindings documentation for the I2C bus controller found on Amlogic Meson SoCs.

---
 .../devicetree/bindings/i2c/i2c-meson.txt          | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-meson.txt
Documentation/devicetree/bindings/i2c/i2c-meson.txt new file +24 -0
new file mode 100644
index 0000000..682f9a6
@@ -0,0 +1,24 @@
+Amlogic Meson I2C controller
+
+Required properties:
+ - compatible: must be "amlogic,meson6-i2c"
+ - reg: physical address and length of the device registers
+ - interrupts: a single interrupt specifier
+ - clocks: clock for the device
+ - #address-cells: should be <1>
+ - #size-cells: should be <0>
+
+Optional properties:
+- clock-frequency: the desired I2C bus clock frequency in Hz; in
+  absence of this property the default value is used (100 kHz).
+
+Examples:
+
+	i2c at c8100500 {
+		compatible = "amlogic,meson6-i2c";
+		reg = <0xc8100500 0x20>;
+		interrupts = <0 92 1>;
+		clocks = <&clk81>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
Signature · 1 line
1.9.1
#3 lore raw

PATCH v3 2/3 i2c: add support for Amlogic Meson I2C controller

In reply to Beniamino Galvani

This is a driver for the I2C controller found in Amlogic Meson SoCs.

---
 drivers/i2c/busses/Kconfig     |   7 +
 drivers/i2c/busses/Makefile    |   1 +
 drivers/i2c/busses/i2c-meson.c | 492 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 500 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-meson.c
drivers/i2c/busses/Kconfig +7 -0
index 917c358..b76fd31 100644
@@ -553,6 +553,13 @@ config I2C_KEMPLD
 	  This driver can also be built as a module. If so, the module
 	  will be called i2c-kempld.
 
+config I2C_MESON
+	tristate "Amlogic Meson I2C controller"
+	depends on ARCH_MESON
+	help
+	  If you say yes to this option, support will be included for the
+	  I2C interface on the Amlogic Meson family of SoCs.
+
 config I2C_MPC
 	tristate "MPC107/824x/85xx/512x/52xx/83xx/86xx"
 	depends on PPC
drivers/i2c/busses/Makefile +1 -0
index 78d56c5..a3f2de9 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_I2C_IBM_IIC)	+= i2c-ibm_iic.o
 obj-$(CONFIG_I2C_IMX)		+= i2c-imx.o
 obj-$(CONFIG_I2C_IOP3XX)	+= i2c-iop3xx.o
 obj-$(CONFIG_I2C_KEMPLD)	+= i2c-kempld.o
+obj-$(CONFIG_I2C_MESON)		+= i2c-meson.o
 obj-$(CONFIG_I2C_MPC)		+= i2c-mpc.o
 obj-$(CONFIG_I2C_MV64XXX)	+= i2c-mv64xxx.o
 obj-$(CONFIG_I2C_MXS)		+= i2c-mxs.o
drivers/i2c/busses/i2c-meson.c new file +492 -0

492 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 3/3 ARM: dts: meson: add I2C controller nodes

In reply to Beniamino Galvani

Add nodes for I2C controllers A,B,AO, which are available in both Meson6 and Meson8.

---
 arch/arm/boot/dts/meson.dtsi | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/boot/dts/meson.dtsi +30 -0
index e6539ea..4f16aee 100644
@@ -106,5 +106,35 @@
 			clocks = <&clk81>;
 			status = "disabled";
 		};
+
+		i2c_AO: i2c at c8100500 {
+			compatible = "amlogic,meson6-i2c";
+			reg = <0xc8100500 0x20>;
+			interrupts = <0 92 1>;
+			clocks = <&clk81>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		i2c_A: i2c at c1108500 {
+			compatible = "amlogic,meson6-i2c";
+			reg = <0xc1108500 0x20>;
+			interrupts = <0 21 1>;
+			clocks = <&clk81>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		i2c_B: i2c at c11087c0 {
+			compatible = "amlogic,meson6-i2c";
+			reg = <0xc11087c0 0x20>;
+			interrupts = <0 128 1>;
+			clocks = <&clk81>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
 	};
 }; /* end of / */
Signature · 1 line
1.9.1
#7 lore raw

Re: [PATCH v3 3/3] ARM: dts: meson: add I2C controller nodes

Quoted 9 lines · Wolfram Sang
Quoted 5 lines · Beniamino Galvani

Add nodes for I2C controllers A,B,AO, which are available in both Meson6 and Meson8.

---

I usually don't take DTS patches. They should go via arm-soc. Please say so if there are reasons I should take it.

I'll take them.

Signature · 1 line
Carlo Caione
#8 lore raw

Re: [PATCH v3 3/3] ARM: dts: meson: add I2C controller nodes

Quoted 5 lines · Carlo Caione
Quoted 4 lines · Wolfram Sang
Quoted 3 lines · Beniamino Galvani

Add nodes for I2C controllers A,B,AO, which are available in both Meson6 and Meson8.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

---

I usually don't take DTS patches. They should go via arm-soc. Please say so if there are reasons I should take it.

I'll take them.

Thanks!

Beniamino