aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-03-21 04:08:46 -0400
committerWolfram Sang <wsa@the-dreams.de>2013-03-24 05:30:55 -0400
commit49a64ac555f1dabd2b94325553187d0db6ecac16 (patch)
tree460fbc0d904e8169e01c95480e22e9dca41fb03a
parentfe69c555ef4df4f3c7bc704bc1858c174832a069 (diff)
i2c: tegra: assume CONFIG_OF, remove platform data
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>
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c2
-rw-r--r--drivers/i2c/busses/i2c-tegra.c26
-rw-r--r--include/linux/i2c-tegra.h25
3 files changed, 7 insertions, 46 deletions
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index a0edf2510280..6e1c9a91848f 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -30,8 +30,6 @@
30#include <linux/pda_power.h> 30#include <linux/pda_power.h>
31#include <linux/platform_data/tegra_usb.h> 31#include <linux/platform_data/tegra_usb.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/i2c.h>
34#include <linux/i2c-tegra.h>
35#include <linux/usb/tegra_usb_phy.h> 33#include <linux/usb/tegra_usb_phy.h>
36 34
37#include <asm/mach-types.h> 35#include <asm/mach-types.h>
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index b714776b6ddd..b60ff90adc39 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -25,7 +25,6 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/i2c-tegra.h>
29#include <linux/of_i2c.h> 28#include <linux/of_i2c.h>
30#include <linux/of_device.h> 29#include <linux/of_device.h>
31#include <linux/module.h> 30#include <linux/module.h>
@@ -172,7 +171,7 @@ struct tegra_i2c_dev {
172 u8 *msg_buf; 171 u8 *msg_buf;
173 size_t msg_buf_remaining; 172 size_t msg_buf_remaining;
174 int msg_read; 173 int msg_read;
175 unsigned long bus_clk_rate; 174 u32 bus_clk_rate;
176 bool is_suspended; 175 bool is_suspended;
177}; 176};
178 177
@@ -694,7 +693,6 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
694 .clk_divisor_std_fast_mode = 0x19, 693 .clk_divisor_std_fast_mode = 0x19,
695}; 694};
696 695
697#if defined(CONFIG_OF)
698/* Match table for of_platform binding */ 696/* Match table for of_platform binding */
699static const struct of_device_id tegra_i2c_of_match[] = { 697static const struct of_device_id tegra_i2c_of_match[] = {
700 { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, }, 698 { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, },
@@ -704,16 +702,13 @@ static const struct of_device_id tegra_i2c_of_match[] = {
704 {}, 702 {},
705}; 703};
706MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); 704MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
707#endif
708 705
709static int tegra_i2c_probe(struct platform_device *pdev) 706static int tegra_i2c_probe(struct platform_device *pdev)
710{ 707{
711 struct tegra_i2c_dev *i2c_dev; 708 struct tegra_i2c_dev *i2c_dev;
712 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
713 struct resource *res; 709 struct resource *res;
714 struct clk *div_clk; 710 struct clk *div_clk;
715 struct clk *fast_clk; 711 struct clk *fast_clk;
716 const unsigned int *prop;
717 void __iomem *base; 712 void __iomem *base;
718 int irq; 713 int irq;
719 int ret = 0; 714 int ret = 0;
@@ -754,23 +749,16 @@ static int tegra_i2c_probe(struct platform_device *pdev)
754 i2c_dev->cont_id = pdev->id; 749 i2c_dev->cont_id = pdev->id;
755 i2c_dev->dev = &pdev->dev; 750 i2c_dev->dev = &pdev->dev;
756 751
757 i2c_dev->bus_clk_rate = 100000; /* default clock rate */ 752 ret = of_property_read_u32(i2c_dev->dev->of_node, "clock-frequency",
758 if (pdata) { 753 &i2c_dev->bus_clk_rate);
759 i2c_dev->bus_clk_rate = pdata->bus_clk_rate; 754 if (ret)
760 755 i2c_dev->bus_clk_rate = 100000; /* default clock rate */
761 } else if (i2c_dev->dev->of_node) { /* if there is a device tree node ... */
762 prop = of_get_property(i2c_dev->dev->of_node,
763 "clock-frequency", NULL);
764 if (prop)
765 i2c_dev->bus_clk_rate = be32_to_cpup(prop);
766 }
767 756
768 i2c_dev->hw = &tegra20_i2c_hw; 757 i2c_dev->hw = &tegra20_i2c_hw;
769 758
770 if (pdev->dev.of_node) { 759 if (pdev->dev.of_node) {
771 const struct of_device_id *match; 760 const struct of_device_id *match;
772 match = of_match_device(of_match_ptr(tegra_i2c_of_match), 761 match = of_match_device(tegra_i2c_of_match, &pdev->dev);
773 &pdev->dev);
774 i2c_dev->hw = match->data; 762 i2c_dev->hw = match->data;
775 i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, 763 i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
776 "nvidia,tegra20-i2c-dvc"); 764 "nvidia,tegra20-i2c-dvc");
@@ -876,7 +864,7 @@ static struct platform_driver tegra_i2c_driver = {
876 .driver = { 864 .driver = {
877 .name = "tegra-i2c", 865 .name = "tegra-i2c",
878 .owner = THIS_MODULE, 866 .owner = THIS_MODULE,
879 .of_match_table = of_match_ptr(tegra_i2c_of_match), 867 .of_match_table = tegra_i2c_of_match,
880 .pm = TEGRA_I2C_PM, 868 .pm = TEGRA_I2C_PM,
881 }, 869 },
882}; 870};
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h
deleted file mode 100644
index 9c85da49857a..000000000000
--- a/include/linux/i2c-tegra.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * drivers/i2c/busses/i2c-tegra.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _LINUX_I2C_TEGRA_H
19#define _LINUX_I2C_TEGRA_H
20
21struct tegra_i2c_platform_data {
22 unsigned long bus_clk_rate;
23};
24
25#endif /* _LINUX_I2C_TEGRA_H */