i80312var.h revision 1.8 1 1.8 thorpej /* $NetBSD: i80312var.h,v 1.8 2003/10/06 16:06:05 thorpej Exp $ */
2 1.2 thorpej
3 1.1 thorpej /*
4 1.6 thorpej * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 1.1 thorpej *
9 1.1 thorpej * Redistribution and use in source and binary forms, with or without
10 1.1 thorpej * modification, are permitted provided that the following conditions
11 1.1 thorpej * are met:
12 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
13 1.1 thorpej * notice, this list of conditions and the following disclaimer.
14 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
16 1.1 thorpej * documentation and/or other materials provided with the distribution.
17 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
18 1.1 thorpej * must display the following acknowledgement:
19 1.1 thorpej * This product includes software developed for the NetBSD Project by
20 1.1 thorpej * Wasabi Systems, Inc.
21 1.1 thorpej * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.1 thorpej * or promote products derived from this software without specific prior
23 1.1 thorpej * written permission.
24 1.1 thorpej *
25 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
36 1.1 thorpej */
37 1.1 thorpej
38 1.1 thorpej #ifndef _ARM_XSCALE_I80312VAR_H_
39 1.1 thorpej #define _ARM_XSCALE_I80312VAR_H_
40 1.1 thorpej
41 1.3 thorpej #include <machine/bus.h>
42 1.3 thorpej
43 1.3 thorpej #include <dev/pci/pcivar.h>
44 1.3 thorpej
45 1.3 thorpej struct i80312_softc {
46 1.3 thorpej struct device sc_dev; /* generic device glue */
47 1.3 thorpej
48 1.3 thorpej int sc_is_host; /* indicates if we're a host or
49 1.3 thorpej plugged into another host */
50 1.3 thorpej
51 1.3 thorpej /*
52 1.3 thorpej * This is the bus_space and handle used to access the
53 1.3 thorpej * i80312 itself. This is filled in by the board-specific
54 1.3 thorpej * front-end.
55 1.3 thorpej */
56 1.3 thorpej bus_space_tag_t sc_st;
57 1.3 thorpej bus_space_handle_t sc_sh;
58 1.3 thorpej
59 1.3 thorpej /* Handles for the various subregions. */
60 1.3 thorpej bus_space_handle_t sc_ppb_sh;
61 1.3 thorpej bus_space_handle_t sc_atu_sh;
62 1.4 thorpej bus_space_handle_t sc_mem_sh;
63 1.5 thorpej bus_space_handle_t sc_intc_sh;
64 1.3 thorpej
65 1.3 thorpej /*
66 1.3 thorpej * Secondary IDSEL Select bits for providing a private
67 1.3 thorpej * PCI device space.
68 1.3 thorpej */
69 1.3 thorpej uint16_t sc_sisr;
70 1.3 thorpej
71 1.3 thorpej /*
72 1.3 thorpej * We expect the board-specific front-end to have already mapped
73 1.3 thorpej * the PCI I/O spaces .. they're only 64K each, and I/O mappings
74 1.3 thorpej * tend to be smaller than a page size, so it's generally more
75 1.3 thorpej * efficient to map them all into virtual space in one fell swoop.
76 1.3 thorpej */
77 1.3 thorpej vaddr_t sc_piow_vaddr; /* primary I/O window vaddr */
78 1.3 thorpej vaddr_t sc_siow_vaddr; /* secondary I/O window vaddr */
79 1.3 thorpej
80 1.3 thorpej /*
81 1.3 thorpej * Variables that define the Primary Inbound window. The base
82 1.3 thorpej * address is configured by a host via BAR #0. The xlate variable
83 1.3 thorpej * defines the start of the local address space that it maps to.
84 1.3 thorpej * The size variable defines the byte size.
85 1.3 thorpej *
86 1.3 thorpej * This window is used for incoming PCI memory read/write cycles
87 1.3 thorpej * from a host.
88 1.3 thorpej *
89 1.3 thorpej * ...unless we're a host, in which case we make the Primary
90 1.3 thorpej * Inbound window work like the Secondary Inbound window, so
91 1.3 thorpej * that PCI devices on that bus can talk to our local RAM.
92 1.3 thorpej */
93 1.3 thorpej uint32_t sc_pin_base;
94 1.3 thorpej uint32_t sc_pin_xlate;
95 1.3 thorpej uint32_t sc_pin_size;
96 1.3 thorpej
97 1.3 thorpej /*
98 1.3 thorpej * Variables that define the Secondary Inbound window. The
99 1.3 thorpej * base variable indicates the PCI base address of the window.
100 1.3 thorpej * The xlate variable defines the start of the local address
101 1.3 thorpej * space that it maps to. The size variable defines the byte
102 1.3 thorpej * size.
103 1.3 thorpej *
104 1.3 thorpej * This window is used for DMA with devices on the secondary bus.
105 1.3 thorpej */
106 1.3 thorpej uint32_t sc_sin_base;
107 1.3 thorpej uint32_t sc_sin_xlate;
108 1.3 thorpej uint32_t sc_sin_size;
109 1.3 thorpej
110 1.3 thorpej /*
111 1.3 thorpej * This is the PCI address that the Primary Outbound Memory
112 1.3 thorpej * window maps to.
113 1.3 thorpej */
114 1.3 thorpej uint32_t sc_pmemout_base;
115 1.3 thorpej uint32_t sc_pmemout_size;
116 1.3 thorpej
117 1.3 thorpej /*
118 1.3 thorpej * This is the PCI address that the Primary Outbound I/O
119 1.3 thorpej * window maps to.
120 1.3 thorpej */
121 1.3 thorpej uint32_t sc_pioout_base;
122 1.3 thorpej uint32_t sc_pioout_size;
123 1.3 thorpej
124 1.3 thorpej /*
125 1.3 thorpej * This is the PCI address that the Secondary Outbound Memory
126 1.3 thorpej * window maps to.
127 1.3 thorpej */
128 1.3 thorpej uint32_t sc_smemout_base;
129 1.3 thorpej uint32_t sc_smemout_size;
130 1.3 thorpej
131 1.3 thorpej /*
132 1.3 thorpej * This is the PCI address that the Secondary Outbound I/O
133 1.3 thorpej * window maps to.
134 1.3 thorpej */
135 1.3 thorpej uint32_t sc_sioout_base;
136 1.3 thorpej uint32_t sc_sioout_size;
137 1.3 thorpej
138 1.3 thorpej /*
139 1.3 thorpej * This defines the private I/O and Memory spaces on the
140 1.3 thorpej * Secondary bus.
141 1.3 thorpej */
142 1.3 thorpej uint32_t sc_privio_base;
143 1.3 thorpej uint32_t sc_privio_size;
144 1.3 thorpej uint32_t sc_privmem_base;
145 1.3 thorpej uint32_t sc_privmem_size;
146 1.3 thorpej
147 1.3 thorpej uint8_t sc_sder; /* secondary decode enable register */
148 1.3 thorpej
149 1.3 thorpej /* Bus space, DMA, and PCI tags for the PCI bus (private devices). */
150 1.3 thorpej struct bus_space sc_pci_iot;
151 1.3 thorpej struct bus_space sc_pci_memt;
152 1.3 thorpej struct arm32_bus_dma_tag sc_pci_dmat;
153 1.3 thorpej struct arm32_pci_chipset sc_pci_chipset;
154 1.6 thorpej
155 1.6 thorpej /* DMA window info for PCI DMA. */
156 1.6 thorpej struct arm32_dma_range sc_pci_dma_range;
157 1.5 thorpej
158 1.5 thorpej /* GPIO state */
159 1.5 thorpej uint8_t sc_gpio_dir; /* GPIO pin direction (1 == output) */
160 1.5 thorpej uint8_t sc_gpio_val; /* GPIO output pin value */
161 1.8 thorpej
162 1.8 thorpej /* DMA tag for local devices. */
163 1.8 thorpej struct arm32_bus_dma_tag sc_local_dmat;
164 1.8 thorpej };
165 1.8 thorpej
166 1.8 thorpej /*
167 1.8 thorpej * Arguments used to attach IOP built-ins.
168 1.8 thorpej */
169 1.8 thorpej struct iopxs_attach_args {
170 1.8 thorpej const char *ia_name; /* name of device */
171 1.8 thorpej bus_space_tag_t ia_st; /* space tag */
172 1.8 thorpej bus_space_handle_t ia_sh;/* handle of IOP base */
173 1.8 thorpej bus_dma_tag_t ia_dmat; /* DMA tag */
174 1.8 thorpej bus_addr_t ia_offset; /* offset of device from IOP base */
175 1.8 thorpej bus_size_t ia_size; /* size of sub-device */
176 1.3 thorpej };
177 1.3 thorpej
178 1.3 thorpej extern struct bus_space i80312_bs_tag;
179 1.5 thorpej extern struct i80312_softc *i80312_softc;
180 1.3 thorpej
181 1.1 thorpej void i80312_sdram_bounds(bus_space_tag_t, bus_space_handle_t,
182 1.1 thorpej paddr_t *, psize_t *);
183 1.3 thorpej
184 1.3 thorpej void i80312_attach(struct i80312_softc *);
185 1.3 thorpej
186 1.3 thorpej void i80312_bs_init(bus_space_tag_t, void *);
187 1.3 thorpej void i80312_io_bs_init(bus_space_tag_t, void *);
188 1.3 thorpej void i80312_mem_bs_init(bus_space_tag_t, void *);
189 1.5 thorpej
190 1.5 thorpej void i80312_gpio_set_direction(uint8_t, uint8_t);
191 1.5 thorpej void i80312_gpio_set_val(uint8_t, uint8_t);
192 1.5 thorpej uint8_t i80312_gpio_get_val(void);
193 1.3 thorpej
194 1.3 thorpej void i80312_pci_init(pci_chipset_tag_t, void *);
195 1.1 thorpej
196 1.1 thorpej #endif /* _ARM_XSCALE_I80312VAR_H_ */
197