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_pro4_clk_init(void)
15 {
16 	u32 tmp;
17 
18 	/* deassert reset */
19 	tmp = readl(SC_RSTCTRL);
20 #ifdef CONFIG_USB_DWC3_UNIPHIER
21 	tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
22 		SC_RSTCTRL_NRST_GIO;
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 #ifdef CONFIG_USB_DWC3_UNIPHIER
31 	tmp = readl(SC_RSTCTRL2);
32 	tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
33 	writel(tmp, SC_RSTCTRL2);
34 	readl(SC_RSTCTRL2); /* dummy read */
35 #endif
36 
37 	/* provide clocks */
38 	tmp = readl(SC_CLKCTRL);
39 #ifdef CONFIG_USB_DWC3_UNIPHIER
40 	tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
41 		SC_CLKCTRL_CEN_GIO;
42 #endif
43 #ifdef CONFIG_USB_EHCI_HCD
44 	tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
45 #endif
46 #ifdef CONFIG_NAND_DENALI
47 	tmp |= SC_CLKCTRL_CEN_NAND;
48 #endif
49 	writel(tmp, SC_CLKCTRL);
50 	readl(SC_CLKCTRL); /* dummy read */
51 }
52