blob: e73bf38924d27c5570e32eb25fe9ac7795c0f327 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada5894ca02014-10-03 19:21:06 +09002/*
Masahiro Yamada70dda1b2016-10-17 22:18:03 +09003 * Copyright (C) 2011-2015 Panasonic Corporation
4 * Copyright (C) 2015-2016 Socionext Inc.
5 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada5894ca02014-10-03 19:21:06 +09006 */
7
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +09008#include <linux/io.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +09009
10#include "../init.h"
11#include "../sc-regs.h"
Masahiro Yamada5894ca02014-10-03 19:21:06 +090012
Masahiro Yamada5b660062016-03-30 20:17:02 +090013void uniphier_pro4_clk_init(void)
Masahiro Yamada5894ca02014-10-03 19:21:06 +090014{
15 u32 tmp;
16
17 /* deassert reset */
18 tmp = readl(SC_RSTCTRL);
Masahiro Yamadac7372d62017-10-14 02:21:17 +090019#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada15351632015-02-27 02:26:58 +090020 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
21 SC_RSTCTRL_NRST_GIO;
22#endif
Masahiro Yamada198a97a2015-02-27 02:26:51 +090023#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 Yamadac7372d62017-10-14 02:21:17 +090029#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada15351632015-02-27 02:26:58 +090030 tmp = readl(SC_RSTCTRL2);
31 tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
32 writel(tmp, SC_RSTCTRL2);
33 readl(SC_RSTCTRL2); /* dummy read */
34#endif
35
Masahiro Yamada67976302016-03-30 20:17:42 +090036 /* provide clocks */
Masahiro Yamada5894ca02014-10-03 19:21:06 +090037 tmp = readl(SC_CLKCTRL);
Masahiro Yamadac7372d62017-10-14 02:21:17 +090038#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada15351632015-02-27 02:26:58 +090039 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
40 SC_CLKCTRL_CEN_GIO;
41#endif
Tom Rini8850c5d2017-05-12 22:33:27 -040042#ifdef CONFIG_USB_EHCI_HCD
Masahiro Yamada42ca6982015-02-27 02:26:53 +090043 tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
Masahiro Yamada198a97a2015-02-27 02:26:51 +090044#endif
45#ifdef CONFIG_NAND_DENALI
46 tmp |= SC_CLKCTRL_CEN_NAND;
47#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090048 writel(tmp, SC_CLKCTRL);
49 readl(SC_CLKCTRL); /* dummy read */
50}