* [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030
@ 2011-09-01 17:21 Benoit Cousson
2011-09-01 17:21 ` [PATCH 01/13] irq: Add stub for none DT build in irqdomain.h Benoit Cousson
` (13 more replies)
0 siblings, 14 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/13] irq: Add stub for none DT build in irqdomain.h
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 02/13] i2c: OMAP: Add DT support for i2c controller Benoit Cousson
` (12 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Add an empty funtion to allow building a file without
adding some #ifdef CONFIG_OF around of APIs.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Grant Likely <grant.likely@secretlab.ca>
---
include/linux/irqdomain.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index e807ad6..6fa08ab 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -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 */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/13] i2c: OMAP: Add DT support for i2c controller
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
2011-09-01 17:21 ` [PATCH 01/13] irq: Add stub for none DT build in irqdomain.h Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 03/13] documentation/dt: Add OMAP i2c bindings documentation Benoit Cousson
` (11 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
From: G, Manjunath Kondaiah <manjugk@ti.com>
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.
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
[b-cousson at ti.com: fix the wrong freq calculation]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 2a072ff..4052279 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -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,
},
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/13] documentation/dt: Add OMAP i2c bindings documentation
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
2011-09-01 17:21 ` [PATCH 01/13] irq: Add stub for none DT build in irqdomain.h Benoit Cousson
2011-09-01 17:21 ` [PATCH 02/13] i2c: OMAP: Add DT support for i2c controller Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030 Benoit Cousson
` (10 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
From: G, Manjunath Kondaiah <manjugk@ti.com>
Add documentation for using omap i2c controller with device
tree support enabled.
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
[b-cousson at ti.com: Update the documentaion with hwmods binding]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
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
diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
new file mode 100644
index 0000000..0dc1de0
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
@@ -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>;
+};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (2 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 03/13] documentation/dt: Add OMAP i2c bindings documentation Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 18:27 ` Arnd Bergmann
2011-09-01 17:21 ` [PATCH 05/13] documentation/dt: Add TWL4030 and TWL6030 bindings Benoit Cousson
` (9 subsequent siblings)
13 siblings, 1 reply; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Balaji T K <balajitk@ti.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Samuel Ortiz <sameo@linux.intel.com>
---
drivers/mfd/twl-core.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 95 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 01ecfee..a12af12 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -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", ®)) {
+ 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;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/13] documentation/dt: Add TWL4030 and TWL6030 bindings
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (3 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030 Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 06/13] arm/dts: OMAP4: Add i2c controller nodes Benoit Cousson
` (8 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Add documentation for the Texas Instruments TWL Integrated Chip.
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
.../devicetree/bindings/mfd/twl-familly.txt | 47 ++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
diff --git a/Documentation/devicetree/bindings/mfd/twl-familly.txt b/Documentation/devicetree/bindings/mfd/twl-familly.txt
new file mode 100644
index 0000000..ff4cacd
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/twl-familly.txt
@@ -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>;
+ };
+};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/13] arm/dts: OMAP4: Add i2c controller nodes
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (4 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 05/13] documentation/dt: Add TWL4030 and TWL6030 bindings Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 07/13] arm/dts: omap4-sdp: Set clock freq for i2c controllers Benoit Cousson
` (7 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Add i2c controllers nodes into the main ocp bus.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: G, Manjunath Kondaiah <manjugk@ti.com>
---
arch/arm/boot/dts/omap4.dtsi | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index b5c798c..fb81a4d 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -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";
+ };
};
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/13] arm/dts: omap4-sdp: Set clock freq for i2c controllers
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (5 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 06/13] arm/dts: OMAP4: Add i2c controller nodes Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 08/13] arm/dts: omap4-panda: " Benoit Cousson
` (6 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Update DTS file with required clock frequencies
for the i2c client devices existing on sdp4430.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/boot/dts/omap4-sdp.dts | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 066e28c..ed85b35 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -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>;
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/13] arm/dts: omap4-panda: Set clock freq for i2c controllers
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (6 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 07/13] arm/dts: omap4-sdp: Set clock freq for i2c controllers Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 09/13] arm/dts: omap4-sdp: Add twl6030 node Benoit Cousson
` (5 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
From: G, Manjunath Kondaiah <manjugk@ti.com>
Update pandaboard dts file with required clock frequencies
for the i2c client devices existing on pandaboard.
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
[b-cousson at ti.com: Fix the wrong use of reference and
wrong clock value]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/boot/dts/omap4-panda.dts | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index c702657..63ecf34 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -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>;
+};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/13] arm/dts: omap4-sdp: Add twl6030 node
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (7 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 08/13] arm/dts: omap4-panda: " Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 10/13] arm/dts: omap4-panda: " Benoit Cousson
` (4 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
arch/arm/boot/dts/omap4-sdp.dts | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index ed85b35..d03f2e7 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -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 {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/13] arm/dts: omap4-panda: Add twl6030 node
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (8 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 09/13] arm/dts: omap4-sdp: Add twl6030 node Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 11/13] OMAP4: board-dt: Remove static i2c init Benoit Cousson
` (3 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
---
arch/arm/boot/dts/omap4-panda.dts | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 63ecf34..5c1c2a7 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -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 {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/13] OMAP4: board-dt: Remove static i2c init
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (9 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 10/13] arm/dts: omap4-panda: " Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 12/13] arm/dts: omap4-sdp: Add i2c3 & i2c4 devices Benoit Cousson
` (2 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Since the minimal DT support is there to initialize
properly the twl6030, remove the static init from
the board file.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-omap4-dt.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap4-dt.c b/arch/arm/mach-omap2/board-omap4-dt.c
index 5688cd5..cefe0a6 100644
--- a/arch/arm/mach-omap2/board-omap4-dt.c
+++ b/arch/arm/mach-omap2/board-omap4-dt.c
@@ -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
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/13] arm/dts: omap4-sdp: Add i2c3 & i2c4 devices
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (10 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 11/13] OMAP4: board-dt: Remove static i2c init Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 17:21 ` [PATCH 13/13] arm/dts: omap4-panda: Add EEPROM entry in i2c3 Benoit Cousson
2011-09-01 19:14 ` [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Arnd Bergmann
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/boot/dts/omap4-sdp.dts | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index d03f2e7..14faf92 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -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>;
+ };
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/13] arm/dts: omap4-panda: Add EEPROM entry in i2c3
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (11 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 12/13] arm/dts: omap4-sdp: Add i2c3 & i2c4 devices Benoit Cousson
@ 2011-09-01 17:21 ` Benoit Cousson
2011-09-01 19:14 ` [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Arnd Bergmann
13 siblings, 0 replies; 17+ messages in thread
From: Benoit Cousson @ 2011-09-01 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Add a generic i2c EEPROM entry.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
arch/arm/boot/dts/omap4-panda.dts | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 5c1c2a7..0a83e3f 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -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 {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030
2011-09-01 17:21 ` [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030 Benoit Cousson
@ 2011-09-01 18:27 ` Arnd Bergmann
2011-09-05 16:05 ` Cousson, Benoit
0 siblings, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2011-09-01 18:27 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 01 September 2011 19:21:20 Benoit Cousson wrote:
> +#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", ®)) {
> + 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
` (12 preceding siblings ...)
2011-09-01 17:21 ` [PATCH 13/13] arm/dts: omap4-panda: Add EEPROM entry in i2c3 Benoit Cousson
@ 2011-09-01 19:14 ` Arnd Bergmann
13 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2011-09-01 19:14 UTC (permalink / raw)
To: linux-arm-kernel
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.
>
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030
2011-09-01 18:27 ` Arnd Bergmann
@ 2011-09-05 16:05 ` Cousson, Benoit
0 siblings, 0 replies; 17+ messages in thread
From: Cousson, Benoit @ 2011-09-05 16:05 UTC (permalink / raw)
To: linux-arm-kernel
On 9/1/2011 8:27 PM, Arnd Bergmann wrote:
> On Thursday 01 September 2011 19:21:20 Benoit Cousson wrote:
>> +#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",®)) {
>> + 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.
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
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-09-05 16:05 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01 17:21 [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
2011-09-01 17:21 ` [PATCH 01/13] irq: Add stub for none DT build in irqdomain.h Benoit Cousson
2011-09-01 17:21 ` [PATCH 02/13] i2c: OMAP: Add DT support for i2c controller Benoit Cousson
2011-09-01 17:21 ` [PATCH 03/13] documentation/dt: Add OMAP i2c bindings documentation Benoit Cousson
2011-09-01 17:21 ` [PATCH 04/13] mfd: twl-core: Add initial DT support for twl4030/twl6030 Benoit Cousson
2011-09-01 18:27 ` Arnd Bergmann
2011-09-05 16:05 ` Cousson, Benoit
2011-09-01 17:21 ` [PATCH 05/13] documentation/dt: Add TWL4030 and TWL6030 bindings Benoit Cousson
2011-09-01 17:21 ` [PATCH 06/13] arm/dts: OMAP4: Add i2c controller nodes Benoit Cousson
2011-09-01 17:21 ` [PATCH 07/13] arm/dts: omap4-sdp: Set clock freq for i2c controllers Benoit Cousson
2011-09-01 17:21 ` [PATCH 08/13] arm/dts: omap4-panda: " Benoit Cousson
2011-09-01 17:21 ` [PATCH 09/13] arm/dts: omap4-sdp: Add twl6030 node Benoit Cousson
2011-09-01 17:21 ` [PATCH 10/13] arm/dts: omap4-panda: " Benoit Cousson
2011-09-01 17:21 ` [PATCH 11/13] OMAP4: board-dt: Remove static i2c init Benoit Cousson
2011-09-01 17:21 ` [PATCH 12/13] arm/dts: omap4-sdp: Add i2c3 & i2c4 devices Benoit Cousson
2011-09-01 17:21 ` [PATCH 13/13] arm/dts: omap4-panda: Add EEPROM entry in i2c3 Benoit Cousson
2011-09-01 19:14 ` [PATCH 00/13] OMAP4: Add DT support for i2c and twl6030 Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).