1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2013-2014 Panasonic Corporation
4 * Copyright (C) 2015-2016 Socionext Inc.
7 #include <linux/delay.h>
8 #include <linux/errno.h>
12 #include "../sc-regs.h"
14 #undef DPLL_SSC_RATE_1PER
16 int uniphier_pro4_dpll_init(const struct uniphier_board_data *bd)
18 unsigned int dram_freq = bd->dram_freq;
23 * Set 0xc(1600MHz)/0xd(1333MHz)/0xe(1066MHz)
24 * to FOUT ( DPLLCTRL.bit[29:20] )
26 tmp = readl(sc_base + SC_DPLLCTRL);
36 pr_err("Unsupported frequency");
42 * Set 0x0(1%)/0x1(2%) to SSC_RATE(DPLLCTRL.bit[15])
44 #if defined(DPLL_SSC_RATE_1PER)
49 writel(tmp, sc_base + SC_DPLLCTRL);
51 tmp = readl(sc_base + SC_DPLLCTRL2);
52 tmp |= SC_DPLLCTRL2_NRSTDS;
53 writel(tmp, sc_base + SC_DPLLCTRL2);
55 /* Wait until dpll gets stable */