Home | History | Annotate | Line # | Download | only in xscale
ixp425.c revision 1.9.12.1
      1 /*	$NetBSD: ixp425.c,v 1.9.12.1 2006/12/30 20:45:37 yamt Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2003
      5  *	Ichiro FUKUHARA <ichiro (at) 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.9.12.1 2006/12/30 20:45:37 yamt 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 	if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE,
     77 			  0, &sc->sc_exp_ioh))
     78 		panic("%s: unable to map Expansion Bus registers",
     79 		    sc->sc_dev.dv_xname);
     80 
     81 	/*
     82 	 * Invoke the board-specific PCI initialization code
     83 	 */
     84 	ixp425_md_pci_init(sc);
     85 
     86 	/*
     87 	 * Generic initialization of the PCI chipset.
     88 	 */
     89 	ixp425_pci_init(sc);
     90 
     91 	/*
     92 	 * Initialize the DMA tags.
     93 	 */
     94 	ixp425_pci_dma_init(sc);
     95 
     96 	/*
     97 	 * Attach the PCI bus.
     98 	 */
     99 	pba.pba_pc = &sc->ia_pci_chipset;
    100 	pba.pba_iot = &sc->sc_pci_iot;
    101 	pba.pba_memt = &sc->sc_pci_memt;
    102 	pba.pba_dmat = &sc->ia_pci_dmat;
    103 	pba.pba_bus = 0;	/* bus number = 0 */
    104 	pba.pba_bridgetag = NULL;
    105 	pba.pba_intrswiz = 0;	/* XXX */
    106 	pba.pba_intrtag = 0;
    107 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
    108 			PCI_FLAGS_MRL_OKAY   | PCI_FLAGS_MRM_OKAY |
    109 			PCI_FLAGS_MWI_OKAY;
    110 	(void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint);
    111 }
    112