Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +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 | 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); |
| 18 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 19 | tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO; |
| 20 | #endif |
| 21 | #ifdef CONFIG_UNIPHIER_ETH |
| 22 | tmp |= SC_RSTCTRL_NRST_ETHER; |
| 23 | #endif |
| 24 | #ifdef CONFIG_NAND_DENALI |
| 25 | tmp |= SC_RSTCTRL_NRST_NAND; |
| 26 | #endif |
| 27 | writel(tmp, SC_RSTCTRL); |
| 28 | readl(SC_RSTCTRL); /* dummy read */ |
| 29 | |
| 30 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 31 | tmp = readl(SC_RSTCTRL2); |
| 32 | tmp |= SC_RSTCTRL2_NRST_USB3B1; |
| 33 | writel(tmp, SC_RSTCTRL2); |
| 34 | readl(SC_RSTCTRL2); /* dummy read */ |
| 35 | #endif |
| 36 | |
Masahiro Yamada | 1c6a5e4 | 2016-03-30 20:17:42 +0900 | [diff] [blame^] | 37 | /* provide clocks */ |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 38 | tmp = readl(SC_CLKCTRL); |
| 39 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 40 | tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | |
| 41 | SC_CLKCTRL_CEN_GIO; |
| 42 | #endif |
| 43 | #ifdef CONFIG_UNIPHIER_ETH |
| 44 | tmp |= SC_CLKCTRL_CEN_ETHER; |
| 45 | #endif |
| 46 | #ifdef CONFIG_NAND_DENALI |
| 47 | tmp |= SC_CLKCTRL_CEN_NAND; |
| 48 | #endif |
| 49 | writel(tmp, SC_CLKCTRL); |
| 50 | readl(SC_CLKCTRL); /* dummy read */ |
| 51 | } |