| 1 |
// SPDX-License-Identifier: GPL-2.0 OR MIT |
| 2 |
/* |
| 3 |
* Copyright (C) 2025 Sophgo Technology Inc. All rights reserved. |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "sg2042.dtsi" |
| 7 |
|
| 8 |
#include <dt-bindings/gpio/gpio.h> |
| 9 |
#include <dt-bindings/input/input.h> |
| 10 |
|
| 11 |
/ { |
| 12 |
model = "Sophgo SG2042 EVB V1.X"; |
| 13 |
compatible = "sophgo,sg2042-evb-v1", "sophgo,sg2042"; |
| 14 |
|
| 15 |
chosen { |
| 16 |
stdout-path = "serial0"; |
| 17 |
}; |
| 18 |
|
| 19 |
gpio-power { |
| 20 |
compatible = "gpio-keys"; |
| 21 |
|
| 22 |
key-power { |
| 23 |
label = "Power Key"; |
| 24 |
linux,code = <KEY_POWER>; |
| 25 |
gpios = <&port0a 22 GPIO_ACTIVE_HIGH>; |
| 26 |
linux,input-type = <EV_KEY>; |
| 27 |
debounce-interval = <100>; |
| 28 |
}; |
| 29 |
}; |
| 30 |
|
| 31 |
pwmfan: pwm-fan { |
| 32 |
compatible = "pwm-fan"; |
| 33 |
cooling-levels = <103 128 179 230 255>; |
| 34 |
pwms = <&pwm 0 40000 0>; |
| 35 |
#cooling-cells = <2>; |
| 36 |
}; |
| 37 |
|
| 38 |
thermal-zones { |
| 39 |
soc-thermal { |
| 40 |
polling-delay-passive = <1000>; |
| 41 |
polling-delay = <1000>; |
| 42 |
thermal-sensors = <&mcu 0>; |
| 43 |
|
| 44 |
trips { |
| 45 |
soc_active1: soc-active1 { |
| 46 |
temperature = <30000>; |
| 47 |
hysteresis = <8000>; |
| 48 |
type = "active"; |
| 49 |
}; |
| 50 |
|
| 51 |
soc_active2: soc-active2 { |
| 52 |
temperature = <58000>; |
| 53 |
hysteresis = <12000>; |
| 54 |
type = "active"; |
| 55 |
}; |
| 56 |
|
| 57 |
soc_active3: soc-active3 { |
| 58 |
temperature = <70000>; |
| 59 |
hysteresis = <10000>; |
| 60 |
type = "active"; |
| 61 |
}; |
| 62 |
|
| 63 |
soc_hot: soc-hot { |
| 64 |
temperature = <80000>; |
| 65 |
hysteresis = <5000>; |
| 66 |
type = "hot"; |
| 67 |
}; |
| 68 |
}; |
| 69 |
|
| 70 |
cooling-maps { |
| 71 |
map0 { |
| 72 |
trip = <&soc_active1>; |
| 73 |
cooling-device = <&pwmfan 0 1>; |
| 74 |
}; |
| 75 |
|
| 76 |
map1 { |
| 77 |
trip = <&soc_active2>; |
| 78 |
cooling-device = <&pwmfan 1 2>; |
| 79 |
}; |
| 80 |
|
| 81 |
map2 { |
| 82 |
trip = <&soc_active3>; |
| 83 |
cooling-device = <&pwmfan 2 3>; |
| 84 |
}; |
| 85 |
|
| 86 |
map3 { |
| 87 |
trip = <&soc_hot>; |
| 88 |
cooling-device = <&pwmfan 3 4>; |
| 89 |
}; |
| 90 |
}; |
| 91 |
}; |
| 92 |
|
| 93 |
board-thermal { |
| 94 |
polling-delay-passive = <1000>; |
| 95 |
polling-delay = <1000>; |
| 96 |
thermal-sensors = <&mcu 1>; |
| 97 |
|
| 98 |
trips { |
| 99 |
board_active: board-active { |
| 100 |
temperature = <75000>; |
| 101 |
hysteresis = <8000>; |
| 102 |
type = "active"; |
| 103 |
}; |
| 104 |
}; |
| 105 |
|
| 106 |
cooling-maps { |
| 107 |
map4 { |
| 108 |
trip = <&board_active>; |
| 109 |
cooling-device = <&pwmfan 3 4>; |
| 110 |
}; |
| 111 |
}; |
| 112 |
}; |
| 113 |
}; |
| 114 |
}; |
| 115 |
|
| 116 |
&cgi_main { |
| 117 |
clock-frequency = <25000000>; |
| 118 |
}; |
| 119 |
|
| 120 |
&cgi_dpll0 { |
| 121 |
clock-frequency = <25000000>; |
| 122 |
}; |
| 123 |
|
| 124 |
&cgi_dpll1 { |
| 125 |
clock-frequency = <25000000>; |
| 126 |
}; |
| 127 |
|
| 128 |
&emmc { |
| 129 |
pinctrl-0 = <&emmc_cfg>; |
| 130 |
pinctrl-names = "default"; |
| 131 |
bus-width = <4>; |
| 132 |
no-sdio; |
| 133 |
no-sd; |
| 134 |
non-removable; |
| 135 |
wp-inverted; |
| 136 |
status = "okay"; |
| 137 |
}; |
| 138 |
|
| 139 |
&i2c1 { |
| 140 |
pinctrl-0 = <&i2c1_cfg>; |
| 141 |
pinctrl-names = "default"; |
| 142 |
status = "okay"; |
| 143 |
|
| 144 |
mcu: syscon@17 { |
| 145 |
compatible = "sophgo,sg2042-hwmon-mcu"; |
| 146 |
reg = <0x17>; |
| 147 |
#thermal-sensor-cells = <1>; |
| 148 |
}; |
| 149 |
}; |
| 150 |
|
| 151 |
&gmac0 { |
| 152 |
phy-handle = <&phy0>; |
| 153 |
phy-mode = "rgmii-id"; |
| 154 |
status = "okay"; |
| 155 |
|
| 156 |
mdio { |
| 157 |
phy0: phy@0 { |
| 158 |
compatible = "ethernet-phy-ieee802.3-c22"; |
| 159 |
reg = <0>; |
| 160 |
reset-gpios = <&port0a 27 GPIO_ACTIVE_LOW>; |
| 161 |
reset-assert-us = <100000>; |
| 162 |
reset-deassert-us = <100000>; |
| 163 |
}; |
| 164 |
}; |
| 165 |
}; |
| 166 |
|
| 167 |
&pcie_rc0 { |
| 168 |
status = "okay"; |
| 169 |
}; |
| 170 |
|
| 171 |
&pcie_rc1 { |
| 172 |
status = "okay"; |
| 173 |
}; |
| 174 |
|
| 175 |
&pcie_rc2 { |
| 176 |
status = "okay"; |
| 177 |
}; |
| 178 |
|
| 179 |
&pinctrl { |
| 180 |
emmc_cfg: sdhci-emmc-cfg { |
| 181 |
sdhci-emmc-wp-pins { |
| 182 |
pinmux = <PINMUX(PIN_EMMC_WP, 0)>; |
| 183 |
bias-disable; |
| 184 |
drive-strength-microamp = <26800>; |
| 185 |
input-schmitt-disable; |
| 186 |
}; |
| 187 |
|
| 188 |
sdhci-emmc-cd-pins { |
| 189 |
pinmux = <PINMUX(PIN_EMMC_CD, 0)>; |
| 190 |
bias-pull-up; |
| 191 |
drive-strength-microamp = <26800>; |
| 192 |
input-schmitt-enable; |
| 193 |
}; |
| 194 |
|
| 195 |
sdhci-emmc-rst-pwr-pins { |
| 196 |
pinmux = <PINMUX(PIN_EMMC_RST, 0)>, |
| 197 |
<PINMUX(PIN_EMMC_PWR_EN, 0)>; |
| 198 |
bias-disable; |
| 199 |
drive-strength-microamp = <26800>; |
| 200 |
input-schmitt-disable; |
| 201 |
}; |
| 202 |
}; |
| 203 |
|
| 204 |
i2c1_cfg: i2c1-cfg { |
| 205 |
i2c1-pins { |
| 206 |
pinmux = <PINMUX(PIN_IIC1_SDA, 0)>, |
| 207 |
<PINMUX(PIN_IIC1_SCL, 0)>; |
| 208 |
bias-pull-up; |
| 209 |
drive-strength-microamp = <26800>; |
| 210 |
input-schmitt-enable; |
| 211 |
}; |
| 212 |
}; |
| 213 |
|
| 214 |
sd_cfg: sdhci-sd-cfg { |
| 215 |
sdhci-sd-cd-wp-pins { |
| 216 |
pinmux = <PINMUX(PIN_SDIO_CD, 0)>, |
| 217 |
<PINMUX(PIN_SDIO_WP, 0)>; |
| 218 |
bias-pull-up; |
| 219 |
drive-strength-microamp = <26800>; |
| 220 |
input-schmitt-enable; |
| 221 |
}; |
| 222 |
|
| 223 |
sdhci-sd-rst-pwr-pins { |
| 224 |
pinmux = <PINMUX(PIN_SDIO_RST, 0)>, |
| 225 |
<PINMUX(PIN_SDIO_PWR_EN, 0)>; |
| 226 |
bias-disable; |
| 227 |
drive-strength-microamp = <26800>; |
| 228 |
input-schmitt-disable; |
| 229 |
}; |
| 230 |
}; |
| 231 |
|
| 232 |
uart0_cfg: uart0-cfg { |
| 233 |
uart0-rx-pins { |
| 234 |
pinmux = <PINMUX(PIN_UART0_TX, 0)>, |
| 235 |
<PINMUX(PIN_UART0_RX, 0)>; |
| 236 |
bias-pull-up; |
| 237 |
drive-strength-microamp = <26800>; |
| 238 |
input-schmitt-enable; |
| 239 |
}; |
| 240 |
}; |
| 241 |
}; |
| 242 |
|
| 243 |
&sd { |
| 244 |
pinctrl-0 = <&sd_cfg>; |
| 245 |
pinctrl-names = "default"; |
| 246 |
bus-width = <4>; |
| 247 |
no-sdio; |
| 248 |
no-mmc; |
| 249 |
wp-inverted; |
| 250 |
status = "okay"; |
| 251 |
}; |
| 252 |
|
| 253 |
&spifmc0 { |
| 254 |
status = "okay"; |
| 255 |
|
| 256 |
flash@0 { |
| 257 |
compatible = "jedec,spi-nor"; |
| 258 |
reg = <0>; |
| 259 |
spi-max-frequency = <50000000>; |
| 260 |
spi-tx-bus-width = <1>; |
| 261 |
spi-rx-bus-width = <1>; |
| 262 |
}; |
| 263 |
}; |
| 264 |
|
| 265 |
&spifmc1 { |
| 266 |
status = "okay"; |
| 267 |
|
| 268 |
flash@0 { |
| 269 |
compatible = "jedec,spi-nor"; |
| 270 |
reg = <0>; |
| 271 |
spi-max-frequency = <50000000>; |
| 272 |
spi-tx-bus-width = <1>; |
| 273 |
spi-rx-bus-width = <1>; |
| 274 |
}; |
| 275 |
}; |
| 276 |
|
| 277 |
&uart0 { |
| 278 |
pinctrl-0 = <&uart0_cfg>; |
| 279 |
pinctrl-names = "default"; |
| 280 |
status = "okay"; |
| 281 |
}; |