-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARM] S3C: Move DMA channel management code to plat-s3c
Change the name of S3C2410_DMA_CHANNELS to S3C_DMA_CHANNELS in the process. Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
- Loading branch information
Ben Dooks
authored and
Ben Dooks
committed
May 1, 2009
1 parent
20934cd
commit 97c1b14
Showing
8 changed files
with
136 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* linux/arch/arm/plat-s3c/dma.c | ||
* | ||
* Copyright (c) 2003-2005,2006,2009 Simtec Electronics | ||
* Ben Dooks <ben@simtec.co.uk> | ||
* http://armlinux.simtec.co.uk/ | ||
* | ||
* S3C DMA core | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
struct s3c2410_dma_buf; | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/module.h> | ||
#include <linux/errno.h> | ||
|
||
#include <mach/dma.h> | ||
#include <mach/irqs.h> | ||
|
||
#include <plat/dma-plat.h> | ||
|
||
/* dma channel state information */ | ||
struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS]; | ||
struct s3c2410_dma_chan *s3c_dma_chan_map[DMACH_MAX]; | ||
|
||
/* s3c_dma_lookup_channel | ||
* | ||
* change the dma channel number given into a real dma channel id | ||
*/ | ||
|
||
struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel) | ||
{ | ||
if (channel & DMACH_LOW_LEVEL) | ||
return &s3c2410_chans[channel & ~DMACH_LOW_LEVEL]; | ||
else | ||
return s3c_dma_chan_map[channel]; | ||
} | ||
|
||
/* do we need to protect the settings of the fields from | ||
* irq? | ||
*/ | ||
|
||
int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn) | ||
{ | ||
struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
|
||
if (chan == NULL) | ||
return -EINVAL; | ||
|
||
pr_debug("%s: chan=%p, op rtn=%p\n", __func__, chan, rtn); | ||
|
||
chan->op_fn = rtn; | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL(s3c2410_dma_set_opfn); | ||
|
||
int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn) | ||
{ | ||
struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
|
||
if (chan == NULL) | ||
return -EINVAL; | ||
|
||
pr_debug("%s: chan=%p, callback rtn=%p\n", __func__, chan, rtn); | ||
|
||
chan->callback_fn = rtn; | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn); | ||
|
||
int s3c2410_dma_setflags(unsigned int channel, unsigned int flags) | ||
{ | ||
struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); | ||
|
||
if (chan == NULL) | ||
return -EINVAL; | ||
|
||
chan->flags = flags; | ||
return 0; | ||
} | ||
EXPORT_SYMBOL(s3c2410_dma_setflags); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* arch/arm/plat-s3c/include/plat/dma.h | ||
* | ||
* Copyright 2008 Openmoko, Inc. | ||
* Copyright 2008 Simtec Electronics | ||
* Ben Dooks <ben@simtec.co.uk> | ||
* http://armlinux.simtec.co.uk/ | ||
* | ||
* Samsung S3C DMA core support | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
extern struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel); | ||
|
||
extern struct s3c2410_dma_chan *s3c_dma_chan_map[]; | ||
|
||
/* the currently allocated channel information */ | ||
extern struct s3c2410_dma_chan s3c2410_chans[]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters