Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <linux/io.h> |
Masahiro Yamada | 107b3fb | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 8 | |
| 9 | #include "../init.h" |
| 10 | #include "../sc-regs.h" |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 11 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 12 | void uniphier_pro5_clk_init(void) |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 13 | { |
| 14 | u32 tmp; |
| 15 | |
| 16 | /* deassert reset */ |
| 17 | tmp = readl(SC_RSTCTRL); |
Masahiro Yamada | c7372d6 | 2017-10-14 02:21:17 +0900 | [diff] [blame] | 18 | #ifdef CONFIG_USB_DWC3_UNIPHIER |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 19 | tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO; |
| 20 | #endif |
| 21 | #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 Yamada | c7372d6 | 2017-10-14 02:21:17 +0900 | [diff] [blame] | 27 | #ifdef CONFIG_USB_DWC3_UNIPHIER |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 28 | tmp = readl(SC_RSTCTRL2); |
| 29 | tmp |= SC_RSTCTRL2_NRST_USB3B1; |
| 30 | writel(tmp, SC_RSTCTRL2); |
| 31 | readl(SC_RSTCTRL2); /* dummy read */ |
| 32 | #endif |
| 33 | |
Masahiro Yamada | 6797630 | 2016-03-30 20:17:42 +0900 | [diff] [blame] | 34 | /* provide clocks */ |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 35 | tmp = readl(SC_CLKCTRL); |
Masahiro Yamada | c7372d6 | 2017-10-14 02:21:17 +0900 | [diff] [blame] | 36 | #ifdef CONFIG_USB_DWC3_UNIPHIER |
Masahiro Yamada | 28f40d4 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 37 | tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | |
| 38 | SC_CLKCTRL_CEN_GIO; |
| 39 | #endif |
| 40 | #ifdef CONFIG_NAND_DENALI |
| 41 | tmp |= SC_CLKCTRL_CEN_NAND; |
| 42 | #endif |
| 43 | writel(tmp, SC_CLKCTRL); |
| 44 | readl(SC_CLKCTRL); /* dummy read */ |
| 45 | } |