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