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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-m68knommu/] [mcfne.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/****************************************************************************/
2
 
3
/*
4
 *      mcfne.h -- NE2000 in ColdFire eval boards.
5
 *
6
 *      (C) Copyright 1999-2000, Greg Ungerer (gerg@moreton.com.au)
7
 *
8
 *      19990409 David W. Miller  Converted from m5206ne.h for 5307 eval board
9
 *
10
 *      Hacked support for m5206e Cadre III evaluation board
11
 *      Fred Stevens (fred.stevens@pemstar.com) 13 April 1999
12
 */
13
 
14
/****************************************************************************/
15
#ifndef mcfne_h
16
#define mcfne_h
17
/****************************************************************************/
18
 
19
#include <linux/config.h>
20
 
21
/*
22
 *      Everything in here is to remap the standard PC style
23
 *      ISA bus access to eval board style ISA bus access.
24
 */
25
 
26
/*
27
 *      Define the basic hardware resources of NE2000 board.
28
 *      The ISA bus is memory mapped on the eval board, with a
29
 *      really funky method for accessing odd addresses.
30
 */
31
 
32
#if defined(CONFIG_M5206)
33
/*
34
 *      Defines specific to the 5206 eval boards.
35
 */
36
#define NE2000_ADDR             0x40000000
37
#define NE2000_ODDOFFSET        0x00010000
38
#define NE2000_IRQ_VECTOR       0xf0
39
#define NE2000_IRQ_PRIORITY     2
40
#define NE2000_IRQ_LEVEL        4
41
#endif
42
 
43
#if defined(CONFIG_CADRE3) && defined(CONFIG_M5307)
44
#define NE2000_ADDR             0x40000000
45
#define NE2000_ODDOFFSET        0x00010000
46
#define NE2000_IRQ_VECTOR       0x1b
47
 
48
#elif defined(CONFIG_CADRE3)
49
#define NE2000_ADDR             0x40000000
50
#define NE2000_ODDOFFSET        0x00010000
51
#define NE2000_IRQ_VECTOR       0x1c
52
#define NE2000_IRQ_PRIORITY     2
53
#define NE2000_IRQ_LEVEL        4
54
 
55
#elif defined(CONFIG_NETtel)
56
#define NE2000_ADDR             0x30000000
57
#define NE2000_IRQ_VECTOR       25
58
#define NE2000_IRQ_PRIORITY     1
59
#define NE2000_IRQ_LEVEL        3
60
 
61
#elif defined(CONFIG_M5307)
62
/*
63
 *      Defines for addressing setup of the 5307 eval board.
64
 */
65
#define NE2000_ADDR             0xfe600000
66
#define NE2000_ODDOFFSET        0x00010000
67
#define NE2000_IRQ_VECTOR       0x1b
68
#define NE2000_IRQ_PRIORITY     2
69
#define NE2000_IRQ_LEVEL        3
70
#endif
71
 
72
/*
73
 *      Define the PC type resources that the NE2000 board thinks
74
 *      it is using.
75
 */
76
#define NE2000_ISA_IO           0x300
77
#if defined(CONFIG_CADRE3) && defined(CONFIG_M5206e)
78
#define NE2000_ISA_IRQ          4
79
#else
80
#define NE2000_ISA_IRQ          3
81
#endif
82
 
83
/*
84
 *      The NETtel NE2000 part is mapped in a very strait forward
85
 *      way. The standard memory versions of inb/outb will do the
86
 *      job.
87
 */
88
#ifdef CONFIG_NETtel
89
 
90
#ifdef COLDFIRE_NE2000_FUNCS
91
void ne2000_irqsetup(void)
92
{
93
        mcf_autovector(NE2000_IRQ_VECTOR);
94
        mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_EINT1);
95
}
96
#endif /* COLDFIRE_NE2000_FUNCS */
97
 
98
 
99
#else
100
/*
101
 *      Re-defines for ColdFire environment... The ne2000 board is
102
 *      mapped in sorta strangely, make adjustments for it.
103
 */
104
#undef outb
105
#undef outb_p
106
#undef inb
107
#undef inb_p
108
 
109
#define outb    ne2000_outb
110
#define inb     ne2000_inb
111
#define outb_p  ne2000_outb
112
#define inb_p   ne2000_inb
113
#define outsb   ne2000_outsb
114
#define outsw   ne2000_outsw
115
#define insb    ne2000_insb
116
#define insw    ne2000_insw
117
 
118
 
119
#ifndef COLDFIRE_NE2000_FUNCS
120
 
