patch-2.4.0-test5 linux/arch/arm/kernel/dma-isa.c

Next file: linux/arch/arm/kernel/dma-isa.h
Previous file: linux/arch/arm/kernel/dma-footbridge.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test4/linux/arch/arm/kernel/dma-isa.c linux/arch/arm/kernel/dma-isa.c
@@ -1,12 +1,13 @@
 /*
  * arch/arm/kernel/dma-isa.c: ISA DMA primitives
  *
- * Copyright (C) Russell King
+ * Copyright (C) 1999-2000 Russell King
  *
  * Taken from various sources, including:
  *  linux/include/asm/dma.h: Defines for using and allocating dma channels.
  *    Written by Hennus Bergman, 1992.
- *    High DMA channel support & info by Hannu Savolainen and John Boyd, Nov. 1992.
+ *    High DMA channel support & info by Hannu Savolainen and John Boyd,
+ *    Nov. 1992.
  *  arch/arm/kernel/dma-ebsa285.c
  *  Copyright (C) 1998 Phil Blundell
  */
@@ -18,7 +19,6 @@
 #include <asm/io.h>
 
 #include "dma.h"
-#include "dma-isa.h"
 
 #define ISA_DMA_MODE_READ	0x44
 #define ISA_DMA_MODE_WRITE	0x48
@@ -45,17 +45,7 @@
 	{  0xd4,  0xd6,  0xd8,  0x48a,  0x08a,  0xcc, 0xce }
 };
 
-int isa_request_dma(int channel, dma_t *dma, const char *dev_name)
-{
-	return 0;
-}
-
-void isa_free_dma(int channel, dma_t *dma)
-{
-	/* nothing to do */
-}
-
-int isa_get_dma_residue(int channel, dma_t *dma)
+static int isa_get_dma_residue(dmach_t channel, dma_t *dma)
 {
 	unsigned int io_port = isa_dma_port[channel][ISA_DMA_COUNT];
 	int count;
@@ -66,7 +56,7 @@
 	return channel < 4 ? count : (count << 1);
 }
 
-void isa_enable_dma(int channel, dma_t *dma)
+static void isa_enable_dma(dmach_t channel, dma_t *dma)
 {
 	if (dma->invalid) {
 		unsigned long address, length;
@@ -121,11 +111,18 @@
 	outb(channel & 3, isa_dma_port[channel][ISA_DMA_MASK]);
 }
 
-void isa_disable_dma(int channel, dma_t *dma)
+static void isa_disable_dma(dmach_t channel, dma_t *dma)
 {
 	outb(channel | 4, isa_dma_port[channel][ISA_DMA_MASK]);
 }
 
+static struct dma_ops isa_dma_ops = {
+	type:		"ISA",
+	enable:		isa_enable_dma,
+	disable:	isa_disable_dma,
+	residue:	isa_get_dma_residue,
+};
+
 static struct resource dma_resources[] = {
 	{ "dma1",		0x0000, 0x000f },
 	{ "dma low page", 	0x0080, 0x008f },
@@ -133,7 +130,7 @@
 	{ "dma high page",	0x0480, 0x048f }
 };
 
-int __init isa_init_dma(void)
+void __init isa_init_dma(dma_t *dma)
 {
 	int dmac_found;
 
@@ -148,8 +145,10 @@
 	if (dmac_found) {
 		int channel, i;
 
-		for (channel = 0; channel < 8; channel++)
+		for (channel = 0; channel < 8; channel++) {
+			dma[channel].d_ops = &isa_dma_ops;
 			isa_disable_dma(channel, NULL);
+		}
 
 		outb(0x40, 0x0b);
 		outb(0x41, 0x0b);
@@ -167,10 +166,9 @@
 		outb(0x10, 0xd0);
 
 		/*
-		 * Is this correct?  According to
-		 * my documentation, it doesn't
-		 * appear to be.  It should be
-		 * outb(0x3f, 0x40b); outb(0x3f, 0x4d6);
+		 * Is this correct?  According to my documentation, it
+		 * doesn't appear to be.  It should be:
+		 *  outb(0x3f, 0x40b); outb(0x3f, 0x4d6);
 		 */
 		outb(0x30, 0x40b);
 		outb(0x31, 0x40b);
@@ -185,6 +183,4 @@
 		for (i = 0; i < sizeof(dma_resources) / sizeof(dma_resources[0]); i++)
 			request_resource(&ioport_resource, dma_resources + i);
 	}
-
-	return dmac_found;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)