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 37static int imx31_uart_match(device_t, struct cfdata *, void *); 38static void imx31_uart_attach(device_t, device_t, void *); 39 40CFATTACH_DECL_NEW(imx31_uart, sizeof(struct imxuart_softc), 41 imx31_uart_match, imx31_uart_attach, NULL, NULL); 42 43int 44imx31_uart_match(device_t parent, struct cfdata *cf, void *aux) 45{ 46 struct aips_attach_args * const aipsa = aux; 47 48 switch (aipsa->aipsa_addr) { 49 case UART1_BASE: 50 case UART2_BASE: 51 case UART3_BASE: 52 case UART4_BASE: 53 case UART5_BASE: 54 return 1; 55 } 56 57 return 0; 58} 59 60void 61imx31_uart_attach(device_t parent, device_t self, void *aux) 62{ 63 struct aips_attach_args * aa = aux; 64 65 imxuart_attach_common(parent, self, 66 aa->aipsa_memt, aa->aipsa_addr, aa->aipsa_size, aa->aipsa_intr, 0); 67} 68 69