blob: 5e072c6dff77bc3559b00d573cbac8a4bd66d77a [file] [log] [blame]
Masahiro Yamada682e09f2016-09-17 03:33:11 +09001/*
2 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Masahiro Yamada546197b2017-08-26 17:57:58 +09008#include <linux/delay.h>
Masahiro Yamada682e09f2016-09-17 03:33:11 +09009
10#include "../init.h"
11#include "../sc64-regs.h"
12#include "pll.h"
13
Masahiro Yamadaa55957b2017-08-26 17:57:59 +090014/* 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_SPLL2CTRL (SC_BASE_ADDR | 0x1420) /* DSP */
18#define SC_MPLLCTRL (SC_BASE_ADDR | 0x1430) /* Video codec */
19#define SC_VPPLLCTRL (SC_BASE_ADDR | 0x1440) /* VPE etc. */
20#define SC_GPPLLCTRL (SC_BASE_ADDR | 0x1450) /* GPU/Mali */
21#define SC_DPLL0CTRL (SC_BASE_ADDR | 0x1460) /* DDR memory 0 */
22#define SC_DPLL1CTRL (SC_BASE_ADDR | 0x1470) /* DDR memory 1 */
23#define SC_DPLL2CTRL (SC_BASE_ADDR | 0x1480) /* DDR memory 2 */
24
25/* PLL type: VPLL27 */
26#define SC_VPLL27FCTRL (SC_BASE_ADDR | 0x1500)
27#define SC_VPLL27ACTRL (SC_BASE_ADDR | 0x1520)
28
29/* PLL type: DSPLL */
30#define SC_VPLL8KCTRL (SC_BASE_ADDR | 0x1540)
31#define SC_A2PLLCTRL (SC_BASE_ADDR | 0x15C0)
32
Masahiro Yamadaa314a242017-01-15 14:59:02 +090033void uniphier_ld20_pll_init(void)
Masahiro Yamada682e09f2016-09-17 03:33:11 +090034{
Masahiro Yamada682e09f2016-09-17 03:33:11 +090035 uniphier_ld20_sscpll_init(SC_CPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 4);
36 /* do nothing for SPLL */
37 uniphier_ld20_sscpll_init(SC_SPLL2CTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 4);
38 uniphier_ld20_sscpll_init(SC_MPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 2);
39 uniphier_ld20_sscpll_init(SC_VPPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 4);
40 uniphier_ld20_sscpll_init(SC_GPPLLCTRL, UNIPHIER_PLL_FREQ_DEFAULT, 0, 2);
41
42 mdelay(1);
43
Masahiro Yamada29532622016-10-27 23:47:00 +090044 uniphier_ld20_sscpll_ssc_en(SC_CPLLCTRL);
45 uniphier_ld20_sscpll_ssc_en(SC_SPLL2CTRL);
46 uniphier_ld20_sscpll_ssc_en(SC_MPLLCTRL);
47 uniphier_ld20_sscpll_ssc_en(SC_VPPLLCTRL);
48 uniphier_ld20_sscpll_ssc_en(SC_GPPLLCTRL);
49 uniphier_ld20_sscpll_ssc_en(SC_DPLL0CTRL);
50 uniphier_ld20_sscpll_ssc_en(SC_DPLL1CTRL);
51 uniphier_ld20_sscpll_ssc_en(SC_DPLL2CTRL);
Masahiro Yamada682e09f2016-09-17 03:33:11 +090052
53 uniphier_ld20_vpll27_init(SC_VPLL27FCTRL);
54 uniphier_ld20_vpll27_init(SC_VPLL27ACTRL);
55
56 uniphier_ld20_dspll_init(SC_VPLL8KCTRL);
57 uniphier_ld20_dspll_init(SC_A2PLLCTRL);
Masahiro Yamada682e09f2016-09-17 03:33:11 +090058}