linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sowjanya Komatineni <skomatineni@nvidia.com>
To: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
	<mkarthik@nvidia.com>, <smohammed@nvidia.com>, <talho@nvidia.com>
Cc: <wsa@the-dreams.de>, <peda@axentia.se>, <digetx@gmail.com>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	<stable@vger.kernel.org>
Subject: [PATCH V18 3/6] i2c: tegra: fix maximum transfer size
Date: Fri, 8 Feb 2019 10:59:39 -0800	[thread overview]
Message-ID: <1549652382-5476-3-git-send-email-skomatineni@nvidia.com> (raw)
In-Reply-To: <1549652382-5476-1-git-send-email-skomatineni@nvidia.com>

Tegra194 supports maximum 64K bytes transfer per packet.
Tegra186 and prior supports maximum 4K bytes transfer per packet.
This includes 12 bytes of packet header and this limit is
applicable irrespective of PIO or DMA mode transfers.

This patch fixes max write length to account for packet header size
for transfers.

Cc: stable@vger.kernel.org

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
---
 [V18] 	: Using Max of SZ_64K (65536) size for dma buffer instead of 65535
 [V16/V17] : I2C core max message size is 65535. So, max_read_len of 65535 is NOP.
	  Removed it leaving max_write_len
 [V15]	: This is new patch in this series.


 drivers/i2c/busses/i2c-tegra.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 3758c7a2c781..08bdefd2810e 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -125,6 +125,9 @@
 #define I2C_MST_FIFO_STATUS_TX_MASK		0xff0000
 #define I2C_MST_FIFO_STATUS_TX_SHIFT		16
 
+/* Packet header size in bytes */
+#define I2C_PACKET_HEADER_SIZE			12
+
 /*
  * msg_end_type: The bus control which need to be send at end of transfer.
  * @MSG_END_STOP: Send stop pulse at end of transfer.
@@ -899,12 +902,13 @@ static const struct i2c_algorithm tegra_i2c_algo = {
 /* payload size is only 12 bit */
 static const struct i2c_adapter_quirks tegra_i2c_quirks = {
 	.flags = I2C_AQ_NO_ZERO_LEN,
-	.max_read_len = 4096,
-	.max_write_len = 4096,
+	.max_read_len = SZ_4K,
+	.max_write_len = SZ_4K - I2C_PACKET_HEADER_SIZE,
 };
 
 static const struct i2c_adapter_quirks tegra194_i2c_quirks = {
 	.flags = I2C_AQ_NO_ZERO_LEN,
+	.max_write_len = SZ_64K - I2C_PACKET_HEADER_SIZE,
 };
 
 static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
-- 
2.7.4


  parent reply	other threads:[~2019-02-08 18:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 18:59 [PATCH V18 1/6] i2c: tegra: sort all the include headers alphabetically Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 2/6] i2c: tegra: add bus clear Master Support Sowjanya Komatineni
2019-02-11 12:44   ` Wolfram Sang
2019-02-11 20:18     ` Sowjanya Komatineni
2019-02-08 18:59 ` Sowjanya Komatineni [this message]
2019-02-08 18:59 ` [PATCH V18 4/6] i2c: tegra: Add DMA support Sowjanya Komatineni
2019-02-11 12:55   ` Wolfram Sang
2019-02-11 13:22     ` Dmitry Osipenko
2019-02-11 13:28       ` Wolfram Sang
2019-02-11 16:26         ` Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 5/6] i2c: tegra: update transfer timeout Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 6/6] i2c: tegra: add i2c interface timing support Sowjanya Komatineni
2019-02-11 13:03   ` Wolfram Sang
2019-02-11 16:23     ` Sowjanya Komatineni
2019-02-11 12:45 ` [PATCH V18 1/6] i2c: tegra: sort all the include headers alphabetically Wolfram Sang
2019-02-11 13:06 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1549652382-5476-3-git-send-email-skomatineni@nvidia.com \
    --to=skomatineni@nvidia.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mkarthik@nvidia.com \
    --cc=peda@axentia.se \
    --cc=smohammed@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=talho@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).