xref: /netbsd-src/sys/arch/arm/imx/imx51_uart.c (revision 6a493d6bc668897c91594964a732d38505b70cbb)
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/imx51reg.h>
33 #include <arm/imx/imx51var.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 axi_attach_args * const aa = aux;
42 
43 	switch (aa->aa_addr) {
44 	case UART1_BASE:
45 	case UART2_BASE:
46 	case UART3_BASE:
47 		return 1;
48 	}
49 
50 	return 0;
51 }
52 
53 void
54 imxuart_attach(device_t parent, device_t self, void *aux)
55 {
56 	struct axi_attach_args * aa = aux;
57 
58 	imxuart_attach_common(parent, self,
59 	    aa->aa_iot, aa->aa_addr, aa->aa_size, aa->aa_irq, 0);
60 }
61 
62