From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: sh: sh7723/7724 nmi: nmi stops DMA transfers
Date: Mon, 13 Dec 2010 10:28:41 +0000 [thread overview]
Message-ID: <20101213102841.GG3750@linux-sh.org> (raw)
In-Reply-To: <95F51F4B902CAC40AF459205F6322F0187A9C8F819@BMK019S01.emtrion.local>
On Mon, Dec 13, 2010 at 10:19:54AM +0100, Szafranek, Michael wrote:
> I've got a patch that fixes a problem when a NMI occurs which stops DMA
> transfers. The code in the patch resumes the DMA transfers. But it does
> not look like the proper place to solve this problem. If you could give
> me a hint were to move the code.
>
> diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
> index 0830c2a..67f24bc 100644
> --- a/arch/sh/kernel/traps.c
> +++ b/arch/sh/kernel/traps.c
> switch (notify_die(DIE_NMI, "NMI", regs, 0, vec & 0xff, SIGINT)) {
> case NOTIFY_OK:
...
You surely must have noticed the notifier chain literally right above
where you decided to add your hack?
> @@ -111,6 +115,22 @@ BUILD_TRAP_HANDLER(nmi)
> printk(KERN_ALERT "Got NMI, but nobody cared. Ignoring...\n");
> break;
> }
> -
> +
> +/* every NMI usually stops all active DMA transfers. These lines simply reanimate the */
> +/* DMA channels so that the transfers are resumed */
> +#if defined(CONFIG_SH_HICO7723) || defined(CONFIG_SH_HICO7724)
> + dmaor = __raw_readw(SH_DMAC_BASE0 + DMAOR);
> + dmaor &= ~(DMAOR_NMIF | DMAOR_AE); // resetting NMI flag and address error flag
> + __raw_writew( dmaor, SH_DMAC_BASE0 + DMAOR );
> + dmaor |= DMAOR_INIT; // restarting DMA
> + __raw_writew( dmaor, SH_DMAC_BASE0 + DMAOR );
> +
> + dmaor = __raw_readw(SH_DMAC_BASE1 + DMAOR);
> + dmaor &= ~(DMAOR_NMIF | DMAOR_AE); // resetting NMI flag and address error flag
> + __raw_writew( dmaor, SH_DMAC_BASE1 + DMAOR );
> + dmaor |= DMAOR_INIT; // restarting DMA
> + __raw_writew( dmaor, SH_DMAC_BASE1 + DMAOR );
> +#endif
> +
> nmi_exit();
> }
>
Simply register a die notifier in the DMA driver and take care of this
there.
next prev parent reply other threads:[~2010-12-13 10:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 9:19 sh: sh7723/7724 nmi: nmi stops DMA transfers Szafranek, Michael
2010-12-13 10:28 ` Paul Mundt [this message]
2010-12-14 6:57 ` Paul Mundt
2010-12-14 9:15 ` AW: " Szafranek, Michael
2010-12-14 9:48 ` Paul Mundt
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=20101213102841.GG3750@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=linux-sh@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;
as well as URLs for NNTP newsgroup(s).