blob: 8fff915b50a406e9cdadfd25c3e43e08454f2034 [file] [log] [blame]
Guillaume La Roque880c0aa2019-10-11 17:33:57 +02001/* 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
Guillaume La Roque880c0aa2019-10-11 17:33:57 +020012
13#define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
14 "bootcmd_fastboot=" \
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;" \
20 "fi;" \
21 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
22 "else " \
23 "echo Broken MMC partition scheme;" \
24 "setenv run_fastboot 1;" \
25 "fi;" \
26 "if test \"${reason}\" = \"bootloader\" -o " \
27 "\"${reason}\" = \"fastboot\"; then " \
28 "echo Fastboot asked by reboot reason;" \
29 "setenv run_fastboot 1;" \
30 "fi;" \
31 "if test \"${skip_fastboot}\" -eq 1; then " \
32 "echo Fastboot skipped by environment;" \
33 "setenv run_fastboot 0;" \
34 "fi;" \
35 "if test \"${force_fastboot}\" -eq 1; then " \
36 "echo Fastboot forced by environment;" \
37 "setenv run_fastboot 1;" \
38 "fi;" \
39 "if test \"${run_fastboot}\" -eq 1; then " \
40 "echo Running Fastboot...;" \
41 "fastboot 0;" \
42 "fi\0"
43
44#define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
45 "fastboot "
46
47/* TOFIX: Run actual recovery instead of fastboot */
48#define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
49 "bootcmd_recovery=" \
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;" \
61 "fi;" \
62 "if test \"${skip_recovery}\" -eq 1; then " \
63 "echo Recovery skipped by environment;" \
64 "setenv run_recovery 0;" \
65 "fi;" \
66 "if test \"${force_recovery}\" -eq 1; then " \
67 "echo Recovery forced by environment;" \
68 "setenv run_recovery 1;" \
69 "fi;" \
70 "if test \"${run_recovery}\" -eq 1; then " \
71 "echo Running Recovery...;" \
72 "fastboot 0;" \
73 "fi\0"
74
75#define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
76 "recovery "
77
78#define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
79 "bootcmd_system=" \
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};" \
88 "fi;" \
89 "echo Failed to boot Android...;" \
90 "reset\0"
91
92#define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
93 "system "
94
95#define BOOT_TARGET_DEVICES(func) \
96 func(FASTBOOT, fastboot, na) \
97 func(RECOVERY, recovery, na) \
98 func(SYSTEM, system, na) \
99
100#define PREBOOT_LOAD_LOGO \
101 "mmc dev ${mmcdev};" \
102 "part start mmc ${mmcdev} ${logopart} boot_start;" \
103 "part size mmc ${mmcdev} ${logopart} boot_size;" \
104 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
105 "bmp display ${loadaddr} m m;" \
106 "fi;"
107
108#define CONFIG_EXTRA_ENV_SETTINGS \
109 "partitions=" PARTS_DEFAULT "\0" \
110 "mmcdev=2\0" \
111 "bootpart=1\0" \
112 "logopart=2\0" \
113 "gpio_recovery=88\0" \
114 "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \
115 "load_logo=" PREBOOT_LOAD_LOGO "\0" \
116 "console=/dev/ttyAML0\0" \
117 "bootargs=no_console_suspend\0" \
118 "stdin=" STDIN_CFG "\0" \
119 "stdout=" STDOUT_CFG "\0" \
120 "stderr=" STDOUT_CFG "\0" \
121 "loadaddr=0x01000000\0" \
122 "fdt_addr_r=0x01000000\0" \
123 "scriptaddr=0x08000000\0" \
124 "kernel_addr_r=0x01080000\0" \
125 "pxefile_addr_r=0x01080000\0" \
126 "ramdisk_addr_r=0x13000000\0" \
127 "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" BOOTENV
128
129#include <configs/meson64.h>
130
131#endif /* __MESON64_ANDROID_CONFIG_H */