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