16aa91cd8bf7a2c857c3615b0d5bab8e18dbdb71
[platform/kernel/u-boot.git] / include / samsung / tizen_rpi.h
1 /*
2  * Copyright (C) 2019 Samsung Electronics
3  *
4  * Configuration settings for the Tizen RPI board.
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #ifndef __CONFIG_TIZEN_RPI_H
10 #define __CONFIG_TIZEN_RPI_H
11
12 /* SPL */
13 #ifdef CONFIG_SPL_BUILD
14 #define CONFIG_SPL_TEXT_BASE            0x00008000
15 #define CONFIG_SPL_MAX_SIZE             0x00030000
16 #define CONFIG_SPL_BSS_START_ADDR       0x00380000
17 #define CONFIG_SPL_BSS_MAX_SIZE         0x00040000
18 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION      1
19 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
20 #endif
21
22 /* DFU */
23 #define DFU_ALT_SYSTEM                          \
24         "Image fat 0 1;"                        \
25         "bcm2710-rpi-3-b.dtb fat 0 1;"          \
26         "bcm2837-rpi-3-b.dtb fat 0 1;"          \
27         "bcm2710-rpi-3-b-plus.dtb fat 0 1;"     \
28         "bcm2711-rpi-4-b.dtb fat 0 1;"          \
29         "u-boot.bin fat 0 1;"                   \
30         "uboot.env fat 0 1;"                    \
31         "boot.scr.uimg fat 0 1;"                \
32         "zImage fat 0 1;"                       \
33         "boot.img part 0 1;"                    \
34         "rootfs part 0 2;"                      \
35         "system-data part 0 3;"                 \
36         "user part 0 5;"                        \
37         "module part 0 6;"                      \
38         "ramdisk.img part 0 7;"                 \
39         "ramdisk-recovery part 0 8;"            \
40         "hal.img part 0 10"
41
42 #define CONFIG_SET_DFU_ALT_BUF_LEN      (SZ_1K)
43
44 #define PARTS_DEFAULT \
45         "name=boot,start=4M,size=64M,bootable,id=0x0e;"         \
46         "name=rootfs,size=3072M,id=0x83;"                       \
47         "name=system-data,size=1344M,id=0x83;"                  \
48         "name=[ext],size=-,id=0x05;"                            \
49         "name=user,size=-,id=0x83;"                             \
50         "name=modules,size=32M,id=0x83;"                        \
51         "name=ramdisk,size=8M,id=0x83;"                         \
52         "name=ramdisk-recovery,size=32M,id=0x83;"               \
53         "name=inform,size=8M,id=0x83;"                          \
54         "name=hal,size=256M,id=0x83;"                           \
55         "name=reserved2,size=125M,id=0x83;"                     \
56         ""
57
58 #define MBR_CHECK       \
59         "env default mbr_parts; "                                       \
60         "if mbr verify ${bootdev} ${mmcbootdev}; "                      \
61         "then true; else "                                              \
62         "echo \"MBR partition layout does not match flashed bootloader!\"; " \
63         "echo \"Please format SD card with recent sd_fusing_rpi3.sh script.\"; " \
64         "askenv tmp \"Press ENTER to continue\"; "                      \
65         "fi"
66
67 #define GPT_PARTS_DEFAULT \
68         "uuid_disk=${uuid_gpt_disk};"                           \
69         "name=boot_a,start=4MiB,uuid=${uuid_gpt_boot_a},size=64MiB,type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B;"  \
70         "name=rootfs_a,size=3072MiB,uuid=${uuid_gpt_rootfs_a},type=linux;"      \
71         "name=system-data,size=1344MiB,uuid=${uuid_gpt_data},type=linux;"       \
72         "name=none,size=36MiB,uuid=${uuid_gpt_none},type=linux;"        \
73         "name=user,size=6636MiB,uuid=${uuid_gpt_user},type=linux;"      \
74         "name=module_a,size=32MiB,uuid=${uuid_gpt_module_a},type=linux;"        \
75         "name=ramdisk_a,size=32MiB,uuid=${uuid_gpt_ramdisk_a},type=linux;"      \
76         "name=ramdisk-recovery_a,size=32MiB,uuid=${uuid_gpt_ramdisk-recovery_a},type=linux;"    \
77         "name=inform,size=8MiB,uuid=${uuid_gpt_inform},type=linux;"     \
78         "name=hal_a,size=256MiB,uuid=${uuid_gpt_hal_a},type=linux;"     \
79         "name=boot_b,size=64MiB,uuid=${uuid_gpt_boot_b},type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B;"     \
80         "name=rootfs_b,size=3072MiB,uuid=${uuid_gpt_rootf_b},type=linux;"       \
81         "name=module_b,size=32MiB,uuid=${uuid_gpt_module_b},type=linux;"        \
82         "name=ramdisk_b,size=32MiB,uuid=${uuid_gpt_ramdisk_b},type=linux;"      \
83         "name=ramdisk-recovery_b,size=32MiB,uuid=${uuid_gpt_ramdisk-recovery_b},type=linux;"    \
84         "name=hal_b,size=256MiB,uuid=${uuid_gpt_hal_b},type=linux;"     \
85         "name=reserved0,size=4MiB,uuid=${uuid_gpt_reserved0},type=linux;"       \
86         "name=reserved1,size=64MiB,uuid=${uuid_gpt_reserved1},type=linux;"      \
87         "name=reserved2,size=-,uuid=${uuid_gpt_reserved2},type=linux;"  \
88         ""
89
90 #define SET_TO_PARTITION_A      \
91         "if test -e mmc ${mmcbootdev}:${mmcinformpart} ${slotfile}; "   \
92         "then ;"                                                        \
93         "load mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
94         "fi; "                                                                  \
95         "mw.b ${slot_addr} 61; "                                                \
96         "ext4write mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
97
98 #define SET_TO_PARTITION_B      \
99         "if test -e mmc ${mmcbootdev}:${mmcinformpart} ${slotfile}; "   \
100         "then ;"                                                        \
101         "load mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
102         "fi; "                                                                  \
103         "mw.b ${slot_addr} 62; "                                                \
104         "ext4write mmc ${mmcbootdev}:${mmcinformpart} ${slot_addr} /${slotfile} 2; " \
105
106 #ifdef CONFIG_TARGET_RPI_4_32B
107 #define TIZEN_VC_MEM "vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 swiotlb=8192 "
108 #else
109 #define TIZEN_VC_MEM "vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 "
110 #endif
111
112 /* SD/MMC configuration */
113 #define CONFIG_MMC_DEFAULT_DEV  0
114
115 #ifdef CONFIG_ARM64
116 #define KERNEL_NAME     "Image"
117 #else
118 #define KERNEL_NAME     "zImage"
119 #endif
120
121 /*
122 # use the ram address of ramdisk before loading ramdisk image
123 # 0x72677075 is ascii code for representing string "upgr"
124 # 0x72766372 is ascii code for representing string "rcvr"
125 # 0x6665646e is ascii code for representing string "ndef"
126 # 0x6c6e7764 is ascii code for representing string "dwnl"
127 */
128 #define TIZEN_ENV_SETTING \
129         "kernel=" KERNEL_NAME "\0"              \
130         "dfu_alt_info=" DFU_ALT_SYSTEM "\0"     \
131         "mmcbootdev=0\0"                        \
132         "mmcbootpart=1\0"                       \
133         "mmcrootdev=0\0"                        \
134         "mmcrootpart=2\0"                       \
135         "mmcinformpart=9\0"                     \
136         "rebootparamfile=reboot-param.bin\0"    \
137         "slotfile=partition-ab.info\0"  \
138         "slot_addr=0x02200000\0"                \
139         "rebootparam_addr=0x02100000\0"         \
140         "upgrade_val=72677075\0"                \
141         "recovery_val=72766372\0"               \
142         "nodef_val=6665646e\0"                  \
143         "download_val=6c6e7764\0"               \
144         "ramdiskpart=7\0"                       \
145         "part=7\0"                              \
146         "bootmode=ramdisk\0"                    \
147         "bootdev=mmc\0"                         \
148         "tfm=setenv bootmode download; run bootcmd\0"   \
149         "tizen_bootarg="                                \
150                 TIZEN_VC_MEM                            \
151                 "8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2709.serial=0xed6687d3 "                \
152                 "bcm2709.uart_clock=48000000 dwc_otg.lpm_enable=0\0"    \
153         "opts=loglevel=4\0"                     \
154         "dfu_usb_con=0\0"                       \
155         "dfu_interface=mmc\0"                   \
156         "dfu_device=" __stringify(CONFIG_MMC_DEFAULT_DEV) "\0" \
157         "mbr_parts=" PARTS_DEFAULT "\0"         \
158         "mbr_check=" MBR_CHECK "\0"             \
159         "set_to_part_a=" SET_TO_PARTITION_A "\0"                \
160         "set_to_part_b=" SET_TO_PARTITION_B "\0"                \
161         "gpt_parts=" GPT_PARTS_DEFAULT "\0"             \
162         "update_gpt_part=gpt write mmc ${mmcbootdev} ${gpt_parts}\0"            \
163         ""
164
165 #endif /* __CONFIG_TIZEN_RPI_H */