mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Szuying Chen <chensiying21@gmail.com>,
	Niklas.Cassel@wdc.com, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Jesse1_Chang@asmedia.com.tw, Richard_Hsu@asmedia.com.tw,
	Chloe_Chen@asmedia.com.tw
Subject: Re: [PATCH] ahci: libahci: clear pending interrupt status
Date: Thu, 31 Aug 2023 14:22:00 +0900	[thread overview]
Message-ID: <2876b3bf-14e4-3570-064f-4d5f9b00314b@kernel.org> (raw)
In-Reply-To: <20230831030924.21960-1-Chloe_Chen@asmedia.com.tw>

On 8/31/23 12:09, Szuying Chen wrote:
> This patch adds the function to clear pending interrupt before COMRESET.
> It follows the  AHCI1.3.1 - section6.2.2.2 specification.

Please explain here the relevant part of that section.

> 
> Signed-off-by: Szuying Chen <Chloe_Chen@asmedia.com.tw>
> ---
>  drivers/ata/libahci.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index 06aec35f88f2..1ae788251a6c 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -1584,6 +1584,23 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
>  	return rc;
>  }
> 
> +static void PortClearPendingInterrupt(struct ata_port *ap)

No CaMeLCaSe please ! Call this ahci_port_clear_peinding_irq().

> +{
> +	struct ahci_host_priv *hpriv = ap->host->private_data;
> +	void __iomem *port_mmio = ahci_port_base(ap);
> +	u32 tmp;
> +
> +	/* clear port SERR */
> +	tmp = readl(port_mmio + PORT_SCR_ERR);
> +	writel(tmp, port_mmio + PORT_SCR_ERR);
> +
> +	/* clear port IRQ */
> +	tmp = readl(port_mmio + PORT_IRQ_STAT);
> +	writel(tmp, port_mmio + PORT_IRQ_STAT);
> +
> +	writel(1 << ap->port_no, hpriv->mmio + HOST_IRQ_STAT);

This code is nearly identical to what ahci_port_init() does. So better make it
common: keep the debug messages that are in ahci_port_init() and modify that
function to call this new helper.

> +}
> +
>  int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
>  		      unsigned long deadline, bool *online)
>  {
> @@ -1602,6 +1619,9 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
>  	tf.status = ATA_BUSY;
>  	ata_tf_to_fis(&tf, 0, 0, d2h_fis);
> 
> +	/* clear pending Interrupt */
> +	PortClearPendingInterrupt(ap);
> +
>  	rc = sata_link_hardreset(link, timing, deadline, online,
>  				 ahci_check_ready);
> 
> --
> 2.39.2
> 

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2023-08-31  5:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  3:09 Szuying Chen
2023-08-31  5:22 ` Damien Le Moal [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-10  9:31 Szuying Chen
2023-08-10  9:59 ` Damien Le Moal
2023-08-10  5:05 Szuying Chen
2023-08-10  5:12 ` Damien Le Moal

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=2876b3bf-14e4-3570-064f-4d5f9b00314b@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=Chloe_Chen@asmedia.com.tw \
    --cc=Jesse1_Chang@asmedia.com.tw \
    --cc=Niklas.Cassel@wdc.com \
    --cc=Richard_Hsu@asmedia.com.tw \
    --cc=chensiying21@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®