Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Tim Yamin <plasm@roo.me.uk>, Julia Lawall <Julia.Lawall@lip6.fr>,
	Jeff Garzik <jgarzik@redhat.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCHv3 3/6] ata: pata_mpc52xx: reset cached DMA direction on resume
Date: Fri, 12 Jun 2026 11:32:24 -0700	[thread overview]
Message-ID: <20260612183227.20446-4-rosenp@gmail.com> (raw)
In-Reply-To: <20260612183227.20446-1-rosenp@gmail.com>

mpc52xx_ata_hw_init() is called from both probe and resume, but only
probe initializes priv->mpc52xx_ata_dma_last_write to -1. On resume
the hardware FIFO state is lost, yet the cached direction survives.
If the first post-resume DMA uses the same direction as before suspend,
mpc52xx_bmdma_setup() skips reconfiguring the FIFO (fifo_control,
fifo_alarm) because the cache matches, leaving the FIFO in its default
reset state.

Move the initialization of mpc52xx_ata_dma_last_write into
mpc52xx_ata_hw_init() so it is reset on both probe and resume.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/ata/pata_mpc52xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 72a2b677bc90..b2e2f83aa9ca 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -375,6 +375,7 @@ mpc52xx_ata_hw_init(struct mpc52xx_ata_priv *priv)
 
 	/* Init timings to PIO0 */
 	memset(priv->timings, 0x00, 2*sizeof(struct mpc52xx_ata_timings));
+	priv->mpc52xx_ata_dma_last_write = -1;
 
 	mpc52xx_ata_compute_pio_timings(priv, 0, 0);
 	mpc52xx_ata_compute_pio_timings(priv, 1, 0);
@@ -750,7 +751,6 @@ static int mpc52xx_ata_probe(struct platform_device *op)
 	priv->ata_regs_pa = res_mem.start;
 	priv->ata_irq = ata_irq;
 	priv->csel = -1;
-	priv->mpc52xx_ata_dma_last_write = -1;
 
 	if (ipb_freq/1000000 == 66) {
 		priv->mdmaspec = mdmaspec66;
-- 
2.54.0


  parent reply	other threads:[~2026-06-12 18:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 18:32 [PATCHv3 0/6] ata: pata_mpc52xx: fix cleanup ordering and modernize Rosen Penev
2026-06-12 18:32 ` [PATCHv3 1/6] ata: pata_mpc52xx: fix NULL pointer dereference in IRQ handler Rosen Penev
2026-06-12 18:32 ` [PATCHv3 2/6] ata: pata_mpc52xx: synchronize with task IRQ before resetting DMA state Rosen Penev
2026-06-12 18:32 ` Rosen Penev [this message]
2026-06-12 18:32 ` [PATCHv3 4/6] ata: pata_mpc52xx: remove redundant irq_dispose_mapping calls Rosen Penev
2026-06-12 18:45   ` sashiko-bot
2026-06-12 18:32 ` [PATCHv3 5/6] ata: pata_mpc52xx: convert to platform_get_irq() Rosen Penev
2026-06-12 18:32 ` [PATCHv3 6/6] ata: pata_mpc52xx: convert to full devm resource management Rosen Penev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260612183227.20446-4-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=plasm@roo.me.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox