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 | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame^] | 10 | #include <mach/init.h> |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 11 | #include <mach/sc-regs.h> |
| 12 | |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame^] | 13 | int ph1_ld4_early_clk_init(const struct uniphier_board_data *bd) |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 14 | { |
| 15 | u32 tmp; |
| 16 | |
| 17 | /* deassert reset */ |
| 18 | tmp = readl(SC_RSTCTRL); |
Masahiro Yamada | 4b9c6f2 | 2015-02-27 02:26:52 +0900 | [diff] [blame] | 19 | |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 20 | tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0; |
Masahiro Yamada | 4b9c6f2 | 2015-02-27 02:26:52 +0900 | [diff] [blame] | 21 | if (spl_boot_device() != BOOT_DEVICE_NAND) |
| 22 | tmp &= ~SC_RSTCTRL_NRST_NAND; |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 23 | writel(tmp, SC_RSTCTRL); |
| 24 | readl(SC_RSTCTRL); /* dummy read */ |
| 25 | |
| 26 | /* privide clocks */ |
| 27 | tmp = readl(SC_CLKCTRL); |
| 28 | tmp |= SC_CLKCTRL_CEN_UMC | SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI; |
| 29 | writel(tmp, SC_CLKCTRL); |
| 30 | readl(SC_CLKCTRL); /* dummy read */ |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame^] | 31 | |
| 32 | return 0; |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 33 | } |