|
15 | 15 | #include <linux/regmap.h>
|
16 | 16 | #include <dt-bindings/reset/imx7-reset.h>
|
17 | 17 | #include <dt-bindings/reset/imx8mq-reset.h>
|
| 18 | +#include <dt-bindings/reset/imx8mp-reset.h> |
18 | 19 |
|
19 | 20 | struct imx7_src_signal {
|
20 | 21 | unsigned int offset, bit;
|
@@ -145,6 +146,18 @@ enum imx8mq_src_registers {
|
145 | 146 | SRC_DDRC2_RCR = 0x1004,
|
146 | 147 | };
|
147 | 148 |
|
| 149 | +enum imx8mp_src_registers { |
| 150 | + SRC_SUPERMIX_RCR = 0x0018, |
| 151 | + SRC_AUDIOMIX_RCR = 0x001c, |
| 152 | + SRC_MLMIX_RCR = 0x0028, |
| 153 | + SRC_GPU2D_RCR = 0x0038, |
| 154 | + SRC_GPU3D_RCR = 0x003c, |
| 155 | + SRC_VPU_G1_RCR = 0x0048, |
| 156 | + SRC_VPU_G2_RCR = 0x004c, |
| 157 | + SRC_VPUVC8KE_RCR = 0x0050, |
| 158 | + SRC_NOC_RCR = 0x0054, |
| 159 | +}; |
| 160 | + |
148 | 161 | static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = {
|
149 | 162 | [IMX8MQ_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) },
|
150 | 163 | [IMX8MQ_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) },
|
@@ -253,6 +266,93 @@ static const struct imx7_src_variant variant_imx8mq = {
|
253 | 266 | },
|
254 | 267 | };
|
255 | 268 |
|
| 269 | +static const struct imx7_src_signal imx8mp_src_signals[IMX8MP_RESET_NUM] = { |
| 270 | + [IMX8MP_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) }, |
| 271 | + [IMX8MP_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) }, |
| 272 | + [IMX8MP_RESET_A53_CORE_POR_RESET2] = { SRC_A53RCR0, BIT(2) }, |
| 273 | + [IMX8MP_RESET_A53_CORE_POR_RESET3] = { SRC_A53RCR0, BIT(3) }, |
| 274 | + [IMX8MP_RESET_A53_CORE_RESET0] = { SRC_A53RCR0, BIT(4) }, |
| 275 | + [IMX8MP_RESET_A53_CORE_RESET1] = { SRC_A53RCR0, BIT(5) }, |
| 276 | + [IMX8MP_RESET_A53_CORE_RESET2] = { SRC_A53RCR0, BIT(6) }, |
| 277 | + [IMX8MP_RESET_A53_CORE_RESET3] = { SRC_A53RCR0, BIT(7) }, |
| 278 | + [IMX8MP_RESET_A53_DBG_RESET0] = { SRC_A53RCR0, BIT(8) }, |
| 279 | + [IMX8MP_RESET_A53_DBG_RESET1] = { SRC_A53RCR0, BIT(9) }, |
| 280 | + [IMX8MP_RESET_A53_DBG_RESET2] = { SRC_A53RCR0, BIT(10) }, |
| 281 | + [IMX8MP_RESET_A53_DBG_RESET3] = { SRC_A53RCR0, BIT(11) }, |
| 282 | + [IMX8MP_RESET_A53_ETM_RESET0] = { SRC_A53RCR0, BIT(12) }, |
| 283 | + [IMX8MP_RESET_A53_ETM_RESET1] = { SRC_A53RCR0, BIT(13) }, |
| 284 | + [IMX8MP_RESET_A53_ETM_RESET2] = { SRC_A53RCR0, BIT(14) }, |
| 285 | + [IMX8MP_RESET_A53_ETM_RESET3] = { SRC_A53RCR0, BIT(15) }, |
| 286 | + [IMX8MP_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) }, |
| 287 | + [IMX8MP_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) }, |
| 288 | + [IMX8MP_RESET_SW_NON_SCLR_M7C_RST] = { SRC_M4RCR, BIT(0) }, |
| 289 | + [IMX8MP_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) }, |
| 290 | + [IMX8MP_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) }, |
| 291 | + [IMX8MP_RESET_SUPERMIX_RESET] = { SRC_SUPERMIX_RCR, BIT(0) }, |
| 292 | + [IMX8MP_RESET_AUDIOMIX_RESET] = { SRC_AUDIOMIX_RCR, BIT(0) }, |
| 293 | + [IMX8MP_RESET_MLMIX_RESET] = { SRC_MLMIX_RCR, BIT(0) }, |
| 294 | + [IMX8MP_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, BIT(2) }, |
| 295 | + [IMX8MP_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) }, |
| 296 | + [IMX8MP_RESET_PCIE_CTRL_APPS_EN] = { SRC_PCIEPHY_RCR, BIT(6) }, |
| 297 | + [IMX8MP_RESET_PCIE_CTRL_APPS_TURNOFF] = { SRC_PCIEPHY_RCR, BIT(11) }, |
| 298 | + [IMX8MP_RESET_HDMI_PHY_APB_RESET] = { SRC_HDMI_RCR, BIT(0) }, |
| 299 | + [IMX8MP_RESET_MEDIA_RESET] = { SRC_DISP_RCR, BIT(0) }, |
| 300 | + [IMX8MP_RESET_GPU2D_RESET] = { SRC_GPU2D_RCR, BIT(0) }, |
| 301 | + [IMX8MP_RESET_GPU3D_RESET] = { SRC_GPU3D_RCR, BIT(0) }, |
| 302 | + [IMX8MP_RESET_GPU_RESET] = { SRC_GPU_RCR, BIT(0) }, |
| 303 | + [IMX8MP_RESET_VPU_RESET] = { SRC_VPU_RCR, BIT(0) }, |
| 304 | + [IMX8MP_RESET_VPU_G1_RESET] = { SRC_VPU_G1_RCR, BIT(0) }, |
| 305 | + [IMX8MP_RESET_VPU_G2_RESET] = { SRC_VPU_G2_RCR, BIT(0) }, |
| 306 | + [IMX8MP_RESET_VPUVC8KE_RESET] = { SRC_VPUVC8KE_RCR, BIT(0) }, |
| 307 | + [IMX8MP_RESET_NOC_RESET] = { SRC_NOC_RCR, BIT(0) }, |
| 308 | +}; |
| 309 | + |
| 310 | +static int imx8mp_reset_set(struct reset_controller_dev *rcdev, |
| 311 | + unsigned long id, bool assert) |
| 312 | +{ |
| 313 | + struct imx7_src *imx7src = to_imx7_src(rcdev); |
| 314 | + const unsigned int bit = imx7src->signals[id].bit; |
| 315 | + unsigned int value = assert ? bit : 0; |
| 316 | + |
| 317 | + switch (id) { |
| 318 | + case IMX8MP_RESET_PCIEPHY: |
| 319 | + /* |
| 320 | + * wait for more than 10us to release phy g_rst and |
| 321 | + * btnrst |
| 322 | + */ |
| 323 | + if (!assert) |
| 324 | + udelay(10); |
| 325 | + break; |
| 326 | + |
| 327 | + case IMX8MP_RESET_PCIE_CTRL_APPS_EN: |
| 328 | + value = assert ? 0 : bit; |
| 329 | + break; |
| 330 | + } |
| 331 | + |
| 332 | + return imx7_reset_update(imx7src, id, value); |
| 333 | +} |
| 334 | + |
| 335 | +static int imx8mp_reset_assert(struct reset_controller_dev *rcdev, |
| 336 | + unsigned long id) |
| 337 | +{ |
| 338 | + return imx8mp_reset_set(rcdev, id, true); |
| 339 | +} |
| 340 | + |
| 341 | +static int imx8mp_reset_deassert(struct reset_controller_dev *rcdev, |
| 342 | + unsigned long id) |
| 343 | +{ |
| 344 | + return imx8mp_reset_set(rcdev, id, false); |
| 345 | +} |
| 346 | + |
| 347 | +static const struct imx7_src_variant variant_imx8mp = { |
| 348 | + .signals = imx8mp_src_signals, |
| 349 | + .signals_num = ARRAY_SIZE(imx8mp_src_signals), |
| 350 | + .ops = { |
| 351 | + .assert = imx8mp_reset_assert, |
| 352 | + .deassert = imx8mp_reset_deassert, |
| 353 | + }, |
| 354 | +}; |
| 355 | + |
256 | 356 | static int imx7_reset_probe(struct platform_device *pdev)
|
257 | 357 | {
|
258 | 358 | struct imx7_src *imx7src;
|
@@ -283,6 +383,7 @@ static int imx7_reset_probe(struct platform_device *pdev)
|
283 | 383 | static const struct of_device_id imx7_reset_dt_ids[] = {
|
284 | 384 | { .compatible = "fsl,imx7d-src", .data = &variant_imx7 },
|
285 | 385 | { .compatible = "fsl,imx8mq-src", .data = &variant_imx8mq },
|
| 386 | + { .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp }, |
286 | 387 | { /* sentinel */ },
|
287 | 388 | };
|
288 | 389 |
|
|
0 commit comments