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