Home | History | Annotate | Line # | Download | only in imx
imx51_uart.c revision 1.2.34.1
      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.2.34.1 2014/08/10 06:53:51 tls 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 
     42 int
     43 imxuart_match(device_t parent, struct cfdata *cf, void *aux)
     44 {
     45 	struct axi_attach_args * const aa = aux;
     46 
     47 	switch (aa->aa_addr) {
     48 	case UART1_BASE:
     49 	case UART2_BASE:
     50 	case UART3_BASE:
     51 		return 1;
     52 	}
     53 
     54 	return 0;
     55 }
     56 
     57 void
     58 imxuart_attach(device_t parent, device_t self, void *aux)
     59 {
     60 	struct axi_attach_args * aa = aux;
     61 
     62 	imxuart_attach_common(parent, self,
     63 	    aa->aa_iot, aa->aa_addr, aa->aa_size, aa->aa_irq, 0);
     64 }
     65 
     66