From: Colin Cross Date: Mon, 14 Jun 2010 23:09:46 +0000 (-0700) Subject: i2c: busses: i2c-tegra: Set bus speed in platform data X-Git-Tag: firefly_0821_release~9833^2~346 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=80f33a8c5ada9411d598f07cb79a7360e0ebc108;p=firefly-linux-kernel-4.4.55.git i2c: busses: i2c-tegra: Set bus speed in platform data Change-Id: Iebc1ad5cc56d09f1df99d09dd6456c24c93cdb0b Signed-off-by: Colin Cross --- 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 #include #include +#include #include @@ -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 + * + * 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 */