blob: 75d3e70d6aad5a5b6bfeac336dbd34e1b04f701f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada1fe65d32015-09-22 00:27:41 +09002/*
Masahiro Yamadaddb19002017-01-15 14:59:03 +09003 * Copyright (C) 2016-2017 Socionext Inc.
Masahiro Yamada1fe65d32015-09-22 00:27:41 +09004 */
5
Masahiro Yamada1fe65d32015-09-22 00:27:41 +09006#include <spl.h>
7#include <linux/io.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +09008
9#include "../init.h"
10#include "../sc-regs.h"
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090011
Masahiro Yamadaddb19002017-01-15 14:59:03 +090012void uniphier_pxs2_dram_clk_init(void)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090013{
14 u32 tmp;
15
16 /* deassert reset */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090017 tmp = readl(sc_base + SC_RSTCTRL4);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090018 tmp |= SC_RSTCTRL4_NRST_UMCSB | SC_RSTCTRL4_NRST_UMCA2 |
19 SC_RSTCTRL4_NRST_UMCA1 | SC_RSTCTRL4_NRST_UMCA0 |
20 SC_RSTCTRL4_NRST_UMC32 | SC_RSTCTRL4_NRST_UMC31 |
21 SC_RSTCTRL4_NRST_UMC30;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090022 writel(tmp, sc_base + SC_RSTCTRL4);
23 readl(sc_base + SC_RSTCTRL4); /* dummy read */
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090024
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090025 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090026 tmp = readl(sc_base + SC_CLKCTRL4);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090027 tmp |= SC_CLKCTRL4_CEN_UMCSB | SC_CLKCTRL4_CEN_UMC2 |
28 SC_CLKCTRL4_CEN_UMC1 | SC_CLKCTRL4_CEN_UMC0;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090029 writel(tmp, sc_base + SC_CLKCTRL4);
30 readl(sc_base + SC_CLKCTRL4); /* dummy read */
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090031}