From 5202146f521b560cbf3065762d3b894771e6f863 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 25 Feb 2009 00:41:19 +0000 Subject: 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 --- arch/arm/plat-s3c64xx/dma.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'arch/arm') 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 #include #include +#include #include #include #include @@ -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)); -- cgit v1.2.3