Thread (17 messages) 17 messages, 3 authors, 2011-12-23

[PATCH v3 02/11] i2c: OMAP: Add DT support for i2c controller

From: Rob Herring <hidden>
Date: 2011-12-20 16:42:43
Also in: linux-devicetree, linux-omap

On 12/20/2011 10:27 AM, Benoit Cousson wrote:
Add initial DT support to retrieve the frequency using a
DT attribute instead of the pdata pointer if of_node exist.

Add documentation for omap i2c controller binding.

Based on original patches from Manju and Grant.

Signed-off-by: Benoit Cousson <redacted>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kevin Hilman <redacted>
One issue below, otherwise:

Reviewed-by: Rob Herring <redacted>

quoted hunk ↗ jump to hunk
@@ -1001,15 +1019,24 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_release_region;
 	}
 
-	if (pdata != NULL) {
-		speed = pdata->clkrate;
+	match = of_match_device(omap_i2c_of_match, &pdev->dev);
+	if (match) {
+		u32 freq = 100000; /* default to 100000 Hz */
+
+		pdata = match->data;
+		dev->dtrev = pdata->rev;
+		dev->flags = pdata->flags;
+
+		of_property_read_u32(node, "clock-frequency", &freq);
+		/* convert DT freq value in Hz into kHz for speed */
+		dev->speed = freq / 1000;
+	} else if (pdata != NULL) {
+		dev->speed = pdata->clkrate;
+		dev->flags = pdata->flags;
 		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
-	} else {
-		speed = 100;	/* Default speed */
-		dev->set_mpu_wkup_lat = NULL;
+		dev->dtrev = pdata->rev;
If you get here, pdata is NULL.

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help