xref: /netbsd-src/sys/arch/arm/imx/imx31_uart.c (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1 /*
2  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
3  * Written by Hiroyuki Bessho for Genetec Corporation.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
18  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  * POSSIBILITY OF SUCH DAMAGE.
25  *
26  */
27 
28 #include "opt_imxuart.h"
29 #include <sys/param.h>
30 #include <sys/bus.h>
31 #include <sys/device.h>
32 #include <arm/imx/imx31reg.h>
33 #include <arm/imx/imx31var.h>
34 #include <arm/imx/imxuartreg.h>
35 #include <arm/imx/imxuartvar.h>
36 
37 
38 int
39 imxuart_match(device_t parent, struct cfdata *cf, void *aux)
40 {
41 	struct aips_attach_args * const aipsa = aux;
42 
43 	switch (aipsa->aipsa_addr) {
44 	case UART1_BASE:
45 	case UART2_BASE:
46 	case UART3_BASE:
47 	case UART4_BASE:
48 	case UART5_BASE:
49 		return 1;
50 	}
51 
52 	return 0;
53 }
54 
55 void
56 imxuart_attach(device_t parent, device_t self, void *aux)
57 {
58 	struct aips_attach_args * aa = aux;
59 
60 	imxuart_attach_common(parent, self,
61 	    aa->aipsa_memt, aa->aipsa_addr, aa->aipsa_size, aa->aipsa_intr, 0);
62 }
63 
64