linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements
@ 2020-01-06  1:04 Dmitry Osipenko
  2020-01-06  1:04 ` [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state Dmitry Osipenko
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

Hello,

This patchset adds support for atomic transfers which are required for
shutting down machine properly. Secondly, a (not)suspending I2C and some
other things are fixed/improved by this small series as well. Please review
and apply, thanks in advance!

Changelog:

v3: The "Prevent interrupt triggering after transfer timeout" and "Support
    atomic transfers" patches got extra very minor improvements. The
    completion now is passed directly to tegra_i2c_poll_completion_timeout(),
    for consistency.

    Added two new patches that firm up DMA transfer handling:

      i2c: tegra: Always terminate DMA transfer
      i2c: tegra: Check DMA completion status in addition to left time

v2: The series is renamed from "Tegra I2C: Support atomic transfers and
    correct suspend/resume" to "NVIDIA Tegra I2C driver fixes and
    improvements" because it now contains some more various changes.

    New patches in v2:

      i2c: tegra: Correct unwinding order on driver's probe error
      i2c: tegra: Prevent interrupt triggering after transfer timeout
      i2c: tegra: Use relaxed versions of readl/writel

    The "Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN" got an
    improved wording for the code's comment to I2C_PIO_MODE_PREFERRED_LEN.

    The "Support atomic transfers" also got some very minor tuning, like
    s/in_interrupt()/i2c_dev->is_curr_atomic_xfer/ in dvc_writel() that was
    missed in v1.

v1: The "i2c: tegra: Support atomic transfers" previously was sent out as
    a separate patch, but later I spotted that suspend/resume doesn't
    work properly. The "i2c: tegra: Fix suspending in active runtime PM
    state" patch depends on the atomic patch because there is a need to
    active IRQ-safe mode for the runtime PM by both patches.

    I fixed a missed doc-comment of the newly added "is_curr_atomic_xfer"
    structure field and added additional comment that explains why IRQ needs
    to be disabled for the atomic transfer in the "Support atomic transfers"
    patch.

    Lastly, I added a minor "i2c: tegra: Rename .." patch that helps to
    follow driver's code.

Dmitry Osipenko (9):
  i2c: tegra: Fix suspending in active runtime PM state
  i2c: tegra: Properly disable runtime PM on driver's probe error
  i2c: tegra: Prevent interrupt triggering after transfer timeout
  i2c: tegra: Support atomic transfers
  i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN
  i2c: tegra: Use relaxed versions of readl/writel
  clk: tegra: Fix double-free in tegra_clk_init()
  i2c: tegra: Always terminate DMA transfer
  i2c: tegra: Check DMA completion status in addition to left time

 drivers/clk/tegra/clk.c        |   4 +-
 drivers/i2c/busses/i2c-tegra.c | 216 ++++++++++++++++++++++-----------
 2 files changed, 147 insertions(+), 73 deletions(-)

-- 
2.24.0


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

* [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:38   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 2/9] i2c: tegra: Properly disable runtime PM on driver's probe error Dmitry Osipenko
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

I noticed that sometime I2C clock is kept enabled during suspend-resume.
This happens because runtime PM defers dynamic suspension and thus it may
happen that runtime PM is in active state when system enters into suspend.
In particular I2C controller that is used for CPU's DVFS is often kept ON
during suspend because CPU's voltage scaling happens quite often.

Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index a98bf31d0e5c..79d19f6ce94e 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1710,9 +1710,14 @@ static int tegra_i2c_remove(struct platform_device *pdev)
 static int __maybe_unused tegra_i2c_suspend(struct device *dev)
 {
 	struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev);
+	int err;
 
 	i2c_mark_adapter_suspended(&i2c_dev->adapter);
 
+	err = pm_runtime_force_suspend(dev);
+	if (err < 0)
+		return err;
+
 	return 0;
 }
 
@@ -1733,6 +1738,10 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev)
 	if (err)
 		return err;
 
+	err = pm_runtime_force_resume(dev);
+	if (err < 0)
+		return err;
+
 	i2c_mark_adapter_resumed(&i2c_dev->adapter);
 
 	return 0;
-- 
2.24.0


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

* [PATCH v3 2/9] i2c: tegra: Properly disable runtime PM on driver's probe error
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
  2020-01-06  1:04 ` [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:38   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 3/9] i2c: tegra: Prevent interrupt triggering after transfer timeout Dmitry Osipenko
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

One of the recent Tegra I2C commits made a change that resumes runtime PM
during driver's probe, but it missed to put the RPM in a case of error.
Note that it's not correct to use pm_runtime_status_suspended because it
breaks RPM refcounting.

Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 79d19f6ce94e..61339c665ebd 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1608,14 +1608,18 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	}
 
 	pm_runtime_enable(&pdev->dev);
