blob: 8746d7df518dcc35b9141d5080ff81e1e1e1401f [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_pro4_clk_init(void)
Masahiro Yamada5894ca02014-10-03 19:21:06 +090013{
14 u32 tmp;
15
16 /* deassert reset */
17 tmp = readl(SC_RSTCTRL);
Masahiro Yamada15351632015-02-27 02:26:58 +090018#ifdef CONFIG_USB_XHCI_UNIPHIER
19 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
20 SC_RSTCTRL_NRST_GIO;
21#endif
Masahiro Yamada198a97a2015-02-27 02:26:51 +090022#ifdef CONFIG_UNIPHIER_ETH
23 tmp |= SC_RSTCTRL_NRST_ETHER;
24#endif
Masahiro Yamadacd0847f2016-02-02 21:11:39 +090025#ifdef CONFIG_USB_EHCI
Masahiro Yamada42ca6982015-02-27 02:26:53 +090026 tmp |= SC_RSTCTRL_NRST_STDMAC;
27#endif
Masahiro Yamada198a97a2015-02-27 02:26:51 +090028#ifdef CONFIG_NAND_DENALI
29 tmp |= SC_RSTCTRL_NRST_NAND;
30#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090031 writel(tmp, SC_RSTCTRL);
32 readl(SC_RSTCTRL); /* dummy read */
33
Masahiro Yamada15351632015-02-27 02:26:58 +090034#ifdef CONFIG_USB_XHCI_UNIPHIER
35 tmp = readl(SC_RSTCTRL2);
36 tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
37 writel(tmp, SC_RSTCTRL2);
38 readl(SC_RSTCTRL2); /* dummy read */
39#endif
40
Masahiro Yamada67976302016-03-30 20:17:42 +090041 /* provide clocks */
Masahiro Yamada5894ca02014-10-03 19:21:06 +090042 tmp = readl(SC_CLKCTRL);
Masahiro Yamada15351632015-02-27 02:26:58 +090043#ifdef CONFIG_USB_XHCI_UNIPHIER
44 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
45 SC_CLKCTRL_CEN_GIO;
46#endif
Masahiro Yamada198a97a2015-02-27 02:26:51 +090047#ifdef CONFIG_UNIPHIER_ETH
48 tmp |= SC_CLKCTRL_CEN_ETHER;
49#endif
Masahiro Yamadacd0847f2016-02-02 21:11:39 +090050#ifdef CONFIG_USB_EHCI
Masahiro Yamada42ca6982015-02-27 02:26:53 +090051 tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
Masahiro Yamada198a97a2015-02-27 02:26:51 +090052#endif
53#ifdef CONFIG_NAND_DENALI
54 tmp |= SC_CLKCTRL_CEN_NAND;
55#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090056 writel(tmp, SC_CLKCTRL);
57 readl(SC_CLKCTRL); /* dummy read */
58}