ixp425var.h revision 186418
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 186418 2008-12-23 04:48:27Z 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
50186352Ssam/* NB: cputype is setup by set_cpufuncs */
51186418Ssam#define	cpu_is_ixp42x()	(cputype == CPU_ID_IXP425)
52186352Ssam#define	cpu_is_ixp43x()	(cputype == CPU_ID_IXP435)
53186352Ssam#define	cpu_is_ixp46x()	(cputype == CPU_ID_IXP465)
54186352Ssam
55164426Ssamstruct ixp425_softc {
56164426Ssam	device_t sc_dev;
57164426Ssam	bus_space_tag_t sc_iot;
58164426Ssam	bus_space_handle_t sc_gpio_ioh;
59164426Ssam	bus_space_handle_t sc_exp_ioh;
60164426Ssam
61164426Ssam	u_int32_t sc_intrmask;
62164426Ssam
63164426Ssam	struct rman sc_irq_rman;
64164426Ssam	struct rman sc_mem_rman;
65166064Scognet	bus_dma_tag_t sc_dmat;
66164426Ssam};
67164426Ssam
68164426Ssamstruct ixppcib_softc {
69164426Ssam	device_t                sc_dev;
70164426Ssam
71164426Ssam	u_int                   sc_bus;
72164426Ssam
73164426Ssam	struct resource         *sc_csr;
74164426Ssam	struct resource         *sc_mem;
75164426Ssam
76164426Ssam	struct rman             sc_io_rman;
77164426Ssam	struct rman             sc_mem_rman;
78164426Ssam	struct rman             sc_irq_rman;
79164426Ssam
80164426Ssam	struct bus_space        sc_pci_memt;
81164426Ssam	struct bus_space        sc_pci_iot;
82166064Scognet	bus_dma_tag_t 		sc_dmat;
83164426Ssam};
84164426Ssam
85164426Ssam#define EXP_BUS_WRITE_4(sc, reg, data) \
86164426Ssam	bus_space_write_4(sc->sc_iot, sc->sc_exp_ioh, reg, data)
87164426Ssam#define EXP_BUS_READ_4(sc, reg) \
88164426Ssam	bus_space_read_4(sc->sc_iot, sc->sc_exp_ioh, reg)
89164426Ssam
90164426Ssam#define	GPIO_CONF_WRITE_4(sc, reg, data)	\
91164426Ssam	bus_space_write_4(sc->sc_iot, sc->sc_gpio_ioh, reg, data)
92164426Ssam#define	GPIO_CONF_READ_4(sc, reg) \
93164426Ssam	bus_space_read_4(sc->sc_iot, sc->sc_gpio_ioh, reg)
94164426Ssam
95164426Ssamextern struct bus_space ixp425_bs_tag;
96164426Ssamextern struct bus_space ixp425_a4x_bs_tag;
97164426Ssam
98164426Ssamvoid	ixp425_io_bs_init(bus_space_tag_t, void *);
99164426Ssamvoid	ixp425_mem_bs_init(bus_space_tag_t, void *);
100164426Ssam
101164426Ssamuint32_t ixp425_sdram_size(void);
102186352Ssamuint32_t ixp435_ddram_size(void);
103186418Ssamuint32_t ixp4xx_read_feature_bits(void);
104164426Ssam
105164426Ssamint	ixp425_md_route_interrupt(device_t, device_t, int);
106164426Ssamvoid	ixp425_md_attach(device_t);
107164426Ssam
108170109Sjhayint	getvbase(uint32_t, uint32_t, uint32_t *);
109170109Sjhay
110169952Ssamstruct ixp425_ivar {
111169952Ssam	uint32_t	addr;
112169952Ssam	int		irq;
113169952Ssam};
114169952Ssam#define	IXP425_IVAR(d)	((struct ixp425_ivar *) device_get_ivars(d))
115169952Ssam
116169952Ssamenum {
117169952Ssam	IXP425_IVAR_ADDR,		/* base physical address */
118169952Ssam	IXP425_IVAR_IRQ			/* irq/gpio pin assignment */
119169952Ssam};
120164426Ssam#endif /* _IXP425VAR_H_ */
121