xref: /netbsd-src/sys/arch/mips/cavium/octeon1p_iobus.c (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: octeon1p_iobus.c,v 1.2 2015/05/01 07:23:47 hikaru Exp $	*/
2 
3 /*
4  * Copyright (c) 2007 Internet Initiative Japan, Inc.
5  * All rights reserved.
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 THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 /*
30  * Octeon I (CN30XX, CN31XX), Plus (CN50XX) I/O Bus devices
31  */
32 
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: octeon1p_iobus.c,v 1.2 2015/05/01 07:23:47 hikaru Exp $");
35 
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 
39 #include <sys/bus.h>
40 
41 #include <mips/cavium/include/iobusvar.h>
42 
43 /* ---- UART */
44 
45 #include <mips/cavium/dev/octeon_uartreg.h>
46 static const struct iobus_unit iobus_units_octeon_uart[] = {
47 	{
48 		.addr = MIO_UART0_BASE
49 	},
50 	{
51 		.addr = MIO_UART1_BASE
52 	}
53 };
54 
55 static const struct iobus_dev iobus_dev_octeon_uart = {
56 	.name = "com",
57 	.nunits = 2,
58 	.units = iobus_units_octeon_uart
59 };
60 
61 /* ---- RNM */
62 
63 #include <mips/cavium/dev/octeon_rnmreg.h>
64 static const struct iobus_unit iobus_units_octeon_rnm[] = {
65 	{
66 		.addr = RNM_BASE
67 	}
68 };
69 
70 static const struct iobus_dev iobus_dev_octeon_rnm = {
71 	.name = "octeon_rnm",
72 	.nunits = RNM_NUNITS,
73 	.units = iobus_units_octeon_rnm
74 };
75 
76 /* ---- TWSI */
77 
78 #include <mips/cavium/dev/octeon_twsireg.h>
79 static const struct iobus_unit iobus_units_octeon_twsi[] = {
80 	{
81 		.addr = MIO_TWS_BASE_0
82 	}
83 };
84 
85 static const struct iobus_dev iobus_dev_octeon_twsi = {
86 	.name = "octeon_twsi",
87 	.nunits = MIO_TWS_NUNITS,
88 	.units = iobus_units_octeon_twsi
89 };
90 
91 /* ---- MPI/SPI */
92 
93 #include <mips/cavium/dev/octeon_mpireg.h>
94 static const struct iobus_unit	iobus_units_octeon_mpi[] = {
95 	{
96 		.addr = MPI_BASE
97 	}
98 };
99 
100 static const struct iobus_dev iobus_dev_octeon_mpi = {
101 	.name = "octeon_mpi",
102 	.nunits = MPI_NUNITS,
103 	.units = iobus_units_octeon_mpi
104 };
105 /* ---- GMX */
106 
107 #include <mips/cavium/dev/octeon_gmxreg.h>
108 static const struct iobus_unit	iobus_units_octeon_gmx[] = {
109 	{
110 		.addr = GMX0_BASE_IF0
111 	}
112 };
113 
114 static const struct iobus_dev iobus_dev_octeon_gmx = {
115 	.name = "octeon_gmx",
116 	.nunits = GMX_IF_NUNITS,
117 	.units = iobus_units_octeon_gmx
118 };
119 
120 
121 /* ---- USBN */
122 #include <mips/cavium/dev/octeon_usbnreg.h>
123 static const struct iobus_unit	iobus_units_octeon_usbn[] = {
124 	{
125 		.addr = USBN_BASE
126 	}
127 };
128 
129 static const struct iobus_dev iobus_dev_octeon_usbn = {
130 	.name = "dwctwo",
131 	.nunits = USBN_NUNITS,
132 	.units = iobus_units_octeon_usbn
133 };
134 
135 /* ---- global */
136 
137 const struct iobus_dev * const iobus_devs[] = {
138 	&iobus_dev_octeon_uart,
139 	&iobus_dev_octeon_rnm,
140 	&iobus_dev_octeon_twsi,
141 	&iobus_dev_octeon_mpi,
142 	&iobus_dev_octeon_gmx,
143 	&iobus_dev_octeon_usbn,
144 };
145 
146 const size_t iobus_ndevs = __arraycount(iobus_devs);
147