-	if (!pm_runtime_enabled(&pdev->dev))
+	if (!pm_runtime_enabled(&pdev->dev)) {
 		ret = tegra_i2c_runtime_resume(&pdev->dev);
-	else
+		if (ret < 0) {
+			dev_err(&pdev->dev, "runtime resume failed\n");
+			goto unprepare_div_clk;
+		}
+	} else {
 		ret = pm_runtime_get_sync(i2c_dev->dev);
-
-	if (ret < 0) {
-		dev_err(&pdev->dev, "runtime resume failed\n");
-		goto unprepare_div_clk;
+		if (ret < 0) {
+			dev_err(&pdev->dev, "runtime resume failed\n");
+			goto disable_rpm;
+		}
 	}
 
 	if (i2c_dev->is_multimaster_mode) {
@@ -1623,7 +1627,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 		if (ret < 0) {
 			dev_err(i2c_dev->dev, "div_clk enable failed %d\n",
 				ret);
-			goto disable_rpm;
+			goto put_rpm;
 		}
 	}
 
@@ -1671,11 +1675,16 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	if (i2c_dev->is_multimaster_mode)
 		clk_disable(i2c_dev->div_clk);
 
-disable_rpm:
-	pm_runtime_disable(&pdev->dev);
-	if (!pm_runtime_status_suspended(&pdev->dev))
+put_rpm:
+	if (pm_runtime_enabled(&pdev->dev))
+		pm_runtime_put_sync(&pdev->dev);
+	else
 		tegra_i2c_runtime_suspend(&pdev->dev);
 
+disable_rpm:
+	if (pm_runtime_enabled(&pdev->dev))
+		pm_runtime_disable(&pdev->dev);
+
 unprepare_div_clk:
 	clk_unprepare(i2c_dev->div_clk);
 
-- 
2.24.0


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

* [PATCH v3 3/9] i2c: tegra: Prevent interrupt triggering after transfer timeout
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
  2020-01-06  1:04 ` [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state Dmitry Osipenko
  2020-01-06  1:04 ` [PATCH v3 2/9] i2c: tegra: Properly disable runtime PM on driver's probe error Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 4/9] i2c: tegra: Support atomic transfers Dmitry Osipenko
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

Potentially it is possible that interrupt may fire after transfer timeout.
That may not end up well for the next transfer because interrupt handling
may race with hardware resetting.

This is very unlikely to happen in practice, but anyway let's prevent the
potential problem by enabling interrupt only at the moments when it is
actually necessary to get some interrupt event.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 70 +++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 34 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 61339c665ebd..882b283e0ed7 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -16,6 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
+#include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
@@ -230,7 +231,6 @@ struct tegra_i2c_hw_feature {
  * @base_phys: physical base address of the I2C controller
  * @cont_id: I2C controller ID, used for packet header
  * @irq: IRQ number of transfer complete interrupt
- * @irq_disabled: used to track whether or not the interrupt is enabled
  * @is_dvc: identifies the DVC I2C controller, has a different register layout
  * @msg_complete: transfer completion notifier
  * @msg_err: error code for completed message
@@ -240,7 +240,6 @@ struct tegra_i2c_hw_feature {
  * @bus_clk_rate: current I2C bus clock rate
  * @clk_divisor_non_hs_mode: clock divider for non-high-speed modes
  * @is_multimaster_mode: track if I2C controller is in multi-master mode
- * @xfer_lock: lock to serialize transfer submission and processing
  * @tx_dma_chan: DMA transmit channel
  * @rx_dma_chan: DMA receive channel
  * @dma_phys: handle to DMA resources
@@ -260,7 +259,6 @@ struct tegra_i2c_dev {
 	phys_addr_t base_phys;
 	int cont_id;
 	int irq;
-	bool irq_disabled;
 	int is_dvc;
 	struct completion msg_complete;
 	int msg_err;
@@ -270,8 +268,6 @@ struct tegra_i2c_dev {
 	u32 bus_clk_rate;
 	u16 clk_divisor_non_hs_mode;
 	bool is_multimaster_mode;
-	/* xfer_lock: lock to serialize transfer submission and processing */
-	spinlock_t xfer_lock;
 	struct dma_chan *tx_dma_chan;
 	struct dma_chan *rx_dma_chan;
 	dma_addr_t dma_phys;
@@ -790,11 +786,6 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev, bool clk_reinit)
 	if (err)
 		return err;
 
-	if (i2c_dev->irq_disabled) {
-		i2c_dev->irq_disabled = false;
-		enable_irq(i2c_dev->irq);
-	}
-
 	return 0;
 }
 
@@ -825,18 +816,12 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
 
 	status = i2c_readl(i2c_dev, I2C_INT_STATUS);
 
-	spin_lock(&i2c_dev->xfer_lock);
 	if (status == 0) {
 		dev_warn(i2c_dev->dev, "irq status 0 %08x %08x %08x\n",
 			 i2c_readl(i2c_dev, I2C_PACKET_TRANSFER_STATUS),
 			 i2c_readl(i2c_dev, I2C_STATUS),
 			 i2c_readl(i2c_dev, I2C_CNFG));
 		i2c_dev->msg_err |= I2C_ERR_UNKNOWN_INTERRUPT;
-
-		if (!i2c_dev->irq_disabled) {
-			disable_irq_nosync(i2c_dev->irq);
-			i2c_dev->irq_disabled = true;
-		}
 		goto err;
 	}
 
@@ -925,7 +910,6 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
 
 	complete(&i2c_dev->msg_complete);
 done:
-	spin_unlock(&i2c_dev->xfer_lock);
 	return IRQ_HANDLED;
 }
 
@@ -999,6 +983,30 @@ static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev,
 	i2c_writel(i2c_dev, val, reg);
 }
 
+static unsigned long
+tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev,
+				  struct completion *complete,
+				  unsigned int timeout_ms)
+{
+	unsigned long ret;
+
+	enable_irq(i2c_dev->irq);
+	ret = wait_for_completion_timeout(complete,
+					  msecs_to_jiffies(timeout_ms));
+	disable_irq(i2c_dev->irq);
+
+	/*
+	 * There is a chance that completion may happen after IRQ
+	 * synchronization, which is done by disable_irq().
+	 */
+	if (ret == 0 && completion_done(complete)) {
+		dev_warn(i2c_dev->dev, "completion done after timeout\n");
+		ret = 1;
+	}
+
+	return ret;
+}
+
 static int tegra_i2c_issue_bus_clear(struct i2c_adapter *adap)
 {
 	struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap);
@@ -1020,8 +1028,8 @@ static int tegra_i2c_issue_bus_clear(struct i2c_adapter *adap)
 	i2c_writel(i2c_dev, reg, I2C_BUS_CLEAR_CNFG);
 	tegra_i2c_unmask_irq(i2c_dev, I2C_INT_BUS_CLR_DONE);
 
