blob: f11fb53133fd0a7139c304af8c8b5b0e5abb9e8b [file] [log] [blame]
Masahiro Yamada5894ca02014-10-03 19:21:06 +09001/*
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +09002 * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada5894ca02014-10-03 19:21:06 +09003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +09007#include <linux/io.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +09008
9#include "../init.h"
10#include "../sc-regs.h"
Masahiro Yamada5894ca02014-10-03 19:21:06 +090011
Masahiro Yamada5b660062016-03-30 20:17:02 +090012void uniphier_ld4_clk_init(void)
Masahiro Yamada5894ca02014-10-03 19:21:06 +090013{
14 u32 tmp;
15
16 /* deassert reset */
17 tmp = readl(SC_RSTCTRL);
Masahiro Yamada198a97a2015-02-27 02:26:51 +090018#ifdef CONFIG_UNIPHIER_ETH
19 tmp |= SC_RSTCTRL_NRST_ETHER;
20#endif
Masahiro Yamadacd0847f2016-02-02 21:11:39 +090021#ifdef CONFIG_USB_EHCI
Masahiro Yamada42ca6982015-02-27 02:26:53 +090022 tmp |= SC_RSTCTRL_NRST_STDMAC;
23#endif
Masahiro Yamada198a97a2015-02-27 02:26:51 +090024#ifdef CONFIG_NAND_DENALI
25 tmp |= SC_RSTCTRL_NRST_NAND;
26#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090027 writel(tmp, SC_RSTCTRL);
28 readl(SC_RSTCTRL); /* dummy read */
29
30 /* privide clocks */
31 tmp = readl(SC_CLKCTRL);
Masahiro Yamada198a97a2015-02-27 02:26:51 +090032#ifdef CONFIG_UNIPHIER_ETH
33 tmp |= SC_CLKCTRL_CEN_ETHER;
34#endif
Masahiro Yamadacd0847f2016-02-02 21:11:39 +090035#ifdef CONFIG_USB_EHCI
Masahiro Yamada42ca6982015-02-27 02:26:53 +090036 tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
Masahiro Yamada198a97a2015-02-27 02:26:51 +090037#endif
38#ifdef CONFIG_NAND_DENALI
39 tmp |= SC_CLKCTRL_CEN_NAND;
40#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090041 writel(tmp, SC_CLKCTRL);
42 readl(SC_CLKCTRL); /* dummy read */
43}