ixp425var.h revision 169952
1164426Ssam/*	$NetBSD: ixp425var.h,v 1.10 2006/04/10 03:36:03 simonb Exp $ */
2164426Ssam
3164426Ssam/*
4164426Ssam * Copyright (c) 2003
5164426Ssam *	Ichiro FUKUHARA <ichiro@ichiro.org>.
6164426Ssam * All rights reserved.
7164426Ssam *
8164426Ssam * Redistribution and use in source and binary forms, with or without
9164426Ssam * modification, are permitted provided that the following conditions
10164426Ssam * are met:
11164426Ssam * 1. Redistributions of source code must retain the above copyright
12164426Ssam *    notice, this list of conditions and the following disclaimer.
13164426Ssam * 2. Redistributions in binary form must reproduce the above copyright
14164426Ssam *    notice, this list of conditions and the following disclaimer in the
15164426Ssam *    documentation and/or other materials provided with the distribution.
16164426Ssam * 3. All advertising materials mentioning features or use of this software
17164426Ssam *    must display the following acknowledgement:
18164426Ssam *	This product includes software developed by Ichiro FUKUHARA.
19164426Ssam * 4. The name of the company nor the name of the author may be used to
20164426Ssam *    endorse or promote products derived from this software without specific
21164426Ssam *    prior written permission.
22164426Ssam *
23164426Ssam * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
24164426Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25164426Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26164426Ssam * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
27164426Ssam * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28164426Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29164426Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30164426Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31164426Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32164426Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33164426Ssam * SUCH DAMAGE.
34164426Ssam *
35164426Ssam * $FreeBSD: head/sys/arm/xscale/ixp425/ixp425var.h 169952 2007-05-24 16:25:49Z sam $
36164426Ssam *
37164426Ssam */
38164426Ssam
39164426Ssam#ifndef _IXP425VAR_H_
40164426Ssam#define _IXP425VAR_H_
41164426Ssam
42164426Ssam#include <sys/conf.h>
43164426Ssam#include <sys/queue.h>
44164426Ssam
45164426Ssam#include <machine/bus.h>
46164426Ssam
47164426Ssam#include <dev/pci/pcivar.h>
48164426Ssam#include <sys/rman.h>
49164426Ssam
50164426Ssamstruct ixp425_softc {
51164426Ssam	device_t sc_dev;
52164426Ssam	bus_space_tag_t sc_iot;
53164426Ssam	bus_space_handle_t sc_gpio_ioh;
54164426Ssam	bus_space_handle_t sc_exp_ioh;
55164426Ssam
56164426Ssam	u_int32_t sc_intrmask;
57164426Ssam
58164426Ssam	struct rman sc_irq_rman;
59164426Ssam	struct rman sc_mem_rman;
60166064Scognet	bus_dma_tag_t sc_dmat;
61164426Ssam};
62164426Ssam
63164426Ssamstruct ixppcib_softc {
64164426Ssam	device_t                sc_dev;
65164426Ssam
66164426Ssam	u_int                   sc_bus;
67164426Ssam
68164426Ssam	struct resource         *sc_csr;
69164426Ssam	struct resource         *sc_mem;
70164426Ssam
71164426Ssam	struct rman             sc_io_rman;
72164426Ssam	struct rman             sc_mem_rman;
73164426Ssam	struct rman             sc_irq_rman;
74164426Ssam
75164426Ssam	struct bus_space        sc_pci_memt;
76164426Ssam	struct bus_space        sc_pci_iot;
77166064Scognet	bus_dma_tag_t 		sc_dmat;
78164426Ssam};
79164426Ssam
80164426Ssam#define EXP_BUS_WRITE_4(sc, reg, data) \
81164426Ssam	bus_space_write_4(sc->sc_iot, sc->sc_exp_ioh, reg, data)
82164426Ssam#define EXP_BUS_READ_4(sc, reg) \
83164426Ssam	bus_space_read_4(sc->sc_iot, sc->sc_exp_ioh, reg)
84164426Ssam
85164426Ssam#define	GPIO_CONF_WRITE_4(sc, reg, data)	\
86164426Ssam	bus_space_write_4(sc->sc_iot, sc->sc_gpio_ioh, reg, data)
87164426Ssam#define	GPIO_CONF_READ_4(sc, reg) \
88164426Ssam	bus_space_read_4(sc->sc_iot, sc->sc_gpio_ioh, reg)
89164426Ssam
90164426Ssamextern struct bus_space ixp425_bs_tag;
91164426Ssamextern struct bus_space ixp425_a4x_bs_tag;
92164426Ssam
93164426Ssamvoid	ixp425_io_bs_init(bus_space_tag_t, void *);
94164426Ssamvoid	ixp425_mem_bs_init(bus_space_tag_t, void *);
95164426Ssam
96164426Ssamuint32_t ixp425_sdram_size(void);
97164426Ssam
98164426Ssamint	ixp425_md_route_interrupt(device_t, device_t, int);
99164426Ssamvoid	ixp425_md_attach(device_t);
100164426Ssam
101169952Ssamstruct ixp425_ivar {
102169952Ssam	uint32_t	addr;
103169952Ssam	int		irq;
104169952Ssam};
105169952Ssam#define	IXP425_IVAR(d)	((struct ixp425_ivar *) device_get_ivars(d))
106169952Ssam
107169952Ssamenum {
108169952Ssam	IXP425_IVAR_ADDR,		/* base physical address */
109169952Ssam	IXP425_IVAR_IRQ			/* irq/gpio pin assignment */
110169952Ssam};
111169952Ssam
112164426Ssam#endif /* _IXP425VAR_H_ */
113