mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] clk: en7523: two fixes for the EN7581 clock and reset driver
@ 2026-11-11  8:56 John Crispin
  2026-11-11  8:56 ` [PATCH 1/2] clk: en7523: do not sleep in the EN7581 PCIe clock disable John Crispin
  2026-11-11  8:56 ` [PATCH 2/2] clk: en7523: add a reset operation John Crispin
  0 siblings, 2 replies; 3+ messages in thread
From: John Crispin @ 2026-11-11  8:56 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Jerome Brunet, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Christian Marangi, lei.dong, Linqi.zhang, linux-arm-kernel,
	linux-clk, linux-kernel, linux-mediatek, Lorenzo Bianconi,
	Rajeev.kumar, upstream, Weifeng.xu, zhengping.zhang

Patch 1 stops en7581_pci_disable() from sleeping in a .disable callback,
which the clock core calls with the enable spinlock held.

Patch 2 adds a reset operation, so device_reset() works for consumers
such as i2c-mt7621.

The series applies to next-20261105 and has no dependencies.

John Crispin (2):
  clk: en7523: do not sleep in the EN7581 PCIe clock disable
  clk: en7523: add a reset operation

 drivers/clk/clk-en7523.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)


base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
-- 
2.34.1


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

* [PATCH 1/2] clk: en7523: do not sleep in the EN7581 PCIe clock disable
  2026-11-11  8:56 [PATCH 0/2] clk: en7523: two fixes for the EN7581 clock and reset driver John Crispin
@ 2026-11-11  8:56 ` John Crispin
  2026-11-11  8:56 ` [PATCH 2/2] clk: en7523: add a reset operation John Crispin
  1 sibling, 0 replies; 3+ messages in thread
From: John Crispin @ 2026-11-11  8:56 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Jerome Brunet, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Christian Marangi, lei.dong, Linqi.zhang, linux-arm-kernel,
	linux-clk, linux-kernel, linux-mediatek, Lorenzo Bianconi,
	Rajeev.kumar, upstream, Weifeng.xu, zhengping.zhang

en7581_pci_disable() is the .disable callback of the PCIe clock gate.
The clock core calls .disable with the enable spinlock held and
interrupts off, but the callback sleeps with usleep_range(). Every boot
where no consumer holds the clock reports "BUG: scheduling while atomic"
from clk_disable_unused(), and so does the unwind of a PCIe probe that
finds no link.

Drop the sleep. Commit 90d4e466c9ea ("PCI: mediatek-gen3: Move reset
delay in mtk_pcie_en7581_power_up()") already moved the wait of the
enable side into the PCIe driver, and nothing depends on a wait after
the disable.

Fixes: 66bc47326ce2 ("clk: en7523: Add EN7581 support")
Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/clk/clk-en7523.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 24fdec2e6198..8f63482cbb7b 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -689,7 +689,6 @@ static void en7581_pci_disable(struct clk_hw *hw)
 	mask = REG_PCI_CONTROL_REFCLK_EN0 | REG_PCI_CONTROL_REFCLK_EN1;
 	val = readl(np_base + REG_PCI_CONTROL);
 	writel(val & ~mask, np_base + REG_PCI_CONTROL);
-	usleep_range(1000, 2000);
 }
 
 static void en7523_register_clocks(struct device *dev, struct clk_hw_onecell_data *clk_data,
-- 
2.34.1


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

* [PATCH 2/2] clk: en7523: add a reset operation
  2026-11-11  8:56 [PATCH 0/2] clk: en7523: two fixes for the EN7581 clock and reset driver John Crispin
  2026-11-11  8:56 ` [PATCH 1/2] clk: en7523: do not sleep in the EN7581 PCIe clock disable John Crispin
@ 2026-11-11  8:56 ` John Crispin
  1 sibling, 0 replies; 3+ messages in thread
From: John Crispin @ 2026-11-11  8:56 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Jerome Brunet, Philipp Zabel,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Christian Marangi, lei.dong, Linqi.zhang, linux-arm-kernel,
	linux-clk, linux-kernel, linux-mediatek, Lorenzo Bianconi,
	Rajeev.kumar, upstream, Weifeng.xu, zhengping.zhang

The reset controller implements assert, deassert and status but not
reset, so device_reset() fails with -ENOTSUPP. The i2c-mt7621 driver
calls it at probe and after a transfer timeout. Every I2C bus that
references an SCU reset, as on the EN7581 and the AN7589, therefore
logs "I2C reset failed!" and is never reset.

Add a reset operation that asserts and then deasserts the line, as the
MT7621 reset controller does for the same I2C block.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/clk/clk-en7523.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 8f63482cbb7b..eb893259d470 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -818,6 +818,18 @@ static int en7523_reset_deassert(struct reset_controller_dev *rcdev,
 	return en7523_reset_update(rcdev, id, false);
 }
 
+static int en7523_reset_reset(struct reset_controller_dev *rcdev,
+			      unsigned long id)
+{
+	int ret;
+
+	ret = en7523_reset_assert(rcdev, id);
+	if (ret)
+		return ret;
+
+	return en7523_reset_deassert(rcdev, id);
+}
+
 static int en7523_reset_status(struct reset_controller_dev *rcdev,
 			       unsigned long id)
 {
@@ -847,6 +859,7 @@ static int en7523_reset_xlate(struct reset_controller_dev *rcdev,
 }
 
 static const struct reset_control_ops en7581_reset_ops = {
+	.reset = en7523_reset_reset,
 	.assert = en7523_reset_assert,
 	.deassert = en7523_reset_deassert,
 	.status = en7523_reset_status,
-- 
2.34.1


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

end of thread, other threads:[~2026-11-11  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  8:56 [PATCH 0/2] clk: en7523: two fixes for the EN7581 clock and reset driver John Crispin
2026-11-11  8:56 ` [PATCH 1/2] clk: en7523: do not sleep in the EN7581 PCIe clock disable John Crispin
2026-11-11  8:56 ` [PATCH 2/2] clk: en7523: add a reset operation John Crispin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®