blob: 6574767f30c001302d367f4e95b488aef3ae4d09 [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 Yamadaefdf3402016-01-09 01:51:13 +090010
11#include "../init.h"
12#include "../sc-regs.h"
Masahiro Yamadac04368f2015-02-27 02:26:51 +090013
Masahiro Yamada75f16f82015-09-22 00:27:39 +090014int ph1_ld4_early_clk_init(const struct uniphier_board_data *bd)
Masahiro Yamadac04368f2015-02-27 02:26:51 +090015{
16 u32 tmp;
17
18 /* deassert reset */
19 tmp = readl(SC_RSTCTRL);
Masahiro Yamada4b9c6f22015-02-27 02:26:52 +090020
Masahiro Yamadac04368f2015-02-27 02:26:51 +090021 tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0;
Masahiro Yamada4b9c6f22015-02-27 02:26:52 +090022 if (spl_boot_device() != BOOT_DEVICE_NAND)
23 tmp &= ~SC_RSTCTRL_NRST_NAND;
Masahiro Yamadac04368f2015-02-27 02:26:51 +090024 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 Yamada75f16f82015-09-22 00:27:39 +090032
33 return 0;
Masahiro Yamadac04368f2015-02-27 02:26:51 +090034}