xref: /netbsd-src/sys/arch/mips/adm5120/adm5120_obio_dma.c (revision 97627a755de6688e3779397891de0a51dd226e2f)
1*97627a75Smatt /*	$NetBSD: adm5120_obio_dma.c,v 1.5 2015/06/09 22:50:50 matt Exp $	*/
2320845ddSdyoung 
3320845ddSdyoung /*-
4320845ddSdyoung  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
5320845ddSdyoung  * All rights reserved.
6320845ddSdyoung  *
7320845ddSdyoung  * Redistribution and use in source and binary forms, with or
8320845ddSdyoung  * without modification, are permitted provided that the following
9320845ddSdyoung  * conditions are met:
10320845ddSdyoung  * 1. Redistributions of source code must retain the above copyright
11320845ddSdyoung  *    notice, this list of conditions and the following disclaimer.
12320845ddSdyoung  * 2. Redistributions in binary form must reproduce the above
13320845ddSdyoung  *    copyright notice, this list of conditions and the following
14320845ddSdyoung  *    disclaimer in the documentation and/or other materials provided
15320845ddSdyoung  *    with the distribution.
16320845ddSdyoung  * 3. The names of the authors may not be used to endorse or promote
17320845ddSdyoung  *    products derived from this software without specific prior
18320845ddSdyoung  *    written permission.
19320845ddSdyoung  *
20320845ddSdyoung  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY
21320845ddSdyoung  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22320845ddSdyoung  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23320845ddSdyoung  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS
24320845ddSdyoung  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25320845ddSdyoung  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26320845ddSdyoung  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
27320845ddSdyoung  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28320845ddSdyoung  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
29320845ddSdyoung  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30320845ddSdyoung  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31320845ddSdyoung  * OF SUCH DAMAGE.
32320845ddSdyoung  */
33320845ddSdyoung /*-
34320845ddSdyoung  * Copyright (c) 2001 The NetBSD Foundation, Inc.
35320845ddSdyoung  * All rights reserved.
36320845ddSdyoung  *
37320845ddSdyoung  * This code is derived from software contributed to The NetBSD Foundation
38320845ddSdyoung  * by Jason R. Thorpe.
39320845ddSdyoung  *
40320845ddSdyoung  * Redistribution and use in source and binary forms, with or without
41320845ddSdyoung  * modification, are permitted provided that the following conditions
42320845ddSdyoung  * are met:
43320845ddSdyoung  * 1. Redistributions of source code must retain the above copyright
44320845ddSdyoung  *    notice, this list of conditions and the following disclaimer.
45320845ddSdyoung  * 2. Redistributions in binary form must reproduce the above copyright
46320845ddSdyoung  *    notice, this list of conditions and the following disclaimer in the
47320845ddSdyoung  *    documentation and/or other materials provided with the distribution.
48320845ddSdyoung  *
49320845ddSdyoung  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
50320845ddSdyoung  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
51320845ddSdyoung  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
52320845ddSdyoung  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
53320845ddSdyoung  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
54320845ddSdyoung  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
55320845ddSdyoung  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
56320845ddSdyoung  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
57320845ddSdyoung  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
58320845ddSdyoung  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
59320845ddSdyoung  * POSSIBILITY OF SUCH DAMAGE.
60320845ddSdyoung  */
61320845ddSdyoung 
62320845ddSdyoung /*
63320845ddSdyoung  * Platform-specific DMA support for the Infineon ADM5120.
64320845ddSdyoung  */
65320845ddSdyoung 
66320845ddSdyoung #include <sys/cdefs.h>
67*97627a75Smatt __KERNEL_RCSID(0, "$NetBSD: adm5120_obio_dma.c,v 1.5 2015/06/09 22:50:50 matt Exp $");
68320845ddSdyoung 
69320845ddSdyoung #include <sys/param.h>
70320845ddSdyoung 
71320845ddSdyoung #define	_MIPS_BUS_DMA_PRIVATE
72e265f67bSdyoung #include <sys/bus.h>
73320845ddSdyoung 
74*97627a75Smatt #include <mips/cpuregs.h>
75*97627a75Smatt 
76320845ddSdyoung #include <mips/adm5120/include/adm5120_obiovar.h>
77320845ddSdyoung 
78320845ddSdyoung void
obio_dma_init(bus_dma_tag_t t)79320845ddSdyoung obio_dma_init(bus_dma_tag_t t)
80320845ddSdyoung {
81320845ddSdyoung 	t->_cookie = t;
82320845ddSdyoung 	t->_wbase = 0;
833e67b512Smatt 	t->_bounce_alloc_lo = 0;
843e67b512Smatt 	t->_bounce_alloc_hi = MIPS_KSEG1_START - MIPS_KSEG0_START;
853e67b512Smatt 	t->_dmamap_ops = mips_bus_dmamap_ops;
863e67b512Smatt 	t->_dmamem_ops = mips_bus_dmamem_ops;
873e67b512Smatt 	t->_dmatag_ops = mips_bus_dmatag_ops;
88320845ddSdyoung }
89