diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 26 |
1 files changed, 7 insertions, 19 deletions
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 */ |
699 | static const struct of_device_id tegra_i2c_of_match[] = { | 697 | static 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 | }; |
706 | MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); | 704 | MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); |
707 | #endif | ||
708 | 705 | ||
709 | static int tegra_i2c_probe(struct platform_device *pdev) | 706 | static 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 | }; |