Skip to contentSkip to conversation

OMAP4: Add DT support for i2c and twl6030

PATCH New Benoit Cousson 2 participants 17 messages Sep 1, 2011 – Sep 5, 2011

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

cover OMAP4: Add DT support for i2c and twl6030

Hi Grant, Tony,

This is a rework of the original series done by Manju:
http://www.spinics.net/lists/linux-omap/msg55827.html

It fixes the main issue of the previous series that was not booting at all due to the lack of twl support. That fix is mandatory to allow further work on the regulators DT bindings.
In order to have a minimal i2c support, both i2c and twl must be added at the same time.
Please note than some patches can be reshuffle with the previous OMAP4 series to avoid the intermediate step with static i2c initialization.

That series is as well using the hwmods binding introduced in my previous series.
The OMAP3/beagle support will be added in an other series.

A couple of basic i2c devices are added for panda and sdp board.

Patches are based on for_3.2/4_omap4_dt_early_devices + devicetree/test and are available here:
git://gitorious.org/omap-pm/linux.git for_3.2/5_omap_dt_i2c_twl

Tested on PandaBoard and sdp4430.

Comments are welcome.

Regards,
Benoit

Benoit Cousson (10):
irq: Add stub for none DT build in irqdomain.h
mfd: twl-core: Add initial DT support for twl4030/twl6030 documentation/dt: Add TWL4030 and TWL6030 bindings arm/dts: OMAP4: Add i2c controller nodes arm/dts: omap4-sdp: Set clock freq for i2c controllers arm/dts: omap4-sdp: Add twl6030 node
arm/dts: omap4-panda: Add twl6030 node
OMAP4: board-dt: Remove static i2c init
arm/dts: omap4-sdp: Add i2c3 & i2c4 devices arm/dts: omap4-panda: Add EEPROM entry in i2c3

G, Manjunath Kondaiah (3):
i2c: OMAP: Add DT support for i2c controller documentation/dt: Add OMAP i2c bindings documentation arm/dts: omap4-panda: Set clock freq for i2c controllers

 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   30 ++++++
 .../devicetree/bindings/mfd/twl-familly.txt        |   47 +++++++++
 arch/arm/boot/dts/omap4-panda.dts                  |   48 ++++++++++
 arch/arm/boot/dts/omap4-sdp.dts                    |   66 +++++++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   32 +++++++
 arch/arm/mach-omap2/board-omap4-dt.c               |   15 ---
 drivers/i2c/busses/i2c-omap.c                      |   23 ++++-
 drivers/mfd/twl-core.c                             |   99 +++++++++++++++++++-
 include/linux/irqdomain.h                          |    2 +
 9 files changed, 340 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
#1 lore raw

PATCH 1/13 irq: Add stub for none DT build in irqdomain.h

Add an empty funtion to allow building a file without adding some #ifdef CONFIG_OF around of APIs.

Grant Likely <[email protected]>

---
 include/linux/irqdomain.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/irqdomain.h +2 -0
index e807ad6..6fa08ab 100644
@@ -84,6 +84,8 @@ extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
 extern void irq_domain_generate_simple(const struct of_device_id *match,
 					u64 phys_base, unsigned int irq_start);
 #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
+static inline void irq_domain_add_simple(struct device_node *controller,
+					 int irq_base) { }
 static inline void irq_domain_generate_simple(const struct of_device_id *match,
 					u64 phys_base, unsigned int irq_start) { }
 #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/13 i2c: OMAP: Add DT support for i2c controller

In reply to Benoit Cousson

From: G, Manjunath Kondaiah <[email protected]>

Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if CONFIG_OF is enabled.

These changes will not affect non DT builds and existing functionality is retained.

[b-cousson at ti.com: fix the wrong freq calculation]
---
 drivers/i2c/busses/i2c-omap.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-omap.c +20 -3
index 2a072ff..4052279 100644
@@ -38,6 +38,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/of_i2c.h>
+#include <linux/of_device.h>
 #include <linux/slab.h>
 #include <linux/i2c-omap.h>
 #include <linux/pm_runtime.h>
