Convert CONFIG_SPL_TARGET to Kconfig
[platform/kernel/u-boot.git] / include / configs / uniphier.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2012-2015 Panasonic Corporation
4  * Copyright (C) 2015-2016 Socionext Inc.
5  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
6  */
7
8 /* U-Boot - Common settings for UniPhier Family */
9
10 #ifndef __CONFIG_UNIPHIER_H__
11 #define __CONFIG_UNIPHIER_H__
12
13 #ifndef CONFIG_SPL_BUILD
14 #include <config_distro_bootcmd.h>
15
16 #ifdef CONFIG_CMD_MMC
17 #define BOOT_TARGET_DEVICE_MMC(func)    func(MMC, mmc, 0) func(MMC, mmc, 1)
18 #else
19 #define BOOT_TARGET_DEVICE_MMC(func)
20 #endif
21
22 #ifdef CONFIG_CMD_UBIFS
23 #define BOOT_TARGET_DEVICE_UBIFS(func)  func(UBIFS, ubifs, 0)
24 #else
25 #define BOOT_TARGET_DEVICE_UBIFS(func)
26 #endif
27
28 #ifdef CONFIG_CMD_USB
29 #define BOOT_TARGET_DEVICE_USB(func)    func(USB, usb, 0)
30 #else
31 #define BOOT_TARGET_DEVICE_USB(func)
32 #endif
33
34 #define BOOT_TARGET_DEVICES(func)       \
35         BOOT_TARGET_DEVICE_MMC(func)    \
36         BOOT_TARGET_DEVICE_UBIFS(func)  \
37         BOOT_TARGET_DEVICE_USB(func)
38 #else
39 #define BOOTENV
40 #endif
41
42 #define CONFIG_SYS_MONITOR_LEN          0x00200000      /* 2MB */
43
44 #if !defined(CONFIG_ARM64)
45 /* Time clock 1MHz */
46 #define CONFIG_SYS_TIMER_RATE                   1000000
47 #endif
48
49 #define CONFIG_SYS_MAX_NAND_DEVICE                      1
50 #define CONFIG_SYS_NAND_REGS_BASE                       0x68100000
51 #define CONFIG_SYS_NAND_DATA_BASE                       0x68000000
52
53 /*
54  * Network Configuration
55  */
56 #define CONFIG_SERVERIP                 192.168.11.1
57 #define CONFIG_IPADDR                   192.168.11.10
58 #define CONFIG_GATEWAYIP                192.168.11.1
59 #define CONFIG_NETMASK                  255.255.255.0
60
61 #define CONFIG_SYS_BOOTM_LEN            (32 << 20)
62
63 #if defined(CONFIG_ARM64)
64 /* ARM Trusted Firmware */
65 #define BOOT_IMAGES \
66         "second_image=unph_bl.bin\0" \
67         "third_image=fip.bin\0"
68 #else
69 #define BOOT_IMAGES \
70         "second_image=u-boot-spl.bin\0" \
71         "third_image=u-boot.bin\0"
72 #endif
73
74 #define CONFIG_ROOTPATH                 "/nfs/root/path"
75
76 #ifdef CONFIG_FIT
77 #define KERNEL_ADDR_R_OFFSET            "0x05100000"
78 #define LINUXBOOT_ENV_SETTINGS \
79         "tftpboot=tftpboot $kernel_addr_r $bootfile &&" \
80                 "bootm $kernel_addr_r\0" \
81         "__nfsboot=run tftpboot\0"
82 #else
83 #ifdef CONFIG_ARM64
84 #define LINUXBOOT_CMD                   "booti"
85 #define KERNEL_ADDR_R_OFFSET            "0x02080000"
86 #else
87 #define LINUXBOOT_CMD                   "bootz"
88 #define KERNEL_ADDR_R_OFFSET            "0x00208000"
89 #endif
90 #define LINUXBOOT_ENV_SETTINGS \
91         "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \
92                 LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \
93         "tftpboot=tftpboot $kernel_addr_r $bootfile && " \
94                 "tftpboot $fdt_addr_r $fdtfile &&" \
95                 "tftpboot $ramdisk_addr_r $ramdisk_file &&" \
96                 "setenv ramdisk_addr_r $ramdisk_addr_r:$filesize &&" \
97                 "run boot_common\0" \
98         "__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
99                 "tftpboot $fdt_addr_r $fdtfile &&" \
100                 "setenv ramdisk_addr_r - &&" \
101                 "run boot_common\0"
102 #endif
103
104 #define CONFIG_EXTRA_ENV_SETTINGS                               \
105         "fdt_addr_r_offset=0x05100000\0" \
106         "kernel_addr_r_offset=" KERNEL_ADDR_R_OFFSET "\0" \
107         "ramdisk_addr_r_offset=0x06000000\0" \
108         "ramdisk_file=rootfs.cpio.gz\0" \
109         "netdev=eth0\0"                                         \
110         "initrd_high=0xffffffffffffffff\0"                      \
111         "loadaddr_offset=0x05000000\0" \
112         "script=boot.scr\0" \
113         "scriptaddr=0x85000000\0"                               \
114         "nor_base=0x42000000\0"                                 \
115         "emmcboot=mmcsetn && run bootcmd_mmc${mmc_first_dev}\0" \
116         "nandboot=run bootcmd_ubifs0\0" \
117         "norboot=run tftpboot\0" \
118         "sdboot=sdsetn && run bootcmd_mmc${sd_first_dev}\0" \
119         "usbboot=run bootcmd_usb0\0" \
120         "emmcscript=setenv devtype mmc && " \
121                 "mmcsetn && " \
122                 "setenv devnum ${mmc_first_dev} && " \
123                 "run loadscript_fat\0" \
124         "nandscript=echo Running ${script} from ubi ... && " \
125                 "ubi part UBI && " \
126                 "ubifsmount ubi0:boot && " \
127                 "ubifsload ${loadaddr} ${script} && " \
128                 "source $loadaddr\0" \
129         "sdscript=setenv devtype mmc && " \
130                 "sdsetn && " \
131                 "setenv devnum ${sd_first_dev} && " \
132                 "run loadscript_fat\0" \
133         "norscript=echo Running ${script} from tftp ... && " \
134                 "tftpboot ${script} &&" \
135                 "source $loadaddr\0" \
136         "usbscript=usb start && " \
137                 "setenv devtype usb && " \
138                 "setenv devnum 0 && " \
139                 "run loadscript_fat\0" \
140         "loadscript_fat=echo Running ${script} from ${devtype}${devnum} ... && " \
141                 "load ${devtype} ${devnum}:1 ${loadaddr} ${script} && " \
142                 "source $loadaddr\0" \
143         "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&"    \
144                 "tftpboot $tmp_addr $second_image && " \
145                 "setexpr tmp_addr $nor_base + 0x70000 && " \
146                 "tftpboot $tmp_addr $third_image\0" \
147         "emmcupdate=mmcsetn &&"                                 \
148                 "mmc dev $mmc_first_dev &&"                     \
149                 "mmc partconf $mmc_first_dev 0 1 1 &&"          \
150                 "tftpboot $second_image && " \
151                 "mmc write $loadaddr 0 100 && " \
152                 "tftpboot $third_image && " \
153                 "mmc write $loadaddr 100 f00\0" \
154         "nandupdate=nand erase 0 0x00100000 &&"                 \
155                 "tftpboot $second_image && " \
156                 "nand write $loadaddr 0 0x00020000 && " \
157                 "tftpboot $third_image && " \
158                 "nand write $loadaddr 0x00020000 0x001e0000\0" \
159         "sdupdate=sdsetn &&" \
160                 "mmc dev $sd_first_dev &&" \
161                 "tftpboot $second_image && " \
162                 "mmc write $loadaddr 0 100 && " \
163                 "tftpboot $third_image && " \
164                 "mmc write $loadaddr 100 f00\0" \
165         "usbupdate=usb start &&" \
166                 "tftpboot $second_image && " \
167                 "usb write $loadaddr 0 100 && " \
168                 "tftpboot $third_image && " \
169                 "usb write $loadaddr 100 f00\0" \
170         BOOT_IMAGES \
171         LINUXBOOT_ENV_SETTINGS \
172         BOOTENV
173
174 #define CONFIG_SYS_BOOTMAPSZ                    0x20000000
175
176 /* only for SPL */
177
178 /* subtract sizeof(struct image_header) */
179 #define CONFIG_SYS_UBOOT_BASE                   (0x130000 - 0x40)
180
181 #endif /* __CONFIG_UNIPHIER_H__ */