blob: 36006fd256ca4ddc4ca9e7b549ed69221cea1124 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada28f40d42015-09-22 00:27:40 +09002/*
3 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada28f40d42015-09-22 00:27:40 +09004 */
5
6#include <linux/io.h>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +09007
8#include "../init.h"
9#include "../sc-regs.h"
Masahiro Yamada28f40d42015-09-22 00:27:40 +090010
Masahiro Yamada5b660062016-03-30 20:17:02 +090011void uniphier_pro5_clk_init(void)
Masahiro Yamada28f40d42015-09-22 00:27:40 +090012{
Masahiro Yamada5bacb442020-01-30 00:55:57 +090013#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada28f40d42015-09-22 00:27:40 +090014 u32 tmp;
15
16 /* deassert reset */
Masahiro Yamada739ba412019-07-10 20:07:41 +090017 tmp = readl(sc_base + SC_RSTCTRL);
Masahiro Yamada28f40d42015-09-22 00:27:40 +090018 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO;
Masahiro Yamada739ba412019-07-10 20:07:41 +090019 writel(tmp, sc_base + SC_RSTCTRL);
20 readl(sc_base + SC_RSTCTRL); /* dummy read */
Masahiro Yamada28f40d42015-09-22 00:27:40 +090021
Masahiro Yamada739ba412019-07-10 20:07:41 +090022 tmp = readl(sc_base + SC_RSTCTRL2);
Masahiro Yamada28f40d42015-09-22 00:27:40 +090023 tmp |= SC_RSTCTRL2_NRST_USB3B1;
Masahiro Yamada739ba412019-07-10 20:07:41 +090024 writel(tmp, sc_base + SC_RSTCTRL2);
25 readl(sc_base + SC_RSTCTRL2); /* dummy read */
Masahiro Yamada28f40d42015-09-22 00:27:40 +090026
Masahiro Yamada67976302016-03-30 20:17:42 +090027 /* provide clocks */
Masahiro Yamada739ba412019-07-10 20:07:41 +090028 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamada28f40d42015-09-22 00:27:40 +090029 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
30 SC_CLKCTRL_CEN_GIO;
Masahiro Yamada739ba412019-07-10 20:07:41 +090031 writel(tmp, sc_base + SC_CLKCTRL);
32 readl(sc_base + SC_CLKCTRL); /* dummy read */
Masahiro Yamada5bacb442020-01-30 00:55:57 +090033#endif
Masahiro Yamada28f40d42015-09-22 00:27:40 +090034}