1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2012-2015 Panasonic Corporation
4 * Copyright (C) 2015-2016 Socionext Inc.
8 /* U-Boot - Common settings for UniPhier Family */
10 #ifndef __CONFIG_UNIPHIER_H__
11 #define __CONFIG_UNIPHIER_H__
13 #include <config_distro_bootcmd.h>
16 #define BOOT_TARGET_DEVICE_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
18 #define BOOT_TARGET_DEVICE_MMC(func)
21 #ifdef CONFIG_CMD_UBIFS
22 #define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot)
24 #define BOOT_TARGET_DEVICE_UBIFS(func)
28 #define BOOT_TARGET_DEVICE_USB(func) func(USB, usb, 0)
30 #define BOOT_TARGET_DEVICE_USB(func)
33 #define BOOT_TARGET_DEVICES(func) \
34 BOOT_TARGET_DEVICE_MMC(func) \
35 BOOT_TARGET_DEVICE_UBIFS(func) \
36 BOOT_TARGET_DEVICE_USB(func)
38 #if !defined(CONFIG_ARM64)
39 #define CFG_SYS_HZ_CLOCK 50000000
42 #define CFG_SYS_NAND_REGS_BASE 0x68100000
43 #define CFG_SYS_NAND_DATA_BASE 0x68000000
46 * Network Configuration
49 #if defined(CONFIG_ARM64)
50 /* ARM Trusted Firmware */
52 "second_image=unph_bl.bin\0" \
53 "third_image=fip.bin\0"
56 "second_image=u-boot-spl.bin\0" \
57 "third_image=u-boot.bin\0"
61 #define KERNEL_ADDR_R_OFFSET "0x05100000"
62 #define LINUXBOOT_ENV_SETTINGS \
63 "tftpboot=tftpboot $kernel_addr_r $bootfile &&" \
64 "bootm $kernel_addr_r\0" \
65 "__nfsboot=run tftpboot\0"
68 #define LINUXBOOT_CMD "booti"
69 #define KERNEL_ADDR_R_OFFSET "0x02080000"
71 #define LINUXBOOT_CMD "bootz"
72 #define KERNEL_ADDR_R_OFFSET "0x00208000"
74 #define LINUXBOOT_ENV_SETTINGS \
75 "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \
76 LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \
77 "tftpboot=tftpboot $kernel_addr_r $bootfile && " \
78 "tftpboot $fdt_addr_r $fdtfile &&" \
79 "tftpboot $ramdisk_addr_r $ramdisk_file &&" \
80 "setenv ramdisk_addr_r $ramdisk_addr_r:$filesize &&" \
82 "__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
83 "tftpboot $fdt_addr_r $fdtfile &&" \
84 "setenv ramdisk_addr_r - &&" \
88 #define CFG_EXTRA_ENV_SETTINGS \
89 "fdt_addr_r_offset=0x05100000\0" \
90 "kernel_addr_r_offset=" KERNEL_ADDR_R_OFFSET "\0" \
91 "ramdisk_addr_r_offset=0x06000000\0" \
92 "ramdisk_file=rootfs.cpio.gz\0" \
94 "initrd_high=0xffffffffffffffff\0" \
95 "loadaddr_offset=0x05000000\0" \
97 "scriptaddr=0x85000000\0" \
98 "nor_base=0x42000000\0" \
99 "emmcboot=mmcsetn && run bootcmd_mmc${mmc_first_dev}\0" \
100 "nandboot=run bootcmd_ubifs0\0" \
101 "norboot=run tftpboot\0" \
102 "sdboot=sdsetn && run bootcmd_mmc${sd_first_dev}\0" \
103 "usbboot=run bootcmd_usb0\0" \
104 "emmcscript=setenv devtype mmc && " \
106 "setenv devnum ${mmc_first_dev} && " \
107 "run loadscript_fat\0" \
108 "nandscript=echo Running ${script} from ubi ... && " \
110 "ubifsmount ubi0:boot && " \
111 "ubifsload ${loadaddr} ${script} && " \
112 "source $loadaddr\0" \
113 "sdscript=setenv devtype mmc && " \
115 "setenv devnum ${sd_first_dev} && " \
116 "run loadscript_fat\0" \
117 "norscript=echo Running ${script} from tftp ... && " \
118 "tftpboot ${script} &&" \
119 "source $loadaddr\0" \
120 "usbscript=usb start && " \
121 "setenv devtype usb && " \
122 "setenv devnum 0 && " \
123 "run loadscript_fat\0" \
124 "loadscript_fat=echo Running ${script} from ${devtype}${devnum} ... && " \
125 "load ${devtype} ${devnum}:1 ${loadaddr} ${script} && " \
126 "source $loadaddr\0" \
127 "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \
128 "tftpboot $tmp_addr $second_image && " \
129 "setexpr tmp_addr $nor_base + 0x70000 && " \
130 "tftpboot $tmp_addr $third_image\0" \
131 "emmcupdate=mmcsetn &&" \
132 "mmc dev $mmc_first_dev &&" \
133 "mmc partconf $mmc_first_dev 0 1 1 &&" \
134 "tftpboot $second_image && " \
135 "mmc write $loadaddr 0 100 && " \
136 "tftpboot $third_image && " \
137 "mmc write $loadaddr 100 f00\0" \
138 "nandupdate=nand erase 0 0x00100000 &&" \
139 "tftpboot $second_image && " \
140 "nand write $loadaddr 0 0x00020000 && " \
141 "tftpboot $third_image && " \
142 "nand write $loadaddr 0x00020000 0x001e0000\0" \
143 "sdupdate=sdsetn &&" \
144 "mmc dev $sd_first_dev &&" \
145 "tftpboot $second_image && " \
146 "mmc write $loadaddr 0 100 && " \
147 "tftpboot $third_image && " \
148 "mmc write $loadaddr 100 f00\0" \
149 "usbupdate=usb start &&" \
150 "tftpboot $second_image && " \
151 "usb write $loadaddr 0 100 && " \
152 "tftpboot $third_image && " \
153 "usb write $loadaddr 100 f00\0" \
155 LINUXBOOT_ENV_SETTINGS \
158 #define CFG_SYS_BOOTMAPSZ 0x20000000
162 /* subtract sizeof(struct legacy_img_hdr) */
163 #define CFG_SYS_UBOOT_BASE (0x130000 - 0x40)
165 #endif /* __CONFIG_UNIPHIER_H__ */