Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011-2014 Panasonic Corporation |
| 3 | * Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/arch/sg-regs.h> |
| 11 | |
| 12 | void sg_init(void) |
| 13 | { |
| 14 | u32 tmp; |
| 15 | |
| 16 | /* Set DDR size */ |
| 17 | tmp = sg_memconf_val_ch0(CONFIG_SDRAM0_SIZE, CONFIG_DDR_NUM_CH0); |
| 18 | tmp |= sg_memconf_val_ch1(CONFIG_SDRAM1_SIZE, CONFIG_DDR_NUM_CH1); |
| 19 | #if CONFIG_SDRAM0_BASE + CONFIG_SDRAM0_SIZE < CONFIG_SDRAM1_BASE |
| 20 | tmp |= SG_MEMCONF_SPARSEMEM; |
| 21 | #endif |
| 22 | writel(tmp, SG_MEMCONF); |
| 23 | |
Masahiro Yamada | 89a7c77 | 2015-01-13 18:54:34 +0900 | [diff] [blame] | 24 | /* Input ports must be enabled before deasserting reset of cores */ |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 25 | tmp = readl(SG_IECTRL); |
Masahiro Yamada | 4484374 | 2015-01-19 22:31:10 +0900 | [diff] [blame] | 26 | tmp |= 1 << 6; |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 27 | writel(tmp, SG_IECTRL); |
| 28 | } |