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