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