summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorAlok Chauhan <alokc@nvidia.com>2012-01-25 09:21:29 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 00:49:17 -0700
commit0ac5dda1e26c710acf3ad13787397bb969a77d22 (patch)
tree286c0a10cd5d3bb200ed29fef0c4f4da37c30074 /drivers/i2c
parente2924aeea75a7f4bb54cdbb40738dca526b5d264 (diff)
tegra: i2c: Added high speed support
Added i2c high speed support. Bug 873879 Reviewed-on: http://git-master/r/71997 Change-Id: I5a2c5f272485e6f7c8bb6c11d7c3b6850fdcd768 Signed-off-by: Alok Chauhan <alokc@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/77741 Reviewed-by: Automatic_Commit_Validation_User Rebase-Id: Rfe9b1c956832f5c764f1280c58b3ae80257af8fa
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-tegra.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 59fdd1f4642e..6f768be8c1a6 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -179,6 +179,8 @@ struct tegra_i2c_dev {
bool is_suspended;
u16 slave_addr;
bool is_clkon_always;
+ bool is_high_speed_enable;
+ u16 hs_master_code;
int scl_gpio;
int sda_gpio;
};
@@ -449,6 +451,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
i2c_writel(i2c_dev, val, I2C_CNFG);
i2c_writel(i2c_dev, 0, I2C_INT_MASK);
clk_set_rate(i2c_dev->div_clk, i2c_dev->bus_clk_rate * 8);
+ i2c_writel(i2c_dev, 0x3, I2C_CLK_DIVISOR);
if (!i2c_dev->is_dvc) {
u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG);
@@ -644,6 +647,10 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
i2c_dev->io_header |= I2C_HEADER_CONT_ON_NAK;
if (msg->flags & I2C_M_RD)
i2c_dev->io_header |= I2C_HEADER_READ;
+ if (i2c_dev->is_high_speed_enable) {
+ i2c_dev->io_header |= I2C_HEADER_HIGHSPEED_MODE;
+ i2c_dev->io_header |= ((i2c_dev->hs_master_code & 0x7) << I2C_HEADER_MASTER_ADDR_SHIFT);
+ }
i2c_writel(i2c_dev, i2c_dev->io_header, I2C_TX_FIFO);
if (!(msg->flags & I2C_M_RD))
@@ -849,6 +856,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
i2c_dev->bus_clk_rate = be32_to_cpup(prop);
}
+ i2c_dev->is_high_speed_enable = pdata->is_high_speed_enable;
i2c_dev->msgs = NULL;
i2c_dev->msgs_num = 0;
@@ -865,6 +873,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
i2c_dev->is_dvc = 1;
}
i2c_dev->slave_addr = pdata->slave_addr;
+ i2c_dev->hs_master_code = pdata->hs_master_code;
init_completion(&i2c_dev->msg_complete);
platform_set_drvdata(pdev, i2c_dev);