1/* $NetBSD: octeon1p_iobus.c,v 1.6 2020/08/17 21:25:12 jmcneill 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.6 2020/08/17 21:25:12 jmcneill 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 .flags = IOBUS_DEV_FDT, 71 .nunits = RNM_NUNITS, 72 .units = iobus_units_octrnm 73}; 74 75/* ---- TWSI */ 76#include <mips/cavium/dev/octeon_twsireg.h> 77static const struct iobus_unit iobus_units_octtwsi[] = { 78 { 79 .addr = MIO_TWS_BASE_0 80 } 81}; 82 83static const struct iobus_dev iobus_dev_octtwsi = { 84 .name = "octtwsi", 85 .nunits = MIO_TWS_NUNITS, 86 .units = iobus_units_octtwsi 87}; 88 89/* ---- MPI/SPI */ 90#include <mips/cavium/dev/octeon_mpireg.h> 91static const struct iobus_unit iobus_units_octmpi[] = { 92 { 93 .addr = MPI_BASE 94 } 95}; 96 97static const struct iobus_dev iobus_dev_octmpi = { 98 .name = "octmpi", 99 .nunits = MPI_NUNITS, 100 .units = iobus_units_octmpi 101}; 102 103/* ---- SMI */ 104#include <mips/cavium/dev/octeon_smireg.h> 105static const struct iobus_unit iobus_units_octsmi[] = { 106 { 107 .addr = SMI_BASE 108 } 109}; 110 111static const struct iobus_dev iobus_dev_octsmi = { 112 .name = "octsmi", 113 .nunits = SMI_NUNITS, 114 .units = iobus_units_octsmi 115}; 116 117/* ---- PIP */ 118#include <mips/cavium/dev/octeon_pipreg.h> 119static const struct iobus_unit iobus_units_octpip[] = { 120 { 121 .addr = PIP_BASE 122 } 123}; 124 125static const struct iobus_dev iobus_dev_octpip = { 126 .name = "octpip", 127 .nunits = 1, 128 .units = iobus_units_octpip 129}; 130 131 132/* ---- USBN */ 133#include <mips/cavium/dev/octeon_usbnreg.h> 134static const struct iobus_unit iobus_units_octusbn[] = { 135 { 136 .addr = USBN_BASE 137 } 138}; 139 140static const struct iobus_dev iobus_dev_octusbn = { 141 .name = "dwctwo", 142 .nunits = USBN_NUNITS, 143 .units = iobus_units_octusbn 144}; 145 146/* ---- global */ 147 148const struct iobus_dev * const iobus_devs[] = { 149 &iobus_dev_octuart, 150 &iobus_dev_octrnm, 151 &iobus_dev_octtwsi, 152 &iobus_dev_octmpi, 153 &iobus_dev_octsmi, 154 &iobus_dev_octpip, 155 &iobus_dev_octusbn, 156}; 157 158const size_t iobus_ndevs = __arraycount(iobus_devs); 159