Home | History | Annotate | Line # | Download | only in imx
imx51_uart.c revision 1.1
      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.1  bsh #include "opt_imxuart.h"
     29  1.1  bsh #include <sys/param.h>
     30  1.1  bsh #include <sys/bus.h>
     31  1.1  bsh #include <sys/device.h>
     32  1.1  bsh #include <arm/imx/imx51reg.h>
     33  1.1  bsh #include <arm/imx/imx51var.h>
     34  1.1  bsh #include <arm/imx/imxuartreg.h>
     35  1.1  bsh #include <arm/imx/imxuartvar.h>
     36  1.1  bsh 
     37  1.1  bsh 
     38  1.1  bsh int
     39  1.1  bsh imxuart_match(struct device *parent, struct cfdata *cf, void *aux)
     40  1.1  bsh {
     41  1.1  bsh 	struct axi_attach_args * const aa = aux;
     42  1.1  bsh 
     43  1.1  bsh 	switch (aa->aa_addr) {
     44  1.1  bsh 	case UART1_BASE:
     45  1.1  bsh 	case UART2_BASE:
     46  1.1  bsh 	case UART3_BASE:
     47  1.1  bsh 		return 1;
     48  1.1  bsh 	}
     49  1.1  bsh 
     50  1.1  bsh 	return 0;
     51  1.1  bsh }
     52  1.1  bsh 
     53  1.1  bsh void
     54  1.1  bsh imxuart_attach(struct device *parent, struct device *self, void *aux)
     55  1.1  bsh {
     56  1.1  bsh 	struct axi_attach_args * aa = aux;
     57  1.1  bsh 
     58  1.1  bsh 	imxuart_attach_common(parent, self,
     59  1.1  bsh 	    aa->aa_iot, aa->aa_addr, aa->aa_size, aa->aa_irq, 0);
     60  1.1  bsh }
     61  1.1  bsh 
     62