blob: b78bd016721844ae9de7fa776fa3289a67f08206 [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
6#include <common.h>
7#include <spl.h>
8#include <linux/io.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +09009
10#include "../init.h"
11#include "../sc-regs.h"
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090012
Masahiro Yamadaddb19002017-01-15 14:59:03 +090013void uniphier_pxs2_dram_clk_init(void)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090014{
15 u32 tmp;
16
17 /* deassert reset */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090018 tmp = readl(sc_base + SC_RSTCTRL4);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090019 tmp |= SC_RSTCTRL4_NRST_UMCSB | SC_RSTCTRL4_NRST_UMCA2 |
20 SC_RSTCTRL4_NRST_UMCA1 | SC_RSTCTRL4_NRST_UMCA0 |
21 SC_RSTCTRL4_NRST_UMC32 | SC_RSTCTRL4_NRST_UMC31 |
22 SC_RSTCTRL4_NRST_UMC30;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090023 writel(tmp, sc_base + SC_RSTCTRL4);
24 readl(sc_base + SC_RSTCTRL4); /* dummy read */
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090025
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090026 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090027 tmp = readl(sc_base + SC_CLKCTRL4);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090028 tmp |= SC_CLKCTRL4_CEN_UMCSB | SC_CLKCTRL4_CEN_UMC2 |
29 SC_CLKCTRL4_CEN_UMC1 | SC_CLKCTRL4_CEN_UMC0;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090030 writel(tmp, sc_base + SC_CLKCTRL4);
31 readl(sc_base + SC_CLKCTRL4); /* dummy read */
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090032}