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