ixp425.c revision 1.11.58.1 1 /* $NetBSD: ixp425.c,v 1.11.58.1 2009/04/28 07:33:46 skrll 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 "pci.h"
37
38 #include <sys/cdefs.h>
39 __KERNEL_RCSID(0, "$NetBSD: ixp425.c,v 1.11.58.1 2009/04/28 07:33:46 skrll Exp $");
40
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/device.h>
44 #include <uvm/uvm.h>
45
46 #include <machine/bus.h>
47
48 #include <arm/xscale/ixp425reg.h>
49 #include <arm/xscale/ixp425var.h>
50
51 struct ixp425_softc *ixp425_softc;
52
53 void
54 ixp425_attach(struct ixp425_softc *sc)
55 {
56 #if NPCI > 0
57 struct pcibus_attach_args pba;
58 #endif
59
60 sc->sc_iot = &ixp425_bs_tag;
61
62 ixp425_softc = sc;
63
64 printf("\n");
65
66 /*
67 * Mapping for GPIO Registers
68 */
69 if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE,
70 0, &sc->sc_gpio_ioh))
71 panic("%s: unable to map GPIO registers", sc->sc_dev.dv_xname);
72
73 if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE,
74 0, &sc->sc_exp_ioh))
75 panic("%s: unable to map Expansion Bus registers",
76 sc->sc_dev.dv_xname);
77
78 #if NPCI > 0
79 /*
80 * Mapping for PCI CSR
81 */
82 if (bus_space_map(sc->sc_iot, IXP425_PCI_HWBASE, IXP425_PCI_SIZE,
83 0, &sc->sc_pci_ioh))
84 panic("%s: unable to map PCI registers", sc->sc_dev.dv_xname);
85
86 /*
87 * Invoke the board-specific PCI initialization code
88 */
89 ixp425_md_pci_init(sc);
90
91 /*
92 * Generic initialization of the PCI chipset.
93 */
94 ixp425_pci_init(sc);
95
96 /*
97 * Initialize the DMA tags.
98 */
99 ixp425_pci_dma_init(sc);
100
101 /*
102 * Attach the PCI bus.
103 */
104 pba.pba_pc = &sc->ia_pci_chipset;
105 pba.pba_iot = &sc->sc_pci_iot;
106 pba.pba_memt = &sc->sc_pci_memt;
107 pba.pba_dmat = &sc->ia_pci_dmat;
108 pba.pba_bus = 0; /* bus number = 0 */
109 pba.pba_bridgetag = NULL;
110 pba.pba_intrswiz = 0; /* XXX */
111 pba.pba_intrtag = 0;
112 pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
113 PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
114 PCI_FLAGS_MWI_OKAY;
115 (void) config_found_ia(&sc->sc_dev, "pcibus", &pba, pcibusprint);
116 #endif
117 }
118