Commit b67d4530 authored by Sowjanya Komatineni's avatar Sowjanya Komatineni Committed by Wolfram Sang

i2c: tegra: Fix Maximum transfer size

Tegra194 supports maximum 64K Bytes transfer per packet.
Tegra186 and prior supports maximum 4K Bytes transfer per packet.

This patch fixes this payload difference between Tegra194 and prior
Tegra chipsets using separate i2c_adapter_quirks.
Signed-off-by: default avatarSowjanya Komatineni <skomatineni@nvidia.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 6ebec961
...@@ -155,6 +155,8 @@ enum msg_end_type { ...@@ -155,6 +155,8 @@ enum msg_end_type {
* @has_mst_fifo: The I2C controller contains the new MST FIFO interface that * @has_mst_fifo: The I2C controller contains the new MST FIFO interface that
* provides additional features and allows for longer messages to * provides additional features and allows for longer messages to
* be transferred in one go. * be transferred in one go.
* @quirks: i2c adapter quirks for limiting write/read transfer size and not
* allowing 0 length transfers.
*/ */
struct tegra_i2c_hw_feature { struct tegra_i2c_hw_feature {
bool has_continue_xfer_support; bool has_continue_xfer_support;
...@@ -167,6 +169,7 @@ struct tegra_i2c_hw_feature { ...@@ -167,6 +169,7 @@ struct tegra_i2c_hw_feature {
bool has_multi_master_mode; bool has_multi_master_mode;
bool has_slcg_override_reg; bool has_slcg_override_reg;
bool has_mst_fifo; bool has_mst_fifo;
const struct i2c_adapter_quirks *quirks;
}; };
/** /**
...@@ -837,6 +840,10 @@ static const struct i2c_adapter_quirks tegra_i2c_quirks = { ...@@ -837,6 +840,10 @@ static const struct i2c_adapter_quirks tegra_i2c_quirks = {
.max_write_len = 4096, .max_write_len = 4096,
}; };
static const struct i2c_adapter_quirks tegra194_i2c_quirks = {
.flags = I2C_AQ_NO_ZERO_LEN,
};
static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
.has_continue_xfer_support = false, .has_continue_xfer_support = false,
.has_per_pkt_xfer_complete_irq = false, .has_per_pkt_xfer_complete_irq = false,
...@@ -848,6 +855,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { ...@@ -848,6 +855,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
.has_multi_master_mode = false, .has_multi_master_mode = false,
.has_slcg_override_reg = false, .has_slcg_override_reg = false,
.has_mst_fifo = false, .has_mst_fifo = false,
.quirks = &tegra_i2c_quirks,
}; };
static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
...@@ -861,6 +869,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { ...@@ -861,6 +869,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
.has_multi_master_mode = false, .has_multi_master_mode = false,
.has_slcg_override_reg = false, .has_slcg_override_reg = false,
.has_mst_fifo = false, .has_mst_fifo = false,
.quirks = &tegra_i2c_quirks,
}; };
static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
...@@ -874,6 +883,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { ...@@ -874,6 +883,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
.has_multi_master_mode = false, .has_multi_master_mode = false,
.has_slcg_override_reg = false, .has_slcg_override_reg = false,
.has_mst_fifo = false, .has_mst_fifo = false,
.quirks = &tegra_i2c_quirks,
}; };
static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { static const struct tegra_i2c_hw_feature tegra124_i2c_hw = {
...@@ -887,6 +897,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { ...@@ -887,6 +897,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = {
.has_multi_master_mode = false, .has_multi_master_mode = false,
.has_slcg_override_reg = true, .has_slcg_override_reg = true,
.has_mst_fifo = false, .has_mst_fifo = false,
.quirks = &tegra_i2c_quirks,
}; };
static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { static const struct tegra_i2c_hw_feature tegra210_i2c_hw = {
...@@ -900,6 +911,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { ...@@ -900,6 +911,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = {
.has_multi_master_mode = true, .has_multi_master_mode = true,
.has_slcg_override_reg = true, .has_slcg_override_reg = true,
.has_mst_fifo = false, .has_mst_fifo = false,
.quirks = &tegra_i2c_quirks,
}; };
static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
...@@ -913,6 +925,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { ...@@ -913,6 +925,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
.has_multi_master_mode = true, .has_multi_master_mode = true,
.has_slcg_override_reg = true, .has_slcg_override_reg = true,
.has_mst_fifo = true, .has_mst_fifo = true,
.quirks = &tegra194_i2c_quirks,
}; };
/* Match table for of_platform binding */ /* Match table for of_platform binding */
...@@ -964,7 +977,6 @@ static int tegra_i2c_probe(struct platform_device *pdev) ...@@ -964,7 +977,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
i2c_dev->base = base; i2c_dev->base = base;
i2c_dev->div_clk = div_clk; i2c_dev->div_clk = div_clk;
i2c_dev->adapter.algo = &tegra_i2c_algo; i2c_dev->adapter.algo = &tegra_i2c_algo;
i2c_dev->adapter.quirks = &tegra_i2c_quirks;
i2c_dev->irq = irq; i2c_dev->irq = irq;
i2c_dev->cont_id = pdev->id; i2c_dev->cont_id = pdev->id;
i2c_dev->dev = &pdev->dev; i2c_dev->dev = &pdev->dev;
...@@ -980,6 +992,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) ...@@ -980,6 +992,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
i2c_dev->hw = of_device_get_match_data(&pdev->dev); i2c_dev->hw = of_device_get_match_data(&pdev->dev);
i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
"nvidia,tegra20-i2c-dvc"); "nvidia,tegra20-i2c-dvc");
i2c_dev->adapter.quirks = i2c_dev->hw->quirks;
init_completion(&i2c_dev->msg_complete); init_completion(&i2c_dev->msg_complete);
spin_lock_init(&i2c_dev->xfer_lock); spin_lock_init(&i2c_dev->xfer_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment