blob: 09c03cd9f50bd8fb97950a0b529f5bc60e6cd07f [file] [log] [blame]
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +09001/*
Masahiro Yamadab4eda202016-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 Yamadabb2ff9d2014-10-03 19:21:06 +09005 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
Masahiro Yamada663a23f2015-05-29 17:30:00 +09009#include <linux/io.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +090010
11#include "../init.h"
12#include "../sc-regs.h"
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090013
Masahiro Yamada98905692016-03-30 20:17:02 +090014void uniphier_pro4_clk_init(void)
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090015{
16 u32 tmp;
17
18 /* deassert reset */
19 tmp = readl(SC_RSTCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090020#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090021 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
22 SC_RSTCTRL_NRST_GIO;
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 Yamada260eda22017-10-14 02:21:17 +090030#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090031 tmp = readl(SC_RSTCTRL2);
32 tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
33 writel(tmp, SC_RSTCTRL2);
34 readl(SC_RSTCTRL2); /* dummy read */
35#endif
36
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090037 /* provide clocks */
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090038 tmp = readl(SC_CLKCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090039#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090040 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
41 SC_CLKCTRL_CEN_GIO;
42#endif
Tom Riniceed5d22017-05-12 22:33:27 -040043#ifdef CONFIG_USB_EHCI_HCD
Masahiro Yamada36563e62015-02-27 02:26:53 +090044 tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC;
Masahiro Yamadac04368f2015-02-27 02:26:51 +090045#endif
46#ifdef CONFIG_NAND_DENALI
47 tmp |= SC_CLKCTRL_CEN_NAND;
48#endif
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090049 writel(tmp, SC_CLKCTRL);
50 readl(SC_CLKCTRL); /* dummy read */
51}