-	time_left = wait_for_completion_timeout(&i2c_dev->msg_complete,
-						msecs_to_jiffies(50));
+	time_left = tegra_i2c_wait_completion_timeout(
+			i2c_dev, &i2c_dev->msg_complete, 50);
 	if (time_left == 0) {
 		dev_err(i2c_dev->dev, "timed out for bus clear\n");
 		return -ETIMEDOUT;
@@ -1044,7 +1052,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 	u32 packet_header;
 	u32 int_mask;
 	unsigned long time_left;
-	unsigned long flags;
 	size_t xfer_size;
 	u32 *buffer = NULL;
 	int err = 0;
@@ -1075,7 +1082,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 	 */
 	xfer_time += DIV_ROUND_CLOSEST(((xfer_size * 9) + 2) * MSEC_PER_SEC,
 					i2c_dev->bus_clk_rate);
-	spin_lock_irqsave(&i2c_dev->xfer_lock, flags);
 
 	int_mask = I2C_INT_NO_ACK | I2C_INT_ARBITRATION_LOST;
 	tegra_i2c_unmask_irq(i2c_dev, int_mask);
@@ -1090,7 +1096,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 				dev_err(i2c_dev->dev,
 					"starting RX DMA failed, err %d\n",
 					err);
-				goto unlock;
+				return err;
 			}
 
 		} else {
@@ -1149,7 +1155,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 				dev_err(i2c_dev->dev,
 					"starting TX DMA failed, err %d\n",
 					err);
-				goto unlock;
+				return err;
 			}
 		} else {
 			tegra_i2c_fill_tx_fifo(i2c_dev);
@@ -1169,15 +1175,10 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 	dev_dbg(i2c_dev->dev, "unmasked irq: %02x\n",
 		i2c_readl(i2c_dev, I2C_INT_MASK));
 
-unlock:
-	spin_unlock_irqrestore(&i2c_dev->xfer_lock, flags);
-
 	if (dma) {
-		if (err)
-			return err;
+		time_left = tegra_i2c_wait_completion_timeout(
+				i2c_dev, &i2c_dev->dma_complete, xfer_time);
 
-		time_left = wait_for_completion_timeout(&i2c_dev->dma_complete,
-							msecs_to_jiffies(xfer_time));
 		if (time_left == 0) {
 			dev_err(i2c_dev->dev, "DMA transfer timeout\n");
 			dmaengine_terminate_sync(i2c_dev->msg_read ?
@@ -1202,13 +1203,13 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 					      i2c_dev->tx_dma_chan);
 	}
 
-	time_left = wait_for_completion_timeout(&i2c_dev->msg_complete,
-						msecs_to_jiffies(xfer_time));
+	time_left = tegra_i2c_wait_completion_timeout(
+			i2c_dev, &i2c_dev->msg_complete, xfer_time);
+
 	tegra_i2c_mask_irq(i2c_dev, int_mask);
 
 	if (time_left == 0) {
 		dev_err(i2c_dev->dev, "i2c transfer timed out\n");
-
 		tegra_i2c_init(i2c_dev, true);
 		return -ETIMEDOUT;
 	}
@@ -1568,7 +1569,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 				I2C_PACKET_HEADER_SIZE;
 	init_completion(&i2c_dev->msg_complete);
 	init_completion(&i2c_dev->dma_complete);
-	spin_lock_init(&i2c_dev->xfer_lock);
 
 	if (!i2c_dev->hw->has_single_clk_source) {
 		fast_clk = devm_clk_get(&pdev->dev, "fast-clk");
@@ -1644,6 +1644,8 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 		goto release_dma;
 	}
 
+	irq_set_status_flags(i2c_dev->irq, IRQ_NOAUTOEN);
+
 	ret = devm_request_irq(&pdev->dev, i2c_dev->irq,
 			       tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev);
 	if (ret) {
-- 
2.24.0


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

* [PATCH v3 4/9] i2c: tegra: Support atomic transfers
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (2 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 3/9] i2c: tegra: Prevent interrupt triggering after transfer timeout Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 5/9] i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN Dmitry Osipenko
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

System shutdown may happen with interrupts being disabled and in this case
I2C core rejects transfers if atomic transfer isn't supported by driver.

There were several occurrences where I found my Nexus 7 completely
discharged despite of being turned off and then one day I spotted this in
the log:

 reboot: Power down
 ------------[ cut here ]------------
 WARNING: CPU: 0 PID: 1 at drivers/i2c/i2c-core.h:40 i2c_transfer+0x95/0x9c
 No atomic I2C transfer handler for 'i2c-1'
 Modules linked in: tegra30_devfreq
 CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.4.0-next-20191202-00120-gf7ecd80fb803-dirty #3195
 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
 [<c010e4b5>] (unwind_backtrace) from [<c010a0fd>] (show_stack+0x11/0x14)
 [<c010a0fd>] (show_stack) from [<c09995e5>] (dump_stack+0x85/0x94)
 [<c09995e5>] (dump_stack) from [<c011f3d1>] (__warn+0xc1/0xc4)
 [<c011f3d1>] (__warn) from [<c011f691>] (warn_slowpath_fmt+0x61/0x78)
 [<c011f691>] (warn_slowpath_fmt) from [<c069a8dd>] (i2c_transfer+0x95/0x9c)
 [<c069a8dd>] (i2c_transfer) from [<c05667f1>] (regmap_i2c_read+0x4d/0x6c)
 [<c05667f1>] (regmap_i2c_read) from [<c0563601>] (_regmap_raw_read+0x99/0x1cc)
 [<c0563601>] (_regmap_raw_read) from [<c0563757>] (_regmap_bus_read+0x23/0x38)
 [<c0563757>] (_regmap_bus_read) from [<c056293d>] (_regmap_read+0x3d/0xfc)
 [<c056293d>] (_regmap_read) from [<c0562d3b>] (_regmap_update_bits+0x87/0xc4)
 [<c0562d3b>] (_regmap_update_bits) from [<c0563add>] (regmap_update_bits_base+0x39/0x50)
 [<c0563add>] (regmap_update_bits_base) from [<c056fd39>] (max77620_pm_power_off+0x29/0x2c)
 [<c056fd39>] (max77620_pm_power_off) from [<c013bbdd>] (__do_sys_reboot+0xe9/0x170)
 [<c013bbdd>] (__do_sys_reboot) from [<c0101001>] (ret_fast_syscall+0x1/0x28)
 Exception stack(0xde907fa8 to 0xde907ff0)
 7fa0:                   00000000 00000000 fee1dead 28121969 4321fedc 00000000
 7fc0: 00000000 00000000 00000000 00000058 00000000 00000000 00000000 00000000
 7fe0: 0045adf0 bed9abb8 004444a0 b6c666d0
 ---[ end trace bdd18f87595b1a5e ]---

The atomic transferring is implemented by enforcing PIO mode for the
transfer and by polling interrupt status until transfer is completed or
failed.

Now system shuts down properly every time.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 84 ++++++++++++++++++++++++++++------
 1 file changed, 69 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 882b283e0ed7..0245fc2b5684 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -18,6 +18,7 @@
 #include <linux/iopoll.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
+#include <linux/ktime.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/pinctrl/consumer.h>
@@ -247,6 +248,7 @@ struct tegra_i2c_hw_feature {
  * @dma_buf_size: DMA buffer size
  * @is_curr_dma_xfer: indicates active DMA transfer
  * @dma_complete: DMA completion notifier
+ * @is_curr_atomic_xfer: indicates active atomic transfer
  */
 struct tegra_i2c_dev {
 	struct device *dev;
@@ -275,6 +277,7 @@ struct tegra_i2c_dev {
 	unsigned int dma_buf_size;
 	bool is_curr_dma_xfer;
 	struct completion dma_complete;
+	bool is_curr_atomic_xfer;
 };
 
 static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val,
@@ -683,7 +686,8 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)
 		reg_offset = tegra_i2c_reg_addr(i2c_dev, I2C_CONFIG_LOAD);
 		addr = i2c_dev->base + reg_offset;
 		i2c_writel(i2c_dev, I2C_MSTR_CONFIG_LOAD, I2C_CONFIG_LOAD);
-		if (in_interrupt())
+
+		if (i2c_dev->is_curr_atomic_xfer)
 			err = readl_poll_timeout_atomic(addr, val, val == 0,
 							1000,
 							I2C_CONFIG_LOAD_TIMEOUT);
@@ -983,6 +987,34 @@ static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev,
 	i2c_writel(i2c_dev, val, reg);
 }
 
+static unsigned long
+tegra_i2c_poll_completion_timeout(struct tegra_i2c_dev *i2c_dev,
+				  struct completion *complete,
+				  unsigned int timeout_ms)
+{
+	ktime_t ktime = ktime_get();
+	ktime_t ktimeout = ktime_add_ms(ktime, timeout_ms);
+
+	do {
+		u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS);
+
+		if (status) {
+			tegra_i2c_isr(i2c_dev->irq, i2c_dev);
+
+			if (completion_done(complete)) {
+				s64 delta = ktime_ms_delta(ktimeout, ktime);
+
+				return msecs_to_jiffies(delta) ?: 1;
+			}
+		}
+
+		ktime = ktime_get();
+
+	} while (ktime_before(ktime, ktimeout));
+
+	return 0;
+}
+
 static unsigned long
 tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev,
 				  struct completion *complete,
@@ -990,18 +1022,24 @@ tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev,
 {
 	unsigned long ret;
 
-	enable_irq(i2c_dev->irq);
-	ret = wait_for_completion_timeout(complete,
-					  msecs_to_jiffies(timeout_ms));
-	disable_irq(i2c_dev->irq);
+	if (i2c_dev->is_curr_atomic_xfer) {
+		ret = tegra_i2c_poll_completion_timeout(i2c_dev, complete,
+							timeout_ms);
+	} else {
+		enable_irq(i2c_dev->irq);
+		ret = wait_for_completion_timeout(complete,
+						  msecs_to_jiffies(timeout_ms));
+		disable_irq(i2c_dev->irq);
 
-	/*
-	 * There is a chance that completion may happen after IRQ
-	 * synchronization, which is done by disable_irq().
-	 */
-	if (ret == 0 && completion_done(complete)) {
-		dev_warn(i2c_dev->dev, "completion done after timeout\n");
-		ret = 1;
+		/*
+		 * There is a chance that completion may happen after IRQ
+		 * synchronization, which is done by disable_irq().
+		 */
+		if (ret == 0 && completion_done(complete)) {
+			dev_warn(i2c_dev->dev,
+				 "completion done after timeout\n");
+			ret = 1;
+		}
 	}
 
 	return ret;
@@ -1073,7 +1111,8 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 
 	xfer_size = ALIGN(xfer_size, BYTES_PER_FIFO_WORD);
 	i2c_dev->is_curr_dma_xfer = (xfer_size > I2C_PIO_MODE_MAX_LEN) &&
-				    i2c_dev->dma_buf;
+				    i2c_dev->dma_buf &&
+				    !i2c_dev->is_curr_atomic_xfer;
 	tegra_i2c_config_fifo_trig(i2c_dev, xfer_size);
 	dma = i2c_dev->is_curr_dma_xfer;
 	/*
@@ -1271,6 +1310,19 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
 	return ret ?: i;
 }
 
+static int tegra_i2c_xfer_atomic(struct i2c_adapter *adap,
+				 struct i2c_msg msgs[], int num)
+{
+	struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap);
+	int ret;
+
+	i2c_dev->is_curr_atomic_xfer = true;
+	ret = tegra_i2c_xfer(adap, msgs, num);
+	i2c_dev->is_curr_atomic_xfer = false;
+
+	return ret;
+}
+
 static u32 tegra_i2c_func(struct i2c_adapter *adap)
 {
 	struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap);
@@ -1298,8 +1350,9 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev)
 }
 
 static const struct i2c_algorithm tegra_i2c_algo = {
-	.master_xfer	= tegra_i2c_xfer,
-	.functionality	= tegra_i2c_func,
+	.master_xfer		= tegra_i2c_xfer,
+	.master_xfer_atomic	= tegra_i2c_xfer_atomic,
+	.functionality		= tegra_i2c_func,
 };
 
 /* payload size is only 12 bit */
@@ -1607,6 +1660,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 		goto unprepare_fast_clk;
 	}
 
+	pm_runtime_irq_safe(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 	if (!pm_runtime_enabled(&pdev->dev)) {
 		ret = tegra_i2c_runtime_resume(&pdev->dev);
-- 
2.24.0


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

* [PATCH v3 5/9] i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (3 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 4/9] i2c: tegra: Support atomic transfers Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 6/9] i2c: tegra: Use relaxed versions of readl/writel Dmitry Osipenko
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

DMA is preferred for a larger transfers, while PIO is preferred for a
smaller transfers to avoid unnecessary DMA overhead. There is no strict
size limitations for the PIO-mode transfers, so let's rename the constant
for clarity.

Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 0245fc2b5684..e0eb8f5dcd6b 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -131,11 +131,12 @@
 #define I2C_PACKET_HEADER_SIZE			12
 
 /*
- * Upto I2C_PIO_MODE_MAX_LEN bytes, controller will use PIO mode,
- * above this, controller will use DMA to fill FIFO.
- * MAX PIO len is 20 bytes excluding packet header.
+ * I2C Controller will use PIO mode for transfers up to 32 bytes in order to
+ * avoid DMA overhead, otherwise external APB DMA controller will be used.
+ * Note that the actual MAX PIO length is 20 bytes because 32 bytes include
+ * I2C_PACKET_HEADER_SIZE.
  */
-#define I2C_PIO_MODE_MAX_LEN			32
+#define I2C_PIO_MODE_PREFERRED_LEN		32
 
 /*
  * msg_end_type: The bus control which need to be send at end of transfer.
@@ -1110,7 +1111,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 		xfer_size = msg->len + I2C_PACKET_HEADER_SIZE;
 
 	xfer_size = ALIGN(xfer_size, BYTES_PER_FIFO_WORD);
-	i2c_dev->is_curr_dma_xfer = (xfer_size > I2C_PIO_MODE_MAX_LEN) &&
+	i2c_dev->is_curr_dma_xfer = (xfer_size > I2C_PIO_MODE_PREFERRED_LEN) &&
 				    i2c_dev->dma_buf &&
 				    !i2c_dev->is_curr_atomic_xfer;
 	tegra_i2c_config_fifo_trig(i2c_dev, xfer_size);
-- 
2.24.0


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

* [PATCH v3 6/9] i2c: tegra: Use relaxed versions of readl/writel
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (4 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 5/9] i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 7/9] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

There is nothing to synchronize in regards to memory accesses for PIO
transfers and for DMA transfers the DMA API takes care of the syncing.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index e0eb8f5dcd6b..1a390e1bff72 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -284,12 +284,12 @@ struct tegra_i2c_dev {
 static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val,
 		       unsigned long reg)
 {
-	writel(val, i2c_dev->base + reg);
+	writel_relaxed(val, i2c_dev->base + reg);
 }
 
 static u32 dvc_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg)
 {
-	return readl(i2c_dev->base + reg);
+	return readl_relaxed(i2c_dev->base + reg);
 }
 
 /*
@@ -307,16 +307,16 @@ static unsigned long tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev,
 static void i2c_writel(struct tegra_i2c_dev *i2c_dev, u32 val,
 		       unsigned long reg)
 {
-	writel(val, i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg));
+	writel_relaxed(val, i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg));
 
 	/* Read back register to make sure that register writes completed */
 	if (reg != I2C_TX_FIFO)
-		readl(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg));
+		readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg));
 }
 
 static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned long reg)
 {
-	return readl(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg));
+	return readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg));
 }
 
 static void i2c_writesl(struct tegra_i2c_dev *i2c_dev, void *data,
@@ -689,12 +689,13 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)
 		i2c_writel(i2c_dev, I2C_MSTR_CONFIG_LOAD, I2C_CONFIG_LOAD);
 
 		if (i2c_dev->is_curr_atomic_xfer)
