From: Adrian McMenamin <adrian@newgolddream.dyndns.info>
To: Paul Mundt <lethal@linux-sh.org>,
linux-sh <linuxsh-dev@lists.sourceforge.net>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix SH DMAC code to handle PVR2 cascade
Date: Tue, 02 Oct 2007 22:09:27 +0100 [thread overview]
Message-ID: <1191359367.17654.24.camel@localhost.localdomain> (raw)
Fix SH DMAC code to correctly handle PVR2 cascade DMA.
This updates http://lkml.org/lkml/2007/10/2/276
(I decided it was better to have the true size of the transfer put in
via the API and refactor this here. And calc_xmit_shift(chan) should
return 5 but only returns 3 so I've not used it here)
--- arch/sh/drivers/dma/dma-sh.c 2007/09/22 18:34:42 1.1
+++ arch/sh/drivers/dma/dma-sh.c 2007/10/02 20:53:49 1.3
@@ -150,6 +150,13 @@ static void sh_dmac_disable_dma(struct d
static int sh_dmac_xfer_dma(struct dma_channel *chan)
{
+ /* Handle Dreamcast PVR cascade */
+ if (mach_is_dreamcast() && chan->chan == PVR2_CASCADE_CHAN) {
+ ctrl_outl(chan->sar, SAR[chan->chan]);
+ /* Transfer in 32 byte blocks */
+ ctrl_outl((chan->count) >> 5, DMATCR[chan->chan]);
+ return 0;
+ }
/*
* If we haven't pre-configured the channel with special flags, use
* the defaults.
@@ -159,26 +166,9 @@ static int sh_dmac_xfer_dma(struct dma_c
sh_dmac_disable_dma(chan);
- /*
- * Single-address mode usage note!
- *
- * It's important that we don't accidentally write any value to SAR/DAR
- * (this includes 0) that hasn't been directly specified by the user if
- * we're in single-address mode.
- *
- * In this case, only one address can be defined, anything else will
- * result in a DMA address error interrupt (at least on the SH-4),
- * which will subsequently halt the transfer.
- *
- * Channel 2 on the Dreamcast is a special case, as this is used for
- * cascading to the PVR2 DMAC. In this case, we still need to write
- * SAR and DAR, regardless of value, in order for cascading to work.
- */
- if (chan->sar || (mach_is_dreamcast() &&
- chan->chan == PVR2_CASCADE_CHAN))
+ if (chan->sar)
ctrl_outl(chan->sar, SAR[chan->chan]);
- if (chan->dar || (mach_is_dreamcast() &&
- chan->chan == PVR2_CASCADE_CHAN))
+ if (chan->dar)
ctrl_outl(chan->dar, DAR[chan->chan]);
ctrl_outl(chan->count >> calc_xmit_shift(chan), DMATCR[chan->chan]);
next reply other threads:[~2007-10-02 21:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-02 21:09 Adrian McMenamin [this message]
2007-10-03 6:18 ` [PATCH] Fix SH DMAC code to handle PVR2 cascade Paul Mundt
2007-10-03 15:41 ` Adrian McMenamin
2007-10-04 10:01 ` Paul Mundt
2007-10-04 11:34 ` Adrian McMenamin
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=1191359367.17654.24.camel@localhost.localdomain \
--to=adrian@newgolddream.dyndns.info \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxsh-dev@lists.sourceforge.net \
/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