blob: 338d73d0708507a33c1aaf973343e732071850f4 [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{
13 u32 tmp;
14
15 /* deassert reset */
16 tmp = readl(SC_RSTCTRL);
Masahiro Yamadac7372d62017-10-14 02:21:17 +090017#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada28f40d42015-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
23 writel(tmp, SC_RSTCTRL);
24 readl(SC_RSTCTRL); /* dummy read */
25
Masahiro Yamadac7372d62017-10-14 02:21:17 +090026#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada28f40d42015-09-22 00:27:40 +090027 tmp = readl(SC_RSTCTRL2);
28 tmp |= SC_RSTCTRL2_NRST_USB3B1;
29 writel(tmp, SC_RSTCTRL2);
30 readl(SC_RSTCTRL2); /* dummy read */
31#endif
32
Masahiro Yamada67976302016-03-30 20:17:42 +090033 /* provide clocks */
Masahiro Yamada28f40d42015-09-22 00:27:40 +090034 tmp = readl(SC_CLKCTRL);
Masahiro Yamadac7372d62017-10-14 02:21:17 +090035#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada28f40d42015-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
42 writel(tmp, SC_CLKCTRL);
43 readl(SC_CLKCTRL); /* dummy read */
44}