1 /* $NetBSD: bcm2838_pcie.h,v 1.1 2021/03/08 13:49:01 mlelstv Exp $ */ 2 3 /*- 4 * Copyright (c) 2020 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Michael van Elst 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef _BCM2838_PCIE_H 33 #define _BCM2838_PCIE_H 34 35 /* Broadcom Settop Box PCIE Register Offsets. */ 36 #define PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1 0x0188 37 #define PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR1 __BITS(0,1) 38 #define PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2 __BITS(2,3) 39 #define PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR3 __BITS(4,5) 40 41 #define PCIE_RC_CFG_PRIV1_ID_VAL3 0x043c 42 #define PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE __BITS(0,23) 43 44 #define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc 45 #define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT __BITS(10,11) 46 47 #define PCIE_RC_DL_MDIO_ADDR 0x1100 48 #define PCIE_RC_DL_MDIO_WR_DATA 0x1104 49 #define PCIE_RC_DL_MDIO_RD_DATA 0x1108 50 #define PCIE_RC_DL_MDIO_DATA __BITS(0,30) 51 #define PCIE_RC_DL_MDIO_PORT __BITS(16,19) 52 #define PCIE_RC_DL_MDIO_REGAD __BITS(0,15) 53 #define PCIE_RC_DL_MDIO_CMD __BITS(20,31) 54 #define PCIE_RC_DL_MDIO_READ __BIT(0) 55 #define PCIE_RC_DL_MDIO_DATA_DONE __BIT(31) 56 57 58 #define PCIE_MISC_MISC_CTRL 0x4008 59 #define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN __BIT(12) 60 #define PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE __BIT(13) 61 #define PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE __BITS(20,21) 62 #define PCIE_MISC_MISC_CTRL_SCB0_SIZE __BITS(27,31) 63 #define PCIE_MISC_MISC_CTRL_SCB1_SIZE __BITS(22,26) 64 #define PCIE_MISC_MISC_CTRL_SCB2_SIZE __BITS(0,4) 65 66 #define PCIE_RC_CFG_PCIE_LINK_CAPABILITY 0x00b8 67 #define PCIE_RC_CFG_PCIE_LINK_CAPABILITY_MAX_LINK_SPEED __BITS(0,3) 68 #define PCIE_RC_CFG_PCIE_LINK_STATUS_CONTROL 0x00bc 69 #define PCIE_RC_CFG_PCIE_LINK_STATUS_CONTROL_NEG_LINK_WIDTH __BITS(24,29) 70 #define PCIE_RC_CFG_PCIE_LINK_STATUS_CONTROL_NEG_LINK_SPEED __BITS(16,19) 71 #define PCIE_RC_CFG_PCIE_ROOT_CAP_CONTROL 0x00c8 72 #define PCIE_RC_CFG_PCIE_ROOT_CAP_CONTROL_RC_CRS_EN __BITS(4,7) 73 #define PCIE_RC_CFG_PCIE_LINK_STATUS_CONTROL_2 0x00dc 74 #define PCIE_RC_CFG_PCIE_LINK_STATUS_CONTROL_2_TARGET_LINK_SPEED __BITS(0,3) 75 76 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO(w) (0x400c + (w) * 0x4) 77 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI(w) (0x4010 + (w) * 0x4) 78 79 #define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c 80 #define PCIE_MISC_RC_BARx_CONFIG_LO_MATCH_ADDRESS __BITS(12,31) 81 #define PCIE_MISC_RC_BARx_CONFIG_LO_SIZE __BITS(0,5) 82 #define PCIE_MISC_RC_BAR1_CONFIG_HI 0x4030 83 #define PCIE_MISC_RC_BAR2_CONFIG_LO 0x4034 84 #define PCIE_MISC_RC_BAR2_CONFIG_HI 0x4038 85 #define PCIE_MISC_RC_BAR3_CONFIG_LO 0x403c 86 #define PCIE_MISC_RC_BAR3_CONFIG_HI 0x4040 87 88 #define PCIE_MISC_PCIE_CTRL 0x4064 89 #define PCIE_MISC_PCIE_CTRL_PCIE_PERSTB __BIT(2) 90 #define PCIE_MISC_PCIE_CTRL_PCIE_L23_REQUEST __BIT(0) 91 92 #define PCIE_MISC_PCIE_STATUS 0x4068 93 #define PCIE_MISC_PCIE_STATUS_PCIE_PORT __BIT(7) 94 #define PCIE_MISC_PCIE_STATUS_PCIE_LINK_IN_L23 __BIT(6) 95 #define PCIE_MISC_PCIE_STATUS_PCIE_DL_ACTIVE __BIT(5) 96 #define PCIE_MISC_PCIE_STATUS_PCIE_PHYLINKUP __BIT(4) 97 98 #define PCIE_MISC_REVISION 0x406c 99 #define PCIE_MISC_REVISION_MAJMIN __BITS(0,15) 100 101 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT(w) (0x4070 + (w) * 0x4) 102 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT __BITS(20,31) 103 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_BASE __BITS(4,15) 104 105 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI(w) (0x4080 + (w) * 0x4) 106 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE __BITS(0,7) 107 108 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI(w) (0x4084 + (w) * 0x8) 109 #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT __BITS(0,7) 110 111 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 112 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ __BIT(1) 113 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ __BIT(27) 114 115 #define PCIE_INTR2_STATUS 0x4300 116 #define PCIE_INTR2_SET 0x4304 117 #define PCIE_INTR2_CLR 0x4308 118 #define PCIE_INTR2_MASK_STATUS 0x430c 119 #define PCIE_INTR2_MASK_SET 0x4310 120 #define PCIE_INTR2_MASK_CLR 0x4314 121 122 #define PCIE_MSI_INTR2_STATUS 0x4500 123 #define PCIE_MSI_INTR2_SET 0x4504 124 #define PCIE_MSI_INTR2_CLR 0x4508 125 #define PCIE_MSI_INTR2_MASK_STATUS 0x450c 126 #define PCIE_MSI_INTR2_MASK_SET 0x4510 127 #define PCIE_MSI_INTR2_MASK_CLR 0x4514 128 129 #define PCIE_EXT_CFG_DATA 0x8000 130 131 #define PCIE_EXT_CFG_INDEX 0x9000 132 #define PCIE_EXT_CFG_INDEX_BUSNUM __BITS(20,27) 133 #define PCIE_EXT_CFG_INDEX_SLOT __BITS(15,19) 134 #define PCIE_EXT_CFG_INDEX_FUNC __BITS(12,14) 135 136 #define PCIE_RGR1_SW_INIT_1 0x9210 137 #define PCIE_RGR1_SW_INIT_1_PERST __BIT(0) 138 #define PCIE_RGR1_SW_INIT_1_INIT __BIT(1) 139 140 #endif /* !_BCM2838_PCIE_H */ 141