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