1 /*
2  * Copyright (C) 2011-2014 Panasonic Corporation
3  * Copyright (C) 2015-2017 Socionext Inc.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <spl.h>
10 #include <linux/io.h>
11 
12 #include "../init.h"
13 #include "../sc-regs.h"
14 
15 void uniphier_ld4_early_clk_init(void)
16 {
17 	u32 tmp;
18 
19 	/* deassert reset */
20 	if (spl_boot_device() != BOOT_DEVICE_NAND) {
21 		tmp = readl(SC_RSTCTRL);
22 		tmp &= ~SC_RSTCTRL_NRST_NAND;
23 		writel(tmp, SC_RSTCTRL);
24 	};
25 
26 	/* provide clocks */
27 	tmp = readl(SC_CLKCTRL);
28 	tmp |= SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI;
29 	writel(tmp, SC_CLKCTRL);
30 	readl(SC_CLKCTRL); /* dummy read */
31 }
32