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