1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2022 Adrian Chadd <adrian@FreeBSD.org>. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <dt-bindings/net/qcom-qca807x.h> 29 30/ { 31 soc { 32 mdio: mdio@90000 { 33 #address-cells = <1>; 34 #size-cells = <0>; 35 compatible = "qcom,ipq4019-mdio"; 36 reg = <0x90000 0x64>; 37 status = "disabled"; 38 }; 39 40 ess-switch@c000000 { 41 compatible = "qcom,ess-switch"; 42 reg = <0xc000000 0x80000>; 43 resets = <&gcc ESS_RESET>; 44 reset-names = "ess_rst"; 45 clocks = <&gcc GCC_ESS_CLK>; 46 clock-names = "ess_clk"; 47 48 /* 49 * The port bitmap describing which ports are CPU 50 * facing. It's almost always going to be port 0 51 * (ie bit 0.) 52 */ 53 switch_cpu_bmp = <0x1>; 54 55 /* 56 * The port bitmap describing which ports are in 57 * the LAN group. This defaults to VLAN 1 in the 58 * switch driver. 59 */ 60 switch_lan_bmp = <0x1e>; 61 62 /* 63 * The port bitmap describing which ports are 64 * in the WAN group. This defaults to VLAN 2 65 * in the switch driver. 66 */ 67 switch_wan_bmp = <0x20>; 68 69 /* 70 * Which interface to use to talk to an external 71 * PHY. In this instance we default to 72 * PORT_WRAPPER_PSGMII as we're defaulting to 73 * a PSGMII (well, Qualcomm SGMII) facing a 5 74 * port Malibu PHY. 75 */ 76 switch_mac_mode = <0>; 77 status = "disabled"; 78 }; 79 80 ess-psgmii@98000 { 81 compatible = "qcom,ess-psgmii"; 82 reg = <0x98000 0x800>; 83 status = "disabled"; 84 }; 85 86 edma@c080000 { 87 compatible = "qcom,ess-edma"; 88 reg = <0xc080000 0x8000>; 89 90 /* 91 * This is a hold-over from the Qualcomm Linux driver 92 * and controls whether to allocate a full PAGE_SIZE 93 * page entry per RX buffer or not. 94 * 95 * For now it's parsed but ignored by FreeBSD. 96 */ 97 qcom,page-mode = <0>; 98 99 /* 100 * This sets the size of the RX head buffer. 101 * 102 * If qcom,page_mode is set to 1 then this is ignored. 103 * 104 * Again, this is currently parsed but ignored by 105 * FreeBSD. 106 */ 107 qcom,rx_head_buf_size = <1540>; 108 109 /* 110 * These two fields control whether the GMAC driver 111 * should be polling the MDIO bus to determine if 112 * a gmac interface should be considered link 113 * up or down. 114 * 115 * It currently isn't supported by FreeBSD. 116 */ 117 qcom,mdio_supported; 118 qcom,poll_required = <1>; 119 120 /* 121 * How many virtual ethernet interfaces to create. 122 * The interfaces are created based on a port bitmap 123 * and default VLAN ID. 124 * 125 * These would do well to map to the default lan/wan 126 * bit map fields in the ESS switch configuration 127 * above. 128 */ 129 qcom,num_gmac = <2>; 130 131 /* 132 * Support up to 16 TX and 16 RX interrupts. 133 * For now the hardware only uses 16 TX and 8 134 * RX interrupts/queues, but for some reason 135 * they're all allocated just in case. 136 */ 137 interrupts = <0 65 IRQ_TYPE_EDGE_RISING 138 0 66 IRQ_TYPE_EDGE_RISING 139 0 67 IRQ_TYPE_EDGE_RISING 140 0 68 IRQ_TYPE_EDGE_RISING 141 0 69 IRQ_TYPE_EDGE_RISING 142 0 70 IRQ_TYPE_EDGE_RISING 143 0 71 IRQ_TYPE_EDGE_RISING 144 0 72 IRQ_TYPE_EDGE_RISING 145 0 73 IRQ_TYPE_EDGE_RISING 146 0 74 IRQ_TYPE_EDGE_RISING 147 0 75 IRQ_TYPE_EDGE_RISING 148 0 76 IRQ_TYPE_EDGE_RISING 149 0 77 IRQ_TYPE_EDGE_RISING 150 0 78 IRQ_TYPE_EDGE_RISING 151 0 79 IRQ_TYPE_EDGE_RISING 152 0 80 IRQ_TYPE_EDGE_RISING 153 0 240 IRQ_TYPE_EDGE_RISING 154 0 241 IRQ_TYPE_EDGE_RISING 155 0 242 IRQ_TYPE_EDGE_RISING 156 0 243 IRQ_TYPE_EDGE_RISING 157 0 244 IRQ_TYPE_EDGE_RISING 158 0 245 IRQ_TYPE_EDGE_RISING 159 0 246 IRQ_TYPE_EDGE_RISING 160 0 247 IRQ_TYPE_EDGE_RISING 161 0 248 IRQ_TYPE_EDGE_RISING 162 0 249 IRQ_TYPE_EDGE_RISING 163 0 250 IRQ_TYPE_EDGE_RISING 164 0 251 IRQ_TYPE_EDGE_RISING 165 0 252 IRQ_TYPE_EDGE_RISING 166 0 253 IRQ_TYPE_EDGE_RISING 167 0 254 IRQ_TYPE_EDGE_RISING 168 0 255 IRQ_TYPE_EDGE_RISING>; 169 170 status = "disabled"; 171 172 /* 173 * This is the LAN gmac interface. 174 */ 175 gmac0: gmac0 { 176 /* 177 * Default to an all-zero MAC address for 178 * this interface. Ideally bootloaders will 179 * override this in a DTS overlay but that 180 * doesn't happen all that often. 181 * 182 * If the driver finds an all-zero MAC address 183 * and no platform hint / routine for fetching 184 * it from flash it will simply choose a 185 * random MAC address. 186 * 187 * Note this isn't programmed into the 188 * hardware! The ethernet switch filters what 189 * is visible to the ethernet MAC through 190 * normal ethernet switch MAC address learning 191 * rules. 192 */ 193 local-mac-address = [00 00 00 00 00 00]; 194 195 /* 196 * The VLAN tag and port map. Yes, they used 197 * the same entry for both fields. The first 198 * integer is the default VLAN ID, and second 199 * field is the port map. 200 * 201 * When 802.1q VLANs are not used the switch 202 * will simply use the portmap to limit which 203 * ports can transmit the frames. It's used 204 * for sending broadcast/multicast or flooded 205 * traffic. 206 * 207 * When 802.1q VLANs are used then it's both 208 * the portmap and the 802.1q tag port 209 * membership that define which ports can 210 * be flooded as above. 211 */ 212 vlan_tag = <1 0x1f>; 213 }; 214 215 /* 216 * This is the WAN gmac interface. 217 */ 218 gmac1: gmac1 { 219 local-mac-address = [00 00 00 00 00 00]; 220 221 /* 222 * Whether to poll the MDIO port / PHY for 223 * link status or not. 224 * 225 * This is how the interface would get a 226 * logical link status for WAN events to tie 227 * things like dhclient to. 228 * 229 * For now it's unsupported in FreeBSD. 230 */ 231 qcom,phy_mdio_addr = <4>; 232 qcom,poll_required = <1>; 233 234 vlan_tag = <2 0x20>; 235 }; 236 }; 237 }; 238}; 239