Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / arm / xscale / ixp425.c
blob80cd778acafe70639c62c1fe9de35e23de517e2d
1 /* $NetBSD: ixp425.c,v 1.12 2009/03/17 00:51:27 msaitoh Exp $ */
3 /*
4 * Copyright (c) 2003
5 * Ichiro FUKUHARA <ichiro@ichiro.org>.
6 * All rights reserved.
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.
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.
30 #include "pci.h"
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.12 2009/03/17 00:51:27 msaitoh Exp $");
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/device.h>
38 #include <uvm/uvm.h>
40 #include <machine/bus.h>
42 #include <arm/xscale/ixp425reg.h>
43 #include <arm/xscale/ixp425var.h>
45 struct ixp425_softc *ixp425_softc;
47 void
48 ixp425_attach(struct ixp425_softc *sc)
50 #if NPCI > 0
51 struct pcibus_attach_args pba;
52 #endif
54 sc->sc_iot = &ixp425_bs_tag;
56 ixp425_softc = sc;
58 printf("\n");
61 * Mapping for GPIO Registers
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);
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);
72 #if NPCI > 0
74 * Mapping for PCI CSR
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);
81 * Invoke the board-specific PCI initialization code
83 ixp425_md_pci_init(sc);
86 * Generic initialization of the PCI chipset.
88 ixp425_pci_init(sc);
91 * Initialize the DMA tags.
93 ixp425_pci_dma_init(sc);
96 * Attach the PCI bus.
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_ENABLED | PCI_FLAGS_MEM_ENABLED |
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