]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/arm/mach-uniphier/clk/early-clk-ld4.c
ARM: uniphier: collect clock/PLL init code into a single directory
[karo-tx-uboot.git] / arch / arm / mach-uniphier / clk / early-clk-ld4.c
1 /*
2  * Copyright (C) 2011-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <spl.h>
9 #include <linux/io.h>
10
11 #include "../init.h"
12 #include "../sc-regs.h"
13
14 int uniphier_ld4_early_clk_init(const struct uniphier_board_data *bd)
15 {
16         u32 tmp;
17
18         /* deassert reset */
19         tmp = readl(SC_RSTCTRL);
20
21         tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0;
22         if (spl_boot_device() != BOOT_DEVICE_NAND)
23                 tmp &= ~SC_RSTCTRL_NRST_NAND;
24         writel(tmp, SC_RSTCTRL);
25         readl(SC_RSTCTRL); /* dummy read */
26
27         /* provide 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 */
32
33         return 0;
34 }