aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/plat-s3c64xx
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-02-25 00:41:19 +0000
committerAndy Green <agreen@octopus.localdomain>2009-02-25 00:41:19 +0000
commit5202146f521b560cbf3065762d3b894771e6f863 (patch)
treeff54d265938cb2191919cd236c50d47709510547 /arch/arm/plat-s3c64xx
parent6972d14fb604e3065189686476ecc01f9d1f22d9 (diff)
S3C64XX: Register DMA channels as system devices
Add the DMA channels as system devices to provide suspend/resume and a presence in sysfs. Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Diffstat (limited to 'arch/arm/plat-s3c64xx')
-rw-r--r--arch/arm/plat-s3c64xx/dma.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/arm/plat-s3c64xx/dma.c b/arch/arm/plat-s3c64xx/dma.c
index a26fd3bfc93..644501bfb99 100644
--- a/arch/arm/plat-s3c64xx/dma.c
+++ b/arch/arm/plat-s3c64xx/dma.c
@@ -16,6 +16,7 @@
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/dmapool.h>
+#include <linux/sysdev.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/io.h>
@@ -38,6 +39,7 @@
struct s3c64xx_dmac {
+ struct sys_device sysdev;
void __iomem *regs;
struct s3c2410_dma_chan *channels;
enum dma_ch chanbase;
@@ -603,6 +605,10 @@ static irqreturn_t s3c64xx_dma_irq(int irq, void *pw)
return IRQ_HANDLED;
}
+static struct sysdev_class dma_sysclass = {
+ .name = "s3c64xx-dma",
+};
+
static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
int irq, unsigned int base)
{
@@ -618,11 +624,20 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
return -ENOMEM;
}
+ dmac->sysdev.id = chno / 8;
+ dmac->sysdev.cls = &dma_sysclass;
+
+ err = sysdev_register(&dmac->sysdev);
+ if (err) {
+ printk(KERN_ERR "%s: failed to register sysdevice\n", __func__);
+ goto err_alloc;
+ }
+
regs = ioremap(base, 0x200);
if (!regs) {
printk(KERN_ERR "%s: failed to ioremap()\n", __func__);
err = -ENXIO;
- goto err_alloc;
+ goto err_dev;
}
dmac->regs = regs;
@@ -657,6 +672,8 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
err_map:
iounmap(regs);
+err_dev:
+ sysdev_unregister(&dmac->sysdev);
err_alloc:
kfree(dmac);
return err;
@@ -664,6 +681,8 @@ err_alloc:
static int __init s3c64xx_dma_init(void)
{
+ int ret;
+
printk(KERN_INFO "%s: Registering DMA channels\n", __func__);
dma_pool = dma_pool_create("DMA-LLI", NULL, 32, 16, 0);
@@ -672,6 +691,12 @@ static int __init s3c64xx_dma_init(void)
return -ENOMEM;
}
+ ret = sysdev_class_register(&dma_sysclass);
+ if (ret) {
+ printk(KERN_ERR "%s: failed to create sysclass\n", __func__);
+ return -ENOMEM;
+ }
+
/* Set all DMA configuration to be DMA, not SDMA */
writel(0xffffff, S3C_SYSREG(0x110));