Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | f6e7f07 | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 2 | * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
Masahiro Yamada | f6e7f07 | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 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 | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 11 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 12 | void uniphier_pro4_clk_init(void) |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 13 | { |
| 14 | u32 tmp; |
| 15 | |
| 16 | /* deassert reset */ |
| 17 | tmp = readl(SC_RSTCTRL); |
Masahiro Yamada | 1535163 | 2015-02-27 02:26:58 +0900 | [diff] [blame] | 18 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 19 | tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 | |
| 20 | SC_RSTCTRL_NRST_GIO; |
| 21 | #endif |
Masahiro Yamada | 198a97a | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 22 | #ifdef CONFIG_UNIPHIER_ETH |
| 23 | tmp |= SC_RSTCTRL_NRST_ETHER; |
| 24 | #endif |
Masahiro Yamada | cd0847f | 2016-02-02 21:11:39 +0900 | [diff] [blame] | 25 | #ifdef CONFIG_USB_EHCI |
Masahiro Yamada | 42ca698 | 2015-02-27 02:26:53 +0900 | [diff] [blame] | 26 | tmp |= SC_RSTCTRL_NRST_STDMAC; |
| 27 | #endif |
Masahiro Yamada | 198a97a | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 28 | #ifdef CONFIG_NAND_DENALI |
| 29 | tmp |= SC_RSTCTRL_NRST_NAND; |
| 30 | #endif |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 31 | writel(tmp, SC_RSTCTRL); |
| 32 | readl(SC_RSTCTRL); /* dummy read */ |
| 33 | |
Masahiro Yamada | 1535163 | 2015-02-27 02:26:58 +0900 | [diff] [blame] | 34 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 35 | tmp = readl(SC_RSTCTRL2); |
| 36 | tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1; |
| 37 | writel(tmp, SC_RSTCTRL2); |
| 38 | readl(SC_RSTCTRL2); /* dummy read */ |
| 39 | #endif |
| 40 | |
Masahiro Yamada | 6797630 | 2016-03-30 20:17:42 +0900 | [diff] [blame] | 41 | /* provide clocks */ |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 42 | tmp = readl(SC_CLKCTRL); |
Masahiro Yamada | 1535163 | 2015-02-27 02:26:58 +0900 | [diff] [blame] | 43 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 44 | tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | |
| 45 | SC_CLKCTRL_CEN_GIO; |
| 46 | #endif |
Masahiro Yamada | 198a97a | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 47 | #ifdef CONFIG_UNIPHIER_ETH |
| 48 | tmp |= SC_CLKCTRL_CEN_ETHER; |
| 49 | #endif |
Masahiro Yamada | cd0847f | 2016-02-02 21:11:39 +0900 | [diff] [blame] | 50 | #ifdef CONFIG_USB_EHCI |
Masahiro Yamada | 42ca698 | 2015-02-27 02:26:53 +0900 | [diff] [blame] | 51 | tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC; |
Masahiro Yamada | 198a97a | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 52 | #endif |
| 53 | #ifdef CONFIG_NAND_DENALI |
| 54 | tmp |= SC_CLKCTRL_CEN_NAND; |
| 55 | #endif |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 56 | writel(tmp, SC_CLKCTRL); |
| 57 | readl(SC_CLKCTRL); /* dummy read */ |
| 58 | } |