i2c: tegra: assume CONFIG_OF, remove platform data
authorStephen Warren <swarren@nvidia.com>
Thu, 21 Mar 2013 08:08:46 +0000 (08:08 +0000)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 24 Mar 2013 09:30:55 +0000 (10:30 +0100)
Tegra only supports, and always enables, device tree. Remove all ifdefs
and runtime checks for DT support from the driver. Platform data is
therefore no longer required. Delete the header that defines it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
arch/arm/mach-tegra/board-dt-tegra20.c
drivers/i2c/busses/i2c-tegra.c
include/linux/i2c-tegra.h [deleted file]

index a0edf2510280b60e559c50dce3731927a11de635..6e1c9a91848fb65dd6be4d7de9575af59584d13e 100644 (file)
@@ -30,8 +30,6 @@
 #include <linux/pda_power.h>
 #include <linux/platform_data/tegra_usb.h>
 #include <linux/io.h>
-#include <linux/i2c.h>
-#include <linux/i2c-tegra.h>
 #include <linux/usb/tegra_usb_phy.h>
 
 #include <asm/mach-types.h>
index b714776b6ddd1828258ee1a81d33728d1aba3c75..b60ff90adc39a92ed3940a53076d53cf6f7ae4f6 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/i2c-tegra.h>
 #include <linux/of_i2c.h>
 #include <linux/of_device.h>
 #include <linux/module.h>
@@ -172,7 +171,7 @@ struct tegra_i2c_dev {
        u8 *msg_buf;
        size_t msg_buf_remaining;
        int msg_read;
-       unsigned long bus_clk_rate;
+       u32 bus_clk_rate;
        bool is_suspended;
 };
 
@@ -694,7 +693,6 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
        .clk_divisor_std_fast_mode = 0x19,
 };
 
-#if defined(CONFIG_OF)
 /* Match table for of_platform binding */
 static const struct of_device_id tegra_i2c_of_match[] = {
        { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, },
@@ -704,16 +702,13 @@ static const struct of_device_id tegra_i2c_of_match[] = {
        {},
 };
 MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
-#endif
 
 static int tegra_i2c_probe(struct platform_device *pdev)
 {
        struct tegra_i2c_dev *i2c_dev;
-       struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
        struct resource *res;
        struct clk *div_clk;
        struct clk *fast_clk;
-       const unsigned int *prop;
        void __iomem *base;
        int irq;
        int ret = 0;
@@ -754,23 +749,16 @@ static int tegra_i2c_probe(struct platform_device *pdev)
        i2c_dev->cont_id = pdev->id;
        i2c_dev->dev = &pdev->dev;
 
-       i2c_dev->bus_clk_rate = 100000; /* default clock rate */
-       if (pdata) {
-               i2c_dev->bus_clk_rate = pdata->bus_clk_rate;
-
-       } else if (i2c_dev->dev->of_node) {    /* if there is a device tree node ... */
-               prop = of_get_property(i2c_dev->dev->of_node,
-                               "clock-frequency", NULL);
-               if (prop)
-                       i2c_dev->bus_clk_rate = be32_to_cpup(prop);
-       }
+       ret = of_property_read_u32(i2c_dev->dev->of_node, "clock-frequency",
+                                       &i2c_dev->bus_clk_rate);
+       if (ret)
+               i2c_dev->bus_clk_rate = 100000; /* default clock rate */
 
        i2c_dev->hw = &tegra20_i2c_hw;
 
        if (pdev->dev.of_node) {
                const struct of_device_id *match;
-               match = of_match_device(of_match_ptr(tegra_i2c_of_match),
-                                               &pdev->dev);
+               match = of_match_device(tegra_i2c_of_match, &pdev->dev);
                i2c_dev->hw = match->data;
                i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
                                                "nvidia,tegra20-i2c-dvc");
@@ -876,7 +864,7 @@ static struct platform_driver tegra_i2c_driver = {
        .driver  = {
                .name  = "tegra-i2c",
                .owner = THIS_MODULE,
-               .of_match_table = of_match_ptr(tegra_i2c_of_match),
+               .of_match_table = tegra_i2c_of_match,
                .pm    = TEGRA_I2C_PM,
        },
 };
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h
deleted file mode 100644 (file)
index 9c85da4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * drivers/i2c/busses/i2c-tegra.c
- *
- * Copyright (C) 2010 Google, Inc.
- * Author: Colin Cross <ccross@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _LINUX_I2C_TEGRA_H
-#define _LINUX_I2C_TEGRA_H
-
-struct tegra_i2c_platform_data {
-       unsigned long bus_clk_rate;
-};
-
-#endif /* _LINUX_I2C_TEGRA_H */