1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Configuration for Android Amlogic Meson 64bits SoCs
5 * Copyright (C) 2019 Baylibre, SAS
6 * Author: Jerome Brunet <jbrunet@baylibre.com>
9 #ifndef __MESON64_ANDROID_CONFIG_H
10 #define __MESON64_ANDROID_CONFIG_H
12 #include <linux/sizes.h>
14 #define CONFIG_SYS_MALLOC_LEN SZ_128M
16 #ifndef BOOT_PARTITION
17 #define BOOT_PARTITION "boot"
20 #ifndef LOGO_PARTITION
21 #define LOGO_PARTITION "logo"
24 #ifndef CONTROL_PARTITION
25 #define CONTROL_PARTITION "misc"
28 #ifndef RECOVERY_PARTITION
29 #define RECOVERY_PARTITION "recovery"
32 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
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;" \
39 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
41 "echo Broken MMC partition scheme;" \
42 "setenv run_fastboot 1;" \
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;" \
51 "if bcb test command = boot-fastboot; then " \
52 "echo BCB: fastboot userspace boot...; " \
53 "setenv force_recovery 1;" \
56 "echo Warning: BCB is corrupted or does not exist; " \
58 "if test \"${run_fastboot}\" -eq 1; then " \
59 "echo Running Fastboot...;" \
60 "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
63 #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
66 #define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
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;" \
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;" \
82 "echo Warning: BCB is corrupted or does not exist; " \
84 "if test \"${skip_recovery}\" -eq 1; then " \
85 "echo Recovery skipped by environment;" \
86 "setenv run_recovery 0;" \
88 "if test \"${force_recovery}\" -eq 1; then " \
89 "echo Recovery forced by environment;" \
90 "setenv run_recovery 1;" \
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};" \
102 "echo Failed to boot Android...;" \
106 #define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
109 #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
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};" \
120 "echo Failed to boot Android...;" \
123 #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
126 #define BOOT_TARGET_DEVICES(func) \
127 func(FASTBOOT, fastboot, na) \
128 func(RECOVERY, recovery, na) \
129 func(SYSTEM, system, na) \
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;" \
142 #define CONFIG_EXTRA_ENV_SETTINGS \
143 "partitions=" PARTS_DEFAULT "\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" \
160 #include <configs/meson64.h>
162 #endif /* __MESON64_ANDROID_CONFIG_H */