-			err = readl_poll_timeout_atomic(addr, val, val == 0,
-							1000,
-							I2C_CONFIG_LOAD_TIMEOUT);
+			err = readl_relaxed_poll_timeout_atomic(
+						addr, val, val == 0, 1000,
+						I2C_CONFIG_LOAD_TIMEOUT);
 		else
-			err = readl_poll_timeout(addr, val, val == 0, 1000,
-						 I2C_CONFIG_LOAD_TIMEOUT);
+			err = readl_relaxed_poll_timeout(
+						addr, val, val == 0, 1000,
+						I2C_CONFIG_LOAD_TIMEOUT);
 
 		if (err) {
 			dev_warn(i2c_dev->dev,
-- 
2.24.0


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

* [PATCH v3 7/9] clk: tegra: Fix double-free in tegra_clk_init()
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (5 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 6/9] i2c: tegra: Use relaxed versions of readl/writel Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 8/9] i2c: tegra: Always terminate DMA transfer Dmitry Osipenko
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

It's unlikely to happen in practice ever, but makes static checkers happy.

Fixes: 535f296d47de ("clk: tegra: Add suspend and resume support on Tegra210")
Reported-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/clk/tegra/clk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
index e6bd6d1ea012..f6cdce441cf7 100644
--- a/drivers/clk/tegra/clk.c
+++ b/drivers/clk/tegra/clk.c
@@ -231,8 +231,10 @@ struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks)
 	periph_banks = banks;
 
 	clks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL);
