blob: f646c9b7df918a70bbfa81766420fc71a72ce02a [file] [log] [blame]
Masahiro Yamada198a97a2015-02-27 02:26:51 +09001/*
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +09002 * Copyright (C) 2011-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>
Masahiro Yamada198a97a2015-02-27 02:26:51 +09003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
Masahiro Yamadad3384bf2015-02-27 02:26:52 +09007#include <common.h>
8#include <spl.h>
Masahiro Yamadaf6e7f072015-05-29 17:30:00 +09009#include <linux/io.h>
Masahiro Yamada323d1f92015-09-22 00:27:39 +090010#include <mach/init.h>
Masahiro Yamada198a97a2015-02-27 02:26:51 +090011#include <mach/sc-regs.h>
12
Masahiro Yamada323d1f92015-09-22 00:27:39 +090013int ph1_ld4_early_clk_init(const struct uniphier_board_data *bd)
Masahiro Yamada198a97a2015-02-27 02:26:51 +090014{
15 u32 tmp;
16
17 /* deassert reset */
18 tmp = readl(SC_RSTCTRL);
Masahiro Yamadad3384bf2015-02-27 02:26:52 +090019
Masahiro Yamada198a97a2015-02-27 02:26:51 +090020 tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0;
Masahiro Yamadad3384bf2015-02-27 02:26:52 +090021 if (spl_boot_device() != BOOT_DEVICE_NAND)
22 tmp &= ~SC_RSTCTRL_NRST_NAND;
Masahiro Yamada198a97a2015-02-27 02:26:51 +090023 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 Yamada323d1f92015-09-22 00:27:39 +090031
32 return 0;
Masahiro Yamada198a97a2015-02-27 02:26:51 +090033}