diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2015-06-16 19:57:29 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2015-06-21 21:24:10 +0200 |
commit | 3aaa34b9923b994c13267e05ce8246faa1e8c8eb (patch) | |
tree | 37df588435266a1613ee980474cfa12d1efb2f49 /drivers/i2c | |
parent | 4bb28e37765f4b5b18cb3b9242aa8542e8c4b8b4 (diff) | |
download | linux-stable-3aaa34b9923b994c13267e05ce8246faa1e8c8eb.tar.gz linux-stable-3aaa34b9923b994c13267e05ce8246faa1e8c8eb.tar.bz2 linux-stable-3aaa34b9923b994c13267e05ce8246faa1e8c8eb.zip |
i2c: tegra: apply size limit quirk
payload_size is a 12 bit field in the HW register, so add a limit for
this size. That way we gracefully reject the message beforehand instead
of generating an OOPS while transferring. Verified using some older
Tegra2 documentation and a more recent Jetson TK1 board.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 0a1b6eacef0f..78a366814696 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -669,6 +669,12 @@ static const struct i2c_algorithm tegra_i2c_algo = { .functionality = tegra_i2c_func, }; +/* payload size is only 12 bit */ +static struct i2c_adapter_quirks tegra_i2c_quirks = { + .max_read_len = 4096, + .max_write_len = 4096, +}; + static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { .has_continue_xfer_support = false, .has_per_pkt_xfer_complete_irq = false, @@ -739,6 +745,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_dev->base = base; i2c_dev->div_clk = div_clk; i2c_dev->adapter.algo = &tegra_i2c_algo; + i2c_dev->adapter.quirks = &tegra_i2c_quirks; i2c_dev->irq = irq; i2c_dev->cont_id = pdev->id; i2c_dev->dev = &pdev->dev; |