diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-07-21 14:04:22 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-07-23 23:42:22 +0900 |
commit | 3365b4eb5543ae26579321da34cca42e38ac130f (patch) | |
tree | 3da8e615f2f020eda20f50cef1b79b83c36e4bd3 /arch/arm/mach-uniphier/ph1-sld3/memconf.c | |
parent | ad6670ee12a1783aeb54881fa5bb2e5582ba2dbc (diff) | |
download | u-boot-imx-3365b4eb5543ae26579321da34cca42e38ac130f.zip u-boot-imx-3365b4eb5543ae26579321da34cca42e38ac130f.tar.gz u-boot-imx-3365b4eb5543ae26579321da34cca42e38ac130f.tar.bz2 |
ARM: UniPhier: add PH1-sLD3 SoC support
The init code for UMC (Unified Memory Controller) and PLL has not
been mainlined yet, but U-boot proper should work.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier/ph1-sld3/memconf.c')
-rw-r--r-- | arch/arm/mach-uniphier/ph1-sld3/memconf.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-uniphier/ph1-sld3/memconf.c b/arch/arm/mach-uniphier/ph1-sld3/memconf.c new file mode 100644 index 0000000..553a9e3 --- /dev/null +++ b/arch/arm/mach-uniphier/ph1-sld3/memconf.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <linux/types.h> +#include <linux/sizes.h> +#include <mach/sg-regs.h> + +static inline u32 sg_memconf_val_ch2(unsigned long size, int num) +{ + int size_mb = size / num; + u32 ret; + + switch (size_mb) { + case SZ_64M: + ret = SG_MEMCONF_CH2_SZ_64M; + break; + case SZ_128M: + ret = SG_MEMCONF_CH2_SZ_128M; + break; + case SZ_256M: + ret = SG_MEMCONF_CH2_SZ_256M; + break; + case SZ_512M: + ret = SG_MEMCONF_CH2_SZ_512M; + break; + default: + BUG(); + break; + } + + switch (num) { + case 1: + ret |= SG_MEMCONF_CH2_NUM_1; + break; + case 2: + ret |= SG_MEMCONF_CH2_NUM_2; + break; + default: + BUG(); + break; + } + return ret; +} + +u32 memconf_additional_val(void) +{ + return sg_memconf_val_ch2(CONFIG_SDRAM2_SIZE, CONFIG_DDR_NUM_CH2); +} |