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 <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: imx51_uart.c,v 1.4 2017/09/08 05:29:12 hkenken Exp $");
30
31#include "opt_imx.h"
32#include "opt_imxuart.h"
33
34#include <sys/param.h>
35#include <sys/bus.h>
36#include <sys/device.h>
37#include <arm/imx/imx51reg.h>
38#include <arm/imx/imx51var.h>
39#include <arm/imx/imxuartreg.h>
40#include <arm/imx/imxuartvar.h>
41
42static int imx51_uart_match(device_t, struct cfdata *, void *);
43static void imx51_uart_attach(device_t, device_t, void *);
44
45CFATTACH_DECL_NEW(imx51_uart, sizeof(struct imxuart_softc),
46    imx51_uart_match, imx51_uart_attach, NULL, NULL);
47
48int
49imx51_uart_match(device_t parent, struct cfdata *cf, void *aux)
50{
51	struct axi_attach_args * const aa = aux;
52
53	switch (aa->aa_addr) {
54	case UART1_BASE:
55	case UART2_BASE:
56	case UART3_BASE:
57		return 1;
58	}
59
60	return 0;
61}
62
63void
64imx51_uart_attach(device_t parent, device_t self, void *aux)
65{
66	struct axi_attach_args * aa = aux;
67
68	imxuart_attach_common(parent, self,
69	    aa->aa_iot, aa->aa_addr, aa->aa_size, aa->aa_irq, 0);
70}
71
72