1183840Sraj/*-
2183840Sraj * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
3183840Sraj * All rights reserved.
4183840Sraj *
5183840Sraj * Developed by Semihalf.
6183840Sraj *
7183840Sraj * Redistribution and use in source and binary forms, with or without
8183840Sraj * modification, are permitted provided that the following conditions
9183840Sraj * are met:
10183840Sraj * 1. Redistributions of source code must retain the above copyright
11183840Sraj *    notice, this list of conditions and the following disclaimer.
12183840Sraj * 2. Redistributions in binary form must reproduce the above copyright
13183840Sraj *    notice, this list of conditions and the following disclaimer in the
14183840Sraj *    documentation and/or other materials provided with the distribution.
15183840Sraj * 3. Neither the name of MARVELL nor the names of contributors
16183840Sraj *    may be used to endorse or promote products derived from this software
17183840Sraj *    without specific prior written permission.
18183840Sraj *
19183840Sraj * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20183840Sraj * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21183840Sraj * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22183840Sraj * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
23183840Sraj * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24183840Sraj * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25183840Sraj * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26183840Sraj * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27183840Sraj * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28183840Sraj * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29183840Sraj * SUCH DAMAGE.
30183840Sraj */
31183840Sraj
32183840Sraj#include <sys/cdefs.h>
33183840Sraj__FBSDID("$FreeBSD$");
34183840Sraj
35183840Sraj#include <sys/param.h>
36183840Sraj#include <sys/systm.h>
37183840Sraj#include <sys/bus.h>
38183840Sraj#include <sys/kernel.h>
39183840Sraj#include <sys/malloc.h>
40183840Sraj
41183840Sraj#include <machine/bus.h>
42183840Sraj
43183840Sraj/*
44183840Sraj * Bus space functions for Marvell SoC family
45183840Sraj */
46183840Sraj
47183840Sraj/* Prototypes for all the bus_space structure functions */
48183840Srajbs_protos(generic);
49183840Srajbs_protos(generic_armv4);
50183840Sraj
51183840Sraj/*
52209131Sraj * The bus space tag.  This is constant for all instances, so
53183840Sraj * we never have to explicitly "create" it.
54183840Sraj */
55183840Srajstatic struct bus_space _base_tag = {
56183840Sraj	/* cookie */
57183840Sraj	(void *) 0,
58183840Sraj
59183840Sraj	/* mapping/unmapping */
60183840Sraj	generic_bs_map,
61183840Sraj	generic_bs_unmap,
62183840Sraj	generic_bs_subregion,
63183840Sraj
64183840Sraj	/* allocation/deallocation */
65183840Sraj	generic_bs_alloc,
66183840Sraj	generic_bs_free,
67183840Sraj
68183840Sraj	/* barrier */
69183840Sraj	generic_bs_barrier,
70183840Sraj
71183840Sraj	/* read (single) */
72183840Sraj	generic_bs_r_1,
73183840Sraj	generic_armv4_bs_r_2,
74183840Sraj	generic_bs_r_4,
75183840Sraj	NULL,
76183840Sraj
77183840Sraj	/* read multiple */
78183840Sraj	generic_bs_rm_1,
79183840Sraj	generic_armv4_bs_rm_2,
80183840Sraj	generic_bs_rm_4,
81183840Sraj	NULL,
82183840Sraj
83183840Sraj	/* read region */
84183840Sraj	generic_bs_rr_1,
85183840Sraj	generic_armv4_bs_rr_2,
86183840Sraj	generic_bs_rr_4,
87183840Sraj	NULL,
88183840Sraj
89183840Sraj	/* write (single) */
90183840Sraj	generic_bs_w_1,
91183840Sraj	generic_armv4_bs_w_2,
92183840Sraj	generic_bs_w_4,
93183840Sraj	NULL,
94183840Sraj
95183840Sraj	/* write multiple */
96183840Sraj	generic_bs_wm_1,
97183840Sraj	generic_armv4_bs_wm_2,
98183840Sraj	generic_bs_wm_4,
99183840Sraj	NULL,
100183840Sraj
101183840Sraj	/* write region */
102183840Sraj	NULL,
103183840Sraj	NULL,
104183840Sraj	NULL,
105183840Sraj	NULL,
106183840Sraj
107183840Sraj	/* set multiple */
108183840Sraj	NULL,
109183840Sraj	NULL,
110183840Sraj	NULL,
111183840Sraj	NULL,
112183840Sraj
113183840Sraj	/* set region */
114183840Sraj	NULL,
115183840Sraj	NULL,
116183840Sraj	NULL,
117183840Sraj	NULL,
118183840Sraj
119183840Sraj	/* copy */
120183840Sraj	NULL,
121183840Sraj	NULL,
122183840Sraj	NULL,
123183840Sraj	NULL,
124183840Sraj
125183840Sraj	/* read stream (single) */
126183840Sraj	NULL,
127183840Sraj	NULL,
128183840Sraj	NULL,
129183840Sraj	NULL,
130183840Sraj
131183840Sraj	/* read multiple stream */
132183840Sraj	NULL,
133183840Sraj	generic_armv4_bs_rm_2,		/* bus_space_read_multi_stream_2 */
134183840Sraj	NULL,
135183840Sraj	NULL,
136183840Sraj
137183840Sraj	/* read region stream */
138183840Sraj	NULL,
139183840Sraj	NULL,
140183840Sraj	NULL,
141183840Sraj	NULL,
142183840Sraj
143183840Sraj	/* write stream (single) */
144183840Sraj	NULL,
145183840Sraj	NULL,
146183840Sraj	NULL,
147183840Sraj	NULL,
148183840Sraj
149183840Sraj	/* write multiple stream */
150183840Sraj	NULL,
151183840Sraj	generic_armv4_bs_wm_2,		/* bus_space_write_multi_stream_2 */
152183840Sraj	NULL,
153183840Sraj	NULL,
154183840Sraj
155183840Sraj	/* write region stream */
156183840Sraj	NULL,
157183840Sraj	NULL,
158183840Sraj	NULL,
159183840Sraj	NULL
160183840Sraj};
161183840Sraj
162209131Srajbus_space_tag_t fdtbus_bs_tag = &_base_tag;
163