1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2ea65c980SMasahiro Yamada /*
370dda1b1SMasahiro Yamada  * Copyright (C) 2011-2015 Panasonic Corporation
470dda1b1SMasahiro Yamada  * Copyright (C) 2015-2016 Socionext Inc.
570dda1b1SMasahiro Yamada  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
6ea65c980SMasahiro Yamada  */
7ea65c980SMasahiro Yamada 
8ea65c980SMasahiro Yamada #include <linux/io.h>
9ea65c980SMasahiro Yamada 
10ea65c980SMasahiro Yamada #include "../init.h"
11ea65c980SMasahiro Yamada #include "../sc-regs.h"
12ea65c980SMasahiro Yamada 
135b660066SMasahiro Yamada void uniphier_ld4_clk_init(void)
14ea65c980SMasahiro Yamada {
15ea65c980SMasahiro Yamada 	u32 tmp;
16ea65c980SMasahiro Yamada 
17ea65c980SMasahiro Yamada 	/* deassert reset */
18ea65c980SMasahiro Yamada 	tmp = readl(SC_RSTCTRL);
19ea65c980SMasahiro Yamada #ifdef CONFIG_NAND_DENALI
20ea65c980SMasahiro Yamada 	tmp |= SC_RSTCTRL_NRST_NAND;
21ea65c980SMasahiro Yamada #endif
22ea65c980SMasahiro Yamada 	writel(tmp, SC_RSTCTRL);
23ea65c980SMasahiro Yamada 	readl(SC_RSTCTRL); /* dummy read */
24ea65c980SMasahiro Yamada 
2567976306SMasahiro Yamada 	/* provide clocks */
26ea65c980SMasahiro Yamada 	tmp = readl(SC_CLKCTRL);
278850c5d5STom Rini #ifdef CONFIG_USB_EHCI_HCD
28ea65c980SMasahiro Yamada 	tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
29ea65c980SMasahiro Yamada #endif
30ea65c980SMasahiro Yamada #ifdef CONFIG_NAND_DENALI
31ea65c980SMasahiro Yamada 	tmp |= SC_CLKCTRL_CEN_NAND;
32ea65c980SMasahiro Yamada #endif
33ea65c980SMasahiro Yamada 	writel(tmp, SC_CLKCTRL);
34ea65c980SMasahiro Yamada 	readl(SC_CLKCTRL); /* dummy read */
35ea65c980SMasahiro Yamada }
36