Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Socionext Inc. |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 4 | */ |
| 5 | |
Masahiro Yamada | 00bfa7b | 2017-08-26 17:57:58 +0900 | [diff] [blame] | 6 | #include <linux/delay.h> |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 7 | #include <linux/io.h> |
| 8 | |
| 9 | #include "../init.h" |
| 10 | #include "../sc64-regs.h" |
| 11 | #include "pll.h" |
| 12 | |
Masahiro Yamada | 629965a | 2017-08-26 17:57:59 +0900 | [diff] [blame] | 13 | /* PLL type: SSC */ |
Masahiro Yamada | c84024c | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 14 | #define SC_CPLLCTRL 0x1400 /* CPU/ARM */ |
| 15 | #define SC_SPLLCTRL 0x1410 /* misc */ |
| 16 | #define SC_MPLLCTRL 0x1430 /* DSP */ |
| 17 | #define SC_VSPLLCTRL 0x1440 /* Video codec, VPE etc. */ |
| 18 | #define SC_DPLLCTRL 0x1460 /* DDR memory */ |
Masahiro Yamada | 629965a | 2017-08-26 17:57:59 +0900 | [diff] [blame] | 19 | |
| 20 | /* PLL type: VPLL27 */ |
Masahiro Yamada | c84024c | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 21 | #define SC_VPLL27FCTRL 0x1500 |
| 22 | #define SC_VPLL27ACTRL 0x1520 |
Masahiro Yamada | 629965a | 2017-08-26 17:57:59 +0900 | [diff] [blame] | 23 | |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 24 | void uniphier_ld11_pll_init(void) |
| 25 | { |
| 26 | uniphier_ld20_sscpll_init(SC_CPLLCTRL, 1960, 1, 2); /* 2000MHz -> 1960MHz */ |
| 27 | /* do nothing for SPLL */ |
| 28 | uniphier_ld20_sscpll_init(SC_MPLLCTRL, 1600, 1, 2); /* 1500MHz -> 1600MHz */ |
| 29 | uniphier_ld20_sscpll_init(SC_VSPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 2); |
| 30 | |
Masahiro Yamada | f366d38 | 2017-02-21 23:00:35 +0900 | [diff] [blame] | 31 | uniphier_ld20_sscpll_set_regi(SC_MPLLCTRL, 5); |
| 32 | |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 33 | mdelay(1); |
| 34 | |
| 35 | uniphier_ld20_sscpll_ssc_en(SC_CPLLCTRL); |
| 36 | uniphier_ld20_sscpll_ssc_en(SC_MPLLCTRL); |
| 37 | uniphier_ld20_sscpll_ssc_en(SC_VSPLLCTRL); |
Masahiro Yamada | 0335cce | 2016-10-08 13:25:23 +0900 | [diff] [blame] | 38 | uniphier_ld20_sscpll_ssc_en(SC_DPLLCTRL); |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 39 | |
| 40 | uniphier_ld20_vpll27_init(SC_VPLL27FCTRL); |
| 41 | uniphier_ld20_vpll27_init(SC_VPLL27ACTRL); |
| 42 | |
Masahiro Yamada | c84024c | 2019-07-10 20:07:41 +0900 | [diff] [blame] | 43 | writel(0, sc_base + SC_CA53_GEARSET); /* Gear0: CPLL/2 */ |
| 44 | writel(SC_CA_GEARUPD, sc_base + SC_CA53_GEARUPD); |
Masahiro Yamada | 090785d | 2016-09-22 07:42:19 +0900 | [diff] [blame] | 45 | } |