diff options
author | Colin Cross <ccross@android.com> | 2010-06-14 16:09:46 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-10-06 16:26:44 -0700 |
commit | 80f33a8c5ada9411d598f07cb79a7360e0ebc108 (patch) | |
tree | 7e68b99c483c133ac3d4720ca99e4f9dbf890ffc | |
parent | 91e3654c23ebf0a532bfad0c503af528daa59eb8 (diff) |
i2c: busses: i2c-tegra: Set bus speed in platform data
Change-Id: Iebc1ad5cc56d09f1df99d09dd6456c24c93cdb0b
Signed-off-by: Colin Cross <ccross@android.com>
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 8 | ||||
-rw-r--r-- | include/linux/i2c-tegra.h | 25 |
2 files changed, 31 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 97d364a69d1c..2586117e7c75 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -24,6 +24,7 @@ #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/slab.h> +#include <linux/i2c-tegra.h> #include <asm/unaligned.h> @@ -107,6 +108,7 @@ struct tegra_i2c_dev { size_t msg_buf_remaining; int msg_read; int msg_transfer_complete; + unsigned long bus_clk_rate; }; static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned long reg) @@ -302,7 +304,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN; i2c_writel(i2c_dev, val, I2C_CNFG); i2c_writel(i2c_dev, 0, I2C_INT_MASK); - tegra_i2c_set_clk(i2c_dev, 100000); + tegra_i2c_set_clk(i2c_dev, i2c_dev->bus_clk_rate); val = 7 << I2C_FIFO_CONTROL_TX_TRIG_SHIFT | 0 << I2C_FIFO_CONTROL_RX_TRIG_SHIFT; @@ -490,7 +492,7 @@ static const struct i2c_algorithm tegra_i2c_algo = { 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 tegra_i2c_platform_data *pdata = pdev->dev.platform_data; struct resource *res; struct resource *iomem; struct clk *clk; @@ -550,6 +552,8 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_dev->irq = irq; i2c_dev->cont_id = pdev->id; i2c_dev->dev = &pdev->dev; + i2c_dev->bus_clk_rate = pdata ? pdata->bus_clk_rate : 100000; + if (pdev->id == 3) i2c_dev->is_dvc = 1; init_completion(&i2c_dev->msg_complete); diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h new file mode 100644 index 000000000000..9c85da49857a --- /dev/null +++ b/include/linux/i2c-tegra.h @@ -0,0 +1,25 @@ +/* + * 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 */ |