stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V18 3/6] i2c: tegra: fix maximum transfer size
       [not found] <1549652382-5476-1-git-send-email-skomatineni@nvidia.com>
@ 2019-02-08 18:59 ` Sowjanya Komatineni
       [not found]   ` <20190211172603.0CE06222A2@mail.kernel.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sowjanya Komatineni @ 2019-02-08 18:59 UTC (permalink / raw)
  To: thierry.reding, jonathanh, mkarthik, smohammed, talho
  Cc: wsa, peda, digetx, linux-tegra, linux-kernel, linux-i2c,
	Sowjanya Komatineni, stable

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V18 3/6] i2c: tegra: fix maximum transfer size
       [not found]   ` <20190211172603.0CE06222A2@mail.kernel.org>
@ 2019-02-11 17:42     ` Dmitry Osipenko
  2019-02-11 17:58       ` Dmitry Osipenko
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Osipenko @ 2019-02-11 17:42 UTC (permalink / raw)
  To: Sasha Levin, Sowjanya Komatineni, thierry.reding, jonathanh
  Cc: wsa, peda, stable

11.02.2019 20:26, Sasha Levin пишет:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
> 
> The bot has tested the following trees: v4.20.7, v4.19.20, v4.14.98, v4.9.155, v4.4.173, v3.18.134.
> 
> v4.20.7: Failed to apply! Possible dependencies:
>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> 
> v4.19.20: Failed to apply! Possible dependencies:
>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> 
> v4.14.98: Failed to apply! Possible dependencies:
>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> 
> v4.9.155: Failed to apply! Possible dependencies:
>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> 
> v4.4.173: Failed to apply! Possible dependencies:
>     0194621b2253 ("IB/rdmavt: Create module framework and handle driver registration")
>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>     1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
>     21e9efd92bb5 ("i2c: tegra: disable clock before returning error")
>     497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
>     50a5ba876908 ("i2c: mux: demux-pinctrl: add driver")
>     685143a1598b ("i2c: tegra: use readl_poll_timeout after config_load reg programmed")
>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
>     7f866986e705 ("leds: add PM8058 LEDs driver")
>     8700e3e7c485 ("Soft RoCE driver")
>     9d7cffaf99f5 ("leds: Add driver for the ISSI IS31FL32xx family of LED controllers")
>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>     be4fdf99fa4d ("leds: add driver for Mellanox systems LEDs")
>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
>     f5076685b3aa ("i2c: tegra: Fix missing blank lines after declarations")
> 
> v3.18.134: Failed to apply! Possible dependencies:
>     1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
>     21e9efd92bb5 ("i2c: tegra: disable clock before returning error")
>     497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
>     5b25b13ab08f ("sys_membarrier(): system-wide memory barrier (generic, x86)")
>     685143a1598b ("i2c: tegra: use readl_poll_timeout after config_load reg programmed")
>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
>     6f4664b2e2c2 ("i2c: tegra: update CONFIG_LOAD for new conifiguration")
>     8700e3e7c485 ("Soft RoCE driver")
>     93c1edb27f9e ("mlxsw: Introduce Mellanox switch driver core")
>     a7405844da1c ("i2c: at91: make use of the new infrastructure for quirks")
>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
>     b94c820f3780 ("i2c: cpm: make use of the new infrastructure for quirks")
>     be4fdf99fa4d ("leds: add driver for Mellanox systems LEDs")
>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>     d57f5dedde18 ("i2c: tegra: add support for fast plus (FM+) mode clock rate")
>     d64a818859af ("i2c: at91: add support for runtime PM")
>     f5076685b3aa ("i2c: tegra: Fix missing blank lines after declarations")
> 
> 
> How should we proceed with this patch?

I guess it will be fine to either limit backporting down to just 5.0 or 4.20 (taking the kerneldoc dependency). Though probably most ideal variant will be to split the fix into two patches: first fixes the max transfer for older Tegra's and second for T194 specifically. Either way should be good enough since realistically none of upstream-supported devices should ever hit the bug (but that's not 100% of course).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V18 3/6] i2c: tegra: fix maximum transfer size
  2019-02-11 17:42     ` Dmitry Osipenko