121
void ne2000_outb(unsigned int val, unsigned int addr);
122
int  ne2000_inb(unsigned int addr);
123
void ne2000_insb(unsigned int addr, void *vbuf, int unsigned long len);
124
void ne2000_insw(unsigned int addr, void *vbuf, unsigned long len);
125
void ne2000_outsb(unsigned int addr, void *vbuf, unsigned long len);
126
void ne2000_outsw(unsigned int addr, void *vbuf, unsigned long len);
127
 
128
#else
129
 
130
/*
131
 *      This macro converts a conventional register address into the
132
 *      real memory pointer on the SBC5206 eval board...
133
 *      This is only needed if the address can be odd!
134
 */
135
#define NE2000_PTR(addr)                                        \
136
        ((volatile unsigned short *) ((addr & 0x1) ?            \
137
                (NE2000_ADDR + NE2000_ODDOFFSET + addr - 1) :   \
138
                (NE2000_ADDR + addr)))
139
 
140
 
141
void ne2000_outb(unsigned int val, unsigned int addr)
142
{
143
        volatile unsigned short *rp;
144
 
145
        rp = NE2000_PTR(addr);
146
        *rp = val;
147
}
148
 
149
int ne2000_inb(unsigned int addr)
150
{
151
        volatile unsigned short *rp;
152
 
153
        rp = NE2000_PTR(addr);
154
        return(*rp);
155
}
156
 
157
void ne2000_insb(unsigned int addr, void *vbuf, int unsigned long len)
158
{
159
        volatile unsigned short *rp;
160
        unsigned char           *buf;
161
 
162
        buf = (unsigned char *) vbuf;
163
        rp = NE2000_PTR(addr);
164
        for (; (len > 0); len--)
165
                *buf++ = *rp;
166
}
167
 
168
void ne2000_insw(unsigned int addr, void *vbuf, unsigned long len)
169
{
170
        volatile unsigned short *rp;
171
        unsigned short          w, *buf;
172
 
173
        buf = (unsigned short *) vbuf;
174
        rp = (volatile unsigned short *) (NE2000_ADDR + addr);
175
        for (; (len > 0); len--) {
176
                w = *rp;
177
                *buf++ = ((w & 0xff) << 8) | ((w >> 8) & 0xff);
178
        }
179
}
180
 
181
void ne2000_outsb(unsigned int addr, const void *vbuf, unsigned long len)
182
{
183
        volatile unsigned short *rp;
184
        unsigned char           *buf;
185
 
186
        buf = (unsigned char *) vbuf;
187
        rp = NE2000_PTR(addr);
188
        for (; (len > 0); len--)
189
                *rp = *buf++;
190
}
191
 
192
void ne2000_outsw(unsigned int addr, const void *vbuf, unsigned long len)
193
{
194
        volatile unsigned short *rp;
195
        unsigned short          w, *buf;
196
 
197
        buf = (unsigned short *) vbuf;
198
        /*rp = NE2000_PTR(addr);*/
199
        rp = (volatile unsigned short *) (NE2000_ADDR + addr);
200
        for (; (len > 0); len--) {
201
                w = *buf++;
202
                *rp = ((w & 0xff) << 8) | ((w >> 8) & 0xff);
203
        }
204
}
205
 
206
 
207
/*
208
 *      Lastly the interrupt set up code...
209
 *      Minor diferences between the different board types.
210
 */
211
 
212
#if defined(CONFIG_M5206)
213
void ne2000_irqsetup(void)
214
{
215
        volatile unsigned char  *icrp;
216
 
217
        icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_ICR4);
218
        *icrp = MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI2;
219
        mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_EINT4);
220
}
221
#endif
222
 
223
#if defined(CONFIG_CADRE3) && !defined(CONFIG_M5307)
224
void ne2000_irqsetup(void)
225
{
226
        volatile unsigned char  *icrp;
227
 
228
        icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_ICR4);
229
        *icrp = MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI2 | MCFSIM_ICR_AUTOVEC;
230
        mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_EINT4);
231
}
232
#endif
233
 
234
#if defined(CONFIG_M5307)
235
void ne2000_irqsetup(void)
236
{
237
        mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_EINT3);
238
        printk("\nSIM: %08lx\n", mcf_getimr());
239
}
240
#endif
241
 
242
#endif /* COLDFIRE_NE2000_FUNCS */
243
#endif /* CONFIG_NETtel */
244
 
245
/****************************************************************************/
246
#endif  /* mcfne_h */

powered by: WebSVN 2.1.0

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