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