mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Adrian McMenamin" <adrianmcmenamin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: lethal@users.sourceforge.net
Subject: [PATCH] Fix DMA on Dreamcast
Date: Thu, 19 Jul 2007 20:30:34 +0100	[thread overview]
Message-ID: <92a12cdb0707191230g216feaf2ied3e95bacf4dd572@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 136 bytes --]

I think my first attempt to post this may have got lost in space somewhere.

Signed-off by: Adrian McMenamin <adrian@mcmen.demon.co.uk>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dma-patch.diff --]
[-- Type: text/x-patch; name="dma-patch.diff", Size: 1958 bytes --]

diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index cf8e119..0c9b3bc 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -31,8 +31,8 @@ struct dma_info *get_dma_info(unsigned int chan)
 	 * the channel is.
 	 */
 	list_for_each_entry(info, &registered_dmac_list, list) {
-		if ((chan <  info->first_channel_nr) ||
-		    (chan >= info->first_channel_nr + info->nr_channels))
+		if ((chan <  info->first_vchannel_nr) ||
+		    (chan >= info->first_vchannel_nr + info->nr_channels))
 			continue;
 
 		return info;
@@ -82,7 +82,7 @@ struct dma_channel *get_dma_channel(unsigned int chan)
 
 	for (i = 0; i < info->nr_channels; i++) {
 		channel = &info->channels[i];
-		if (channel->chan == chan)
+		if (channel->chan == (chan - info->first_vchannel_nr))
 			return channel;
 	}
 
@@ -183,6 +183,7 @@ int dmac_search_free_channel(const char *dev_id)
 			return result;
 
 		atomic_set(&channel->busy, 1);
+
 		return channel->chan;
 	}
 
@@ -194,7 +195,6 @@ int request_dma(unsigned int chan, const char *dev_id)
 	struct dma_channel *channel = { 0 };
 	struct dma_info *info = get_dma_info(chan);
 	int result;
-
 	channel = get_dma_channel(chan);
 	if (atomic_xchg(&channel->busy, 1))
 		return -EBUSY;
@@ -369,6 +369,7 @@ int register_dmac(struct dma_info *info)
 	}
 
 	total_channels = get_nr_channels();
+	info->first_vchannel_nr = total_channels;
 	for (i = 0; i < info->nr_channels; i++) {
 		struct dma_channel *chan = &info->channels[i];
 
@@ -387,7 +388,7 @@ int register_dmac(struct dma_info *info)
 	}
 
 	list_add(&info->list, &registered_dmac_list);
-
+	
 	return 0;
 }
 EXPORT_SYMBOL(register_dmac);
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index 6034d4a..4c75b70 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -111,6 +111,7 @@ struct dma_info {
 
 	struct list_head list;
 	int first_channel_nr;
+	int first_vchannel_nr;
 };
 
 struct dma_chan_caps {

             reply	other threads:[~2007-07-19 19:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 19:30 Adrian McMenamin [this message]
2007-07-20 19:04 ` Andrew Morton
2007-07-21 10:22   ` Adrian McMenamin
2007-07-21 11:24     ` Peter Bortas
2007-07-21 12:06       ` Adrian McMenamin
2007-07-21 14:13         ` Peter Bortas
2007-07-26 10:10           ` Marcus Comstedt
2007-07-26 12:59             ` Peter Bortas
2007-07-26 13:06               ` Paul Mundt
2007-07-28  1:50                 ` Peter Bortas

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=92a12cdb0707191230g216feaf2ied3e95bacf4dd572@mail.gmail.com \
    --to=adrianmcmenamin@gmail.com \
    --cc=lethal@users.sourceforge.net \
    --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®