Masahiro Yamada | 019df87 | 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 | |
Masahiro Yamada | 29d63a5 | 2016-07-22 20:20:11 +0900 | [diff] [blame] | 7 | #include <linux/bitops.h> |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 8 | #include <linux/io.h> |
Masahiro Yamada | 107b3fb | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 9 | |
| 10 | #include "../init.h" |
| 11 | #include "../sc-regs.h" |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 12 | |
Masahiro Yamada | 5b66006 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 13 | void uniphier_pxs2_clk_init(void) |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 14 | { |
| 15 | u32 tmp; |
| 16 | |
| 17 | /* deassert reset */ |
| 18 | tmp = readl(SC_RSTCTRL); |
| 19 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 20 | tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO; |
| 21 | #endif |
| 22 | #ifdef CONFIG_UNIPHIER_ETH |
| 23 | tmp |= SC_RSTCTRL_NRST_ETHER; |
| 24 | #endif |
| 25 | #ifdef CONFIG_NAND_DENALI |
| 26 | tmp |= SC_RSTCTRL_NRST_NAND; |
| 27 | #endif |
| 28 | writel(tmp, SC_RSTCTRL); |
| 29 | readl(SC_RSTCTRL); /* dummy read */ |
| 30 | |
| 31 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
| 32 | tmp = readl(SC_RSTCTRL2); |
| 33 | tmp |= SC_RSTCTRL2_NRST_USB3B1; |
| 34 | writel(tmp, SC_RSTCTRL2); |
| 35 | readl(SC_RSTCTRL2); /* dummy read */ |
Masahiro Yamada | 29d63a5 | 2016-07-22 20:20:11 +0900 | [diff] [blame] | 36 | |
| 37 | tmp = readl(SC_RSTCTRL6); |
| 38 | tmp |= 0x37; |
| 39 | writel(tmp, SC_RSTCTRL6); |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 40 | #endif |
| 41 | |
Masahiro Yamada | 6797630 | 2016-03-30 20:17:42 +0900 | [diff] [blame] | 42 | /* provide clocks */ |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 43 | tmp = readl(SC_CLKCTRL); |
| 44 | #ifdef CONFIG_USB_XHCI_UNIPHIER |
Masahiro Yamada | 29d63a5 | 2016-07-22 20:20:11 +0900 | [diff] [blame] | 45 | tmp |= BIT(20) | BIT(19) | SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | |
Masahiro Yamada | 019df87 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 46 | SC_CLKCTRL_CEN_GIO; |
| 47 | #endif |
| 48 | #ifdef CONFIG_UNIPHIER_ETH |
| 49 | tmp |= SC_CLKCTRL_CEN_ETHER; |
| 50 | #endif |
| 51 | #ifdef CONFIG_NAND_DENALI |
| 52 | tmp |= SC_CLKCTRL_CEN_NAND; |
| 53 | #endif |
| 54 | writel(tmp, SC_CLKCTRL); |
| 55 | readl(SC_CLKCTRL); /* dummy read */ |
| 56 | } |