@ 2019-02-11 17:58       ` Dmitry Osipenko
  2019-02-11 21:54         ` Sowjanya Komatineni
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Osipenko @ 2019-02-11 17:58 UTC (permalink / raw)
  To: Sasha Levin, Sowjanya Komatineni, thierry.reding, jonathanh
  Cc: wsa, peda, stable

11.02.2019 20:42, Dmitry Osipenko пишет:
> 11.02.2019 20:26, Sasha Levin пишет:
>> Hi,
>>
>> [This is an automated email]
>>
>> This commit has been processed because it contains a -stable tag.
>> The stable tag indicates that it's relevant for the following trees: all
>>
>> The bot has tested the following trees: v4.20.7, v4.19.20, v4.14.98, v4.9.155, v4.4.173, v3.18.134.
>>
>> v4.20.7: Failed to apply! Possible dependencies:
>>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
>>
>> v4.19.20: Failed to apply! Possible dependencies:
>>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
>>
>> v4.14.98: Failed to apply! Possible dependencies:
>>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
>>
>> v4.9.155: Failed to apply! Possible dependencies:
>>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
>>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
>>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
>>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
>>
>> v4.4.173: Failed to apply! Possible dependencies:
>>     0194621b2253 ("IB/rdmavt: Create module framework and handle driver registration")
>>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
>>     1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
>>     21e9efd92bb5 ("i2c: tegra: disable clock before returning error")
>>     497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
>>     50a5ba876908 ("i2c: mux: demux-pinctrl: add driver")
>>     685143a1598b ("i2c: tegra: use readl_poll_timeout after config_load reg programmed")
>>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
>>     7f866986e705 ("leds: add PM8058 LEDs driver")
>>     8700e3e7c485 ("Soft RoCE driver")
>>     9d7cffaf99f5 ("leds: Add driver for the ISSI IS31FL32xx family of LED controllers")
>>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
>>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
>>     be4fdf99fa4d ("leds: add driver for Mellanox systems LEDs")
>>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
>>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
>>     f5076685b3aa ("i2c: tegra: Fix missing blank lines after declarations")
>>
>> v3.18.134: Failed to apply! Possible dependencies:
>>     1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
>>     21e9efd92bb5 ("i2c: tegra: disable clock before returning error")
>>     497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
>>     5b25b13ab08f ("sys_membarrier(): system-wide memory barrier (generic, x86)")
>>     685143a1598b ("i2c: tegra: use readl_poll_timeout after config_load reg programmed")
>>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
>>     6f4664b2e2c2 ("i2c: tegra: update CONFIG_LOAD for new conifiguration")
>>     8700e3e7c485 ("Soft RoCE driver")
>>     93c1edb27f9e ("mlxsw: Introduce Mellanox switch driver core")
>>     a7405844da1c ("i2c: at91: make use of the new infrastructure for quirks")
>>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
>>     b94c820f3780 ("i2c: cpm: make use of the new infrastructure for quirks")
>>     be4fdf99fa4d ("leds: add driver for Mellanox systems LEDs")
>>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
>>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
>>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
>>     d57f5dedde18 ("i2c: tegra: add support for fast plus (FM+) mode clock rate")
>>     d64a818859af ("i2c: at91: add support for runtime PM")
>>     f5076685b3aa ("i2c: tegra: Fix missing blank lines after declarations")
>>
>>
>> How should we proceed with this patch?
> 
> I guess it will be fine to either limit backporting down to just 5.0 or 4.20 (taking the kerneldoc dependency). Though probably most ideal variant will be to split the fix into two patches: first fixes the max transfer for older Tegra's and second for T194 specifically. Either way should be good enough since realistically none of upstream-supported devices should ever hit the bug (but that's not 100% of course).
> 

