blob: 04b3312a2a5a8a40be364084c7321ba20965de7f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadad11b0b72016-09-17 03:33:11 +09002/*
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadad11b0b72016-09-17 03:33:11 +09005 */
6
Masahiro Yamada00bfa7b2017-08-26 17:57:58 +09007#include <linux/delay.h>
Masahiro Yamadad11b0b72016-09-17 03:33:11 +09008
9#include "../init.h"
10#include "../sc64-regs.h"
11#include "pll.h"
12
Masahiro Yamada629965a2017-08-26 17:57:59 +090013/* PLL type: SSC */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090014#define SC_CPLLCTRL 0x1400 /* CPU/ARM */
15#define SC_SPLLCTRL 0x1410 /* misc */
16#define SC_SPLL2CTRL 0x1420 /* DSP */
17#define SC_MPLLCTRL 0x1430 /* Video codec */
18#define SC_VPPLLCTRL 0x1440 /* VPE etc. */
19#define SC_GPPLLCTRL 0x1450 /* GPU/Mali */
20#define SC_DPLL0CTRL 0x1460 /* DDR memory 0 */
21#define SC_DPLL1CTRL 0x1470 /* DDR memory 1 */
22#define SC_DPLL2CTRL 0x1480 /* DDR memory 2 */
Masahiro Yamada629965a2017-08-26 17:57:59 +090023
24/* PLL type: VPLL27 */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090025#define SC_VPLL27FCTRL 0x1500
26#define SC_VPLL27ACTRL 0x1520
Masahiro Yamada629965a2017-08-26 17:57:59 +090027
28/* PLL type: DSPLL */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090029#define SC_VPLL8KCTRL 0x1540
30#define SC_A2PLLCTRL 0x15C0
Masahiro Yamada629965a2017-08-26 17:57:59 +090031
Masahiro Yamada52b14bf2017-01-15 14:59:02 +090032void uniphier_ld20_pll_init(void)
Masahiro Yamadad11b0b72016-09-17 03:33:11 +090033{
Masahiro Yamadad11b0b72016-09-17 03:33:11 +090034 uniphier_ld20_sscpll_init(SC_CPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 4);
35 /* do nothing for SPLL */
36 uniphier_ld20_sscpll_init(SC_SPLL2CTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 4);
37 uniphier_ld20_sscpll_init(SC_MPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 2);
38 uniphier_ld20_sscpll_init(SC_VPPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 4);
39 uniphier_ld20_sscpll_init(SC_GPPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 2);
40
41 mdelay(1);
42
Masahiro Yamadacc9fca12016-10-27 23:47:00 +090043 uniphier_ld20_sscpll_ssc_en(SC_CPLLCTRL);
44 uniphier_ld20_sscpll_ssc_en(SC_SPLL2CTRL);
45 uniphier_ld20_sscpll_ssc_en(SC_MPLLCTRL);
46 uniphier_ld20_sscpll_ssc_en(SC_VPPLLCTRL);
47 uniphier_ld20_sscpll_ssc_en(SC_GPPLLCTRL);
48 uniphier_ld20_sscpll_ssc_en(SC_DPLL0CTRL);
49 uniphier_ld20_sscpll_ssc_en(SC_DPLL1CTRL);
50 uniphier_ld20_sscpll_ssc_en(SC_DPLL2CTRL);
Masahiro Yamadad11b0b72016-09-17 03:33:11 +090051
52 uniphier_ld20_vpll27_init(SC_VPLL27FCTRL);
53 uniphier_ld20_vpll27_init(SC_VPLL27ACTRL);
54
55 uniphier_ld20_dspll_init(SC_VPLL8KCTRL);
56 uniphier_ld20_dspll_init(SC_A2PLLCTRL);
Masahiro Yamadad11b0b72016-09-17 03:33:11 +090057}