1 /* $Id: imx31_aips.c,v 1.3 2008/05/02 22:00:29 martin Exp $ */
4 /* $NetBSD: imx31_aips.c,v 1.2 2008/04/27 18:58:44 matt Exp $ */
7 * Copyright (c) 2002, 2005 Genetec Corporation. All rights reserved.
8 * Written by Hiroyuki Bessho for Genetec Corporation.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed for the NetBSD Project by
21 * Genetec Corporation.
22 * 4. The name of Genetec Corporation may not be used to endorse or
23 * promote products derived from this software without specific prior
26 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
39 * Autoconfiguration support for the Intel PXA2[15]0 application
40 * processor. This code is derived from arm/sa11x0/sa11x0.c
44 * Copyright (c) 2001, The NetBSD Foundation, Inc. All rights reserved.
46 * This code is derived from software contributed to The NetBSD Foundation
47 * by IWAMOTO Toshihiro and Ichiro FUKUHARA.
49 * Redistribution and use in source and binary forms, with or without
50 * modification, are permitted provided that the following conditions
52 * 1. Redistributions of source code must retain the above copyright
53 * notice, this list of conditions and the following disclaimer.
54 * 2. Redistributions in binary form must reproduce the above copyright
55 * notice, this list of conditions and the following disclaimer in the
56 * documentation and/or other materials provided with the distribution.
58 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
59 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
60 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
61 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
62 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
63 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
64 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
65 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
66 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
67 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
68 * POSSIBILITY OF SUCH DAMAGE.
72 * Shin Takemura and PocketBSD Project. All rights reserved.
74 * Redistribution and use in source and binary forms, with or without
75 * modification, are permitted provided that the following conditions
77 * 1. Redistributions of source code must retain the above copyright
78 * notice, this list of conditions and the following disclaimer.
79 * 2. Redistributions in binary form must reproduce the above copyright
80 * notice, this list of conditions and the following disclaimer in the
81 * documentation and/or other materials provided with the distribution.
82 * 3. All advertising materials mentioning features or use of this software
83 * must display the following acknowledgement:
84 * This product includes software developed by the PocketBSD project
85 * and its contributors.
86 * 4. Neither the name of the project nor the names of its contributors
87 * may be used to endorse or promote products derived from this software
88 * without specific prior written permission.
90 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
91 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
92 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
93 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
94 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
95 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
96 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
97 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
99 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
104 #include <sys/cdefs.h>
105 __KERNEL_RCSID(0, "$Id: imx31_aips.c,v 1.3 2008/05/02 22:00:29 martin Exp $");
107 #include "locators.h"
109 #include <sys/param.h>
110 #include <sys/systm.h>
111 #include <sys/device.h>
112 #include <sys/kernel.h>
113 #include <sys/reboot.h>
115 #include <machine/cpu.h>
116 #include <machine/bus.h>
118 #include <arm/cpufunc.h>
119 #include <arm/mainbus/mainbus.h>
121 #include <machine/intr.h>
123 #include <arm/imx/imx31var.h>
124 #include <arm/imx/imxuartreg.h>
125 #include <arm/imx/imxuartvar.h>
127 struct imxaips_softc
{
128 struct device sc_dev
;
129 bus_space_tag_t sc_bust
;
133 static int imxaips_match(device_t
, cfdata_t
, void *);
134 static void imxaips_attach(device_t
, device_t
, void *);
135 static int imxaips_search(device_t
, cfdata_t
, const int *, void *);
136 static int imxaips_print(void *, const char *);
138 /* attach structures */
139 CFATTACH_DECL(aips
, sizeof(struct imxaips_softc
),
140 imxaips_match
, imxaips_attach
, NULL
, NULL
);
143 imxaips_match(device_t parent
, cfdata_t match
, void *aux
)
149 imxaips_attach(device_t parent
, device_t self
, void *aux
)
151 struct imxaips_softc
* const sc
= (struct imxaips_softc
*)self
;
152 struct ahb_attach_args
* const ahba
= aux
;
154 sc
->sc_bust
= ahba
->ahba_memt
;
156 aprint_normal(": imx31 AHB-Lite 2.v6 to IP bus interface\n");
159 * Attach all other devices
161 config_search_ia(imxaips_search
, self
, "aips", sc
);
165 imxaips_search(device_t parent
, cfdata_t cf
, const int *ldesc
, void *aux
)
167 struct imxaips_softc
* const sc
= aux
;
168 struct aips_attach_args aipsa
;
170 aipsa
.aipsa_name
= "aisp";
171 aipsa
.aipsa_memt
= sc
->sc_bust
;
172 aipsa
.aipsa_addr
= cf
->cf_loc
[AIPSCF_ADDR
];
173 aipsa
.aipsa_size
= cf
->cf_loc
[AIPSCF_SIZE
];
174 aipsa
.aipsa_intr
= cf
->cf_loc
[AIPSCF_INTR
];
176 if (config_match(parent
, cf
, &aipsa
))
177 config_attach(parent
, cf
, &aipsa
, imxaips_print
);
183 imxaips_print(void *aux
, const char *name
)
185 struct aips_attach_args
*aipsa
= aux
;
187 if (aipsa
->aipsa_addr
!= AIPSCF_ADDR_DEFAULT
) {
188 aprint_normal(" addr 0x%lx", aipsa
->aipsa_addr
);
189 if (aipsa
->aipsa_size
> AIPSCF_SIZE_DEFAULT
)
190 aprint_normal("-0x%lx",
191 aipsa
->aipsa_addr
+ aipsa
->aipsa_size
-1);
193 if (aipsa
->aipsa_intr
!= AIPSCF_INTR_DEFAULT
)
194 aprint_normal(" intr %d", aipsa
->aipsa_intr
);