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