xref: /openbmc/linux/arch/arm/mach-rpc/dma.c (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  *  linux/arch/arm/mach-rpc/dma.c
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  *  Copyright (C) 1998 Russell King
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  *  DMA functions specific to RiscPC architecture
81da177e4SLinus Torvalds  */
91da177e4SLinus Torvalds #include <linux/mman.h>
101da177e4SLinus Torvalds #include <linux/init.h>
111da177e4SLinus Torvalds #include <linux/interrupt.h>
127cdad482SRussell King #include <linux/dma-mapping.h>
13fced80c7SRussell King #include <linux/io.h>
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds #include <asm/page.h>
161da177e4SLinus Torvalds #include <asm/dma.h>
171da177e4SLinus Torvalds #include <asm/fiq.h>
181da177e4SLinus Torvalds #include <asm/irq.h>
19a09e64fbSRussell King #include <mach/hardware.h>
207c0f6ba6SLinus Torvalds #include <linux/uaccess.h>
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds #include <asm/mach/dma.h>
231da177e4SLinus Torvalds #include <asm/hardware/iomd.h>
241da177e4SLinus Torvalds 
25308d333aSRussell King struct iomd_dma {
26308d333aSRussell King 	struct dma_struct	dma;
27090a37ceSRussell King 	void __iomem		*base;		/* Controller base address */
28308d333aSRussell King 	int			irq;		/* Controller IRQ */
29090a37ceSRussell King 	unsigned int		state;
308194468fSRussell King 	dma_addr_t		cur_addr;
318194468fSRussell King 	unsigned int		cur_len;
32fa4e9989SRussell King 	dma_addr_t		dma_addr;
33fa4e9989SRussell King 	unsigned int		dma_len;
34308d333aSRussell King };
35308d333aSRussell King 
361da177e4SLinus Torvalds #if 0
371da177e4SLinus Torvalds typedef enum {
381da177e4SLinus Torvalds 	dma_size_8	= 1,
391da177e4SLinus Torvalds 	dma_size_16	= 2,
401da177e4SLinus Torvalds 	dma_size_32	= 4,
411da177e4SLinus Torvalds 	dma_size_128	= 16
421da177e4SLinus Torvalds } dma_size_t;
431da177e4SLinus Torvalds #endif
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds #define TRANSFER_SIZE	2
461da177e4SLinus Torvalds 
471da177e4SLinus Torvalds #define CURA	(0)
481da177e4SLinus Torvalds #define ENDA	(IOMD_IO0ENDA - IOMD_IO0CURA)
491da177e4SLinus Torvalds #define CURB	(IOMD_IO0CURB - IOMD_IO0CURA)
501da177e4SLinus Torvalds #define ENDB	(IOMD_IO0ENDB - IOMD_IO0CURA)
511da177e4SLinus Torvalds #define CR	(IOMD_IO0CR - IOMD_IO0CURA)
521da177e4SLinus Torvalds #define ST	(IOMD_IO0ST - IOMD_IO0CURA)
531da177e4SLinus Torvalds 
iomd_get_next_sg(struct iomd_dma * idma)548194468fSRussell King static void iomd_get_next_sg(struct iomd_dma *idma)
551da177e4SLinus Torvalds {
561da177e4SLinus Torvalds 	unsigned long end, offset, flags = 0;
571da177e4SLinus Torvalds 
58ad9dd94cSRussell King 	if (idma->dma.sg) {
598194468fSRussell King 		idma->cur_addr = idma->dma_addr;
608194468fSRussell King 		offset = idma->cur_addr & ~PAGE_MASK;
611da177e4SLinus Torvalds 
62fa4e9989SRussell King 		end = offset + idma->dma_len;
631da177e4SLinus Torvalds 
641da177e4SLinus Torvalds 		if (end > PAGE_SIZE)
651da177e4SLinus Torvalds 			end = PAGE_SIZE;
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds 		if (offset + TRANSFER_SIZE >= end)
681da177e4SLinus Torvalds 			flags |= DMA_END_L;
691da177e4SLinus Torvalds 
708194468fSRussell King 		idma->cur_len = end - TRANSFER_SIZE;
711da177e4SLinus Torvalds 
72fa4e9989SRussell King 		idma->dma_len -= end - offset;
73fa4e9989SRussell King 		idma->dma_addr += end - offset;
741da177e4SLinus Torvalds 
75fa4e9989SRussell King 		if (idma->dma_len == 0) {
76ad9dd94cSRussell King 			if (idma->dma.sgcount > 1) {
779e28d7e8SRussell King 				idma->dma.sg = sg_next(idma->dma.sg);
78fa4e9989SRussell King 				idma->dma_addr = idma->dma.sg->dma_address;
79fa4e9989SRussell King 				idma->dma_len = idma->dma.sg->length;
80ad9dd94cSRussell King 				idma->dma.sgcount--;
811da177e4SLinus Torvalds 			} else {
82ad9dd94cSRussell King 				idma->dma.sg = NULL;
831da177e4SLinus Torvalds 				flags |= DMA_END_S;
841da177e4SLinus Torvalds 			}
851da177e4SLinus Torvalds 		}
861da177e4SLinus Torvalds 	} else {
871da177e4SLinus Torvalds 		flags = DMA_END_S | DMA_END_L;
888194468fSRussell King 		idma->cur_addr = 0;
898194468fSRussell King 		idma->cur_len = 0;
901da177e4SLinus Torvalds 	}
911da177e4SLinus Torvalds 
928194468fSRussell King 	idma->cur_len |= flags;
931da177e4SLinus Torvalds }
941da177e4SLinus Torvalds 
iomd_dma_handle(int irq,void * dev_id)950cd61b68SLinus Torvalds static irqreturn_t iomd_dma_handle(int irq, void *dev_id)
961da177e4SLinus Torvalds {
97ad9dd94cSRussell King 	struct iomd_dma *idma = dev_id;
98090a37ceSRussell King 	void __iomem *base = idma->base;
9939694ed0SRussell King 	unsigned int state = idma->state;
100e659587cSRussell King 	unsigned int status, cur, end;
1011da177e4SLinus Torvalds 
1021da177e4SLinus Torvalds 	do {
103090a37ceSRussell King 		status = readb(base + ST);
1041da177e4SLinus Torvalds 		if (!(status & DMA_ST_INT))
10539694ed0SRussell King 			goto out;
1061da177e4SLinus Torvalds 
10739694ed0SRussell King 		if ((state ^ status) & DMA_ST_AB)
1088194468fSRussell King 			iomd_get_next_sg(idma);
1091da177e4SLinus Torvalds 
110e659587cSRussell King 		// This efficiently implements state = OFL != AB ? AB : 0
111e659587cSRussell King 		state = ((status >> 2) ^ status) & DMA_ST_AB;
112e659587cSRussell King 		if (state) {
113e659587cSRussell King 			cur = CURA;
114e659587cSRussell King 			end = ENDA;
115e659587cSRussell King 		} else {
116e659587cSRussell King 			cur = CURB;
117e659587cSRussell King 			end = ENDB;
1181da177e4SLinus Torvalds 		}
119090a37ceSRussell King 		writel(idma->cur_addr, base + cur);
120090a37ceSRussell King 		writel(idma->cur_len, base + end);
1211da177e4SLinus Torvalds 
1221da177e4SLinus Torvalds 		if (status & DMA_ST_OFL &&
1238194468fSRussell King 		    idma->cur_len == (DMA_END_S|DMA_END_L))
1241da177e4SLinus Torvalds 			break;
1251da177e4SLinus Torvalds 	} while (1);
1261da177e4SLinus Torvalds 
12739694ed0SRussell King 	state = ~DMA_ST_AB;
128ffd9a1baSRussell King 	disable_irq_nosync(irq);
12939694ed0SRussell King out:
13039694ed0SRussell King 	idma->state = state;
1311da177e4SLinus Torvalds 	return IRQ_HANDLED;
1321da177e4SLinus Torvalds }
1331da177e4SLinus Torvalds 
iomd_request_dma(unsigned int chan,dma_t * dma)1341df81302SRussell King static int iomd_request_dma(unsigned int chan, dma_t *dma)
1351da177e4SLinus Torvalds {
136ad9dd94cSRussell King 	struct iomd_dma *idma = container_of(dma, struct iomd_dma, dma);
137ad9dd94cSRussell King 
138ad9dd94cSRussell King 	return request_irq(idma->irq, iomd_dma_handle,
13978f6db99SMichael Opdenacker 			   0, idma->dma.device_id, idma);
1401da177e4SLinus Torvalds }
1411da177e4SLinus Torvalds 
iomd_free_dma(unsigned int chan,dma_t * dma)1421df81302SRussell King static void iomd_free_dma(unsigned int chan, dma_t *dma)
1431da177e4SLinus Torvalds {
144ad9dd94cSRussell King 	struct iomd_dma *idma = container_of(dma, struct iomd_dma, dma);
145ad9dd94cSRussell King 
146ad9dd94cSRussell King 	free_irq(idma->irq, idma);
1471da177e4SLinus Torvalds }
1481da177e4SLinus Torvalds 
1495ab6a91aSChristoph Hellwig static struct device isa_dma_dev = {
1505ab6a91aSChristoph Hellwig 	.init_name		= "fallback device",
1515ab6a91aSChristoph Hellwig 	.coherent_dma_mask	= ~(dma_addr_t)0,
1525ab6a91aSChristoph Hellwig 	.dma_mask		= &isa_dma_dev.coherent_dma_mask,
1535ab6a91aSChristoph Hellwig };
1545ab6a91aSChristoph Hellwig 
iomd_enable_dma(unsigned int chan,dma_t * dma)1551df81302SRussell King static void iomd_enable_dma(unsigned int chan, dma_t *dma)
1561da177e4SLinus Torvalds {
157ad9dd94cSRussell King 	struct iomd_dma *idma = container_of(dma, struct iomd_dma, dma);
158090a37ceSRussell King 	void __iomem *base = idma->base;
1591da177e4SLinus Torvalds 	unsigned int ctrl = TRANSFER_SIZE | DMA_CR_E;
1601da177e4SLinus Torvalds 
161ad9dd94cSRussell King 	if (idma->dma.invalid) {
162ad9dd94cSRussell King 		idma->dma.invalid = 0;
1631da177e4SLinus Torvalds 
1641da177e4SLinus Torvalds 		/*
1651da177e4SLinus Torvalds 		 * Cope with ISA-style drivers which expect cache
1661da177e4SLinus Torvalds 		 * coherence.
1671da177e4SLinus Torvalds 		 */
168ad9dd94cSRussell King 		if (!idma->dma.sg) {
169ad9dd94cSRussell King 			idma->dma.sg = &idma->dma.buf;
170ad9dd94cSRussell King 			idma->dma.sgcount = 1;
171ad9dd94cSRussell King 			idma->dma.buf.length = idma->dma.count;
1725ab6a91aSChristoph Hellwig 			idma->dma.buf.dma_address = dma_map_single(&isa_dma_dev,
173ad9dd94cSRussell King 				idma->dma.addr, idma->dma.count,
174ad9dd94cSRussell King 				idma->dma.dma_mode == DMA_MODE_READ ?
1757cdad482SRussell King 				DMA_FROM_DEVICE : DMA_TO_DEVICE);
1761da177e4SLinus Torvalds 		}
1771da177e4SLinus Torvalds 
178ffd9a1baSRussell King 		idma->dma_addr = idma->dma.sg->dma_address;
179ffd9a1baSRussell King 		idma->dma_len = idma->dma.sg->length;
180ffd9a1baSRussell King 
181090a37ceSRussell King 		writeb(DMA_CR_C, base + CR);
182ad9dd94cSRussell King 		idma->state = DMA_ST_AB;
1831da177e4SLinus Torvalds 	}
1841da177e4SLinus Torvalds 
185ad9dd94cSRussell King 	if (idma->dma.dma_mode == DMA_MODE_READ)
1861da177e4SLinus Torvalds 		ctrl |= DMA_CR_D;
1871da177e4SLinus Torvalds 
188090a37ceSRussell King 	writeb(ctrl, base + CR);
189ad9dd94cSRussell King 	enable_irq(idma->irq);
1901da177e4SLinus Torvalds }
1911da177e4SLinus Torvalds 
iomd_disable_dma(unsigned int chan,dma_t * dma)1921df81302SRussell King static void iomd_disable_dma(unsigned int chan, dma_t *dma)
1931da177e4SLinus Torvalds {
194ad9dd94cSRussell King 	struct iomd_dma *idma = container_of(dma, struct iomd_dma, dma);
195090a37ceSRussell King 	void __iomem *base = idma->base;
1961da177e4SLinus Torvalds 	unsigned long flags;
1971da177e4SLinus Torvalds 
1981da177e4SLinus Torvalds 	local_irq_save(flags);
199ad9dd94cSRussell King 	if (idma->state != ~DMA_ST_AB)
200ad9dd94cSRussell King 		disable_irq(idma->irq);
201090a37ceSRussell King 	writeb(0, base + CR);
2021da177e4SLinus Torvalds 	local_irq_restore(flags);
2031da177e4SLinus Torvalds }
2041da177e4SLinus Torvalds 
iomd_set_dma_speed(unsigned int chan,dma_t * dma,int cycle)2051df81302SRussell King static int iomd_set_dma_speed(unsigned int chan, dma_t *dma, int cycle)
2061da177e4SLinus Torvalds {
2071da177e4SLinus Torvalds 	int tcr, speed;
2081da177e4SLinus Torvalds 
2091da177e4SLinus Torvalds 	if (cycle < 188)
2101da177e4SLinus Torvalds 		speed = 3;
2111da177e4SLinus Torvalds 	else if (cycle <= 250)
2121da177e4SLinus Torvalds 		speed = 2;
2131da177e4SLinus Torvalds 	else if (cycle < 438)
2141da177e4SLinus Torvalds 		speed = 1;
2151da177e4SLinus Torvalds 	else
2161da177e4SLinus Torvalds 		speed = 0;
2171da177e4SLinus Torvalds 
2181da177e4SLinus Torvalds 	tcr = iomd_readb(IOMD_DMATCR);
2191da177e4SLinus Torvalds 	speed &= 3;
2201da177e4SLinus Torvalds 
2211df81302SRussell King 	switch (chan) {
2221da177e4SLinus Torvalds 	case DMA_0:
2231da177e4SLinus Torvalds 		tcr = (tcr & ~0x03) | speed;
2241da177e4SLinus Torvalds 		break;
2251da177e4SLinus Torvalds 
2261da177e4SLinus Torvalds 	case DMA_1:
2271da177e4SLinus Torvalds 		tcr = (tcr & ~0x0c) | (speed << 2);
2281da177e4SLinus Torvalds 		break;
2291da177e4SLinus Torvalds 
2301da177e4SLinus Torvalds 	case DMA_2:
2311da177e4SLinus Torvalds 		tcr = (tcr & ~0x30) | (speed << 4);
2321da177e4SLinus Torvalds 		break;
2331da177e4SLinus Torvalds 
2341da177e4SLinus Torvalds 	case DMA_3:
2351da177e4SLinus Torvalds 		tcr = (tcr & ~0xc0) | (speed << 6);
2361da177e4SLinus Torvalds 		break;
2371da177e4SLinus Torvalds 
2381da177e4SLinus Torvalds 	default:
2391da177e4SLinus Torvalds 		break;
2401da177e4SLinus Torvalds 	}
2411da177e4SLinus Torvalds 
2421da177e4SLinus Torvalds 	iomd_writeb(tcr, IOMD_DMATCR);
2431da177e4SLinus Torvalds 
2441da177e4SLinus Torvalds 	return speed;
2451da177e4SLinus Torvalds }
2461da177e4SLinus Torvalds 
2471da177e4SLinus Torvalds static struct dma_ops iomd_dma_ops = {
2481da177e4SLinus Torvalds 	.type		= "IOMD",
2491da177e4SLinus Torvalds 	.request	= iomd_request_dma,
2501da177e4SLinus Torvalds 	.free		= iomd_free_dma,
2511da177e4SLinus Torvalds 	.enable		= iomd_enable_dma,
2521da177e4SLinus Torvalds 	.disable	= iomd_disable_dma,
2531da177e4SLinus Torvalds 	.setspeed	= iomd_set_dma_speed,
2541da177e4SLinus Torvalds };
2551da177e4SLinus Torvalds 
2561da177e4SLinus Torvalds static struct fiq_handler fh = {
2571da177e4SLinus Torvalds 	.name	= "floppydma"
2581da177e4SLinus Torvalds };
2591da177e4SLinus Torvalds 
260308d333aSRussell King struct floppy_dma {
261308d333aSRussell King 	struct dma_struct	dma;
262308d333aSRussell King 	unsigned int		fiq;
263308d333aSRussell King };
264308d333aSRussell King 
floppy_enable_dma(unsigned int chan,dma_t * dma)2651df81302SRussell King static void floppy_enable_dma(unsigned int chan, dma_t *dma)
2661da177e4SLinus Torvalds {
267ad9dd94cSRussell King 	struct floppy_dma *fdma = container_of(dma, struct floppy_dma, dma);
2681da177e4SLinus Torvalds 	void *fiqhandler_start;
2691da177e4SLinus Torvalds 	unsigned int fiqhandler_length;
2701da177e4SLinus Torvalds 	struct pt_regs regs;
2711da177e4SLinus Torvalds 
272ad9dd94cSRussell King 	if (fdma->dma.sg)
2731da177e4SLinus Torvalds 		BUG();
2741da177e4SLinus Torvalds 
275ad9dd94cSRussell King 	if (fdma->dma.dma_mode == DMA_MODE_READ) {
2761da177e4SLinus Torvalds 		extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
2771da177e4SLinus Torvalds 		fiqhandler_start = &floppy_fiqin_start;
2781da177e4SLinus Torvalds 		fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start;
2791da177e4SLinus Torvalds 	} else {
2801da177e4SLinus Torvalds 		extern unsigned char floppy_fiqout_start, floppy_fiqout_end;
2811da177e4SLinus Torvalds 		fiqhandler_start = &floppy_fiqout_start;
2821da177e4SLinus Torvalds 		fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
2831da177e4SLinus Torvalds 	}
2841da177e4SLinus Torvalds 
285ad9dd94cSRussell King 	regs.ARM_r9  = fdma->dma.count;
286ad9dd94cSRussell King 	regs.ARM_r10 = (unsigned long)fdma->dma.addr;
2871da177e4SLinus Torvalds 	regs.ARM_fp  = (unsigned long)FLOPPYDMA_BASE;
2881da177e4SLinus Torvalds 
2891da177e4SLinus Torvalds 	if (claim_fiq(&fh)) {
2901da177e4SLinus Torvalds 		printk("floppydma: couldn't claim FIQ.\n");
2911da177e4SLinus Torvalds 		return;
2921da177e4SLinus Torvalds 	}
2931da177e4SLinus Torvalds 
2941da177e4SLinus Torvalds 	set_fiq_handler(fiqhandler_start, fiqhandler_length);
2951da177e4SLinus Torvalds 	set_fiq_regs(&regs);
296ad9dd94cSRussell King 	enable_fiq(fdma->fiq);
2971da177e4SLinus Torvalds }
2981da177e4SLinus Torvalds 
floppy_disable_dma(unsigned int chan,dma_t * dma)2991df81302SRussell King static void floppy_disable_dma(unsigned int chan, dma_t *dma)
3001da177e4SLinus Torvalds {
301ad9dd94cSRussell King 	struct floppy_dma *fdma = container_of(dma, struct floppy_dma, dma);
302ad9dd94cSRussell King 	disable_fiq(fdma->fiq);
3031da177e4SLinus Torvalds 	release_fiq(&fh);
3041da177e4SLinus Torvalds }
3051da177e4SLinus Torvalds 
floppy_get_residue(unsigned int chan,dma_t * dma)3061df81302SRussell King static int floppy_get_residue(unsigned int chan, dma_t *dma)
3071da177e4SLinus Torvalds {
3081da177e4SLinus Torvalds 	struct pt_regs regs;
3091da177e4SLinus Torvalds 	get_fiq_regs(&regs);
3101da177e4SLinus Torvalds 	return regs.ARM_r9;
3111da177e4SLinus Torvalds }
3121da177e4SLinus Torvalds 
3131da177e4SLinus Torvalds static struct dma_ops floppy_dma_ops = {
3141da177e4SLinus Torvalds 	.type		= "FIQDMA",
3151da177e4SLinus Torvalds 	.enable		= floppy_enable_dma,
3161da177e4SLinus Torvalds 	.disable	= floppy_disable_dma,
3171da177e4SLinus Torvalds 	.residue	= floppy_get_residue,
3181da177e4SLinus Torvalds };
3191da177e4SLinus Torvalds 
3201da177e4SLinus Torvalds /*
3211da177e4SLinus Torvalds  * This is virtual DMA - we don't need anything here.
3221da177e4SLinus Torvalds  */
sound_enable_disable_dma(unsigned int chan,dma_t * dma)3231df81302SRussell King static void sound_enable_disable_dma(unsigned int chan, dma_t *dma)
3241da177e4SLinus Torvalds {
3251da177e4SLinus Torvalds }
3261da177e4SLinus Torvalds 
3271da177e4SLinus Torvalds static struct dma_ops sound_dma_ops = {
3281da177e4SLinus Torvalds 	.type		= "VIRTUAL",
3291da177e4SLinus Torvalds 	.enable		= sound_enable_disable_dma,
3301da177e4SLinus Torvalds 	.disable	= sound_enable_disable_dma,
3311da177e4SLinus Torvalds };
3321da177e4SLinus Torvalds 
333ad9dd94cSRussell King static struct iomd_dma iomd_dma[6];
3342f757f2aSRussell King 
335ad9dd94cSRussell King static struct floppy_dma floppy_dma = {
336ad9dd94cSRussell King 	.dma		= {
3372f757f2aSRussell King 		.d_ops	= &floppy_dma_ops,
338ad9dd94cSRussell King 	},
339ad9dd94cSRussell King 	.fiq		= FIQ_FLOPPYDATA,
3402f757f2aSRussell King };
3412f757f2aSRussell King 
3422f757f2aSRussell King static dma_t sound_dma = {
3432f757f2aSRussell King 	.d_ops		= &sound_dma_ops,
3442f757f2aSRussell King };
3452f757f2aSRussell King 
rpc_dma_init(void)3462f757f2aSRussell King static int __init rpc_dma_init(void)
3471da177e4SLinus Torvalds {
3482f757f2aSRussell King 	unsigned int i;
3492f757f2aSRussell King 	int ret;
3502f757f2aSRussell King 
3511da177e4SLinus Torvalds 	iomd_writeb(0, IOMD_IO0CR);
3521da177e4SLinus Torvalds 	iomd_writeb(0, IOMD_IO1CR);
3531da177e4SLinus Torvalds 	iomd_writeb(0, IOMD_IO2CR);
3541da177e4SLinus Torvalds 	iomd_writeb(0, IOMD_IO3CR);
3551da177e4SLinus Torvalds 
3561da177e4SLinus Torvalds 	iomd_writeb(0xa0, IOMD_DMATCR);
3571da177e4SLinus Torvalds 
3581da177e4SLinus Torvalds 	/*
3591da177e4SLinus Torvalds 	 * Setup DMA channels 2,3 to be for podules
3601da177e4SLinus Torvalds 	 * and channels 0,1 for internal devices
3611da177e4SLinus Torvalds 	 */
3621da177e4SLinus Torvalds 	iomd_writeb(DMA_EXT_IO3|DMA_EXT_IO2, IOMD_DMAEXT);
3632f757f2aSRussell King 
364090a37ceSRussell King 	iomd_dma[DMA_0].base	= IOMD_BASE + IOMD_IO0CURA;
365ad9dd94cSRussell King 	iomd_dma[DMA_0].irq	= IRQ_DMA0;
366090a37ceSRussell King 	iomd_dma[DMA_1].base	= IOMD_BASE + IOMD_IO1CURA;
367ad9dd94cSRussell King 	iomd_dma[DMA_1].irq	= IRQ_DMA1;
368090a37ceSRussell King 	iomd_dma[DMA_2].base	= IOMD_BASE + IOMD_IO2CURA;
369ad9dd94cSRussell King 	iomd_dma[DMA_2].irq	= IRQ_DMA2;
370090a37ceSRussell King 	iomd_dma[DMA_3].base	= IOMD_BASE + IOMD_IO3CURA;
371ad9dd94cSRussell King 	iomd_dma[DMA_3].irq	= IRQ_DMA3;
372090a37ceSRussell King 	iomd_dma[DMA_S0].base	= IOMD_BASE + IOMD_SD0CURA;
373ad9dd94cSRussell King 	iomd_dma[DMA_S0].irq	= IRQ_DMAS0;
374090a37ceSRussell King 	iomd_dma[DMA_S1].base	= IOMD_BASE + IOMD_SD1CURA;
375ad9dd94cSRussell King 	iomd_dma[DMA_S1].irq	= IRQ_DMAS1;
3762f757f2aSRussell King 
3772f757f2aSRussell King 	for (i = DMA_0; i <= DMA_S1; i++) {
378ad9dd94cSRussell King 		iomd_dma[i].dma.d_ops = &iomd_dma_ops;
3792f757f2aSRussell King 
380ad9dd94cSRussell King 		ret = isa_dma_add(i, &iomd_dma[i].dma);
3812f757f2aSRussell King 		if (ret)
3822f757f2aSRussell King 			printk("IOMDDMA%u: unable to register: %d\n", i, ret);
3831da177e4SLinus Torvalds 	}
3842f757f2aSRussell King 
385ad9dd94cSRussell King 	ret = isa_dma_add(DMA_VIRTUAL_FLOPPY, &floppy_dma.dma);
3862f757f2aSRussell King 	if (ret)
3872f757f2aSRussell King 		printk("IOMDFLOPPY: unable to register: %d\n", ret);
3882f757f2aSRussell King 	ret = isa_dma_add(DMA_VIRTUAL_SOUND, &sound_dma);
3892f757f2aSRussell King 	if (ret)
3902f757f2aSRussell King 		printk("IOMDSOUND: unable to register: %d\n", ret);
3912f757f2aSRussell King 	return 0;
3922f757f2aSRussell King }
3932f757f2aSRussell King core_initcall(rpc_dma_init);
394