blob: 99579022504b2564f68dada48b5db0faea0f91e4 [file] [log] [blame]
Jerome Brunet55f54b22019-02-15 13:53:59 +01001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Configuration for the SEI510
4 *
5 * Copyright (C) 2019 Baylibre, SAS
6 * Author: Jerome Brunet <jbrunet@baylibre.com>
7 */
8
9#ifndef __CONFIG_H
10#define __CONFIG_H
11
12#define CONFIG_SYS_MMC_ENV_DEV 2
13#define CONFIG_SYS_MMC_ENV_PART 1
14#define CONFIG_ENV_SIZE 0x10000
15#define CONFIG_ENV_OFFSET (-0x10000)
16
17#define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;"
18#define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;"
19#define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;"
20#define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;"
21#define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"
22
23#define PARTS_DEFAULT \
24 "uuid_disk=${uuid_gpt_disk};" \
25 "name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \
26 "name=cache,size=256M,uuid=" CACHE_UUID \
27 "name=system,size=1536M,uuid=" SYSTEM_UUID \
28 "name=vendor,size=256M,uuid=" VENDOR_UUID \
29 "name=userdata,size=4746M,uuid=" USERDATA_UUID \
30 "name=rootfs,size=-,uuid=" ROOT_UUID
31
32#define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
33 "bootcmd_fastboot=" \
34 "sm reboot_reason reason;" \
35 "setenv run_fastboot 0;" \
36 "if gpt verify mmc ${mmcdev} ${partitions}; then; " \
37 "else " \
38 "echo Broken MMC partition scheme;" \
39 "setenv run_fastboot 1;" \
40 "fi;" \
41 "if test \"${reason}\" = \"bootloader\" -o " \
42 "\"${reason}\" = \"fastboot\"; then " \
43 "echo Fastboot asked by reboot reason;" \
44 "setenv run_fastboot 1;" \
45 "fi;" \
46 "if test \"${skip_fastboot}\" -eq 1; then " \
47 "echo Fastboot skipped by environment;" \
48 "setenv run_fastboot 0;" \
49 "fi;" \
50 "if test \"${force_fastboot}\" -eq 1; then " \
51 "echo Fastboot forced by environment;" \
52 "setenv run_fastboot 1;" \
53 "fi;" \
54 "if test \"${run_fastboot}\" -eq 1; then " \
55 "echo Running Fastboot...;" \
56 "fastboot 0;" \
57 "fi\0"
58
59#define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \
60 "fastboot "
61
62/* TOFIX: Run actual recovery instead of fastboot */
63#define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \
64 "bootcmd_recovery=" \
65 "pinmux dev pinctrl@14;" \
66 "pinmux dev pinctrl@40;" \
67 "sm reboot_reason reason;" \
68 "setenv run_recovery 0;" \
69 "if run check_button; then " \
70 "echo Recovery button is pressed;" \
71 "setenv run_recovery 1;" \
72 "elif test \"${reason}\" = \"recovery\" -o " \
73 "\"${reason}\" = \"update\"; then " \
74 "echo Recovery asked by reboot reason;" \
75 "setenv run_recovery 1;" \
76 "fi;" \
77 "if test \"${skip_recovery}\" -eq 1; then " \
78 "echo Recovery skipped by environment;" \
79 "setenv run_recovery 0;" \
80 "fi;" \
81 "if test \"${force_recovery}\" -eq 1; then " \
82 "echo Recovery forced by environment;" \
83 "setenv run_recovery 1;" \
84 "fi;" \
85 "if test \"${run_recovery}\" -eq 1; then " \
86 "echo Running Recovery...;" \
87 "fastboot 0;" \
88 "fi\0"
89
90#define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \
91 "recovery "
92
93#define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
94 "bootcmd_system=" \
95 "echo Loading Android boot partition...;" \
96 "mmc dev ${mmcdev};" \
97 "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \
98 "part start mmc ${mmcdev} ${bootpart} boot_start;" \
99 "part size mmc ${mmcdev} ${bootpart} boot_size;" \
100 "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
101 "echo Running Android...;" \
102 "bootm ${loadaddr};" \
103 "fi;" \
104 "echo Failed to boot Android...;" \
105 "reset\0"
106
107#define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \
108 "system "
109
110#define BOOT_TARGET_DEVICES(func) \
111 func(ROMUSB, romusb, na) \
112 func(FASTBOOT, fastboot, na) \
113 func(RECOVERY, recovery, na) \
114 func(SYSTEM, system, na) \
115
116#define CONFIG_EXTRA_ENV_SETTINGS \
117 "partitions=" PARTS_DEFAULT "\0" \
118 "mmcdev=2\0" \
119 "bootpart=1\0" \
120 "gpio_recovery=88\0" \
121 "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \
122 "console=/dev/ttyAML0\0" \
123 "bootargs=no_console_suspend\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" BOOTENV
134
135#include <configs/meson64.h>
136
137#endif /* __CONFIG_H */