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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [mips/] [vr41xx/] [common/] [pciu.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * FILE NAME
3
 *      arch/mips/vr41xx/common/pciu.h
4
 *
5
 * BRIEF MODULE DESCRIPTION
6
 *      Include file for PCI Control Unit of the NEC VR4100 series.
7
 *
8
 * Author: Yoichi Yuasa
9
 *         yyuasa@mvista.com or source@mvista.com
10
 *
11
 * Copyright 2002 MontaVista Software Inc.
12
 *
13
 *  This program is free software; you can redistribute it and/or modify it
14
 *  under the terms of the GNU General Public License as published by the
15
 *  Free Software Foundation; either version 2 of the License, or (at your
16
 *  option) any later version.
17
 *
18
 *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19
 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
 *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23
 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24
 *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26
 *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27
 *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 *  You should have received a copy of the GNU General Public License along
30
 *  with this program; if not, write to the Free Software Foundation, Inc.,
31
 *  675 Mass Ave, Cambridge, MA 02139, USA.
32
 */
33
/*
34
 * Changes:
35
 *  MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
36
 *  - New creation, NEC VR4122 and VR4131 are supported.
37
 */
38
#ifndef __VR41XX_PCIU_H
39
#define __VR41XX_PCIU_H
40
 
41
#include <linux/config.h>
42
#include <asm/addrspace.h>
43
 
44
#define BIT(x)  (1 << (x))
45
 
46
#define PCIMMAW1REG                     KSEG1ADDR(0x0f000c00)
47
#define PCIMMAW2REG                     KSEG1ADDR(0x0f000c04)
48
#define PCITAW1REG                      KSEG1ADDR(0x0f000c08)
49
#define PCITAW2REG                      KSEG1ADDR(0x0f000c0c)
50
#define PCIMIOAWREG                     KSEG1ADDR(0x0f000c10)
51
#define INTERNAL_BUS_BASE_ADDRESS       0xff000000
52
#define ADDRESS_MASK                    0x000fe000
53
#define PCI_ACCESS_ENABLE               BIT(12)
54
#define PCI_ADDRESS_SETTING             0x000000ff
55
 
56
#define PCICONFDREG                     KSEG1ADDR(0x0f000c14)
57
#define PCICONFAREG                     KSEG1ADDR(0x0f000c18)
58
#define PCIMAILREG                      KSEG1ADDR(0x0f000c1c)
59
 
60
#define BUSERRADREG                     KSEG1ADDR(0x0f000c24)
61
#define ERROR_ADDRESS                   0xfffffffc
62
 
63
#define INTCNTSTAREG                    KSEG1ADDR(0x0f000c28)
64
#define MABTCLR                         BIT(31)
65
#define TRDYCLR                         BIT(30)
66
#define PARCLR                          BIT(29)
67
#define MBCLR                           BIT(28)
68
#define SERRCLR                         BIT(27)
69
 
70
#define PCIEXACCREG                     KSEG1ADDR(0x0f000c2c)
71
#define UNLOCK                          BIT(1)
72
#define EAREQ                           BIT(0)
73
 
74
#define PCIRECONTREG                    KSEG1ADDR(0x0f000c30)
75
#define RTRYCNT                         0x000000ff
76
 
77
#define PCIENREG                        KSEG1ADDR(0x0f000c34)
78
#define CONFIG_DONE                     BIT(2)
79
 
80
#define PCICLKSELREG                    KSEG1ADDR(0x0f000c38)
81
#define EQUAL_VTCLOCK                   0x00000002
82
#define HALF_VTCLOCK                    0x00000000
83
#define QUARTER_VTCLOCK                 0x00000001
84
 
85
#define PCITRDYVREG                     KSEG1ADDR(0x0f000c3c)
86
 
87
#define PCICLKRUNREG                    KSEG1ADDR(0x0f000c60)
88
 
89
#define PCIU_CONFIGREGS_BASE            KSEG1ADDR(0x0f000d00)
90
#define VENDORIDREG                     KSEG1ADDR(0x0f000d00)
91
#define DEVICEIDREG                     KSEG1ADDR(0x0f000d00)
92
#define COMMANDREG                      KSEG1ADDR(0x0f000d04)
93
#define STATUSREG                       KSEG1ADDR(0x0f000d04)
94
#define REVIDREG                        KSEG1ADDR(0x0f000d08)
95
#define CLASSREG                        KSEG1ADDR(0x0f000d08)
96
#define CACHELSREG                      KSEG1ADDR(0x0f000d0c)
97
#define LATTIMEREG                      KSEG1ADDR(0x0f000d0c)
98
#define MAILBAREG                       KSEG1ADDR(0x0f000d10)
99
#define PCIMBA1REG                      KSEG1ADDR(0x0f000d14)
100
#define PCIMBA2REG                      KSEG1ADDR(0x0f000d18)
101
#define INTLINEREG                      KSEG1ADDR(0x0f000d3c)
102
#define INTPINREG                       KSEG1ADDR(0x0f000d3c)
103
#define RETVALREG                       KSEG1ADDR(0x0f000d40)
104
#define PCIAPCNTREG                     KSEG1ADDR(0x0f000d40)
105
 
106
#define MPCIINTREG                      KSEG1ADDR(0x0f0000b2)
107
 
108
#define MAX_PCI_CLOCK                   33333333
109
 
110
static inline int pciu_read_config_byte(int where, u8 *val)
111
{
112
        u32 data;
113
 
114
        data = readl(PCIU_CONFIGREGS_BASE + where);
115
        *val = (u8)(data >> ((where & 3) << 3));
116
 
117
        return PCIBIOS_SUCCESSFUL;
118
}
119
 
120
static inline int pciu_read_config_word(int where, u16 *val)
121
{
122
        u32 data;
123
 
124
        if (where & 1)
125
                return PCIBIOS_BAD_REGISTER_NUMBER;
126
 
127
        data = readl(PCIU_CONFIGREGS_BASE + where);
128
        *val = (u16)(data >> ((where & 2) << 3));
129
 
130
        return PCIBIOS_SUCCESSFUL;
131
}
132
 
133
static inline int pciu_read_config_dword(int where, u32 *val)
134
{
135
        if (where & 3)
136
                return PCIBIOS_BAD_REGISTER_NUMBER;
137
 
138
        *val = readl(PCIU_CONFIGREGS_BASE + where);
139
 
140
        return PCIBIOS_SUCCESSFUL;
141
}
142
 
143
static inline int pciu_write_config_byte(int where, u8 val)
144
{
145
        writel(val, PCIU_CONFIGREGS_BASE + where);
146
 
147
        return 0;
148
}
149
 
150
static inline int pciu_write_config_word(int where, u16 val)
151
{
152
        writel(val, PCIU_CONFIGREGS_BASE + where);
153
 
154
        return 0;
155
}
156
 
157
static inline int pciu_write_config_dword(int where, u32 val)
158
{
159
        writel(val, PCIU_CONFIGREGS_BASE + where);
160
 
161
        return 0;
162
}
163
 
164
#endif /* __VR41XX_PCIU_H */

powered by: WebSVN 2.1.0

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