Sowjanya,

So the first patch could looks like this:

-----------
 static const struct i2c_adapter_quirks tegra_i2c_quirks = {
 	.flags = I2C_AQ_NO_ZERO_LEN,
	.max_read_len = 4096,
-	.max_write_len = 4096,
+	.max_write_len = 4096 - 12,
 };
-----------

And then you should change the stable tag to "Cc: stable@vger.kernel.org # 4.4+"

The second patch will be somewhat like this:

-----------
+/* Packet header size in bytes */
+#define I2C_PACKET_HEADER_SIZE			12
+
#define I2C_MST_FIFO_STATUS			0x0b8
#define I2C_MST_FIFO_STATUS_RX_MASK		0xff
#define I2C_MST_FIFO_STATUS_RX_SHIFT		0
#define I2C_MST_FIFO_STATUS_TX_MASK		0xff0000
#define I2C_MST_FIFO_STATUS_TX_SHIFT		16

@@ -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 - 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 const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
-----------

And then the stable tag for the second patch will be: "Cc: stable@vger.kernel.org # 4.20+".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH V18 3/6] i2c: tegra: fix maximum transfer size
  2019-02-11 17:58       ` Dmitry Osipenko
@ 2019-02-11 21:54         ` Sowjanya Komatineni
  0 siblings, 0 replies; 4+ messages in thread
From: Sowjanya Komatineni @ 2019-02-11 21:54 UTC (permalink / raw)
  To: Dmitry Osipenko, Sasha Levin, thierry.reding, Jonathan Hunter
  Cc: wsa, peda, stable

