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