Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 4 | */ |
| 5 | |
Masahiro Yamada | 85ab607 | 2016-07-22 20:20:11 +0900 | [diff] [blame] | 6 | #include <linux/bitops.h> |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 7 | #include <linux/io.h> |
Masahiro Yamada | efdf340 | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 8 | |
| 9 | #include "../init.h" |
| 10 | #include "../sc-regs.h" |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 11 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 12 | void uniphier_pxs2_clk_init(void) |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 13 | { |
| 14 | u32 tmp; |
| 15 | |
| 16 | /* deassert reset */ |
| 17 | tmp = readl(SC_RSTCTRL); |
Masahiro Yamada | 260eda2 | 2017-10-14 02:21:17 +0900 | [diff] [blame] | 18 | #ifdef CONFIG_USB_DWC3_UNIPHIER |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 19 | tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO; |
| 20 | #endif |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 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 | 260eda2 | 2017-10-14 02:21:17 +0900 | [diff] [blame] | 27 | #ifdef CONFIG_USB_DWC3_UNIPHIER |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +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 */ |
Masahiro Yamada | 85ab607 | 2016-07-22 20:20:11 +0900 | [diff] [blame] | 32 | |
| 33 | tmp = readl(SC_RSTCTRL6); |
| 34 | tmp |= 0x37; |
| 35 | writel(tmp, SC_RSTCTRL6); |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 36 | #endif |
| 37 | |
Masahiro Yamada | 1c6a5e4 | 2016-03-30 20:17:42 +0900 | [diff] [blame] | 38 | /* provide clocks */ |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 39 | tmp = readl(SC_CLKCTRL); |
Masahiro Yamada | 260eda2 | 2017-10-14 02:21:17 +0900 | [diff] [blame] | 40 | #ifdef CONFIG_USB_DWC3_UNIPHIER |
Masahiro Yamada | 85ab607 | 2016-07-22 20:20:11 +0900 | [diff] [blame] | 41 | tmp |= BIT(20) | BIT(19) | SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 42 | SC_CLKCTRL_CEN_GIO; |
| 43 | #endif |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 44 | #ifdef CONFIG_NAND_DENALI |
| 45 | tmp |= SC_CLKCTRL_CEN_NAND; |
| 46 | #endif |
| 47 | writel(tmp, SC_CLKCTRL); |
| 48 | readl(SC_CLKCTRL); /* dummy read */ |
| 49 | } |