1 /*
2  * Copyright (C) 2011-2015 Panasonic Corporation
3  * Copyright (C) 2015-2016 Socionext Inc.
4  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #include <linux/io.h>
10 
11 #include "../init.h"
12 #include "../sc-regs.h"
13 
14 void uniphier_ld4_clk_init(void)
15 {
16 	u32 tmp;
17 
18 	/* deassert reset */
19 	tmp = readl(SC_RSTCTRL);
20 #ifdef CONFIG_NAND_DENALI
21 	tmp |= SC_RSTCTRL_NRST_NAND;
22 #endif
23 	writel(tmp, SC_RSTCTRL);
24 	readl(SC_RSTCTRL); /* dummy read */
25 
26 	/* provide clocks */
27 	tmp = readl(SC_CLKCTRL);
28 #ifdef CONFIG_USB_EHCI_HCD
29 	tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
30 #endif
31 #ifdef CONFIG_NAND_DENALI
32 	tmp |= SC_CLKCTRL_CEN_NAND;
33 #endif
34 	writel(tmp, SC_CLKCTRL);
35 	readl(SC_CLKCTRL); /* dummy read */
36 }
37