OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [drivers/] [sbus/] [dvma.c] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* dvma.c:  Routines that are used to access DMA on the Sparc SBus.
2
 *
3
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4
 */
5
 
6
#include <linux/kernel.h>
7
#include <linux/malloc.h>
8
 
9
#include <asm/oplib.h>
10
#include <asm/contregs.h>
11
#include <asm/sysen.h>
12
#include <asm/delay.h>
13
#include <asm/idprom.h>
14
#include <asm/machines.h>
15
#include <asm/io.h>
16
#include <asm/dma.h>
17
#include <asm/sbus.h>
18
#include <asm/vac-ops.h>
19
#include <asm/vaddrs.h>
20
 
21
struct Linux_SBus_DMA *dma_chain;
22
 
23
/* Print out the current values in the DMA control registers */
24
void
25
dump_dma_regs(struct sparc_dma_registers *dregs)
26
{
27
        printk("DMA CONTROL<%08lx>  ADDR<%08lx> CNT<%08lx> TEST<%08lx>\n",
28
               dregs->cond_reg,
29
               (unsigned long) dregs->st_addr,
30
               (unsigned long) dregs->cnt,
31
               (unsigned long) dregs->dma_test);
32
        return;
33
}
34
 
35
 
36
/* Probe this SBus DMA module(s) */
37
unsigned long
38
dvma_init(struct linux_sbus *sbus, unsigned long memory_start)
39
{
40
        struct linux_sbus_device *this_dev;
41
        struct Linux_SBus_DMA *dma;
42
        struct Linux_SBus_DMA *dchain;
43
        static int num_dma=0;
44
 
45
        for_each_sbusdev(this_dev, sbus) {
46
                if(strcmp(this_dev->prom_name, "dma") &&
47
                   strcmp(this_dev->prom_name, "ledma") &&
48
                   strcmp(this_dev->prom_name, "espdma"))
49
                        continue;
50
 
51
                /* Found one... */
52
                dma = (struct Linux_SBus_DMA *) memory_start;
53
                memory_start += sizeof(struct Linux_SBus_DMA);
54
 
55
                dma->SBus_dev = this_dev;
56
 
57
                /* Put at end of dma chain */
58
                dchain = dma_chain;
59
                if(dchain) {
60
                        while(dchain->next) dchain=dchain->next;
61
                        dchain->next=dma;
62
                } else {
63
                        /* We're the first in line */
64
                        dma_chain=dma;
65
                }
66
                dma->next = 0;
67
 
68
                printk("dma%d: ", num_dma);
69
                num_dma++;
70
 
71
                /* The constant PAGE_SIZE that is passed to sparc_alloc_io makes the
72
                 * routine only alloc 1 page, that was what the original code did
73
                 */
74
                prom_apply_sbus_ranges(dma->SBus_dev->reg_addrs, 0x1);
75
                dma->regs = (struct sparc_dma_registers *)
76
                        sparc_alloc_io (dma->SBus_dev->reg_addrs[0].phys_addr, 0,
77
                                        PAGE_SIZE, "dma",
78
                                        dma->SBus_dev->reg_addrs[0].which_io, 0x0);
79
 
80
                dma->node = dma->SBus_dev->prom_node;
81
                dma->running=0;      /* No transfers going on as of yet */
82
                dma->allocated=0;    /* No one has allocated us yet */
83
                switch((dma->regs->cond_reg)&DMA_DEVICE_ID) {
84
                case DMA_VERS0:
85
                        dma->revision=dvmarev0;
86
                        printk("Revision 0 ");
87
                        break;
88
                case DMA_ESCV1:
89
                        dma->revision=dvmaesc1;
90
                        printk("ESC Revision 1 ");
91
                        break;
92
                case DMA_VERS1:
93
                        dma->revision=dvmarev1;
94
                        printk("Revision 1 ");
95
                        break;
96
                case DMA_VERS2:
97
                        dma->revision=dvmarev2;
98
                        printk("Revision 2 ");
99
                        break;
100
                case DMA_VERSPLUS:
101
                        dma->revision=dvmarevplus;
102
                        printk("Revision 1 PLUS ");
103
                        break;
104
                default:
105
                        printk("unknown dma version");
106
                        dma->allocated = 1;
107
                        break;
108
                }
109
                printk("\n");
110
#if 0 /* Clutters up the screen */
111
                dump_dma_regs(dma->regs);
112
#endif
113
        };  /* while(this_dev) */
114
 
115
        return memory_start;
116
}
117
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.