|
| 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 | +&pinctrl { |
| 168 | + emmc_cfg: sdhci-emmc-cfg { |
| 169 | + sdhci-emmc-wp-pins { |
| 170 | + pinmux = <PINMUX(PIN_EMMC_WP, 0)>; |
| 171 | + bias-disable; |
| 172 | + drive-strength-microamp = <26800>; |
| 173 | + input-schmitt-disable; |
| 174 | + }; |
| 175 | + |
| 176 | + sdhci-emmc-cd-pins { |
| 177 | + pinmux = <PINMUX(PIN_EMMC_CD, 0)>; |
| 178 | + bias-pull-up; |
| 179 | + drive-strength-microamp = <26800>; |
| 180 | + input-schmitt-enable; |
| 181 | + }; |
| 182 | + |
| 183 | + sdhci-emmc-rst-pwr-pins { |
| 184 | + pinmux = <PINMUX(PIN_EMMC_RST, 0)>, |
| 185 | + <PINMUX(PIN_EMMC_PWR_EN, 0)>; |
| 186 | + bias-disable; |
| 187 | + drive-strength-microamp = <26800>; |
| 188 | + input-schmitt-disable; |
| 189 | + }; |
| 190 | + }; |
| 191 | + |
| 192 | + i2c1_cfg: i2c1-cfg { |
| 193 | + i2c1-pins { |
| 194 | + pinmux = <PINMUX(PIN_IIC1_SDA, 0)>, |
| 195 | + <PINMUX(PIN_IIC1_SCL, 0)>; |
| 196 | + bias-pull-up; |
| 197 | + drive-strength-microamp = <26800>; |
| 198 | + input-schmitt-enable; |
| 199 | + }; |
| 200 | + }; |
| 201 | + |
| 202 | + sd_cfg: sdhci-sd-cfg { |
| 203 | + sdhci-sd-cd-wp-pins { |
| 204 | + pinmux = <PINMUX(PIN_SDIO_CD, 0)>, |
| 205 | + <PINMUX(PIN_SDIO_WP, 0)>; |
| 206 | + bias-pull-up; |
| 207 | + drive-strength-microamp = <26800>; |
| 208 | + input-schmitt-enable; |
| 209 | + }; |
| 210 | + |
| 211 | + sdhci-sd-rst-pwr-pins { |
| 212 | + pinmux = <PINMUX(PIN_SDIO_RST, 0)>, |
| 213 | + <PINMUX(PIN_SDIO_PWR_EN, 0)>; |
| 214 | + bias-disable; |
| 215 | + drive-strength-microamp = <26800>; |
| 216 | + input-schmitt-disable; |
| 217 | + }; |
| 218 | + }; |
| 219 | + |
| 220 | + uart0_cfg: uart0-cfg { |
| 221 | + uart0-rx-pins { |
| 222 | + pinmux = <PINMUX(PIN_UART0_TX, 0)>, |
| 223 | + <PINMUX(PIN_UART0_RX, 0)>; |
| 224 | + bias-pull-up; |
| 225 | + drive-strength-microamp = <26800>; |
| 226 | + input-schmitt-enable; |
| 227 | + }; |
| 228 | + }; |
| 229 | +}; |
| 230 | + |
| 231 | +&sd { |
| 232 | + pinctrl-0 = <&sd_cfg>; |
| 233 | + pinctrl-names = "default"; |
| 234 | + bus-width = <4>; |
| 235 | + no-sdio; |
| 236 | + no-mmc; |
| 237 | + wp-inverted; |
| 238 | + status = "okay"; |
| 239 | +}; |
| 240 | + |
| 241 | +&uart0 { |
| 242 | + pinctrl-0 = <&uart0_cfg>; |
| 243 | + pinctrl-names = "default"; |
| 244 | + status = "okay"; |
| 245 | +}; |
0 commit comments