Skip to contentSkip to conversation

i2c: add driver for Amlogic Meson I2C controller

PATCH Superseded Beniamino Galvani 2 participants 5 messages Oct 5, 2014 – Nov 10, 2014

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover i2c: add driver for Amlogic Meson I2C controller

Hi,

this patchset adds a driver for the I2C controller available in Amlogic Meson SoCs and has been tested on a Tronsmart Vega S89E TV box to communicate with a Ricoh RN5T618 PMIC.

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

Beniamino Galvani (2):
i2c: add support for Amlogic Meson I2C controller
i2c: meson: add device tree bindings documentation

 .../devicetree/bindings/i2c/i2c-meson.txt          |  24 +
 drivers/i2c/busses/Kconfig                         |   7 +
 drivers/i2c/busses/Makefile                        |   1 +
 drivers/i2c/busses/i2c-meson.c                     | 492 +++++++++++++++++++++
 4 files changed, 524 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 v2 1/2 i2c: add support for Amlogic Meson I2C controller

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 2e45ae3..b8e8f63 100644
@@ -530,6 +530,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 49bf07e..c7ed7f12 100644
@@ -51,6 +51,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
#2 lore raw

Re: [PATCH v2 1/2] i2c: add support for Amlogic Meson I2C controller

Quoted 3 lines · Beniamino Galvani

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

Thanks. Looking very good already!

Quoted 1 line

+static void meson_i2c_prepare_xfer(struct meson_i2c *i2c, bool write)

Instead of the bool, maybe you could query i2c->state in the function? You decide, I am not forcing you to do this.

drivers/i2c/busses/i2c-meson.c line 382

Quoted 4 lines
drivers/i2c/busses/i2c-meson.c new file +4 -0
+static u32 meson_i2c_func(struct i2c_adapter *adap)
+{
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+}

Have you tested 0-byte transfers, too (i2cdetect -q)? What was your test scenario in general?

Just minor questions. It is good to go already!

#3 lore raw

Re: [PATCH v2 1/2] i2c: add support for Amlogic Meson I2C controller

Quoted 11 lines · Wolfram Sang
Quoted 3 lines · Beniamino Galvani

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

Thanks. Looking very good already!

Quoted 1 line

+static void meson_i2c_prepare_xfer(struct meson_i2c *i2c, bool write)

Instead of the bool, maybe you could query i2c->state in the function? You decide, I am not forcing you to do this.

Seems reasonable, will do.

Quoted 8 lines

drivers/i2c/busses/i2c-meson.c line 382

Quoted 5 lines
drivers/i2c/busses/i2c-meson.c new file +4 -0
+static u32 meson_i2c_func(struct i2c_adapter *adap)
+{
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+}

Have you tested 0-byte transfers, too (i2cdetect -q)? What was your test scenario in general?

I did a test with i2cdetect and quick write commands appear to work.

When I wrote the driver I tested it to communicate with the only I2C device available on the board, a Ricoh RN5T618 PMIC.

Now I have access to a hardware with a PCF8564 RTC and just realized that long reads don't work properly, so I'm going to submit a new version of the patchset in the next days.

Thanks,
Beniamino

#4 lore raw

PATCH v2 2/2 i2c: meson: add device tree bindings documentation

In reply to Beniamino Galvani

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@c8100500 {
+		compatible = "amlogic,meson6-i2c";
+		reg = <0xc8100500 0x20>;
+		interrupts = <0 92 1>;
+		clocks = <&clk81>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html