]> Pileus Git - ~andy/linux/commitdiff
i2c: tegra: Support DVC controller in device tree
authorStephen Warren <swarren@nvidia.com>
Sun, 18 Dec 2011 06:29:30 +0000 (23:29 -0700)
committerOlof Johansson <olof@lixom.net>
Tue, 20 Dec 2011 01:54:20 +0000 (17:54 -0800)
One of the Tegra I2C blocks is inside the DVC (Digital Voltage Controller)
block. This block is identical to the rest of the I2C blocks, except that
it only supports master mode, it has registers moved around, and it needs
some extra init to get it into I2C mode.  The register moves are handled
by i2c_readl and i2c_writel

This patch adds a new compatible value for controllers of this "DVC"
type; I figured that this approach was reasonable, as opposed to adding
an is-dvc property under the existing compatible value, since the HW
truly is different.

v2: Call of_device_is_compatible() to determine is_dvc, instead of storing
the flag in tegra_i2c_of_match[]'s .data field.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
drivers/i2c/busses/i2c-tegra.c

index e8560ed3d3c8c71ab034175af4dbc139c767e13c..6381604696d304a0508b23778ac04fe7ee05ef08 100644 (file)
@@ -636,7 +636,10 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
                        i2c_dev->bus_clk_rate = be32_to_cpup(prop);
        }
 
-       if (pdev->id == 3)
+       if (pdev->dev.of_node)
+               i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
+                                               "nvidia,tegra20-i2c-dvc");
+       else if (pdev->id == 3)
                i2c_dev->is_dvc = 1;
        init_completion(&i2c_dev->msg_complete);
 
@@ -742,6 +745,7 @@ static int tegra_i2c_resume(struct platform_device *pdev)
 /* Match table for of_platform binding */
 static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
        { .compatible = "nvidia,tegra20-i2c", },
+       { .compatible = "nvidia,tegra20-i2c-dvc", },
        {},
 };
 MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);