ixp425.c revision 1.4 1 /* $NetBSD: ixp425.c,v 1.4 2003/07/02 11:02:28 ichiro 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.4 2003/07/02 11:02:28 ichiro 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 #include <evbarm/ixdp425/ixdp425reg.h>
50
51 int ixp425_pcibus_print(void *, const char *);
52 static struct ixp425_softc *ixp425_softc;
53
54 void
55 ixp425_attach(struct ixp425_softc *sc)
56 {
57 ixp425_softc = sc;
58
59 printf("\n");
60
61 #if 0
62 /*
63 * PCI bus reset
64 */
65 /* disable PCI command */
66
67 /* XXX assert PCI reset Mode */
68
69 /* We setup a 1:1 memory map of bus<->physical addresses */
70
71 /*
72 * Enable bus mastering and I/O,memory access
73 */
74
75
76 /*
77 * Initialize the bus space and DMA tags and the PCI chipset tag.
78 */
79 ixp425_io_bs_init(&sc->ia_pci_iot, sc);
80 ixp425_mem_bs_init(&sc->ia_pci_memt, sc);
81 ixp425_pci_init(&sc->ia_pci_chipset, sc);
82
83 /*
84 * Initialize the DMA tags.
85 */
86 ixp425_pci_dma_init(sc);
87
88 /*
89 * Attach the PCI bus.
90 */
91 pba.pba_busname = "pci";
92 pba.pba_pc = &sc->ia_pci_chipset;
93 pba.pba_iot = &sc->ia_pci_iot;
94 pba.pba_memt = &sc->ia_pci_memt;
95 pba.pba_dmat = &sc->ia_pci_dmat;
96 pba.pba_bus = 0; /* bus number = 0 */
97 pba.pba_intrswiz = 0; /* XXX */
98 pba.pba_intrtag = 0;
99 pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
100 PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
101 PCI_FLAGS_MWI_OKAY;
102 (void) config_found(&sc->sc_dev, &pba, ixp425_pcibus_print);
103 #endif
104 }
105
106 int
107 ixp425_pcibus_print(void *aux, const char *pnp)
108 {
109 struct pcibus_attach_args *pba = aux;
110
111 if (pnp)
112 aprint_normal("%s at %s", pba->pba_busname, pnp);
113
114 aprint_normal(" bus %d", pba->pba_bus);
115
116 return (UNCONF);
117 }
118