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