blob: c41a8ead2eb6a166acc4bbb6374c32c02f0734ef [file] [log] [blame]
Masahiro Yamada28f40d42015-09-22 00:27:40 +09001/*
2 * Copyright (C) 2015 Masahiro Yamada <yamada.m@jp.panasonic.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <linux/io.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +09008
9#include "../init.h"
10#include "../sc-regs.h"
Masahiro Yamada28f40d42015-09-22 00:27:40 +090011
Masahiro Yamada5b660062016-03-30 20:17:02 +090012int uniphier_pro5_early_clk_init(const struct uniphier_board_data *bd)
Masahiro Yamada28f40d42015-09-22 00:27:40 +090013{
14 u32 tmp;
15
16 /*
17 * deassert reset
18 * UMCA2: Ch1 (DDR3)
19 * UMCA1, UMC31: Ch0 (WIO1)
20 * UMCA0, UMC30: Ch0 (WIO0)
21 */
22 tmp = readl(SC_RSTCTRL4);
23 tmp |= SC_RSTCTRL4_NRST_UMCSB | SC_RSTCTRL4_NRST_UMCA2 |
24 SC_RSTCTRL4_NRST_UMCA1 | SC_RSTCTRL4_NRST_UMCA0 |
25 SC_RSTCTRL4_NRST_UMC31 | SC_RSTCTRL4_NRST_UMC30;
26 writel(tmp, SC_RSTCTRL4);
27 readl(SC_RSTCTRL); /* dummy read */
28
Masahiro Yamada67976302016-03-30 20:17:42 +090029 /* provide clocks */
Masahiro Yamada28f40d42015-09-22 00:27:40 +090030 tmp = readl(SC_CLKCTRL);
31 tmp |= SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI;
32 writel(tmp, SC_CLKCTRL);
33 tmp = readl(SC_CLKCTRL4);
34 tmp |= SC_CLKCTRL4_CEN_UMCSB | SC_CLKCTRL4_CEN_UMC1 |
35 SC_CLKCTRL4_CEN_UMC0;
36 writel(tmp, SC_CLKCTRL4);
37 readl(SC_CLKCTRL4); /* dummy read */
38
39 return 0;
40}