@@ -972,6 +973,16 @@ static const struct i2c_algorithm omap_i2c_algo = {
 	.functionality	= omap_i2c_func,
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id omap_i2c_of_match[] = {
+	{.compatible = "ti,omap-i2c", },
+	{},
+}
+MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
+#else
+#define omap_i2c_of_match NULL
+#endif
+
 static int __devinit
 omap_i2c_probe(struct platform_device *pdev)
 {
@@ -1008,12 +1019,17 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_release_region;
 	}
 
+	speed = 100;	/* Default speed */
 	if (pdata != NULL) {
 		speed = pdata->clkrate;
 		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
-	} else {
-		speed = 100;	/* Default speed */
-		dev->set_mpu_wkup_lat = NULL;
+#if defined(CONFIG_OF)
+	} else if (pdev->dev.of_node) {
+		u32 prop;
+		if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
+					  &prop))
+			speed = prop / 1000; /* convert Hz into kHz */
+#endif
 	}
 
 	dev->speed = speed;
@@ -1178,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
 		.name	= "omap_i2c",
 		.owner	= THIS_MODULE,
 		.pm	= OMAP_I2C_PM_OPS,
+		.of_match_table = omap_i2c_of_match,
 	},
 };
 
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/13 documentation/dt: Add OMAP i2c bindings documentation

In reply to Benoit Cousson

From: G, Manjunath Kondaiah <[email protected]>

Add documentation for using omap i2c controller with device tree support enabled.

[b-cousson at ti.com: Update the documentaion with hwmods binding]
---
 Documentation/devicetree/bindings/i2c/omap-i2c.txt |   30 ++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +30 -0
new file mode 100644
index 0000000..0dc1de0
@@ -0,0 +1,30 @@
+I2C for OMAP platforms
+
+Required properties :
+- compatible : Must be "ti,omap-i2c"
+- hwmods : Must be "i2c<n>", n being the instance number (1-based)
+- #address-cells = <1>;
+- #size-cells = <0>;
+
+Recommended properties :
+- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise
+  the default 100 kHz frequency will be used.
+
+Optional properties:
+- Child nodes conforming to i2c bus binding
+
+Note: Current implementation will fetch base address, irq and dma
+from omap hwmod data base during device registration.
+Future plan is to migrate hwmod data base contents into device tree
+blob so that, all the required data will be used from device tree dts
+file.
+
+Examples :
+
+i2c1: i2c at 0 {
+    compatible = "ti,omap-i2c";
+    #address-cells = <1>;
+    #size-cells = <0>;
+    hwmods = "i2c1";
+    clock-frequency = <400000>;
+};
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 4/13 mfd: twl-core: Add initial DT support for twl4030/twl6030

In reply to Benoit Cousson

Add initial device-tree support for twl familly chips. The current version is missing the regulator entries due to the lack of DT regulator bindings for the moment. Only the simple sub-modules that do not depend on platform_data information can be initialized properly.

Cc Balaji T K <[email protected]>
Cc Graeme Gregory <[email protected]>
Cc Samuel Ortiz <[email protected]>
---
 drivers/mfd/twl-core.c |   99 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 95 insertions(+), 4 deletions(-)
drivers/mfd/twl-core.c +95 -4
index 01ecfee..a12af12 100644
@@ -33,6 +33,9 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/slab.h>
+#include <linux/of_irq.h>
+#include <linux/irqdomain.h>
 
 #include <linux/regulator/machine.h>
 
@@ -633,6 +636,55 @@ add_regulator(int num, struct regulator_init_data *pdata,
 	return add_regulator_linked(num, pdata, NULL, 0, features);
 }
 
