2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2014-10-03 10:21:06 +00:00
|
|
|
/*
|
2016-08-10 07:08:49 +00:00
|
|
|
* Copyright (C) 2012-2015 Panasonic Corporation
|
|
|
|
* Copyright (C) 2015-2016 Socionext Inc.
|
|
|
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
|
2014-10-03 10:21:06 +00:00
|
|
|
*/
|
|
|
|
|
2016-02-06 03:30:11 +00:00
|
|
|
/* U-Boot - Common settings for UniPhier Family */
|
2014-10-03 10:21:06 +00:00
|
|
|
|
|
|
|
#ifndef __CONFIG_UNIPHIER_COMMON_H__
|
|
|
|
#define __CONFIG_UNIPHIER_COMMON_H__
|
|
|
|
|
2016-08-25 12:03:41 +00:00
|
|
|
#define CONFIG_ARMV7_PSCI_1_0
|
2016-08-10 07:08:49 +00:00
|
|
|
|
2014-10-03 10:21:06 +00:00
|
|
|
/*-----------------------------------------------------------------------
|
|
|
|
* MMU and Cache Setting
|
|
|
|
*----------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/* Comment out the following to enable L1 cache */
|
|
|
|
/* #define CONFIG_SYS_ICACHE_OFF */
|
|
|
|
/* #define CONFIG_SYS_DCACHE_OFF */
|
|
|
|
|
|
|
|
#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
|
|
|
|
|
|
|
|
#define CONFIG_TIMESTAMP
|
|
|
|
|
|
|
|
/* FLASH related */
|
|
|
|
#define CONFIG_MTD_DEVICE
|
|
|
|
|
|
|
|
#define CONFIG_FLASH_CFI_DRIVER
|
|
|
|
#define CONFIG_SYS_FLASH_CFI
|
|
|
|
|
|
|
|
#define CONFIG_SYS_MAX_FLASH_SECT 256
|
|
|
|
#define CONFIG_SYS_MONITOR_BASE 0
|
2018-04-20 08:42:29 +00:00
|
|
|
#define CONFIG_SYS_MONITOR_LEN 0x00090000 /* 576KB */
|
2014-10-03 10:21:06 +00:00
|
|
|
#define CONFIG_SYS_FLASH_BASE 0
|
|
|
|
|
|
|
|
/*
|
2016-10-08 04:25:26 +00:00
|
|
|
* flash_toggle does not work for our support card.
|
2014-10-03 10:21:06 +00:00
|
|
|
* We need to use flash_status_poll.
|
|
|
|
*/
|
|
|
|
#define CONFIG_SYS_CFI_FLASH_STATUS_POLL
|
|
|
|
|
|
|
|
#define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */
|
|
|
|
|
2015-09-11 11:17:45 +00:00
|
|
|
#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
|
2014-10-03 10:21:06 +00:00
|
|
|
|
|
|
|
/* serial console configuration */
|
|
|
|
|
|
|
|
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
|
|
|
|
/* Boot Argument Buffer Size */
|
|
|
|
#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE)
|
|
|
|
|
2017-01-27 21:53:52 +00:00
|
|
|
#define CONFIG_ENV_OFFSET 0x100000
|
2014-10-03 10:21:06 +00:00
|
|
|
#define CONFIG_ENV_SIZE 0x2000
|
|
|
|
/* #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) */
|
|
|
|
|
2016-02-16 08:08:42 +00:00
|
|
|
#define CONFIG_SYS_MMC_ENV_DEV 0
|
|
|
|
#define CONFIG_SYS_MMC_ENV_PART 1
|
|
|
|
|
2017-07-13 11:32:15 +00:00
|
|
|
#if !defined(CONFIG_ARM64)
|
2014-10-03 10:21:06 +00:00
|
|
|
/* Time clock 1MHz */
|
|
|
|
#define CONFIG_SYS_TIMER_RATE 1000000
|
2016-04-21 05:43:18 +00:00
|
|
|
#endif
|
|
|
|
|
2014-10-03 10:21:06 +00:00
|
|
|
#define CONFIG_SYS_MAX_NAND_DEVICE 1
|
|
|
|
#define CONFIG_SYS_NAND_ONFI_DETECTION
|
|
|
|
#define CONFIG_SYS_NAND_REGS_BASE 0x68100000
|
|
|
|
#define CONFIG_SYS_NAND_DATA_BASE 0x68000000
|
|
|
|
#define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
|
|
|
|
|
2016-02-18 10:52:49 +00:00
|
|
|
/* SD/MMC */
|
2016-02-16 08:08:39 +00:00
|
|
|
#define CONFIG_SUPPORT_EMMC_BOOT
|
2016-02-18 10:52:49 +00:00
|
|
|
|
2014-10-03 10:21:06 +00:00
|
|
|
/* memtest works on */
|
|
|
|
#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
|
|
|
|
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x01000000)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Network Configuration
|
|
|
|
*/
|
|
|
|
#define CONFIG_SERVERIP 192.168.11.1
|
|
|
|
#define CONFIG_IPADDR 192.168.11.10
|
|
|
|
#define CONFIG_GATEWAYIP 192.168.11.1
|
|
|
|
#define CONFIG_NETMASK 255.255.255.0
|
|
|
|
|
2018-02-22 10:00:08 +00:00
|
|
|
#define CONFIG_LOADADDR 0x85000000
|
2014-10-03 10:21:06 +00:00
|
|
|
#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
|
2017-10-19 10:17:51 +00:00
|
|
|
#define CONFIG_SYS_BOOTM_LEN (32 << 20)
|
2014-10-03 10:21:06 +00:00
|
|
|
|
2017-07-13 11:32:15 +00:00
|
|
|
#if defined(CONFIG_ARM64)
|
2017-01-27 21:53:54 +00:00
|
|
|
/* ARM Trusted Firmware */
|
|
|
|
#define BOOT_IMAGES \
|
2017-02-12 09:21:16 +00:00
|
|
|
"second_image=unph_bl.bin\0" \
|
2017-01-27 21:53:54 +00:00
|
|
|
"third_image=fip.bin\0"
|
|
|
|
#else
|
|
|
|
#define BOOT_IMAGES \
|
|
|
|
"second_image=u-boot-spl.bin\0" \
|
|
|
|
"third_image=u-boot.bin\0"
|
|
|
|
#endif
|
|
|
|
|
2014-10-03 10:21:06 +00:00
|
|
|
#define CONFIG_BOOTCOMMAND "run $bootmode"
|
|
|
|
|
|
|
|
#define CONFIG_ROOTPATH "/nfs/root/path"
|
|
|
|
#define CONFIG_NFSBOOTCOMMAND \
|
|
|
|
"setenv bootargs $bootargs root=/dev/nfs rw " \
|
|
|
|
"nfsroot=$serverip:$rootpath " \
|
|
|
|
"ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off;" \
|
2016-01-21 05:56:09 +00:00
|
|
|
"run __nfsboot"
|
2014-10-03 10:21:06 +00:00
|
|
|
|
2015-07-21 05:04:18 +00:00
|
|
|
#ifdef CONFIG_FIT
|
|
|
|
#define CONFIG_BOOTFILE "fitImage"
|
|
|
|
#define LINUXBOOT_ENV_SETTINGS \
|
|
|
|
"fit_addr=0x00100000\0" \
|
2018-02-22 10:00:08 +00:00
|
|
|
"fit_addr_r=0x85100000\0" \
|
2015-07-21 05:04:18 +00:00
|
|
|
"fit_size=0x00f00000\0" \
|
2015-09-21 15:27:38 +00:00
|
|
|
"norboot=setexpr fit_addr $nor_base + $fit_addr &&" \
|
2015-07-21 05:04:18 +00:00
|
|
|
"bootm $fit_addr\0" \
|
2015-09-21 15:27:38 +00:00
|
|
|
"nandboot=nand read $fit_addr_r $fit_addr $fit_size &&" \
|
2015-07-21 05:04:19 +00:00
|
|
|
"bootm $fit_addr_r\0" \
|
2015-09-21 15:27:38 +00:00
|
|
|
"tftpboot=tftpboot $fit_addr_r $bootfile &&" \
|
2016-01-21 05:56:09 +00:00
|
|
|
"bootm $fit_addr_r\0" \
|
|
|
|
"__nfsboot=run tftpboot\0"
|
2015-07-21 05:04:18 +00:00
|
|
|
#else
|
2016-04-21 05:43:18 +00:00
|
|
|
#ifdef CONFIG_ARM64
|
2017-01-27 21:53:50 +00:00
|
|
|
#define CONFIG_BOOTFILE "Image.gz"
|
2016-04-21 05:43:18 +00:00
|
|
|
#define LINUXBOOT_CMD "booti"
|
2018-02-22 10:00:08 +00:00
|
|
|
#define KERNEL_ADDR_LOAD "kernel_addr_load=0x85200000\0"
|
2017-05-16 05:35:15 +00:00
|
|
|
#define KERNEL_ADDR_R "kernel_addr_r=0x82080000\0"
|
2016-04-21 05:43:18 +00:00
|
|
|
#else
|
2015-12-18 05:52:32 +00:00
|
|
|
#define CONFIG_BOOTFILE "zImage"
|
2016-04-21 05:43:18 +00:00
|
|
|
#define LINUXBOOT_CMD "bootz"
|
2017-01-27 21:53:50 +00:00
|
|
|
#define KERNEL_ADDR_LOAD "kernel_addr_load=0x80208000\0"
|
2016-04-21 05:43:18 +00:00
|
|
|
#define KERNEL_ADDR_R "kernel_addr_r=0x80208000\0"
|
|
|
|
#endif
|
2015-07-21 05:04:18 +00:00
|
|
|
#define LINUXBOOT_ENV_SETTINGS \
|
|
|
|
"fdt_addr=0x00100000\0" \
|
2018-02-22 10:00:08 +00:00
|
|
|
"fdt_addr_r=0x85100000\0" \
|
2015-07-21 05:04:18 +00:00
|
|
|
"fdt_size=0x00008000\0" \
|
|
|
|
"kernel_addr=0x00200000\0" \
|
2017-01-27 21:53:50 +00:00
|
|
|
KERNEL_ADDR_LOAD \
|
2016-04-21 05:43:18 +00:00
|
|
|
KERNEL_ADDR_R \
|
2018-02-22 10:00:08 +00:00
|
|
|
"kernel_size=0x00e00000\0" \
|
|
|
|
"ramdisk_addr=0x01000000\0" \
|
|
|
|
"ramdisk_addr_r=0x86000000\0" \
|
|
|
|
"ramdisk_size=0x00800000\0" \
|
2015-07-21 05:04:19 +00:00
|
|
|
"ramdisk_file=rootfs.cpio.uboot\0" \
|
2017-01-27 21:53:50 +00:00
|
|
|
"boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \
|
|
|
|
"if test $kernel_addr_load = $kernel_addr_r; then " \
|
|
|
|
"true; " \
|
|
|
|
"else " \
|
|
|
|
"unzip $kernel_addr_load $kernel_addr_r; " \
|
|
|
|
"fi && " \
|
2016-04-21 05:43:18 +00:00
|
|
|
LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \
|
2017-01-27 21:53:50 +00:00
|
|
|
"norboot=setexpr kernel_addr_nor $nor_base + $kernel_addr && " \
|
|
|
|
"setexpr kernel_size_div4 $kernel_size / 4 && " \
|
|
|
|
"cp $kernel_addr_nor $kernel_addr_load $kernel_size_div4 && " \
|
2017-01-27 21:53:51 +00:00
|
|
|
"setexpr ramdisk_addr_nor $nor_base + $ramdisk_addr && " \
|
|
|
|
"setexpr ramdisk_size_div4 $ramdisk_size / 4 && " \
|
|
|
|
"cp $ramdisk_addr_nor $ramdisk_addr_r $ramdisk_size_div4 && " \
|
|
|
|
"setexpr fdt_addr_nor $nor_base + $fdt_addr && " \
|
|
|
|
"setexpr fdt_size_div4 $fdt_size / 4 && " \
|
|
|
|
"cp $fdt_addr_nor $fdt_addr_r $fdt_size_div4 && " \
|
2016-01-21 05:56:08 +00:00
|
|
|
"run boot_common\0" \
|
2017-01-27 21:53:50 +00:00
|
|
|
"nandboot=nand read $kernel_addr_load $kernel_addr $kernel_size && " \
|
2015-07-21 05:04:18 +00:00
|
|
|
"nand read $ramdisk_addr_r $ramdisk_addr $ramdisk_size &&" \
|
|
|
|
"nand read $fdt_addr_r $fdt_addr $fdt_size &&" \
|
2016-01-21 05:56:08 +00:00
|
|
|
"run boot_common\0" \
|
2017-01-27 21:53:50 +00:00
|
|
|
"tftpboot=tftpboot $kernel_addr_load $bootfile && " \
|
2015-07-21 05:04:19 +00:00
|
|
|
"tftpboot $ramdisk_addr_r $ramdisk_file &&" \
|
2018-05-17 10:55:20 +00:00
|
|
|
"tftpboot $fdt_addr_r $fdtfile &&" \
|
2016-01-21 05:56:09 +00:00
|
|
|
"run boot_common\0" \
|
2017-01-27 21:53:50 +00:00
|
|
|
"__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
|
2018-05-17 10:55:20 +00:00
|
|
|
"tftpboot $fdt_addr_r $fdtfile &&" \
|
2016-01-21 05:56:09 +00:00
|
|
|
"setenv ramdisk_addr_r - &&" \
|
2016-01-21 05:56:08 +00:00
|
|
|
"run boot_common\0"
|
2015-07-21 05:04:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CONFIG_EXTRA_ENV_SETTINGS \
|
|
|
|
"netdev=eth0\0" \
|
2017-01-27 21:53:51 +00:00
|
|
|
"initrd_high=0xffffffffffffffff\0" \
|
2016-01-21 05:56:06 +00:00
|
|
|
"nor_base=0x42000000\0" \
|
2016-03-24 13:23:36 +00:00
|
|
|
"sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \
|
2017-01-27 21:53:54 +00:00
|
|
|
"tftpboot $tmp_addr $second_image && " \
|
2017-01-27 21:53:53 +00:00
|
|
|
"setexpr tmp_addr $nor_base + 0x70000 && " \
|
2017-01-27 21:53:54 +00:00
|
|
|
"tftpboot $tmp_addr $third_image\0" \
|
2016-02-16 08:08:41 +00:00
|
|
|
"emmcupdate=mmcsetn &&" \
|
2018-04-20 09:38:27 +00:00
|
|
|
"mmc dev $mmc_first_dev &&" \
|
2016-02-16 08:08:41 +00:00
|
|
|
"mmc partconf $mmc_first_dev 0 1 1 &&" \
|
2017-01-27 21:53:54 +00:00
|
|
|
"tftpboot $second_image && " \
|
2017-01-27 21:53:53 +00:00
|
|
|
"mmc write $loadaddr 0 100 && " \
|
2017-01-27 21:53:54 +00:00
|
|
|
"tftpboot $third_image && " \
|
2018-02-02 05:16:36 +00:00
|
|
|
"mmc write $loadaddr 100 f00\0" \
|
2015-07-21 05:04:18 +00:00
|
|
|
"nandupdate=nand erase 0 0x00100000 &&" \
|
2017-01-27 21:53:54 +00:00
|
|
|
"tftpboot $second_image && " \
|
2017-01-27 21:53:53 +00:00
|
|
|
"nand write $loadaddr 0 0x00020000 && " \
|
2017-01-27 21:53:54 +00:00
|
|
|
"tftpboot $third_image && " \
|
2018-02-02 05:16:36 +00:00
|
|
|
"nand write $loadaddr 0x00020000 0x001e0000\0" \
|
2017-05-10 11:57:39 +00:00
|
|
|
"usbupdate=usb start &&" \
|
|
|
|
"tftpboot $second_image && " \
|
|
|
|
"usb write $loadaddr 0 100 && " \
|
|
|
|
"tftpboot $third_image && " \
|
2018-02-02 05:16:36 +00:00
|
|
|
"usb write $loadaddr 100 f00\0" \
|
2017-01-27 21:53:54 +00:00
|
|
|
BOOT_IMAGES \
|
2015-07-21 05:04:18 +00:00
|
|
|
LINUXBOOT_ENV_SETTINGS
|
2014-10-03 10:21:06 +00:00
|
|
|
|
2016-01-08 17:12:26 +00:00
|
|
|
#define CONFIG_SYS_BOOTMAPSZ 0x20000000
|
|
|
|
|
2015-09-11 11:17:49 +00:00
|
|
|
#define CONFIG_SYS_SDRAM_BASE 0x80000000
|
ARM: uniphier: detect RAM size by decoding HW register instead of DT
U-Boot needs to set up available memory area(s) in dram_init() and
dram_init_banksize(). It is platform-dependent how to detect the
memory banks. Currently, UniPhier adopts the memory banks _alleged_
by DT. This is based on the assumption that users bind a correct DT
in their build process.
Come to think of it, the DRAM controller has already been set up
before U-Boot is entered (because U-Boot runs on DRAM). So, the
DRAM controller setup register seems a more reliable source of any
information about DRAM stuff. The DRAM banks are initialized by
preliminary firmware (SPL, ARM Trusted Firmware BL2, or whatever),
so this means the source of the reliability is shifted from Device
Tree to such early-stage firmware. However, if the DRAM controller
is wrongly configured, the system will crash. If your system is
running, the DRAM setup register is very likely to provide the
correct DRAM mapping.
Decode the SG_MEMCONF register to get the available DRAM banks.
The dram_init() and dram_init_banksize() need similar decoding.
It would be nice if dram_init_banksize() could reuse the outcome
of dram_init(), but global variables are unavailable at this stage
because the .bss section is available only after the relocation.
As a result, SG_MEMCONF must be checked twice, but a new helper
uniphier_memconf_decode() will help to avoid code duplication.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-27 21:53:43 +00:00
|
|
|
#define CONFIG_NR_DRAM_BANKS 3
|
2014-10-03 10:21:06 +00:00
|
|
|
|
2017-01-27 21:53:49 +00:00
|
|
|
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE)
|
|
|
|
|
|
|
|
/* only for SPL */
|
2017-08-13 00:01:13 +00:00
|
|
|
#if defined(CONFIG_ARCH_UNIPHIER_LD4) || \
|
2016-03-18 07:41:43 +00:00
|
|
|
defined(CONFIG_ARCH_UNIPHIER_SLD8)
|
2014-12-05 15:03:22 +00:00
|
|
|
#define CONFIG_SPL_TEXT_BASE 0x00040000
|
2015-09-21 15:27:39 +00:00
|
|
|
#else
|
2014-12-05 15:03:22 +00:00
|
|
|
#define CONFIG_SPL_TEXT_BASE 0x00100000
|
|
|
|
#endif
|
|
|
|
|
2018-04-23 06:10:51 +00:00
|
|
|
#define CONFIG_SPL_STACK (0x00200000)
|
2015-03-22 15:07:24 +00:00
|
|
|
|
2017-01-27 21:53:53 +00:00
|
|
|
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000
|
2016-03-22 16:40:04 +00:00
|
|
|
|
2016-03-22 16:40:05 +00:00
|
|
|
/* subtract sizeof(struct image_header) */
|
2017-01-27 21:53:53 +00:00
|
|
|
#define CONFIG_SYS_UBOOT_BASE (0x70000 - 0x40)
|
2014-10-03 10:21:06 +00:00
|
|
|
|
2016-03-22 16:40:05 +00:00
|
|
|
#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
|
2015-03-22 15:07:27 +00:00
|
|
|
#define CONFIG_SPL_MAX_FOOTPRINT 0x10000
|
2016-03-24 13:22:23 +00:00
|
|
|
#define CONFIG_SPL_MAX_SIZE 0x10000
|
2016-04-21 05:43:18 +00:00
|
|
|
#define CONFIG_SPL_BSS_MAX_SIZE 0x2000
|
2015-03-22 15:07:27 +00:00
|
|
|
|
2017-01-27 21:53:53 +00:00
|
|
|
#define CONFIG_SPL_PAD_TO 0x20000
|
|
|
|
|
2014-10-03 10:21:06 +00:00
|
|
|
#endif /* __CONFIG_UNIPHIER_COMMON_H__ */
|