1/* $NetBSD: ixp425.c,v 1.14 2011/05/17 17:34:48 dyoung Exp $ */ 2 3/* 4 * Copyright (c) 2003 5 * Ichiro FUKUHARA <ichiro@ichiro.org>. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include "pci.h" 31 32#include <sys/cdefs.h> 33__KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.14 2011/05/17 17:34:48 dyoung Exp $"); 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/device.h> 38#include <uvm/uvm.h> 39 40#include <sys/bus.h> 41 42#include <arm/xscale/ixp425reg.h> 43#include <arm/xscale/ixp425var.h> 44 45struct ixp425_softc *ixp425_softc; 46 47void 48ixp425_attach(struct ixp425_softc *sc) 49{ 50#if NPCI > 0 51 struct pcibus_attach_args pba; 52#endif 53 54 sc->sc_iot = &ixp425_bs_tag; 55 56 ixp425_softc = sc; 57 58 printf("\n"); 59 60 /* 61 * Mapping for GPIO Registers 62 */ 63 if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE, 64 0, &sc->sc_gpio_ioh)) 65 panic("%s: unable to map GPIO registers", sc->sc_dev.dv_xname); 66 67 if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, 68 0, &sc->sc_exp_ioh)) 69 panic("%s: unable to map Expansion Bus registers", 70 sc->sc_dev.dv_xname); 71 72#if NPCI > 0 73 /* 74 * Mapping for PCI CSR 75 */ 76 if (bus_space_map(sc->sc_iot, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, 77 0, &sc->sc_pci_ioh)) 78 panic("%s: unable to map PCI registers", sc->sc_dev.dv_xname); 79 80 /* 81 * Invoke the board-specific PCI initialization code 82 */ 83 ixp425_md_pci_init(sc); 84 85 /* 86 * Generic initialization of the PCI chipset. 87 */ 88 ixp425_pci_init(sc); 89 90 /* 91 * Initialize the DMA tags. 92 */ 93 ixp425_pci_dma_init(sc); 94 95 /* 96 * Attach the PCI bus. 97 */ 98 pba.pba_pc = &sc->ia_pci_chipset; 99 pba.pba_iot = &sc->sc_pci_iot; 100 pba.pba_memt = &sc->sc_pci_memt; 101 pba.pba_dmat = &sc->ia_pci_dmat; 102 pba.pba_bus = 0; /* bus number = 0 */ 103 pba.pba_bridgetag = NULL; 104 pba.pba_intrswiz = 0; /* XXX */ 105 pba.pba_intrtag = 0; 106 pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY | 107 PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | 108 PCI_FLAGS_MWI_OKAY; 109 (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint); 110#endif 111} 112