+#ifdef CONFIG_OF
+#define MODALIAS_SIZE 32
+
+static int add_of_children(struct i2c_client *client, unsigned long features)
+{
+	u32 reg;
+	struct device *child, *dev = &client->dev;
+	struct device_node *node, *parent = client->dev.of_node;
+	int irq;
+	char alias[MODALIAS_SIZE];
+
+	for_each_child_of_node(parent, node) {
+		if (of_property_read_u32(node, "reg", &reg)) {
+			dev_err(dev, "%s(): invalid reg on %s\n", __func__,
+				node->full_name);
+			continue;
+		}
+
+		irq = irq_of_parse_and_map(node, 0);
+
+		if (of_modalias_node(node, alias, MODALIAS_SIZE)) {
+			dev_err(dev, "%s(): modalias failure on %s\n", __func__,
+				node->full_name);
+			continue;
+		}
+
+		if (of_device_is_compatible(node, "ti,twl_reg")) {
+			dev_dbg(dev, " %s(): add_regulator\n", __func__);
+			child = NULL;
+		} else {
+			dev_dbg(dev, " %s(): add_child\n", __func__);
+			child = add_child(reg, alias, NULL, 0, true, irq, 0);
+		}
+
+		if (IS_ERR(child)) {
+			dev_err(dev, " %s(): add_child failed: %ld\n", __func__,
+				PTR_ERR(child));
+			continue;
+		}
+	}
+	return 0;
+}
+#else
+static int add_of_children(struct device_node *parent, unsigned long features)
+{
+	return 0;
+}
+#endif
+
 /*
  * NOTE:  We know the first 8 IRQs after pdata->base_irq are
  * for the PIH, and the next are for the PWR_INT SIH, since
@@ -1182,22 +1234,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	int				status;
 	unsigned			i;
 	struct twl4030_platform_data	*pdata = client->dev.platform_data;
+	struct device_node		*node = client->dev.of_node;
 	u8 temp;
 	int ret = 0;
 
+	if (node && !pdata) {
+		/*
+		 * XXX: Temporary fake pdata until the information
+		 * is correctly retrieved by every TWL modules from DT.
+		 */
+		pdata = kzalloc(sizeof(struct twl4030_platform_data),
+				GFP_KERNEL);
+		if (!pdata) {
+			status = -ENOMEM;
+			goto exit;
+		}
+
+		/*
+		 * XXX: For the moment the IRQs for TWL seems to be encoded in
+		 * the global OMAP space. That should be cleaned to allow
+		 * dynamically adding a new IRQ controller.
+		 */
+		if ((id->driver_data) & TWL6030_CLASS) {
+			pdata->irq_base = TWL6030_IRQ_BASE;
+			pdata->irq_end = pdata->irq_base + TWL6030_BASE_NR_IRQS;
+		} else {
+			pdata->irq_base = TWL4030_IRQ_BASE;
+			pdata->irq_end = pdata->irq_base + TWL4030_BASE_NR_IRQS;
+		}
+		irq_domain_add_simple(node, pdata->irq_base);
+	}
+
 	if (!pdata) {
 		dev_dbg(&client->dev, "no platform data?\n");
-		return -EINVAL;
+		status = -EINVAL;
+		goto fail_free;
 	}
 
 	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
 		dev_dbg(&client->dev, "can't talk I2C?\n");
-		return -EIO;
+		status = -EIO;
+		goto fail_free;
 	}
 
 	if (inuse) {
 		dev_dbg(&client->dev, "driver is already in use\n");
-		return -EBUSY;
+		status = -EBUSY;
+		goto fail_free;
 	}
 
 	for (i = 0; i < TWL_NUM_SLAVES; i++) {
@@ -1269,10 +1352,18 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
 	}
 
-	status = add_children(pdata, id->driver_data);
+	if (node)
+		status = add_of_children(client, id->driver_data);
+	else
+		status = add_children(pdata, id->driver_data);
+
 fail:
 	if (status < 0)
 		twl_remove(client);
+fail_free:
+	if (node)
+		kfree(pdata);
+exit:
 	return status;
 }
 
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 4/13 mfd: twl-core: Add initial DT support for twl4030/twl6030

