i80321var.h revision 139735
1135669Scognet/*	$NetBSD: i80321var.h,v 1.8 2003/10/06 16:06:06 thorpej Exp $	*/
2135669Scognet
3139735Simp/*-
4135669Scognet * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
5135669Scognet * All rights reserved.
6135669Scognet *
7135669Scognet * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8135669Scognet *
9135669Scognet * Redistribution and use in source and binary forms, with or without
10135669Scognet * modification, are permitted provided that the following conditions
11135669Scognet * are met:
12135669Scognet * 1. Redistributions of source code must retain the above copyright
13135669Scognet *    notice, this list of conditions and the following disclaimer.
14135669Scognet * 2. Redistributions in binary form must reproduce the above copyright
15135669Scognet *    notice, this list of conditions and the following disclaimer in the
16135669Scognet *    documentation and/or other materials provided with the distribution.
17135669Scognet * 3. All advertising materials mentioning features or use of this software
18135669Scognet *    must display the following acknowledgement:
19135669Scognet *	This product includes software developed for the NetBSD Project by
20135669Scognet *	Wasabi Systems, Inc.
21135669Scognet * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22135669Scognet *    or promote products derived from this software without specific prior
23135669Scognet *    written permission.
24135669Scognet *
25135669Scognet * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26135669Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27135669Scognet * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28135669Scognet * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
29135669Scognet * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30135669Scognet * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31135669Scognet * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32135669Scognet * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33135669Scognet * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34135669Scognet * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35135669Scognet * POSSIBILITY OF SUCH DAMAGE.
36135669Scognet *
37135669Scognet * $FreeBSD: head/sys/arm/xscale/i80321/i80321var.h 139735 2005-01-05 21:58:49Z imp $
38135669Scognet *
39135669Scognet */
40135669Scognet
41135669Scognet#ifndef _ARM_XSCALE_I80321VAR_H_
42135669Scognet#define	_ARM_XSCALE_I80321VAR_H_
43135669Scognet
44135669Scognet#include <sys/queue.h>
45135669Scognet#include <dev/pci/pcivar.h>
46135669Scognet
47135669Scognet/*
48135669Scognet * There are roughly 32 interrupt sources.
49135669Scognet */
50135669Scognet#define	NIRQ		32
51135669Scognet
52135669Scognetextern struct bus_space i80321_bs_tag;
53135669Scognet
54135669Scognetstruct i80321_softc {
55135669Scognet	device_t 		dev;
56135669Scognet	bus_space_tag_t 	sc_st;
57135669Scognet	bus_space_handle_t	sc_sh;
58135669Scognet	/* Handles for the various subregions. */
59135669Scognet	bus_space_handle_t 	sc_atu_sh;
60135669Scognet	bus_space_handle_t 	sc_mcu_sh;
61135669Scognet	int			sc_is_host;
62135669Scognet
63135669Scognet	/*
64135669Scognet	 * We expect the board-specific front-end to have already mapped
65135669Scognet	 * the PCI I/O space .. it is only 64K, and I/O mappings tend to
66135669Scognet	 * be smaller than a page size, so it's generally more efficient
67135669Scognet	 * to map them all into virtual space in one fell swoop.
68135669Scognet	 */
69135669Scognet	vm_offset_t		sc_iow_vaddr;		/* I/O window vaddr */
70135669Scognet
71135669Scognet	/*
72135669Scognet	 * Variables that define the Inbound windows.  The base address of
73135669Scognet	 * 0-2 are configured by a host via BARs.  The xlate variable
74135669Scognet	 * defines the start of the local address space that it maps to.
75135669Scognet	 * The size variable defines the byte size.
76135669Scognet	 *
77135669Scognet	 * The first 3 windows are for incoming PCI memory read/write
78135669Scognet	 * cycles from a host.  The 4th window, not configured by the
79135669Scognet	 * host (as it outside the normal BAR range) is the inbound
80135669Scognet	 * window for PCI devices controlled by the i80321.
81135669Scognet	 */
82135669Scognet	struct {
83135669Scognet		uint32_t iwin_base_hi;
84135669Scognet		uint32_t iwin_base_lo;
85135669Scognet		uint32_t iwin_xlate;
86135669Scognet		uint32_t iwin_size;
87135669Scognet	} sc_iwin[4];
88135669Scognet
89135669Scognet	/*
90135669Scognet	 * Variables that define the Outbound windows.
91135669Scognet	 */
92135669Scognet	struct {
93135669Scognet		uint32_t owin_xlate_lo;
94135669Scognet		uint32_t owin_xlate_hi;
95135669Scognet	} sc_owin[2];
96135669Scognet
97135669Scognet	/*
98135669Scognet	 * This is the PCI address that the Outbound I/O
99135669Scognet	 * window maps to.
100135669Scognet	 */
101135669Scognet	uint32_t		sc_ioout_xlate;
102135669Scognet
103135669Scognet	/* Bus space, DMA, and PCI tags for the PCI bus (private devices). */
104135669Scognet	struct bus_space 	sc_pci_iot;
105135669Scognet	struct bus_space 	sc_pci_memt;
106135669Scognet
107135669Scognet	/* GPIO state */
108135669Scognet	uint8_t sc_gpio_dir;    /* GPIO pin direction (1 == output) */
109135669Scognet	uint8_t sc_gpio_val;    /* GPIO output pin value */
110135669Scognet
111135669Scognet};
112135669Scognetvoid	i80321_sdram_bounds(bus_space_tag_t, bus_space_handle_t,
113135669Scognet	    vm_paddr_t *, vm_size_t *);
114135669Scognet
115135669Scognetvoid	i80321_attach(struct i80321_softc *);
116135669Scognetvoid	i80321_calibrate_delay(void);
117135669Scognet
118135669Scognetvoid	i80321_bs_init(bus_space_tag_t, void *);
119135669Scognetvoid	i80321_io_bs_init(bus_space_tag_t, void *);
120135669Scognetvoid	i80321_mem_bs_init(bus_space_tag_t, void *);
121135669Scognet
122135669Scognet#endif /* _ARM_XSCALE_I80321VAR_H_ */
123