Masahiro Yamada | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | 663a23f | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 2 | * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
Masahiro Yamada | 663a23f | 2015-05-29 17:30:00 +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 | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 11 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 12 | void uniphier_ld4_clk_init(void) |
Masahiro Yamada | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 13 | { |
| 14 | u32 tmp; |
| 15 | |
| 16 | /* deassert reset */ |
| 17 | tmp = readl(SC_RSTCTRL); |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 18 | #ifdef CONFIG_UNIPHIER_ETH |
| 19 | tmp |= SC_RSTCTRL_NRST_ETHER; |
| 20 | #endif |
Masahiro Yamada | d544ef4 | 2016-02-02 21:11:39 +0900 | [diff] [blame] | 21 | #ifdef CONFIG_USB_EHCI |
Masahiro Yamada | 36563e6 | 2015-02-27 02:26:53 +0900 | [diff] [blame] | 22 | tmp |= SC_RSTCTRL_NRST_STDMAC; |
| 23 | #endif |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 24 | #ifdef CONFIG_NAND_DENALI |
| 25 | tmp |= SC_RSTCTRL_NRST_NAND; |
| 26 | #endif |
Masahiro Yamada | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 27 | writel(tmp, SC_RSTCTRL); |
| 28 | readl(SC_RSTCTRL); /* dummy read */ |
| 29 | |
Masahiro Yamada | 1c6a5e4 | 2016-03-30 20:17:42 +0900 | [diff] [blame] | 30 | /* provide clocks */ |
Masahiro Yamada | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 31 | tmp = readl(SC_CLKCTRL); |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 32 | #ifdef CONFIG_UNIPHIER_ETH |
| 33 | tmp |= SC_CLKCTRL_CEN_ETHER; |
| 34 | #endif |
Masahiro Yamada | d544ef4 | 2016-02-02 21:11:39 +0900 | [diff] [blame] | 35 | #ifdef CONFIG_USB_EHCI |
Masahiro Yamada | 36563e6 | 2015-02-27 02:26:53 +0900 | [diff] [blame] | 36 | tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC; |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 37 | #endif |
| 38 | #ifdef CONFIG_NAND_DENALI |
| 39 | tmp |= SC_CLKCTRL_CEN_NAND; |
| 40 | #endif |
Masahiro Yamada | bb2ff9d | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 41 | writel(tmp, SC_CLKCTRL); |
| 42 | readl(SC_CLKCTRL); /* dummy read */ |
| 43 | } |