summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/dma-footbridge.c
blob: a355283dc93e729a2a75648a29f3224956d03241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * arch/arm/kernel/dma-ebsa285.c
 *
 * Copyright (C) 1998 Phil Blundell
 *
 * DMA functions specific to EBSA-285/CATS architectures
 *
 * Changelog:
 *  09-Nov-1998	RMK	Split out ISA DMA functions to dma-isa.c
 *  17-Mar-1999	RMK	Allow any EBSA285-like architecture to have
 *			ISA DMA controllers.
 */

#include <linux/config.h>
#include <linux/sched.h>
#include <linux/malloc.h>
#include <linux/mman.h>
#include <linux/init.h>

#include <asm/page.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/hardware.h>

#include "dma.h"
#include "dma-isa.h"

#ifdef CONFIG_ISA_DMA
static int has_isa_dma;
#else
#define has_isa_dma 0
#endif

int arch_request_dma(dmach_t channel, dma_t *dma, const char *dev_name)
{
	switch (channel) {
	case _DC21285_DMA(0):
	case _DC21285_DMA(1):	/* 21285 internal channels */
		return 0;

	case _ISA_DMA(0) ... _ISA_DMA(7):
		if (has_isa_dma)
			return isa_request_dma(channel - _ISA_DMA(0), dma, dev_name);
	}

	return -EINVAL;
}

void arch_free_dma(dmach_t channel, dma_t *dma)
{
	/* nothing to do */
}

int arch_get_dma_residue(dmach_t channel, dma_t *dma)
{
	int residue = 0;

	switch (channel) {
	case _DC21285_DMA(0):
	case _DC21285_DMA(1):
		break;

	case _ISA_DMA(0) ... _ISA_DMA(7):
		if (has_isa_dma)
			residue = isa_get_dma_residue(channel - _ISA_DMA(0), dma);
	}
	return residue;
}

void arch_enable_dma(dmach_t channel, dma_t *dma)
{
	switch (channel) {
	case _DC21285_DMA(0):
	case _DC21285_DMA(1):
		/*
		 * Not yet implemented
		 */
		break;

	case _ISA_DMA(0) ... _ISA_DMA(7):
		if (has_isa_dma)
			isa_enable_dma(channel - _ISA_DMA(0), dma);
	}
}

void arch_disable_dma(dmach_t channel, dma_t *dma)
{
	switch (channel) {
	case _DC21285_DMA(0):
	case _DC21285_DMA(1):
		/*
		 * Not yet implemented
		 */
		break;

	case _ISA_DMA(0) ... _ISA_DMA(7):
		if (has_isa_dma)
			isa_disable_dma(channel - _ISA_DMA(0), dma);
	}
}

int arch_set_dma_speed(dmach_t channel, dma_t *dma, int cycle_ns)
{
	return 0;
}

__initfunc(void arch_dma_init(dma_t *dma))
{
#ifdef CONFIG_ISA_DMA
	has_isa_dma = isa_init_dma();
#endif
}