]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/mach-uniphier/ph1-ld4/sg_init.c
de83962cb27932ec865223dfdcce9810486c419d
[karo-tx-uboot.git] / arch / arm / mach-uniphier / ph1-ld4 / sg_init.c
1 /*
2  * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <linux/io.h>
8 #include <mach/sg-regs.h>
9
10 void sg_init(void)
11 {
12         u32 tmp;
13
14         /* Set DDR size */
15         tmp = sg_memconf_val_ch0(CONFIG_SDRAM0_SIZE, CONFIG_DDR_NUM_CH0);
16         tmp |= sg_memconf_val_ch1(CONFIG_SDRAM1_SIZE, CONFIG_DDR_NUM_CH1);
17 #if CONFIG_SDRAM0_BASE + CONFIG_SDRAM0_SIZE < CONFIG_SDRAM1_BASE
18         tmp |= SG_MEMCONF_SPARSEMEM;
19 #endif
20         writel(tmp, SG_MEMCONF);
21
22         /* Input ports must be enabled before deasserting reset of cores */
23         tmp = readl(SG_IECTRL);
24         tmp |= 0x1;
25         writel(tmp, SG_IECTRL);
26 }