diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-tegra.c')
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 2f38170bb178..0a6b21f8f077 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -44,7 +44,8 @@ #define I2C_SL_CNFG 0x020 #define I2C_SL_CNFG_NACK (1<<1) #define I2C_SL_CNFG_NEWSL (1<<2) -#define I2C_SL_ADDR1 0x02c +#define I2C_SL_ADDR1 0x02c +#define I2C_SL_ADDR2 0x030 #define I2C_TX_FIFO 0x050 #define I2C_RX_FIFO 0x054 #define I2C_PACKET_TRANSFER_STATUS 0x058 @@ -100,6 +101,9 @@ #define I2C_HEADER_MASTER_ADDR_SHIFT 12 #define I2C_HEADER_SLAVE_ADDR_SHIFT 1 +#define SL_ADDR1(addr) (addr & 0xff) +#define SL_ADDR2(addr) ((addr >> 8) & 0xff) + struct tegra_i2c_dev; struct tegra_i2c_bus { @@ -138,6 +142,7 @@ struct tegra_i2c_dev { const struct tegra_pingroup_config *last_mux; int last_mux_len; unsigned long last_bus_clk; + u16 slave_addr; struct tegra_i2c_bus busses[1]; }; @@ -314,6 +319,13 @@ static void tegra_i2c_slave_init(struct tegra_i2c_dev *i2c_dev) u32 val = I2C_SL_CNFG_NEWSL | I2C_SL_CNFG_NACK; i2c_writel(i2c_dev, val, I2C_SL_CNFG); + + if (i2c_dev->slave_addr) { + u16 addr = i2c_dev->slave_addr; + + i2c_writel(i2c_dev, SL_ADDR1(addr), I2C_SL_ADDR1); + i2c_writel(i2c_dev, SL_ADDR2(addr), I2C_SL_ADDR2); + } } static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) @@ -697,6 +709,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_dev->msgs_num = 0; rt_mutex_init(&i2c_dev->dev_lock); + i2c_dev->slave_addr = plat->slave_addr; i2c_dev->is_dvc = plat->is_dvc; init_completion(&i2c_dev->msg_complete); |