Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | 663a23f | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 2 | * Copyright (C) 2011-2015 Masahiro Yamada <yamada.m@jp.panasonic.com> |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
Masahiro Yamada | 4b9c6f2 | 2015-02-27 02:26:52 +0900 | [diff] [blame] | 7 | #include <common.h> |
| 8 | #include <spl.h> |
Masahiro Yamada | 663a23f | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 9 | #include <linux/io.h> |
Masahiro Yamada | efdf340 | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 10 | |
| 11 | #include "../init.h" |
| 12 | #include "../sc-regs.h" |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 13 | |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame^] | 14 | int uniphier_ld4_early_clk_init(const struct uniphier_board_data *bd) |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 15 | { |
| 16 | u32 tmp; |
| 17 | |
| 18 | /* deassert reset */ |
| 19 | tmp = readl(SC_RSTCTRL); |
Masahiro Yamada | 4b9c6f2 | 2015-02-27 02:26:52 +0900 | [diff] [blame] | 20 | |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 21 | tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0; |
Masahiro Yamada | 4b9c6f2 | 2015-02-27 02:26:52 +0900 | [diff] [blame] | 22 | if (spl_boot_device() != BOOT_DEVICE_NAND) |
| 23 | tmp &= ~SC_RSTCTRL_NRST_NAND; |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 24 | writel(tmp, SC_RSTCTRL); |
| 25 | readl(SC_RSTCTRL); /* dummy read */ |
| 26 | |
| 27 | /* privide clocks */ |
| 28 | tmp = readl(SC_CLKCTRL); |
| 29 | tmp |= SC_CLKCTRL_CEN_UMC | SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI; |
| 30 | writel(tmp, SC_CLKCTRL); |
| 31 | readl(SC_CLKCTRL); /* dummy read */ |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 32 | |
| 33 | return 0; |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 34 | } |