blob: afa12fa071e73e25c2d550878b56c383ed95d6a1 [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{
14 u32 tmp;
15
16 /* deassert reset */
17 tmp = readl(SC_RSTCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090018#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090019 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO;
20#endif
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090021#ifdef CONFIG_NAND_DENALI
22 tmp |= SC_RSTCTRL_NRST_NAND;
23#endif
24 writel(tmp, SC_RSTCTRL);
25 readl(SC_RSTCTRL); /* dummy read */
26
Masahiro Yamada260eda22017-10-14 02:21:17 +090027#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090028 tmp = readl(SC_RSTCTRL2);
29 tmp |= SC_RSTCTRL2_NRST_USB3B1;
30 writel(tmp, SC_RSTCTRL2);
31 readl(SC_RSTCTRL2); /* dummy read */
Masahiro Yamada85ab6072016-07-22 20:20:11 +090032
33 tmp = readl(SC_RSTCTRL6);
34 tmp |= 0x37;
35 writel(tmp, SC_RSTCTRL6);
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090036#endif
37
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090038 /* provide clocks */
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090039 tmp = readl(SC_CLKCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090040#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada85ab6072016-07-22 20:20:11 +090041 tmp |= BIT(20) | BIT(19) | SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090042 SC_CLKCTRL_CEN_GIO;
43#endif
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090044#ifdef CONFIG_NAND_DENALI
45 tmp |= SC_CLKCTRL_CEN_NAND;
46#endif
47 writel(tmp, SC_CLKCTRL);
48 readl(SC_CLKCTRL); /* dummy read */
49}