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_UNIPHIER_ETH
21 	tmp |= SC_RSTCTRL_NRST_ETHER;
22 #endif
23 #ifdef CONFIG_NAND_DENALI
24 	tmp |= SC_RSTCTRL_NRST_NAND;
25 #endif
26 	writel(tmp, SC_RSTCTRL);
27 	readl(SC_RSTCTRL); /* dummy read */
28 
29 	/* provide clocks */
30 	tmp = readl(SC_CLKCTRL);
31 #ifdef CONFIG_UNIPHIER_ETH
32 	tmp |= SC_CLKCTRL_CEN_ETHER;
33 #endif
34 #ifdef CONFIG_USB_EHCI_HCD
35 	tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
36 #endif
37 #ifdef CONFIG_NAND_DENALI
38 	tmp |= SC_CLKCTRL_CEN_NAND;
39 #endif
40 	writel(tmp, SC_CLKCTRL);
41 	readl(SC_CLKCTRL); /* dummy read */
42 }
43