-	if (!clks)
+	if (!clks) {
 		kfree(periph_clk_enb_refcnt);
+		return NULL;
+	}
 
 	clk_num = num;
 
-- 
2.24.0


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

* [PATCH v3 8/9] i2c: tegra: Always terminate DMA transfer
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (6 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 7/9] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-06  1:04 ` [PATCH v3 9/9] i2c: tegra: Check DMA completion status in addition to left time Dmitry Osipenko
  2020-01-07 12:38 ` [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Thierry Reding
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

It is possible that I2C could error out in the middle of DMA transfer and
in this case DMA channel needs to be reset, otherwise a follow up transfer
will fail because DMA channel stays blocked.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 1a390e1bff72..3c7c86d4b0e4 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1220,11 +1220,12 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 		time_left = tegra_i2c_wait_completion_timeout(
 				i2c_dev, &i2c_dev->dma_complete, xfer_time);
 
+		dmaengine_terminate_sync(i2c_dev->msg_read ?
+					 i2c_dev->rx_dma_chan :
+					 i2c_dev->tx_dma_chan);
+
 		if (time_left == 0) {
 			dev_err(i2c_dev->dev, "DMA transfer timeout\n");
-			dmaengine_terminate_sync(i2c_dev->msg_read ?
-						 i2c_dev->rx_dma_chan :
-						 i2c_dev->tx_dma_chan);
 			tegra_i2c_init(i2c_dev, true);
 			return -ETIMEDOUT;
 		}
@@ -1237,11 +1238,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 			memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf,
 			       msg->len);
 		}
