blob: 874964b2d5bc04dd82232121b5254bb2dd89ed8e [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{
13 u32 tmp;
14
15 /* deassert reset */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090016 tmp = readl(sc_base + SC_RSTCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090017#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamadad5167d52015-09-22 00:27:40 +090018 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO;
19#endif
20#ifdef CONFIG_NAND_DENALI
21 tmp |= SC_RSTCTRL_NRST_NAND;
22#endif
Masahiro Yamadac84024c2019-07-10 20:07:41 +090023 writel(tmp, sc_base + SC_RSTCTRL);
24 readl(sc_base + SC_RSTCTRL); /* dummy read */
Masahiro Yamadad5167d52015-09-22 00:27:40 +090025
Masahiro Yamada260eda22017-10-14 02:21:17 +090026#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamadac84024c2019-07-10 20:07:41 +090027 tmp = readl(sc_base + SC_RSTCTRL2);
Masahiro Yamadad5167d52015-09-22 00:27:40 +090028 tmp |= SC_RSTCTRL2_NRST_USB3B1;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090029 writel(tmp, sc_base + SC_RSTCTRL2);
30 readl(sc_base + SC_RSTCTRL2); /* dummy read */
Masahiro Yamadad5167d52015-09-22 00:27:40 +090031#endif
32
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090033 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090034 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090035#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamadad5167d52015-09-22 00:27:40 +090036 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
37 SC_CLKCTRL_CEN_GIO;
38#endif
39#ifdef CONFIG_NAND_DENALI
40 tmp |= SC_CLKCTRL_CEN_NAND;
41#endif
Masahiro Yamadac84024c2019-07-10 20:07:41 +090042 writel(tmp, sc_base + SC_CLKCTRL);
43 readl(sc_base + SC_CLKCTRL); /* dummy read */
Masahiro Yamadad5167d52015-09-22 00:27:40 +090044}