Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Yanjie Jiang | 64dea2e | 2019-05-07 10:31:07 +0800 | [diff] [blame] | 2 | |
| 3 | #include <device/mmio.h> |
| 4 | #include <soc/addressmap.h> |
| 5 | #include <soc/infracfg.h> |
| 6 | #include <soc/pll.h> |
| 7 | #include <soc/md_ctrl.h> |
| 8 | |
| 9 | #define TOPCKGEN_CLK_MODE_MD_32K (1 << 8) |
| 10 | #define TOPCKGEN_CLK_MODE_MD_26M (1 << 9) |
| 11 | #define INFRA_MISC2_SRCCLKENA_RELEASE (0xFF) |
| 12 | |
| 13 | static void internal_md_power_down(void) |
| 14 | { |
| 15 | /* Gating MD clock */ |
Julius Werner | 55009af | 2019-12-02 22:03:27 -0800 | [diff] [blame] | 16 | setbits32(&mtk_topckgen->clk_mode, |
Yanjie Jiang | 64dea2e | 2019-05-07 10:31:07 +0800 | [diff] [blame] | 17 | TOPCKGEN_CLK_MODE_MD_32K | TOPCKGEN_CLK_MODE_MD_26M); |
| 18 | /* Release SRCCLKENA */ |
Julius Werner | 55009af | 2019-12-02 22:03:27 -0800 | [diff] [blame] | 19 | clrbits32(&mt8183_infracfg->infra_misc2, |
Yanjie Jiang | 64dea2e | 2019-05-07 10:31:07 +0800 | [diff] [blame] | 20 | INFRA_MISC2_SRCCLKENA_RELEASE); |
| 21 | } |
| 22 | |
| 23 | void mtk_md_early_init(void) |
| 24 | { |
| 25 | internal_md_power_down(); |
| 26 | } |