-
-		if (i2c_dev->msg_err != I2C_ERR_NONE)
-			dmaengine_synchronize(i2c_dev->msg_read ?
-					      i2c_dev->rx_dma_chan :
-					      i2c_dev->tx_dma_chan);
 	}
 
 	time_left = tegra_i2c_wait_completion_timeout(
-- 
2.24.0


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

* [PATCH v3 9/9] i2c: tegra: Check DMA completion status in addition to left time
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (7 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 8/9] i2c: tegra: Always terminate DMA transfer Dmitry Osipenko
@ 2020-01-06  1:04 ` Dmitry Osipenko
  2020-01-07 12:39   ` Thierry Reding
  2020-01-07 12:38 ` [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Thierry Reding
  9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-06  1:04 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

It is more robust to check completion status in addition to the left time
in a case of DMA transfer because transfer's completion happens in two
phases [one is ISR, other is tasklet] and thus it is possible that DMA is
completed while I2C completion awaiting times out because of the deferred
notification done by the DMA driver. The DMA completion status becomes
100% actual after DMA synchronization. This fixes spurious DMA timeouts
when system is under load.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 3c7c86d4b0e4..cbc2ad49043e 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1224,7 +1224,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 					 i2c_dev->rx_dma_chan :
 					 i2c_dev->tx_dma_chan);
 
-		if (time_left == 0) {
+		if (!time_left && !completion_done(&i2c_dev->dma_complete)) {
 			dev_err(i2c_dev->dev, "DMA transfer timeout\n");
 			tegra_i2c_init(i2c_dev, true);
 			return -ETIMEDOUT;
-- 
2.24.0


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

* Re: [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements
  2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
                   ` (8 preceding siblings ...)
  2020-01-06  1:04 ` [PATCH v3 9/9] i2c: tegra: Check DMA completion status in addition to left time Dmitry Osipenko
@ 2020-01-07 12:38 ` Thierry Reding
  2020-01-07 16:39   ` Dmitry Osipenko
  9 siblings, 1 reply; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:38 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Jonathan Hunter, Laxman Dewangan, Mikko Perttunen, Wolfram Sang,
	linux-i2c, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3898 bytes --]

On Mon, Jan 06, 2020 at 04:04:14AM +0300, Dmitry Osipenko wrote:
> Hello,
> 
> This patchset adds support for atomic transfers which are required for
> shutting down machine properly. Secondly, a (not)suspending I2C and some
> other things are fixed/improved by this small series as well. Please review
> and apply, thanks in advance!
> 
> Changelog:
> 
> v3: The "Prevent interrupt triggering after transfer timeout" and "Support
>     atomic transfers" patches got extra very minor improvements. The
>     completion now is passed directly to tegra_i2c_poll_completion_timeout(),
>     for consistency.
> 
>     Added two new patches that firm up DMA transfer handling:
> 
>       i2c: tegra: Always terminate DMA transfer
>       i2c: tegra: Check DMA completion status in addition to left time
> 
> v2: The series is renamed from "Tegra I2C: Support atomic transfers and
>     correct suspend/resume" to "NVIDIA Tegra I2C driver fixes and
>     improvements" because it now contains some more various changes.
> 
>     New patches in v2:
> 
>       i2c: tegra: Correct unwinding order on driver's probe error
>       i2c: tegra: Prevent interrupt triggering after transfer timeout
>       i2c: tegra: Use relaxed versions of readl/writel
> 
>     The "Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN" got an
>     improved wording for the code's comment to I2C_PIO_MODE_PREFERRED_LEN.
> 
>     The "Support atomic transfers" also got some very minor tuning, like
>     s/in_interrupt()/i2c_dev->is_curr_atomic_xfer/ in dvc_writel() that was
>     missed in v1.
> 
> v1: The "i2c: tegra: Support atomic transfers" previously was sent out as
>     a separate patch, but later I spotted that suspend/resume doesn't
>     work properly. The "i2c: tegra: Fix suspending in active runtime PM
>     state" patch depends on the atomic patch because there is a need to
>     active IRQ-safe mode for the runtime PM by both patches.
> 
>     I fixed a missed doc-comment of the newly added "is_curr_atomic_xfer"
>     structure field and added additional comment that explains why IRQ needs
>     to be disabled for the atomic transfer in the "Support atomic transfers"
>     patch.
> 
>     Lastly, I added a minor "i2c: tegra: Rename .." patch that helps to
>     follow driver's code.
> 
> Dmitry Osipenko (9):
>   i2c: tegra: Fix suspending in active runtime PM state
>   i2c: tegra: Properly disable runtime PM on driver's probe error
>   i2c: tegra: Prevent interrupt triggering after transfer timeout
>   i2c: tegra: Support atomic transfers
>   i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN
>   i2c: tegra: Use relaxed versions of readl/writel
>   clk: tegra: Fix double-free in tegra_clk_init()
>   i2c: tegra: Always terminate DMA transfer
>   i2c: tegra: Check DMA completion status in addition to left time
> 
>  drivers/clk/tegra/clk.c        |   4 +-
>  drivers/i2c/busses/i2c-tegra.c | 216 ++++++++++++++++++++++-----------
>  2 files changed, 147 insertions(+), 73 deletions(-)

I'm still a bit on the fence about that second patch because I don't
think force-suspend is the right thing to do.

You should probably split the clk subsystem patch out of this series so
that it can be picked up into the clk tree (or I can pick it up into the
Tegra tree).

Other than that, I ran this through the testfarm and didn't see any
regressions:

    Test results:
      13 builds: 13 pass, 0 fail
      11 boots:  11 pass, 0 fail
      38 tests:  38 pass, 0 fail

    Linux version: 5.5.0-rc5-g258d134300af
    Boards tested: tegra20-ventana, tegra30-cardhu-a04, tegra124-jetson-tk1,
                   tegra186-p2771-0000, tegra194-p2972-0000,
                   tegra210-p2371-2180

I'll reply to the individual patches with a Tested-by for patchwork to
pick up.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state
  2020-01-06  1:04 ` [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state Dmitry Osipenko
@ 2020-01-07 12:38   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:38 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:15 +0300, Dmitry Osipenko wrote:
> I noticed that sometime I2C clock is kept enabled during suspend-resume.
> This happens because runtime PM defers dynamic suspension and thus it may
> happen that runtime PM is in active state when system enters into suspend.
> In particular I2C controller that is used for CPU's DVFS is often kept ON
> during suspend because CPU's voltage scaling happens quite often.
> 
> Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 2/9] i2c: tegra: Properly disable runtime PM on driver's probe error
  2020-01-06  1:04 ` [PATCH v3 2/9] i2c: tegra: Properly disable runtime PM on driver's probe error Dmitry Osipenko
@ 2020-01-07 12:38   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:38 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:16 +0300, Dmitry Osipenko wrote:
> One of the recent Tegra I2C commits made a change that resumes runtime PM
> during driver's probe, but it missed to put the RPM in a case of error.
> Note that it's not correct to use pm_runtime_status_suspended because it
> breaks RPM refcounting.
> 
> Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 3/9] i2c: tegra: Prevent interrupt triggering after transfer timeout
  2020-01-06  1:04 ` [PATCH v3 3/9] i2c: tegra: Prevent interrupt triggering after transfer timeout Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:17 +0300, Dmitry Osipenko wrote:
> Potentially it is possible that interrupt may fire after transfer timeout.
> That may not end up well for the next transfer because interrupt handling
> may race with hardware resetting.
> 
> This is very unlikely to happen in practice, but anyway let's prevent the
> potential problem by enabling interrupt only at the moments when it is
> actually necessary to get some interrupt event.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 70 +++++++++++++++++-----------------
>  1 file changed, 36 insertions(+), 34 deletions(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 4/9] i2c: tegra: Support atomic transfers
  2020-01-06  1:04 ` [PATCH v3 4/9] i2c: tegra: Support atomic transfers Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:18 +0300, Dmitry Osipenko wrote:
> System shutdown may happen with interrupts being disabled and in this case
> I2C core rejects transfers if atomic transfer isn't supported by driver.
> 
> There were several occurrences where I found my Nexus 7 completely
> discharged despite of being turned off and then one day I spotted this in
> the log:
> 
>  reboot: Power down
>  ------------[ cut here ]------------
>  WARNING: CPU: 0 PID: 1 at drivers/i2c/i2c-core.h:40 i2c_transfer+0x95/0x9c
>  No atomic I2C transfer handler for 'i2c-1'
>  Modules linked in: tegra30_devfreq
>  CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.4.0-next-20191202-00120-gf7ecd80fb803-dirty #3195
>  Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
>  [<c010e4b5>] (unwind_backtrace) from [<c010a0fd>] (show_stack+0x11/0x14)
>  [<c010a0fd>] (show_stack) from [<c09995e5>] (dump_stack+0x85/0x94)
>  [<c09995e5>] (dump_stack) from [<c011f3d1>] (__warn+0xc1/0xc4)
>  [<c011f3d1>] (__warn) from [<c011f691>] (warn_slowpath_fmt+0x61/0x78)
>  [<c011f691>] (warn_slowpath_fmt) from [<c069a8dd>] (i2c_transfer+0x95/0x9c)
>  [<c069a8dd>] (i2c_transfer) from [<c05667f1>] (regmap_i2c_read+0x4d/0x6c)
>  [<c05667f1>] (regmap_i2c_read) from [<c0563601>] (_regmap_raw_read+0x99/0x1cc)
>  [<c0563601>] (_regmap_raw_read) from [<c0563757>] (_regmap_bus_read+0x23/0x38)
>  [<c0563757>] (_regmap_bus_read) from [<c056293d>] (_regmap_read+0x3d/0xfc)
>  [<c056293d>] (_regmap_read) from [<c0562d3b>] (_regmap_update_bits+0x87/0xc4)
>  [<c0562d3b>] (_regmap_update_bits) from [<c0563add>] (regmap_update_bits_base+0x39/0x50)
>  [<c0563add>] (regmap_update_bits_base) from [<c056fd39>] (max77620_pm_power_off+0x29/0x2c)
>  [<c056fd39>] (max77620_pm_power_off) from [<c013bbdd>] (__do_sys_reboot+0xe9/0x170)
>  [<c013bbdd>] (__do_sys_reboot) from [<c0101001>] (ret_fast_syscall+0x1/0x28)
>  Exception stack(0xde907fa8 to 0xde907ff0)
>  7fa0:                   00000000 00000000 fee1dead 28121969 4321fedc 00000000
>  7fc0: 00000000 00000000 00000000 00000058 00000000 00000000 00000000 00000000
>  7fe0: 0045adf0 bed9abb8 004444a0 b6c666d0
>  ---[ end trace bdd18f87595b1a5e ]---
> 
> The atomic transferring is implemented by enforcing PIO mode for the
> transfer and by polling interrupt status until transfer is completed or
> failed.
> 
> Now system shuts down properly every time.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 84 ++++++++++++++++++++++++++++------
>  1 file changed, 69 insertions(+), 15 deletions(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 5/9] i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN
  2020-01-06  1:04 ` [PATCH v3 5/9] i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:19 +0300, Dmitry Osipenko wrote:
> DMA is preferred for a larger transfers, while PIO is preferred for a
> smaller transfers to avoid unnecessary DMA overhead. There is no strict
> size limitations for the PIO-mode transfers, so let's rename the constant
> for clarity.
> 
> Tested-by: Thierry Reding <treding@nvidia.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 6/9] i2c: tegra: Use relaxed versions of readl/writel
  2020-01-06  1:04 ` [PATCH v3 6/9] i2c: tegra: Use relaxed versions of readl/writel Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:20 +0300, Dmitry Osipenko wrote:
> There is nothing to synchronize in regards to memory accesses for PIO
> transfers and for DMA transfers the DMA API takes care of the syncing.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 7/9] clk: tegra: Fix double-free in tegra_clk_init()
  2020-01-06  1:04 ` [PATCH v3 7/9] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:21 +0300, Dmitry Osipenko wrote:
