blob: 62b6927732a630402360cd4daae5ade7a87ebaa3 [file] [log] [blame]
Masahiro Yamada5894ca02014-10-03 19:21:06 +09001/*
Masahiro Yamada70dda1b2016-10-17 22:18:03 +09002 * Copyright (C) 2011-2015 Panasonic Corporation
3 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada5894ca02014-10-03 19:21:06 +09005 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +09009#include <linux/io.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +090010
11#include "../init.h"
12#include "../sc-regs.h"
Masahiro Yamada5894ca02014-10-03 19:21:06 +090013
Masahiro Yamada5b660062016-03-30 20:17:02 +090014void uniphier_ld4_clk_init(void)
Masahiro Yamada5894ca02014-10-03 19:21:06 +090015{
16 u32 tmp;
17
18 /* deassert reset */
19 tmp = readl(SC_RSTCTRL);
Masahiro Yamada198a97a2015-02-27 02:26:51 +090020#ifdef CONFIG_UNIPHIER_ETH
21 tmp |= SC_RSTCTRL_NRST_ETHER;
22#endif
23#ifdef CONFIG_NAND_DENALI
24 tmp |= SC_RSTCTRL_NRST_NAND;
25#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090026 writel(tmp, SC_RSTCTRL);
27 readl(SC_RSTCTRL); /* dummy read */
28
Masahiro Yamada67976302016-03-30 20:17:42 +090029 /* provide clocks */
Masahiro Yamada5894ca02014-10-03 19:21:06 +090030 tmp = readl(SC_CLKCTRL);
Masahiro Yamada198a97a2015-02-27 02:26:51 +090031#ifdef CONFIG_UNIPHIER_ETH
32 tmp |= SC_CLKCTRL_CEN_ETHER;
33#endif
Masahiro Yamadacd0847f2016-02-02 21:11:39 +090034#ifdef CONFIG_USB_EHCI
Masahiro Yamada42ca6982015-02-27 02:26:53 +090035 tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
Masahiro Yamada198a97a2015-02-27 02:26:51 +090036#endif
37#ifdef CONFIG_NAND_DENALI
38 tmp |= SC_CLKCTRL_CEN_NAND;
39#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090040 writel(tmp, SC_CLKCTRL);
41 readl(SC_CLKCTRL); /* dummy read */
42}