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