> 11.02.2019 20:42, Dmitry Osipenko пишет:
> > 11.02.2019 20:26, Sasha Levin пишет:
> >> Hi,
> >>
> >> [This is an automated email]
> >>
> >> This commit has been processed because it contains a -stable tag.
> >> The stable tag indicates that it's relevant for the following trees: all
> >>
> >> The bot has tested the following trees: v4.20.7, v4.19.20, v4.14.98, v4.9.155, v4.4.173, v3.18.134.
> >>
> >> v4.20.7: Failed to apply! Possible dependencies:
> >>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
> >>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
> >>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> >>
> >> v4.19.20: Failed to apply! Possible dependencies:
> >>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
> >>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
> >>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
> >>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> >>
> >> v4.14.98: Failed to apply! Possible dependencies:
> >>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
> >>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
> >>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
> >>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
> >>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> >>
> >> v4.9.155: Failed to apply! Possible dependencies:
> >>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
> >>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
> >>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
> >>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
> >>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
> >>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
> >>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
> >>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> >>
> >> v4.4.173: Failed to apply! Possible dependencies:
> >>     0194621b2253 ("IB/rdmavt: Create module framework and handle driver registration")
> >>     0604ee4aefa2 ("i2c: tegra: Add missing kerneldoc for some fields")
> >>     1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
> >>     21e9efd92bb5 ("i2c: tegra: disable clock before returning error")
> >>     497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
> >>     50a5ba876908 ("i2c: mux: demux-pinctrl: add driver")
> >>     685143a1598b ("i2c: tegra: use readl_poll_timeout after config_load reg programmed")
> >>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
> >>     7f866986e705 ("leds: add PM8058 LEDs driver")
> >>     8700e3e7c485 ("Soft RoCE driver")
> >>     9d7cffaf99f5 ("leds: Add driver for the ISSI IS31FL32xx family of LED controllers")
> >>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
> >>     b67d4530cdad ("i2c: tegra: Fix Maximum transfer size")
> >>     be4fdf99fa4d ("leds: add driver for Mellanox systems LEDs")
> >>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
> >>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
> >>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
> >>     c990bbafdb11 ("i2c: tegra: Cleanup kerneldoc comments")
> >>     f5076685b3aa ("i2c: tegra: Fix missing blank lines after declarations")
> >>
> >> v3.18.134: Failed to apply! Possible dependencies:
> >>     1f50ad2c86cd ("i2c: tegra: Add runtime power-management support")
> >>     21e9efd92bb5 ("i2c: tegra: disable clock before returning error")
> >>     497fbe24987b ("i2c: tegra: enable multi master mode for tegra210")
> >>     5b25b13ab08f ("sys_membarrier(): system-wide memory barrier (generic, x86)")
> >>     685143a1598b ("i2c: tegra: use readl_poll_timeout after config_load reg programmed")
> >>     6bec23bff914 ("i2c: mlxcpld: add master driver for mellanox systems")
> >>     6f4664b2e2c2 ("i2c: tegra: update CONFIG_LOAD for new conifiguration")
> >>     8700e3e7c485 ("Soft RoCE driver")
> >>     93c1edb27f9e ("mlxsw: Introduce Mellanox switch driver core")
> >>     a7405844da1c ("i2c: at91: make use of the new infrastructure for quirks")
> >>     ae3923a284cc ("i2c: busses: make i2c_adapter_quirks const")
> >>     b94c820f3780 ("i2c: cpm: make use of the new infrastructure for quirks")
> >>     be4fdf99fa4d ("leds: add driver for Mellanox systems LEDs")
> >>     c02b7bf532f7 ("i2c: mux: mellanox: add driver")
> >>     c5907c6b96f1 ("i2c: tegra: Add support for Tegra194")
> >>     c96c0f268380 ("i2c: tegra: use core to detect 'no zero length' quirk")
> >>     d57f5dedde18 ("i2c: tegra: add support for fast plus (FM+) mode clock rate")
> >>     d64a818859af ("i2c: at91: add support for runtime PM")
> >>     f5076685b3aa ("i2c: tegra: Fix missing blank lines after declarations")
> >>
> >>
> >> How should we proceed with this patch?
> > 
> > I guess it will be fine to either limit backporting down to just 5.0 or 4.20 (taking the kerneldoc dependency). Though probably most ideal variant will be to split the fix into two patches: first fixes the max transfer for older Tegra's and second for T194 specifically. Either way should be good enough since realistically none of upstream-supported devices should ever hit the bug (but that's not 100% of course).
> > 
>
> Sowjanya,
>
> So the first patch could looks like this:
>
> -----------
 > static const struct i2c_adapter_quirks tegra_i2c_quirks = {
>  	.flags = I2C_AQ_NO_ZERO_LEN,
>	.max_read_len = 4096,
> -	.max_write_len = 4096,
> +	.max_write_len = 4096 - 12,
>  };
> -----------
>
> And then you should change the stable tag to "Cc: stable@vger.kernel.org # 4.4+"
>
> The second patch will be somewhat like this:
>
> -----------
> +/* Packet header size in bytes */
> +#define I2C_PACKET_HEADER_SIZE			12
> +
> #define I2C_MST_FIFO_STATUS			0x0b8
> #define I2C_MST_FIFO_STATUS_RX_MASK		0xff
> #define I2C_MST_FIFO_STATUS_RX_SHIFT		0
> #define I2C_MST_FIFO_STATUS_TX_MASK		0xff0000
> #define I2C_MST_FIFO_STATUS_TX_SHIFT		16
>
> @@ -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 - 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 const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
> -----------
>
> And then the stable tag for the second patch will be: "Cc: stable@vger.kernel.org # 4.20+".

OK, Will split into 2 patches as you suggested above

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-11 21:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1549652382-5476-1-git-send-email-skomatineni@nvidia.com>
2019-02-08 18:59 ` [PATCH V18 3/6] i2c: tegra: fix maximum transfer size Sowjanya Komatineni
     [not found]   ` <20190211172603.0CE06222A2@mail.kernel.org>
2019-02-11 17:42     ` Dmitry Osipenko
2019-02-11 17:58       ` Dmitry Osipenko
2019-02-11 21:54         ` Sowjanya Komatineni

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).