]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/mach-uniphier/ph1-pro4/early_clkrst_init.c
sunxi: Fix gmac not working on the Colombus board
[karo-tx-uboot.git] / arch / arm / mach-uniphier / ph1-pro4 / early_clkrst_init.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 #include <mach/sc-regs.h>
11
12 void early_clkrst_init(void)
13 {
14         u32 tmp;
15
16         /* deassert reset */
17         tmp = readl(SC_RSTCTRL);
18
19         tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0;
20         if (spl_boot_device() != BOOT_DEVICE_NAND)
21                 tmp &= ~SC_RSTCTRL_NRST_NAND;
22         writel(tmp, SC_RSTCTRL);
23         readl(SC_RSTCTRL); /* dummy read */
24
25         /* privide clocks */
26         tmp = readl(SC_CLKCTRL);
27         tmp |= SC_CLKCTRL_CEN_UMC | SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI;
28         writel(tmp, SC_CLKCTRL);
29         readl(SC_CLKCTRL); /* dummy read */
30 }