> It's unlikely to happen in practice ever, but makes static checkers happy.
> 
> Fixes: 535f296d47de ("clk: tegra: Add suspend and resume support on Tegra210")
> Reported-by: Stephen Boyd <sboyd@kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/clk/tegra/clk.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 8/9] i2c: tegra: Always terminate DMA transfer
  2020-01-06  1:04 ` [PATCH v3 8/9] i2c: tegra: Always terminate DMA transfer Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:22 +0300, Dmitry Osipenko wrote:
> It is possible that I2C could error out in the middle of DMA transfer and
> in this case DMA channel needs to be reset, otherwise a follow up transfer
> will fail because DMA channel stays blocked.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 9/9] i2c: tegra: Check DMA completion status in addition to left time
  2020-01-06  1:04 ` [PATCH v3 9/9] i2c: tegra: Check DMA completion status in addition to left time Dmitry Osipenko
@ 2020-01-07 12:39   ` Thierry Reding
  0 siblings, 0 replies; 21+ messages in thread
From: Thierry Reding @ 2020-01-07 12:39 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	Mikko Perttunen, Wolfram Sang, linux-i2c, linux-tegra,
	linux-kernel

On Mon, 06 Jan 2020 04:04:23 +0300, Dmitry Osipenko wrote:
> It is more robust to check completion status in addition to the left time
> in a case of DMA transfer because transfer's completion happens in two
> phases [one is ISR, other is tasklet] and thus it is possible that DMA is
> completed while I2C completion awaiting times out because of the deferred
> notification done by the DMA driver. The DMA completion status becomes
> 100% actual after DMA synchronization. This fixes spurious DMA timeouts
> when system is under load.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Tested-by: Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements
  2020-01-07 12:38 ` [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Thierry Reding
@ 2020-01-07 16:39   ` Dmitry Osipenko
  0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Osipenko @ 2020-01-07 16:39 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jonathan Hunter, Laxman Dewangan, Mikko Perttunen, Wolfram Sang,
	linux-i2c, linux-tegra, linux-kernel

Hello Thierry,

07.01.2020 15:38, Thierry Reding пишет:
> On Mon, Jan 06, 2020 at 04:04:14AM +0300, Dmitry Osipenko wrote:
>> Hello,
>>
>> This patchset adds support for atomic transfers which are required for
>> shutting down machine properly. Secondly, a (not)suspending I2C and some
>> other things are fixed/improved by this small series as well. Please review
>> and apply, thanks in advance!
>>
>> Changelog:
>>
>> v3: The "Prevent interrupt triggering after transfer timeout" and "Support
>>     atomic transfers" patches got extra very minor improvements. The
>>     completion now is passed directly to tegra_i2c_poll_completion_timeout(),
>>     for consistency.
>>
>>     Added two new patches that firm up DMA transfer handling:
>>
>>       i2c: tegra: Always terminate DMA transfer
>>       i2c: tegra: Check DMA completion status in addition to left time
>>
>> v2: The series is renamed from "Tegra I2C: Support atomic transfers and
>>     correct suspend/resume" to "NVIDIA Tegra I2C driver fixes and
>>     improvements" because it now contains some more various changes.
>>
>>     New patches in v2:
>>
>>       i2c: tegra: Correct unwinding order on driver's probe error
>>       i2c: tegra: Prevent interrupt triggering after transfer timeout
>>       i2c: tegra: Use relaxed versions of readl/writel
>>
>>     The "Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN" got an
>>     improved wording for the code's comment to I2C_PIO_MODE_PREFERRED_LEN.
>>
>>     The "Support atomic transfers" also got some very minor tuning, like
>>     s/in_interrupt()/i2c_dev->is_curr_atomic_xfer/ in dvc_writel() that was
>>     missed in v1.
>>
>> v1: The "i2c: tegra: Support atomic transfers" previously was sent out as
>>     a separate patch, but later I spotted that suspend/resume doesn't
>>     work properly. The "i2c: tegra: Fix suspending in active runtime PM
>>     state" patch depends on the atomic patch because there is a need to
>>     active IRQ-safe mode for the runtime PM by both patches.
>>
>>     I fixed a missed doc-comment of the newly added "is_curr_atomic_xfer"
>>     structure field and added additional comment that explains why IRQ needs
>>     to be disabled for the atomic transfer in the "Support atomic transfers"
>>     patch.
>>
>>     Lastly, I added a minor "i2c: tegra: Rename .." patch that helps to
>>     follow driver's code.
>>
>> Dmitry Osipenko (9):
>>   i2c: tegra: Fix suspending in active runtime PM state
>>   i2c: tegra: Properly disable runtime PM on driver's probe error
>>   i2c: tegra: Prevent interrupt triggering after transfer timeout
>>   i2c: tegra: Support atomic transfers
>>   i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN
>>   i2c: tegra: Use relaxed versions of readl/writel
>>   clk: tegra: Fix double-free in tegra_clk_init()
>>   i2c: tegra: Always terminate DMA transfer
>>   i2c: tegra: Check DMA completion status in addition to left time
>>
>>  drivers/clk/tegra/clk.c        |   4 +-
>>  drivers/i2c/busses/i2c-tegra.c | 216 ++++++++++++++++++++++-----------
>>  2 files changed, 147 insertions(+), 73 deletions(-)
> 
> I'm still a bit on the fence about that second patch because I don't
> think force-suspend is the right thing to do.

Technically the force-suspend does absolutely the right thing. That's
what other drivers do, including some of the Tegra drivers. Personally
I'm feeling confident that it should be correct. Of course it would be
better to get a confirmation, unfortunately Rafael didn't answer
anything yet. We can always make another patch if it will turn out that
something is wrong.

> You should probably split the clk subsystem patch out of this series so
> that it can be picked up into the clk tree (or I can pick it up into the
> Tegra tree).

I made a mistake during rebase and didn't notice that, the clk patch is
already applied to the clk tree by Stephen Boyd. I'll fix the rebase and
send out v4, thanks!

> Other than that, I ran this through the testfarm and didn't see any
> regressions:
> 
>     Test results:
>       13 builds: 13 pass, 0 fail
>       11 boots:  11 pass, 0 fail
>       38 tests:  38 pass, 0 fail
> 
>     Linux version: 5.5.0-rc5-g258d134300af
>     Boards tested: tegra20-ventana, tegra30-cardhu-a04, tegra124-jetson-tk1,
>                    tegra186-p2771-0000, tegra194-p2972-0000,
>                    tegra210-p2371-2180
> 
> I'll reply to the individual patches with a Tested-by for patchwork to
> pick up.

Thanks!


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

end of thread, other threads:[~2020-01-07 16:39 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06  1:04 [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Dmitry Osipenko
2020-01-06  1:04 ` [PATCH v3 1/9] i2c: tegra: Fix suspending in active runtime PM state Dmitry Osipenko
2020-01-07 12:38   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 2/9] i2c: tegra: Properly disable runtime PM on driver's probe error Dmitry Osipenko
2020-01-07 12:38   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 3/9] i2c: tegra: Prevent interrupt triggering after transfer timeout Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 4/9] i2c: tegra: Support atomic transfers Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 5/9] i2c: tegra: Rename I2C_PIO_MODE_MAX_LEN to I2C_PIO_MODE_PREFERRED_LEN Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 6/9] i2c: tegra: Use relaxed versions of readl/writel Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 7/9] clk: tegra: Fix double-free in tegra_clk_init() Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 8/9] i2c: tegra: Always terminate DMA transfer Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-06  1:04 ` [PATCH v3 9/9] i2c: tegra: Check DMA completion status in addition to left time Dmitry Osipenko
2020-01-07 12:39   ` Thierry Reding
2020-01-07 12:38 ` [PATCH v3 0/9] NVIDIA Tegra I2C driver fixes and improvements Thierry Reding
2020-01-07 16:39   ` Dmitry Osipenko

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