blob: 2e1b20a423c2d8da556729ecbaccf57b1e3a422d [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 Yamada75f16f82015-09-22 00:27:39 +09008#include <mach/init.h>
Masahiro Yamada95387e22015-02-27 02:26:44 +09009#include <mach/sc-regs.h>
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090010
Masahiro Yamada75f16f82015-09-22 00:27:39 +090011void ph1_pro4_clk_init(void)
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090012{
13 u32 tmp;
14
15 /* deassert reset */
16 tmp = readl(SC_RSTCTRL);
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090017#ifdef CONFIG_USB_XHCI_UNIPHIER
18 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
19 SC_RSTCTRL_NRST_GIO;
20#endif
Masahiro Yamadac04368f2015-02-27 02:26:51 +090021#ifdef CONFIG_UNIPHIER_ETH
22 tmp |= SC_RSTCTRL_NRST_ETHER;
23#endif
Masahiro Yamada36563e62015-02-27 02:26:53 +090024#ifdef CONFIG_USB_EHCI_UNIPHIER
25 tmp |= SC_RSTCTRL_NRST_STDMAC;
26#endif
Masahiro Yamadac04368f2015-02-27 02:26:51 +090027#ifdef CONFIG_NAND_DENALI
28 tmp |= SC_RSTCTRL_NRST_NAND;
29#endif
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090030 writel(tmp, SC_RSTCTRL);
31 readl(SC_RSTCTRL); /* dummy read */
32
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090033#ifdef CONFIG_USB_XHCI_UNIPHIER
34 tmp = readl(SC_RSTCTRL2);
35 tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
36 writel(tmp, SC_RSTCTRL2);
37 readl(SC_RSTCTRL2); /* dummy read */
38#endif
39
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090040 /* privide clocks */
41 tmp = readl(SC_CLKCTRL);
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090042#ifdef CONFIG_USB_XHCI_UNIPHIER
43 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
44 SC_CLKCTRL_CEN_GIO;
45#endif
Masahiro Yamadac04368f2015-02-27 02:26:51 +090046#ifdef CONFIG_UNIPHIER_ETH
47 tmp |= SC_CLKCTRL_CEN_ETHER;
48#endif
49#ifdef CONFIG_USB_EHCI_UNIPHIER
Masahiro Yamada36563e62015-02-27 02:26:53 +090050 tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
Masahiro Yamadac04368f2015-02-27 02:26:51 +090051#endif
52#ifdef CONFIG_NAND_DENALI
53 tmp |= SC_CLKCTRL_CEN_NAND;
54#endif
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090055 writel(tmp, SC_CLKCTRL);
56 readl(SC_CLKCTRL); /* dummy read */
57}