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.4 hkenken __KERNEL_RCSID(0, "$NetBSD: imx51_uart.c,v 1.4 2017/09/08 05:29:12 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.4 hkenken static int imx51_uart_match(device_t, struct cfdata *, void *); 43 1.4 hkenken static void imx51_uart_attach(device_t, device_t, void *); 44 1.4 hkenken 45 1.4 hkenken CFATTACH_DECL_NEW(imx51_uart, sizeof(struct imxuart_softc), 46 1.4 hkenken imx51_uart_match, imx51_uart_attach, NULL, NULL); 47 1.4 hkenken 48 1.1 bsh int 49 1.4 hkenken imx51_uart_match(device_t parent, struct cfdata *cf, void *aux) 50 1.1 bsh { 51 1.1 bsh struct axi_attach_args * const aa = aux; 52 1.1 bsh 53 1.1 bsh switch (aa->aa_addr) { 54 1.1 bsh case UART1_BASE: 55 1.1 bsh case UART2_BASE: 56 1.1 bsh case UART3_BASE: 57 1.1 bsh return 1; 58 1.1 bsh } 59 1.1 bsh 60 1.1 bsh return 0; 61 1.1 bsh } 62 1.1 bsh 63 1.1 bsh void 64 1.4 hkenken imx51_uart_attach(device_t parent, device_t self, void *aux) 65 1.1 bsh { 66 1.1 bsh struct axi_attach_args * aa = aux; 67 1.1 bsh 68 1.4 hkenken imxuart_attach_common(parent, self, 69 1.1 bsh aa->aa_iot, aa->aa_addr, aa->aa_size, aa->aa_irq, 0); 70 1.1 bsh } 71 1.1 bsh 72