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
13 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
15 "sm reboot_reason reason;" \
16 "setenv run_fastboot 0;" \
17 "if test \"${boot_source}\" = \"usb\"; then " \
18 "echo Fastboot forced by usb rom boot;" \
19 "setenv run_fastboot 1;" \
21 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
23 "echo Broken MMC partition scheme;" \
24 "setenv run_fastboot 1;" \
26 "if test \"${reason}\" = \"bootloader\" -o " \
27 "\"${reason}\" = \"fastboot\"; then " \
28 "echo Fastboot asked by reboot reason;" \
29 "setenv run_fastboot 1;" \
31 "if test \"${skip_fastboot}\" -eq 1; then " \
32 "echo Fastboot skipped by environment;" \
33 "setenv run_fastboot 0;" \
35 "if test \"${force_fastboot}\" -eq 1; then " \
36 "echo Fastboot forced by environment;" \
37 "setenv run_fastboot 1;" \
39 "if test \"${run_fastboot}\" -eq 1; then " \
40 "echo Running Fastboot...;" \
44 #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
47 /* TOFIX: Run actual recovery instead of fastboot */
48 #define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
50 "pinmux dev pinctrl@14;" \
51 "pinmux dev pinctrl@40;" \
52 "sm reboot_reason reason;" \
53 "setenv run_recovery 0;" \
54 "if run check_button; then " \
55 "echo Recovery button is pressed;" \
56 "setenv run_recovery 1;" \
57 "elif test \"${reason}\" = \"recovery\" -o " \
58 "\"${reason}\" = \"update\"; then " \
59 "echo Recovery asked by reboot reason;" \
60 "setenv run_recovery 1;" \
62 "if test \"${skip_recovery}\" -eq 1; then " \
63 "echo Recovery skipped by environment;" \
64 "setenv run_recovery 0;" \
66 "if test \"${force_recovery}\" -eq 1; then " \
67 "echo Recovery forced by environment;" \
68 "setenv run_recovery 1;" \
70 "if test \"${run_recovery}\" -eq 1; then " \
71 "echo Running Recovery...;" \
75 #define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
78 #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
80 "echo Loading Android boot partition...;" \
81 "mmc dev ${mmcdev};" \
82 "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \
83 "part start mmc ${mmcdev} ${bootpart} boot_start;" \
84 "part size mmc ${mmcdev} ${bootpart} boot_size;" \
85 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
86 "echo Running Android...;" \
87 "bootm ${loadaddr};" \
89 "echo Failed to boot Android...;" \
92 #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
95 #define BOOT_TARGET_DEVICES(func) \
96 func(FASTBOOT, fastboot, na) \
97 func(RECOVERY, recovery, na) \
98 func(SYSTEM, system, na) \
100 #define PREBOOT_LOAD_LOGO \
101 "if test \"${boot_source}\" != \"usb\" && " \
102 "gpt verify mmc ${mmcdev} ${partitions}; then; " \
103 "mmc dev ${mmcdev};" \
104 "part start mmc ${mmcdev} ${logopart} boot_start;" \
105 "part size mmc ${mmcdev} ${logopart} boot_size;" \
106 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
107 "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 */