1 /* $NetBSD: ixp425.c,v 1.10 2005/12/11 12:16:51 christos 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 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by Ichiro FUKUHARA. 19 * 4. The name of the company nor the name of the author may be used to 20 * endorse or promote products derived from this software without specific 21 * prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR 27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 36 #include <sys/cdefs.h> 37 __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.10 2005/12/11 12:16:51 christos Exp $"); 38 39 #include <sys/param.h> 40 #include <sys/systm.h> 41 #include <sys/device.h> 42 #include <uvm/uvm.h> 43 44 #include <machine/bus.h> 45 46 #include <arm/xscale/ixp425reg.h> 47 #include <arm/xscale/ixp425var.h> 48 49 struct ixp425_softc *ixp425_softc; 50 51 void 52 ixp425_attach(struct ixp425_softc *sc) 53 { 54 struct pcibus_attach_args pba; 55 56 sc->sc_iot = &ixp425_bs_tag; 57 58 ixp425_softc = sc; 59 60 printf("\n"); 61 62 /* 63 * Mapping for PCI CSR 64 */ 65 if (bus_space_map(sc->sc_iot, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, 66 0, &sc->sc_pci_ioh)) 67 panic("%s: unable to map PCI registers", sc->sc_dev.dv_xname); 68 69 /* 70 * Mapping for GPIO Registers 71 */ 72 if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE, 73 0, &sc->sc_gpio_ioh)) 74 panic("%s: unable to map GPIO registers", sc->sc_dev.dv_xname); 75 76 /* 77 * Invoke the board-specific PCI initialization code 78 */ 79 ixp425_md_pci_init(sc); 80 81 /* 82 * Generic initialization of the PCI chipset. 83 */ 84 ixp425_pci_init(sc); 85 86 /* 87 * Initialize the DMA tags. 88 */ 89 ixp425_pci_dma_init(sc); 90 91 /* 92 * Attach the PCI bus. 93 */ 94 pba.pba_pc = &sc->ia_pci_chipset; 95 pba.pba_iot = &sc->sc_pci_iot; 96 pba.pba_memt = &sc->sc_pci_memt; 97 pba.pba_dmat = &sc->ia_pci_dmat; 98 pba.pba_bus = 0; /* bus number = 0 */ 99 pba.pba_bridgetag = NULL; 100 pba.pba_intrswiz = 0; /* XXX */ 101 pba.pba_intrtag = 0; 102 pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED | 103 PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | 104 PCI_FLAGS_MWI_OKAY; 105 (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint); 106 } 107