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 #ifndef BOOT_PARTITION
13 #define BOOT_PARTITION "boot"
16 #ifndef LOGO_PARTITION
17 #define LOGO_PARTITION "logo"
20 #ifndef CONTROL_PARTITION
21 #define CONTROL_PARTITION "misc"
24 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
26 "setenv run_fastboot 0;" \
27 "if test \"${boot_source}\" = \"usb\"; then " \
28 "echo Fastboot forced by usb rom boot;" \
29 "setenv run_fastboot 1;" \
31 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
33 "echo Broken MMC partition scheme;" \
34 "setenv run_fastboot 1;" \
36 "if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
37 CONTROL_PARTITION "; then " \
38 "if bcb test command = bootonce-bootloader; then " \
39 "echo BCB: Bootloader boot...; " \
40 "bcb clear command; bcb store; " \
41 "setenv run_fastboot 1;" \
44 "echo Warning: BCB is corrupted or does not exist; " \
46 "if test \"${run_fastboot}\" -eq 1; then " \
47 "echo Running Fastboot...;" \
48 "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
51 #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
54 /* TOFIX: Run actual recovery instead of fastboot */
55 #define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
57 "pinmux dev pinctrl@14;" \
58 "pinmux dev pinctrl@40;" \
59 "sm reboot_reason reason;" \
60 "setenv run_recovery 0;" \
61 "if run check_button; then " \
62 "echo Recovery button is pressed;" \
63 "setenv run_recovery 1;" \
64 "elif test \"${reason}\" = \"recovery\" -o " \
65 "\"${reason}\" = \"update\"; then " \
66 "echo Recovery asked by reboot reason;" \
67 "setenv run_recovery 1;" \
69 "if test \"${skip_recovery}\" -eq 1; then " \
70 "echo Recovery skipped by environment;" \
71 "setenv run_recovery 0;" \
73 "if test \"${force_recovery}\" -eq 1; then " \
74 "echo Recovery forced by environment;" \
75 "setenv run_recovery 1;" \
77 "if test \"${run_recovery}\" -eq 1; then " \
78 "echo Running Recovery...;" \
79 "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
82 #define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
85 #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
87 "echo Loading Android " BOOT_PARTITION " partition...;" \
88 "mmc dev ${mmcdev};" \
89 "setenv bootargs ${bootargs} androidboot.serialno=${serial#};" \
90 "part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
91 "part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
92 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
93 "echo Running Android...;" \
94 "bootm ${loadaddr};" \
96 "echo Failed to boot Android...;" \
99 #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
102 #define BOOT_TARGET_DEVICES(func) \
103 func(FASTBOOT, fastboot, na) \
104 func(RECOVERY, recovery, na) \
105 func(SYSTEM, system, na) \
107 #define PREBOOT_LOAD_LOGO \
108 "if test \"${boot_source}\" != \"usb\" && " \
109 "gpt verify mmc ${mmcdev} ${partitions}; then; " \
110 "mmc dev ${mmcdev};" \
111 "part start mmc ${mmcdev} " LOGO_PARTITION " boot_start;" \
112 "part size mmc ${mmcdev} " LOGO_PARTITION " boot_size;" \
113 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
114 "bmp display ${loadaddr} m m;" \
118 #define CONFIG_EXTRA_ENV_SETTINGS \
119 "partitions=" PARTS_DEFAULT "\0" \
121 "gpio_recovery=88\0" \
122 "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \
123 "load_logo=" PREBOOT_LOAD_LOGO "\0" \
124 "stdin=" STDIN_CFG "\0" \
125 "stdout=" STDOUT_CFG "\0" \
126 "stderr=" STDOUT_CFG "\0" \
127 "loadaddr=0x01000000\0" \
128 "fdt_addr_r=0x01000000\0" \
129 "scriptaddr=0x08000000\0" \
130 "kernel_addr_r=0x01080000\0" \
131 "pxefile_addr_r=0x01080000\0" \
132 "ramdisk_addr_r=0x13000000\0" \
133 "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
136 #include <configs/meson64.h>
138 #endif /* __MESON64_ANDROID_CONFIG_H */