public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: rp2: Fix reset with non forgiving PCIe host bridges
@ 2024-09-06 22:54 Florian Fainelli
  2024-09-11 13:46 ` Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Florian Fainelli @ 2024-09-06 22:54 UTC (permalink / raw)
  To: linux-serial
  Cc: Florian Fainelli, Jim Quinlan, Kevin Cernekee, Greg Kroah-Hartman,
	Jiri Slaby, John Ogness, Ilpo Järvinen, Thomas Gleixner,
	open list:TTY LAYER AND SERIAL DRIVERS

The write to RP2_GLOBAL_CMD followed by an immediate read of
RP2_GLOBAL_CMD in rp2_reset_asic() is intented to flush out the write,
however by then the device is already in reset and cannot respond to a
memory cycle access.

On platforms such as the Raspberry Pi 4 and others using the
pcie-brcmstb.c driver, any memory access to a device that cannot respond
is met with a fatal system error, rather than being substituted with all
1s as is usually the case on PC platforms.

Swapping the delay and the read ensures that the device has finished
resetting before we attempt to read from it.

Fixes: 7d9f49afa451 ("serial: rp2: New driver for Comtrol RocketPort 2 cards")
Suggested-by: Jim Quinlan <james.quinlan@broadcom.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 drivers/tty/serial/rp2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/rp2.c b/drivers/tty/serial/rp2.c
index 4132fcff7d4e..8bab2aedc499 100644
--- a/drivers/tty/serial/rp2.c
+++ b/drivers/tty/serial/rp2.c
@@ -577,8 +577,8 @@ static void rp2_reset_asic(struct rp2_card *card, unsigned int asic_id)
 	u32 clk_cfg;
 
 	writew(1, base + RP2_GLOBAL_CMD);
-	readw(base + RP2_GLOBAL_CMD);
 	msleep(100);
+	readw(base + RP2_GLOBAL_CMD);
 	writel(0, base + RP2_CLK_PRESCALER);
 
 	/* TDM clock configuration */
-- 
2.43.0


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

end of thread, other threads:[~2024-09-26 22:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 22:54 [PATCH] tty: rp2: Fix reset with non forgiving PCIe host bridges Florian Fainelli
2024-09-11 13:46 ` Greg Kroah-Hartman
2024-09-11 21:47 ` Jim Quinlan
2024-09-11 22:01   ` Florian Fainelli
2024-09-11 22:16     ` Jim Quinlan
2024-09-11 22:19       ` Florian Fainelli
2024-09-11 22:44         ` Jim Quinlan
2024-09-12  0:19           ` Florian Fainelli
2024-09-23  9:44 ` Jiri Slaby
2024-09-26 22:50   ` Florian Fainelli

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