Home | History | Annotate | Line # | Download | only in imx
imx51_uart.c revision 1.2.20.2
      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.2.20.1       tls #include <sys/cdefs.h>
     29  1.2.20.1       tls __KERNEL_RCSID(0, "$NetBSD: imx51_uart.c,v 1.2.20.2 2017/12/03 11:35:53 jdolecek Exp $");
     30  1.2.20.1       tls 
     31  1.2.20.1       tls #include "opt_imx.h"
     32       1.1       bsh #include "opt_imxuart.h"
     33  1.2.20.1       tls 
     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.2.20.2  jdolecek static int imx51_uart_match(device_t, struct cfdata *, void *);
     43  1.2.20.2  jdolecek static void imx51_uart_attach(device_t, device_t, void *);
     44  1.2.20.2  jdolecek 
     45  1.2.20.2  jdolecek CFATTACH_DECL_NEW(imx51_uart, sizeof(struct imxuart_softc),
     46  1.2.20.2  jdolecek     imx51_uart_match, imx51_uart_attach, NULL, NULL);
     47  1.2.20.2  jdolecek 
     48       1.1       bsh int
     49  1.2.20.2  jdolecek 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.2.20.2  jdolecek 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.2.20.2  jdolecek 	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