blob: 798128b30247c8638b4a14c17f0dcb432c20b4fb [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{
Masahiro Yamada5bacb442020-01-30 00:55:57 +090015#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada5894ca02014-10-03 19:21:06 +090016 u32 tmp;
17
18 /* deassert reset */
Masahiro Yamada739ba412019-07-10 20:07:41 +090019 tmp = readl(sc_base + SC_RSTCTRL);
Masahiro Yamada15351632015-02-27 02:26:58 +090020 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
21 SC_RSTCTRL_NRST_GIO;
Masahiro Yamada739ba412019-07-10 20:07:41 +090022 writel(tmp, sc_base + SC_RSTCTRL);
23 readl(sc_base + SC_RSTCTRL); /* dummy read */
Masahiro Yamada5894ca02014-10-03 19:21:06 +090024
Masahiro Yamada739ba412019-07-10 20:07:41 +090025 tmp = readl(sc_base + SC_RSTCTRL2);
Masahiro Yamada15351632015-02-27 02:26:58 +090026 tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
Masahiro Yamada739ba412019-07-10 20:07:41 +090027 writel(tmp, sc_base + SC_RSTCTRL2);
28 readl(sc_base + SC_RSTCTRL2); /* dummy read */
Masahiro Yamada15351632015-02-27 02:26:58 +090029
Masahiro Yamada67976302016-03-30 20:17:42 +090030 /* provide clocks */
Masahiro Yamada739ba412019-07-10 20:07:41 +090031 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamada15351632015-02-27 02:26:58 +090032 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
33 SC_CLKCTRL_CEN_GIO;
Masahiro Yamada739ba412019-07-10 20:07:41 +090034 writel(tmp, sc_base + SC_CLKCTRL);
35 readl(sc_base + SC_CLKCTRL); /* dummy read */
Masahiro Yamada5bacb442020-01-30 00:55:57 +090036#endif
Masahiro Yamada5894ca02014-10-03 19:21:06 +090037}