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