configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB
[platform/kernel/u-boot.git] / include / configs / meson64_android.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Configuration for Android Amlogic Meson 64bits SoCs
4  *
5  * Copyright (C) 2019 Baylibre, SAS
6  * Author: Jerome Brunet <jbrunet@baylibre.com>
7  */
8
9 #ifndef __MESON64_ANDROID_CONFIG_H
10 #define __MESON64_ANDROID_CONFIG_H
11
12 #include <linux/sizes.h>
13
14 #define CONFIG_SYS_MALLOC_LEN          SZ_128M
15
16 #ifndef BOOT_PARTITION
17 #define BOOT_PARTITION "boot"
18 #endif
19
20 #ifndef LOGO_PARTITION
21 #define LOGO_PARTITION "logo"
22 #endif
23
24 #ifndef CONTROL_PARTITION
25 #define CONTROL_PARTITION "misc"
26 #endif
27
28 #ifndef RECOVERY_PARTITION
29 #define RECOVERY_PARTITION "recovery"
30 #endif
31
32 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
33         "bootcmd_fastboot=" \
34                 "setenv run_fastboot 0;" \
35                 "if test \"${boot_source}\" = \"usb\"; then " \
36                         "echo Fastboot forced by usb rom boot;" \
37                         "setenv run_fastboot 1;" \
38                 "fi;" \
39                 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
40                 "else " \
41                         "echo Broken MMC partition scheme;" \
42                         "setenv run_fastboot 1;" \
43                 "fi;" \
44                 "if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
45                 CONTROL_PARTITION "; then " \
46                         "if bcb test command = bootonce-bootloader; then " \
47                                 "echo BCB: Bootloader boot...; " \
48                                 "bcb clear command; bcb store; " \
49                                 "setenv run_fastboot 1;" \
50                         "fi; " \
51                         "if bcb test command = boot-fastboot; then " \
52                                 "echo BCB: fastboot userspace boot...; " \
53                                 "setenv force_recovery 1;" \
54                         "fi; " \
55                 "else " \
56                         "echo Warning: BCB is corrupted or does not exist; " \
57                 "fi;" \
58                 "if test \"${run_fastboot}\" -eq 1; then " \
59                         "echo Running Fastboot...;" \
60                         "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
61                 "fi\0"
62
63 #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
64                 "fastboot "
65
66 #define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
67         "bootcmd_recovery=" \
68                 "pinmux dev pinctrl@14;" \
69                 "pinmux dev pinctrl@40;" \
70                 "setenv run_recovery 0;" \
71                 "if run check_button; then " \
72                         "echo Recovery button is pressed;" \
73                         "setenv run_recovery 1;" \
74                 "fi; " \
75                 "if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
76                 CONTROL_PARTITION "; then " \
77                         "if bcb test command = boot-recovery; then " \
78                                 "echo BCB: Recovery boot...; " \
79                                 "setenv run_recovery 1;" \
80                         "fi;" \
81                 "else " \
82                         "echo Warning: BCB is corrupted or does not exist; " \
83                 "fi;" \
84                 "if test \"${skip_recovery}\" -eq 1; then " \
85                         "echo Recovery skipped by environment;" \
86                         "setenv run_recovery 0;" \
87                 "fi;" \
88                 "if test \"${force_recovery}\" -eq 1; then " \
89                         "echo Recovery forced by environment;" \
90                         "setenv run_recovery 1;" \
91                 "fi;" \
92                 "if test \"${run_recovery}\" -eq 1; then " \
93                         "echo Running Recovery...;" \
94                         "mmc dev ${mmcdev};" \
95                         "setenv bootargs \"${bootargs} androidboot.serialno=${serial#}\";" \
96                         "part start mmc ${mmcdev} " RECOVERY_PARTITION " boot_start;" \
97                         "part size mmc ${mmcdev} " RECOVERY_PARTITION " boot_size;" \
98                         "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
99                                 "echo Running Android Recovery...;" \
100                                 "bootm ${loadaddr};" \
101                         "fi;" \
102                         "echo Failed to boot Android...;" \
103                         "reset;" \
104                 "fi\0"
105
106 #define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
107                 "recovery "
108
109 #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
110         "bootcmd_system=" \
111                 "echo Loading Android " BOOT_PARTITION " partition...;" \
112                 "mmc dev ${mmcdev};" \
113                 "setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
114                 "part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
115                 "part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
116                 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
117                         "echo Running Android...;" \
118                         "bootm ${loadaddr};" \
119                 "fi;" \
120                 "echo Failed to boot Android...;" \
121                 "reset\0"
122
123 #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance)   \
124                 "system "
125
126 #define BOOT_TARGET_DEVICES(func) \
127         func(FASTBOOT, fastboot, na) \
128         func(RECOVERY, recovery, na) \
129         func(SYSTEM, system, na) \
130
131 #define PREBOOT_LOAD_LOGO \
132         "if test \"${boot_source}\" != \"usb\" && " \
133                 "gpt verify mmc ${mmcdev} ${partitions}; then; " \
134                 "mmc dev ${mmcdev};" \
135                 "part start mmc ${mmcdev} " LOGO_PARTITION " boot_start;" \
136                 "part size mmc ${mmcdev} " LOGO_PARTITION " boot_size;" \
137                 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
138                         "bmp display ${loadaddr} m m;" \
139                 "fi;" \
140         "fi;"
141
142 #define CONFIG_EXTRA_ENV_SETTINGS                                     \
143         "partitions=" PARTS_DEFAULT "\0"                              \
144         "mmcdev=2\0"                                                  \
145         "gpio_recovery=88\0"                                          \
146         "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0"   \
147         "load_logo=" PREBOOT_LOAD_LOGO "\0"                           \
148         "stdin=" STDIN_CFG "\0"                                       \
149         "stdout=" STDOUT_CFG "\0"                                     \
150         "stderr=" STDOUT_CFG "\0"                                     \
151         "loadaddr=0x01000000\0"                                       \
152         "fdt_addr_r=0x01000000\0"                                     \
153         "scriptaddr=0x08000000\0"                                     \
154         "kernel_addr_r=0x01080000\0"                                  \
155         "pxefile_addr_r=0x01080000\0"                                 \
156         "ramdisk_addr_r=0x13000000\0"                                 \
157         "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"        \
158         BOOTENV
159
160 #include <configs/meson64.h>
161
162 #endif /* __MESON64_ANDROID_CONFIG_H */