blob: 808d1ebfe19032a07ce48e41850f1646ead4978f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadad5167d52015-09-22 00:27:40 +09002/*
Masahiro Yamadaddb19002017-01-15 14:59:03 +09003 * Copyright (C) 2015-2017 Socionext Inc.
Masahiro Yamadad5167d52015-09-22 00:27:40 +09004 */
5
6#include <linux/io.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +09007
8#include "../init.h"
9#include "../sc-regs.h"
Masahiro Yamadad5167d52015-09-22 00:27:40 +090010
Masahiro Yamadaddb19002017-01-15 14:59:03 +090011void uniphier_pro5_dram_clk_init(void)
Masahiro Yamadad5167d52015-09-22 00:27:40 +090012{
13 u32 tmp;
14
15 /*
16 * deassert reset
17 * UMCA2: Ch1 (DDR3)
18 * UMCA1, UMC31: Ch0 (WIO1)
19 * UMCA0, UMC30: Ch0 (WIO0)
20 */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090021 tmp = readl(sc_base + SC_RSTCTRL4);
Masahiro Yamadad5167d52015-09-22 00:27:40 +090022 tmp |= SC_RSTCTRL4_NRST_UMCSB | SC_RSTCTRL4_NRST_UMCA2 |
23 SC_RSTCTRL4_NRST_UMCA1 | SC_RSTCTRL4_NRST_UMCA0 |
24 SC_RSTCTRL4_NRST_UMC31 | SC_RSTCTRL4_NRST_UMC30;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090025 writel(tmp, sc_base + SC_RSTCTRL4);
26 readl(sc_base + SC_RSTCTRL4); /* dummy read */
Masahiro Yamadad5167d52015-09-22 00:27:40 +090027
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090028 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090029 tmp = readl(sc_base + SC_CLKCTRL4);
Masahiro Yamadad5167d52015-09-22 00:27:40 +090030 tmp |= SC_CLKCTRL4_CEN_UMCSB | SC_CLKCTRL4_CEN_UMC1 |
31 SC_CLKCTRL4_CEN_UMC0;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090032 writel(tmp, sc_base + SC_CLKCTRL4);
33 readl(sc_base + SC_CLKCTRL4); /* dummy read */
Masahiro Yamadad5167d52015-09-22 00:27:40 +090034}