i2c: tegra: update maximum transfer size
authorSowjanya Komatineni <skomatineni@nvidia.com>
Tue, 12 Feb 2019 19:06:45 +0000 (11:06 -0800)
committerWolfram Sang <wsa@the-dreams.de>
Thu, 14 Feb 2019 16:48:10 +0000 (17:48 +0100)
Tegra194 supports maximum 64K bytes per packet including 12 bytes of
packet header irrespective of PIO or DMA mode transfer.

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

Cc: stable@vger.kernel.org # 4.20+
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-tegra.c

index 036cab7954264c80bfc04d2ada0b6dcc5d9cb30d..f8265bd5d02c11d7a828f2e85adeef8d076f95a0 100644 (file)
 #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.
@@ -900,12 +903,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 - 12,
+       .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 struct i2c_bus_recovery_info tegra_i2c_recovery_info = {