Home | History | Annotate | Line # | Download | only in imx
      1 /* $NetBSD: imx31_uart.c,v 1.4 2026/02/02 06:23:37 skrll Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
      5  * Written by Hiroyuki Bessho for Genetec Corporation.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
     17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
     20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  * POSSIBILITY OF SUCH DAMAGE.
     27  *
     28  */
     29 
     30 #include "opt_imxuart.h"
     31 #include <sys/param.h>
     32 #include <sys/bus.h>
     33 #include <sys/device.h>
     34 #include <arm/imx/imx31reg.h>
     35 #include <arm/imx/imx31var.h>
     36 #include <arm/imx/imxuartreg.h>
     37 #include <arm/imx/imxuartvar.h>
     38 
     39 static int imx31_uart_match(device_t, struct cfdata *, void *);
     40 static void imx31_uart_attach(device_t, device_t, void *);
     41 
     42 CFATTACH_DECL_NEW(imx31_uart, sizeof(struct imxuart_softc),
     43     imx31_uart_match, imx31_uart_attach, NULL, NULL);
     44 
     45 int
     46 imx31_uart_match(device_t parent, struct cfdata *cf, void *aux)
     47 {
     48 	struct aips_attach_args * const aipsa = aux;
     49 
     50 	switch (aipsa->aipsa_addr) {
     51 	case UART1_BASE:
     52 	case UART2_BASE:
     53 	case UART3_BASE:
     54 	case UART4_BASE:
     55 	case UART5_BASE:
     56 		return 1;
     57 	}
     58 
     59 	return 0;
     60 }
     61 
     62 void
     63 imx31_uart_attach(device_t parent, device_t self, void *aux)
     64 {
     65 	struct aips_attach_args * aa = aux;
     66 
     67 	imxuart_attach_common(parent, self,
     68 	    aa->aipsa_memt, aa->aipsa_addr, aa->aipsa_size, aa->aipsa_intr, 0);
     69 }
     70 
     71