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 #define CONFIG_SYS_MMC_ENV_DEV 2
13 #define CONFIG_SYS_MMC_ENV_PART 1
16 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
18 "sm reboot_reason reason;" \
19 "setenv run_fastboot 0;" \
20 "if test \"${boot_source}\" = \"usb\"; then " \
21 "echo Fastboot forced by usb rom boot;" \
22 "setenv run_fastboot 1;" \
24 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
26 "echo Broken MMC partition scheme;" \
27 "setenv run_fastboot 1;" \
29 "if test \"${reason}\" = \"bootloader\" -o " \
30 "\"${reason}\" = \"fastboot\"; then " \
31 "echo Fastboot asked by reboot reason;" \
32 "setenv run_fastboot 1;" \
34 "if test \"${skip_fastboot}\" -eq 1; then " \
35 "echo Fastboot skipped by environment;" \
36 "setenv run_fastboot 0;" \
38 "if test \"${force_fastboot}\" -eq 1; then " \
39 "echo Fastboot forced by environment;" \
40 "setenv run_fastboot 1;" \
42 "if test \"${run_fastboot}\" -eq 1; then " \
43 "echo Running Fastboot...;" \
47 #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
50 /* TOFIX: Run actual recovery instead of fastboot */
51 #define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
53 "pinmux dev pinctrl@14;" \
54 "pinmux dev pinctrl@40;" \
55 "sm reboot_reason reason;" \
56 "setenv run_recovery 0;" \
57 "if run check_button; then " \
58 "echo Recovery button is pressed;" \
59 "setenv run_recovery 1;" \
60 "elif test \"${reason}\" = \"recovery\" -o " \
61 "\"${reason}\" = \"update\"; then " \
62 "echo Recovery asked by reboot reason;" \
63 "setenv run_recovery 1;" \
65 "if test \"${skip_recovery}\" -eq 1; then " \
66 "echo Recovery skipped by environment;" \
67 "setenv run_recovery 0;" \
69 "if test \"${force_recovery}\" -eq 1; then " \
70 "echo Recovery forced by environment;" \
71 "setenv run_recovery 1;" \
73 "if test \"${run_recovery}\" -eq 1; then " \
74 "echo Running Recovery...;" \
78 #define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
81 #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
83 "echo Loading Android boot partition...;" \
84 "mmc dev ${mmcdev};" \
85 "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \
86 "part start mmc ${mmcdev} ${bootpart} boot_start;" \
87 "part size mmc ${mmcdev} ${bootpart} boot_size;" \
88 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
89 "echo Running Android...;" \
90 "bootm ${loadaddr};" \
92 "echo Failed to boot Android...;" \
95 #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
98 #define BOOT_TARGET_DEVICES(func) \
99 func(FASTBOOT, fastboot, na) \
100 func(RECOVERY, recovery, na) \
101 func(SYSTEM, system, na) \
103 #define PREBOOT_LOAD_LOGO \
104 "mmc dev ${mmcdev};" \
105 "part start mmc ${mmcdev} ${logopart} boot_start;" \
106 "part size mmc ${mmcdev} ${logopart} boot_size;" \
107 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
108 "bmp display ${loadaddr} m m;" \
111 #define CONFIG_EXTRA_ENV_SETTINGS \
112 "partitions=" PARTS_DEFAULT "\0" \
116 "gpio_recovery=88\0" \
117 "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \
118 "load_logo=" PREBOOT_LOAD_LOGO "\0" \
119 "console=/dev/ttyAML0\0" \
120 "bootargs=no_console_suspend\0" \
121 "stdin=" STDIN_CFG "\0" \
122 "stdout=" STDOUT_CFG "\0" \
123 "stderr=" STDOUT_CFG "\0" \
124 "loadaddr=0x01000000\0" \
125 "fdt_addr_r=0x01000000\0" \
126 "scriptaddr=0x08000000\0" \
127 "kernel_addr_r=0x01080000\0" \
128 "pxefile_addr_r=0x01080000\0" \
129 "ramdisk_addr_r=0x13000000\0" \
130 "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" BOOTENV
132 #include <configs/meson64.h>
134 #endif /* __MESON64_ANDROID_CONFIG_H */