Quoted 8 lines · On Thursday 01 September 2011 19:21:20 Benoit Cousson wrote:
drivers/mfd/twl-core.c +8 -0
+#ifdef CONFIG_OF
+#define MODALIAS_SIZE 32
+
+static int add_of_children(struct i2c_client *client, unsigned long features)
+{
+       u32 reg;
+       struct device *child, *dev = &client->dev;
+       struct device_node *node, *parent = client->dev.of_node;

drivers/mfd/twl-core.c add_regulator(int num, struct regulator_init_data *pdata, · line 656

Quoted 10 lines
drivers/mfd/twl-core.c +10 -0
+       int irq;
+       char alias[MODALIAS_SIZE];
+
+       for_each_child_of_node(parent, node) {
+               if (of_property_read_u32(node, "reg", &reg)) {
+                       dev_err(dev, "%s(): invalid reg on %s\n", __func__,
+                               node->full_name);
+                       continue;
+               }
+

Have you tried just calling calling of_platform_bus_probe on the parent? If all child devices are in the device tree, I think that should work, too. It probably requires some tweaking in the child drivers though.

Arnd

#6 lore raw

PATCH 4/13 mfd: twl-core: Add initial DT support for twl4030/twl6030

Quoted 16 lines · Arnd Bergmann
Quoted 15 lines · On Thursday 01 September 2011 19:21:20 Benoit Cousson wrote:
drivers/mfd/twl-core.c +15 -0
+#ifdef CONFIG_OF
+#define MODALIAS_SIZE 32
+
+static int add_of_children(struct i2c_client *client, unsigned long features)
+{
+       u32 reg;
+       struct device *child, *dev =&client->dev;
+       struct device_node *node, *parent = client->dev.of_node;
+       int irq;
+       char alias[MODALIAS_SIZE];
+
+       for_each_child_of_node(parent, node) {
+               if (of_property_read_u32(node, "reg",&reg)) {
+                       dev_err(dev, "%s(): invalid reg on %s\n", __func__,
+                               node->full_name);
Quoted 8 lines

drivers/mfd/twl-core.c add_regulator(int num, struct regulator_init_data *pdata, · line 656

Quoted 3 lines
drivers/mfd/twl-core.c +3 -0
+                       continue;
+               }
+

Have you tried just calling calling of_platform_bus_probe on the parent? If all child devices are in the device tree, I think that should work, too. It probably requires some tweaking in the child drivers though.

Good point. That should indeed work for the current children since the add_numbered_child is just creating a platform_device.
On top of that, this function is filling some IRQ resources, but DT will do that for free and in a much better way thanks to the irq_domain.

I had some concern with the regulator devices that does require some custom pdata for the moment, but that should disappear as soon as the proper regulator binding will be there.

Since the idea is to move all the children to DT, this is definitively the best approach. I'll update the driver to support the DT binding too.

Thanks for the suggestion. I'll try that and repost if it works as expected. But it should... at least for the twl_rtc.

Benoit

#7 lore raw

PATCH 5/13 documentation/dt: Add TWL4030 and TWL6030 bindings

In reply to Benoit Cousson

Add documentation for the Texas Instruments TWL Integrated Chip.

---
 .../devicetree/bindings/mfd/twl-familly.txt        |   47 ++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
Documentation/devicetree/bindings/mfd/twl-familly.txt new file +47 -0
new file mode 100644
index 0000000..ff4cacd
@@ -0,0 +1,47 @@
+Texas Instruments TWL family
+
+The TWLs are Integrated Power Management Chips.
+Some version might contain much more analog function like
+USB transceiver or Audio amplifier.
+These chips are connected to an i2c bus.
+
+
+Required properties:
+- compatible : Must be "ti,twl4030";
+  For Integrated power-management/audio CODEC device used in OMAP3
+  based boards
+- compatible : Must be "ti,twl6030";
+  For Integrated power-management used in OMAP4 based boards
+- interrupts : This i2c device has an IRQ line connected to the main SoC
+- interrupt-controller : Since the twl support several interrupts internally,
+  it is considered as an interrupt controller cascaded to the SoC one.
+- #interrupt-cells = <1>;
+- interrupt-parent : The parent interrupt controller.
+
+Optional node:
+- Child nodes contain in the twl. The twl family is made of severals variants
+  that support a different number of features.
+  The children nodes will thus depend of the capabilty of the variant.
+
+
+Example:
+/*
+ * Integrated Power Management Chip
+ * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+ */
+twl at 48 {
+    compatible = "ti,twl6030";
+    reg = <0x48>;
+    interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
+    interrupt-controller;
+    #interrupt-cells = <1>;
+    interrupt-parent = <&gic>;
+    #address-cells = <1>;
+    #size-cells = <0>;
+
+    twl_rtc {
+        compatible = "ti,twl_rtc";
+        interrupts = <11>;
+        reg = <0>;
+    };
+};
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH 6/13 arm/dts: OMAP4: Add i2c controller nodes

In reply to Benoit Cousson

Add i2c controllers nodes into the main ocp bus.

Cc G, Manjunath Kondaiah <[email protected]>
---
 arch/arm/boot/dts/omap4.dtsi |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4.dtsi +32 -0
index b5c798c..fb81a4d 100644
@@ -21,6 +21,10 @@
 	interrupt-parent = <&gic>;
 
 	aliases {
+		i2c1 = &i2c1;
+		i2c2 = &i2c2;
+		i2c3 = &i2c3;
+		i2c4 = &i2c4;
 	};
 
 	/*
@@ -178,5 +182,33 @@
 			#gpio-cells = <2>;
 			gpio-controller;
 		};
+
+		i2c1: i2c at 1 {
+			compatible = "ti,omap4-i2c", "ti,omap-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hwmods = "i2c1";
+		};
+
+		i2c2: i2c at 2 {
+			compatible = "ti,omap4-i2c", "ti,omap-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hwmods = "i2c2";
+		};
+
+		i2c3: i2c at 3 {
+			compatible = "ti,omap4-i2c", "ti,omap-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hwmods = "i2c3";
+		};
+
+		i2c4: i2c at 4 {
+			compatible = "ti,omap4-i2c", "ti,omap-i2c";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hwmods = "i2c4";
+		};
 	};
 };
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH 7/13 arm/dts: omap4-sdp: Set clock freq for i2c controllers

In reply to Benoit Cousson

Update DTS file with required clock frequencies
for the i2c client devices existing on sdp4430.

---
 arch/arm/boot/dts/omap4-sdp.dts |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-sdp.dts +18 -0
index 066e28c..ed85b35 100644
@@ -26,4 +26,22 @@
 		device_type = "memory";
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
+
+
+};
+
+&i2c1 {
+	clock-frequency = <400000>;
+};
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&i2c3 {
+	clock-frequency = <400000>;
+};
+
+&i2c4 {
+	clock-frequency = <400000>;
 };
Signature · 1 line
1.7.0.4
#10 lore raw

PATCH 8/13 arm/dts: omap4-panda: Set clock freq for i2c controllers

In reply to Benoit Cousson

From: G, Manjunath Kondaiah <[email protected]>

Update pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.

[b-cousson at ti.com: Fix the wrong use of reference and wrong clock value]

---
 arch/arm/boot/dts/omap4-panda.dts |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda.dts +16 -0
index c702657..63ecf34 100644
@@ -27,3 +27,19 @@
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
 };
+
+&i2c1 {
+	clock-frequency = <400000>;
+};
+
+&i2c2 {
+	clock-frequency = <400000>;
+};
+
+&i2c3 {
+	clock-frequency = <100000>;
+};
+
+&i2c4 {
+	clock-frequency = <400000>;
+};
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH 9/13 arm/dts: omap4-sdp: Add twl6030 node

In reply to Benoit Cousson

Add the twl6030 node inside the i2c1 controller node. Add the RTC submodule inside the twl node.

This is just the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.

---
 arch/arm/boot/dts/omap4-sdp.dts |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap4-sdp.dts +23 -2
index ed85b35..d03f2e7 100644
@@ -26,12 +26,33 @@
 		device_type = "memory";
 		reg = <0x80000000 0x40000000>; /* 1 GB */
 	};
-
-
 };
 
 &i2c1 {
 	clock-frequency = <400000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+	 */
+	twl at 48 {
+		compatible = "ti,twl6030";
+		reg = <0x48>;
+		interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&gic>;
+		/* twl is a MFD, so it will contain a bunch of sub-ips */
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ranges = <0 0x48>;
+
+		twl_rtc {
+			compatible = "ti,twl_rtc";
+			interrupts = <11>;
+			reg = <0>;
+		};
+	};
 };
 
 &i2c2 {
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH 10/13 arm/dts: omap4-panda: Add twl6030 node

In reply to Benoit Cousson

Add the twl6030 node in i2c1 controller.

This is just the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.

---
 arch/arm/boot/dts/omap4-panda.dts |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda.dts +23 -0
index 63ecf34..5c1c2a7 100644
@@ -30,6 +30,29 @@
 
 &i2c1 {
 	clock-frequency = <400000>;
+
+	/*
+	 * Integrated Power Management Chip
+	 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
+	 */
+	twl at 48 {
+		compatible = "ti,twl6030";
+		reg = <0x48>;
+		interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		interrupt-parent = <&gic>;
+		/* twl is a MFD, so it will contain a bunch of sub-ips */
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ranges = <0 0x48>;
+
+		twl_rtc {
+			compatible = "ti,twl_rtc";
+			interrupts = <11>;
+			reg = <0>;
+		};
+	};
 };
 
 &i2c2 {
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH 11/13 OMAP4: board-dt: Remove static i2c init

In reply to Benoit Cousson

Since the minimal DT support is there to initialize properly the twl6030, remove the static init from the board file.

---
 arch/arm/mach-omap2/board-omap4-dt.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/board-omap4-dt.c +0 -15
index 5688cd5..cefe0a6 100644
@@ -51,20 +51,6 @@ static struct of_device_id omap_dt_gic_match[] __initdata = {
 	{}
 };
 
-/*
- * XXX: Still needed to boot until the i2c & twl driver is adapted to
- * device-tree
- */
-static struct twl4030_platform_data sdp4430_twldata = {
-	.irq_base	= TWL6030_IRQ_BASE,
-	.irq_end	= TWL6030_IRQ_END,
-};
-
-static void __init omap4_i2c_init(void)
-{
-	omap4_pmic_init("twl6030", &sdp4430_twldata);
-}
-
 static void __init omap4_init_machine(void)
 {
 	int package = OMAP_PACKAGE_CBS;
@@ -78,7 +64,6 @@ static void __init omap4_init_machine(void)
 		package = OMAP_PACKAGE_CBL;
 	omap4_mux_init(NULL, NULL, package);
 
-	omap4_i2c_init();
 	/*
 	 * XXX: Still needed to boot until the omap-serial driver is adapted
 	 * to device-tree
Signature · 1 line
1.7.0.4
#14 lore raw

PATCH 12/13 arm/dts: omap4-sdp: Add i2c3 & i2c4 devices

In reply to Benoit Cousson
---
 arch/arm/boot/dts/omap4-sdp.dts |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-sdp.dts +27 -0
index d03f2e7..14faf92 100644
@@ -61,8 +61,35 @@
 
 &i2c3 {
 	clock-frequency = <400000>;
+
+	/*
+	 * Temperature Sensor
+	 * http://www.ti.com/lit/ds/symlink/tmp105.pdf
+	 */
+	tmp105 at 48 {
+		compatible = "ti,tmp105";
+		reg = <0x48>;
+	};
+
+	/*
+	 * Ambient Light Sensor
+	 * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf
+	 */
+	bh1780 at 29 {
+		compatible = "rohm,bh1780";
+		reg = <0x29>;
+	};
 };
 
 &i2c4 {
 	clock-frequency = <400000>;
+
+	/*
+	 * 3-Axis Digital Compass
+	 * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf
+	 */
+	hmc5843 at 1e {
+		compatible = "honeywell,hmc5843";
+		reg = <0x1e>;
+	};
 };
Signature · 1 line
1.7.0.4
#15 lore raw

PATCH 13/13 arm/dts: omap4-panda: Add EEPROM entry in i2c3

In reply to Benoit Cousson

Add a generic i2c EEPROM entry.

---
 arch/arm/boot/dts/omap4-panda.dts |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda.dts +9 -0
index 5c1c2a7..0a83e3f 100644
@@ -61,6 +61,15 @@
 
 &i2c3 {
 	clock-frequency = <100000>;
+
+	/*
+	 * Display monitor features are burnt in their EEPROM as EDID data.
+	 * The EEPROM is connected as I2C slave device.
+	 */
+	eeprom at 50 {
+		compatible = "ti,eeprom";
+		reg = <0x50>;
+	};
 };
 
 &i2c4 {
Signature · 1 line
1.7.0.4
#16 lore raw

cover OMAP4: Add DT support for i2c and twl6030

In reply to Benoit Cousson
Quoted 15 lines · On Thursday 01 September 2011 19:21:16 Benoit Cousson wrote:

This is a rework of the original series done by Manju:
http://www.spinics.net/lists/linux-omap/msg55827.html

It fixes the main issue of the previous series that was not booting at all due to the lack of twl support. That fix is mandatory to allow further work on the regulators DT bindings.
In order to have a minimal i2c support, both i2c and twl must be added at the same time.
Please note than some patches can be reshuffle with the previous OMAP4 series to avoid the intermediate step with static i2c initialization.

That series is as well using the hwmods binding introduced in my previous series.
The OMAP3/beagle support will be added in an other series.

Quoted 7 lines

A couple of basic i2c devices are added for panda and sdp board.

Patches are based on for_3.2/4_omap4_dt_early_devices + devicetree/test and are available here:
git://gitorious.org/omap-pm/linux.git for_3.2/5_omap_dt_i2c_twl

Tested on PandaBoard and sdp4430.

I think this is great stuff. I missed the original series, but it's definitely good to see progress on this!

Arnd