ixp425var.h revision 215319
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 215319 2010-11-14 20:41:22Z thompsa $ 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 68194653Ssamvoid ixp425_set_gpio(struct ixp425_softc *sc, int pin, int type); 69194653Ssam 70164426Ssamstruct ixppcib_softc { 71164426Ssam device_t sc_dev; 72164426Ssam 73164426Ssam u_int sc_bus; 74164426Ssam 75164426Ssam struct resource *sc_csr; 76164426Ssam struct resource *sc_mem; 77164426Ssam 78164426Ssam struct rman sc_io_rman; 79164426Ssam struct rman sc_mem_rman; 80164426Ssam struct rman sc_irq_rman; 81164426Ssam 82164426Ssam struct bus_space sc_pci_memt; 83164426Ssam struct bus_space sc_pci_iot; 84166064Scognet bus_dma_tag_t sc_dmat; 85164426Ssam}; 86164426Ssam 87164426Ssam#define EXP_BUS_WRITE_4(sc, reg, data) \ 88164426Ssam bus_space_write_4(sc->sc_iot, sc->sc_exp_ioh, reg, data) 89164426Ssam#define EXP_BUS_READ_4(sc, reg) \ 90164426Ssam bus_space_read_4(sc->sc_iot, sc->sc_exp_ioh, reg) 91164426Ssam 92164426Ssam#define GPIO_CONF_WRITE_4(sc, reg, data) \ 93164426Ssam bus_space_write_4(sc->sc_iot, sc->sc_gpio_ioh, reg, data) 94164426Ssam#define GPIO_CONF_READ_4(sc, reg) \ 95164426Ssam bus_space_read_4(sc->sc_iot, sc->sc_gpio_ioh, reg) 96215319Sthompsa#define IXP4XX_GPIO_LOCK() mtx_lock(&ixp425_gpio_mtx) 97215319Sthompsa#define IXP4XX_GPIO_UNLOCK() mtx_unlock(&ixp425_gpio_mtx) 98215319Sthompsaextern struct mtx ixp425_gpio_mtx; 99164426Ssam 100164426Ssamextern struct bus_space ixp425_bs_tag; 101164426Ssamextern struct bus_space ixp425_a4x_bs_tag; 102164426Ssam 103194670Ssamextern struct bus_space cambria_exp_bs_tag; 104194670Ssamvoid cambria_exp_bus_init(struct ixp425_softc *); 105194670Ssam 106164426Ssamvoid ixp425_io_bs_init(bus_space_tag_t, void *); 107164426Ssamvoid ixp425_mem_bs_init(bus_space_tag_t, void *); 108164426Ssam 109164426Ssamuint32_t ixp425_sdram_size(void); 110186352Ssamuint32_t ixp435_ddram_size(void); 111186418Ssamuint32_t ixp4xx_read_feature_bits(void); 112194319Ssamvoid ixp4xx_write_feature_bits(uint32_t); 113164426Ssam 114164426Ssamint ixp425_md_route_interrupt(device_t, device_t, int); 115164426Ssamvoid ixp425_md_attach(device_t); 116164426Ssam 117170109Sjhayint getvbase(uint32_t, uint32_t, uint32_t *); 118170109Sjhay 119169952Ssamstruct ixp425_ivar { 120169952Ssam uint32_t addr; 121169952Ssam int irq; 122169952Ssam}; 123169952Ssam#define IXP425_IVAR(d) ((struct ixp425_ivar *) device_get_ivars(d)) 124169952Ssam 125169952Ssamenum { 126169952Ssam IXP425_IVAR_ADDR, /* base physical address */ 127169952Ssam IXP425_IVAR_IRQ /* irq/gpio pin assignment */ 128169952Ssam}; 129164426Ssam#endif /* _IXP425VAR_H_ */ 130