blob: 2b364dca4100f197b159189a9cdbb1261a01eb7a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +09002/*
Masahiro Yamadab4eda202016-10-17 22:18:03 +09003 * Copyright (C) 2011-2015 Panasonic Corporation
4 * Copyright (C) 2015-2016 Socionext Inc.
5 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +09006 */
7
Masahiro Yamada663a23f2015-05-29 17:30:00 +09008#include <linux/io.h>
Masahiro Yamadaefdf3402016-01-09 01:51:13 +09009
10#include "../init.h"
11#include "../sc-regs.h"
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090012
Masahiro Yamada98905692016-03-30 20:17:02 +090013void uniphier_pro4_clk_init(void)
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090014{
15 u32 tmp;
16
17 /* deassert reset */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090018 tmp = readl(sc_base + SC_RSTCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090019#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090020 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 |
21 SC_RSTCTRL_NRST_GIO;
22#endif
Masahiro Yamadac04368f2015-02-27 02:26:51 +090023#ifdef CONFIG_NAND_DENALI
24 tmp |= SC_RSTCTRL_NRST_NAND;
25#endif
Masahiro Yamadac84024c2019-07-10 20:07:41 +090026 writel(tmp, sc_base + SC_RSTCTRL);
27 readl(sc_base + SC_RSTCTRL); /* dummy read */
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090028
Masahiro Yamada260eda22017-10-14 02:21:17 +090029#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamadac84024c2019-07-10 20:07:41 +090030 tmp = readl(sc_base + SC_RSTCTRL2);
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090031 tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090032 writel(tmp, sc_base + SC_RSTCTRL2);
33 readl(sc_base + SC_RSTCTRL2); /* dummy read */
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090034#endif
35
Masahiro Yamada1c6a5e42016-03-30 20:17:42 +090036 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090037 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamada260eda22017-10-14 02:21:17 +090038#ifdef CONFIG_USB_DWC3_UNIPHIER
Masahiro Yamada046d8fd2015-02-27 02:26:58 +090039 tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 |
40 SC_CLKCTRL_CEN_GIO;
41#endif
Masahiro Yamadac04368f2015-02-27 02:26:51 +090042#ifdef CONFIG_NAND_DENALI
43 tmp |= SC_CLKCTRL_CEN_NAND;
44#endif
Masahiro Yamadac84024c2019-07-10 20:07:41 +090045 writel(tmp, sc_base + SC_CLKCTRL);
46 readl(sc_base + SC_CLKCTRL); /* dummy read */
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090047}