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