blob: c2a75ce00010ca25ce30c817652caabb7c784d8c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada1fe65d32015-09-22 00:27:41 +09002/*
3 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada1fe65d32015-09-22 00:27:41 +09004 */
5
Masahiro Yamada85ab6072016-07-22 20:20:11 +09006#include <linux/bitops.h>
Masahiro Yamada1fe65d32015-09-22 00:27:41 +09007#include <linux/io.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +09008
9#include "../init.h"
10#include "../sc-regs.h"
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090011
Masahiro Yamada98905692016-03-30 20:17:02 +090012void uniphier_pxs2_clk_init(void)
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090013{
Masahiro Yamada51b9bc92020-01-30 00:55:57 +090014#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090015 u32 tmp;
16
17 /* deassert reset */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090018 tmp = readl(sc_base + SC_RSTCTRL);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090019 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090020 writel(tmp, sc_base + SC_RSTCTRL);
21 readl(sc_base + SC_RSTCTRL); /* dummy read */
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090022
Masahiro Yamadac84024c2019-07-10 20:07:41 +090023 tmp = readl(sc_base + SC_RSTCTRL2);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090024 tmp |= SC_RSTCTRL2_NRST_USB3B1;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090025 writel(tmp, sc_base + SC_RSTCTRL2);
26 readl(sc_base + SC_RSTCTRL2); /* dummy read */
Masahiro Yamada85ab6072016-07-22 20:20:11 +090027
Masahiro Yamadac84024c2019-07-10 20:07:41 +090028 tmp = readl(sc_base + SC_RSTCTRL6);
Masahiro Yamada85ab6072016-07-22 20:20:11 +090029 tmp |= 0x37;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090030 writel(tmp, sc_base + SC_RSTCTRL6);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090031
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090032 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090033 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamada85ab6072016-07-22 20:20:11 +090034 tmp |= BIT(20) | BIT(19) | SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090035 SC_CLKCTRL_CEN_GIO;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090036 writel(tmp, sc_base + SC_CLKCTRL);
37 readl(sc_base + SC_CLKCTRL); /* dummy read */
Masahiro Yamada51b9bc92020-01-30 00:55:57 +090038#endif
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090039}