blob: f32f78dd26d8b9b712a49dbbeaf2f15a7023dd00 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadaddb19002017-01-15 14:59:03 +09002/*
3 * Copyright (C) 2011-2014 Panasonic Corporation
4 * Copyright (C) 2015-2017 Socionext Inc.
Masahiro Yamadaddb19002017-01-15 14:59:03 +09005 */
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
Masahiro Yamadad3c14612017-08-13 09:01:13 +090014void uniphier_ld4_early_clk_init(void)
Masahiro Yamadaddb19002017-01-15 14:59:03 +090015{
16 u32 tmp;
17
18 /* deassert reset */
19 if (spl_boot_device() != BOOT_DEVICE_NAND) {
Masahiro Yamadac84024c2019-07-10 20:07:41 +090020 tmp = readl(sc_base + SC_RSTCTRL);
Masahiro Yamadaddb19002017-01-15 14:59:03 +090021 tmp &= ~SC_RSTCTRL_NRST_NAND;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090022 writel(tmp, sc_base + SC_RSTCTRL);
Masahiro Yamadaddb19002017-01-15 14:59:03 +090023 };
24
25 /* provide clocks */
Masahiro Yamadac84024c2019-07-10 20:07:41 +090026 tmp = readl(sc_base + SC_CLKCTRL);
Masahiro Yamadaddb19002017-01-15 14:59:03 +090027 tmp |= SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI;
Masahiro Yamadac84024c2019-07-10 20:07:41 +090028 writel(tmp, sc_base + SC_CLKCTRL);
29 readl(sc_base + SC_CLKCTRL); /* dummy read */
Masahiro Yamadaddb19002017-01-15 14:59:03 +090030}