octeon1p_iobus.c revision 1.5
1/* $NetBSD: octeon1p_iobus.c,v 1.5 2020/06/23 05:18:02 simonb 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.5 2020/06/23 05:18:02 simonb 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#include <mips/cavium/dev/octeon_uartreg.h> 45static const struct iobus_unit iobus_units_octuart[] = { 46 { 47 .addr = MIO_UART0_BASE 48 }, 49 { 50 .addr = MIO_UART1_BASE 51 } 52}; 53 54static const struct iobus_dev iobus_dev_octuart = { 55 .name = "com", 56 .nunits = 2, 57 .units = iobus_units_octuart 58}; 59 60/* ---- RNM */ 61#include <mips/cavium/dev/octeon_rnmreg.h> 62static const struct iobus_unit iobus_units_octrnm[] = { 63 { 64 .addr = RNM_BASE 65 } 66}; 67 68static const struct iobus_dev iobus_dev_octrnm = { 69 .name = "octrnm", 70 .nunits = RNM_NUNITS, 71 .units = iobus_units_octrnm 72}; 73 74/* ---- TWSI */ 75#include <mips/cavium/dev/octeon_twsireg.h> 76static const struct iobus_unit iobus_units_octtwsi[] = { 77 { 78 .addr = MIO_TWS_BASE_0 79 } 80}; 81 82static const struct iobus_dev iobus_dev_octtwsi = { 83 .name = "octtwsi", 84 .nunits = MIO_TWS_NUNITS, 85 .units = iobus_units_octtwsi 86}; 87 88/* ---- MPI/SPI */ 89#include <mips/cavium/dev/octeon_mpireg.h> 90static const struct iobus_unit iobus_units_octmpi[] = { 91 { 92 .addr = MPI_BASE 93 } 94}; 95 96static const struct iobus_dev iobus_dev_octmpi = { 97 .name = "octmpi", 98 .nunits = MPI_NUNITS, 99 .units = iobus_units_octmpi 100}; 101 102/* ---- SMI */ 103#include <mips/cavium/dev/octeon_smireg.h> 104static const struct iobus_unit iobus_units_octsmi[] = { 105 { 106 .addr = SMI_BASE 107 } 108}; 109 110static const struct iobus_dev iobus_dev_octsmi = { 111 .name = "octsmi", 112 .nunits = SMI_NUNITS, 113 .units = iobus_units_octsmi 114}; 115 116/* ---- PIP */ 117#include <mips/cavium/dev/octeon_pipreg.h> 118static const struct iobus_unit iobus_units_octpip[] = { 119 { 120 .addr = PIP_BASE 121 } 122}; 123 124static const struct iobus_dev iobus_dev_octpip = { 125 .name = "octpip", 126 .nunits = 1, 127 .units = iobus_units_octpip 128}; 129 130 131/* ---- USBN */ 132#include <mips/cavium/dev/octeon_usbnreg.h> 133static const struct iobus_unit iobus_units_octusbn[] = { 134 { 135 .addr = USBN_BASE 136 } 137}; 138 139static const struct iobus_dev iobus_dev_octusbn = { 140 .name = "dwctwo", 141 .nunits = USBN_NUNITS, 142 .units = iobus_units_octusbn 143}; 144 145/* ---- global */ 146 147const struct iobus_dev * const iobus_devs[] = { 148 &iobus_dev_octuart, 149 &iobus_dev_octrnm, 150 &iobus_dev_octtwsi, 151 &iobus_dev_octmpi, 152 &iobus_dev_octsmi, 153 &iobus_dev_octpip, 154 &iobus_dev_octusbn, 155}; 156 157const size_t iobus_ndevs = __arraycount(iobus_devs); 158