Jerome Brunet | 0998367 | 2019-02-15 13:53:59 +0100 | [diff] [blame] | 1 | /* 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 | |
Neil Armstrong | 3b12fec | 2019-08-30 14:09:28 +0200 | [diff] [blame^] | 17 | #define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;" |
Jerome Brunet | 0998367 | 2019-02-15 13:53:59 +0100 | [diff] [blame] | 18 | #define CACHE_UUID "99207ae6-5207-11e9-999e-6f77a3612069;" |
| 19 | #define SYSTEM_UUID "99f9b7ac-5207-11e9-8507-c3c037e393f3;" |
| 20 | #define VENDOR_UUID "9d082802-5207-11e9-954c-cbbce08ba108;" |
| 21 | #define USERDATA_UUID "9b976e42-5207-11e9-8f16-ff47ac594b22;" |
| 22 | #define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;" |
| 23 | |
| 24 | #define PARTS_DEFAULT \ |
| 25 | "uuid_disk=${uuid_gpt_disk};" \ |
| 26 | "name=boot,size=64M,bootable,uuid=${uuid_gpt_boot};" \ |
Neil Armstrong | 3b12fec | 2019-08-30 14:09:28 +0200 | [diff] [blame^] | 27 | "name=logo,size=2M,uuid=" LOGO_UUID \ |
Jerome Brunet | 0998367 | 2019-02-15 13:53:59 +0100 | [diff] [blame] | 28 | "name=cache,size=256M,uuid=" CACHE_UUID \ |
| 29 | "name=system,size=1536M,uuid=" SYSTEM_UUID \ |
| 30 | "name=vendor,size=256M,uuid=" VENDOR_UUID \ |
| 31 | "name=userdata,size=4746M,uuid=" USERDATA_UUID \ |
| 32 | "name=rootfs,size=-,uuid=" ROOT_UUID |
| 33 | |
| 34 | #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \ |
| 35 | "bootcmd_fastboot=" \ |
| 36 | "sm reboot_reason reason;" \ |
| 37 | "setenv run_fastboot 0;" \ |
| 38 | "if gpt verify mmc ${mmcdev} ${partitions}; then; " \ |
| 39 | "else " \ |
| 40 | "echo Broken MMC partition scheme;" \ |
| 41 | "setenv run_fastboot 1;" \ |
| 42 | "fi;" \ |
| 43 | "if test \"${reason}\" = \"bootloader\" -o " \ |
| 44 | "\"${reason}\" = \"fastboot\"; then " \ |
| 45 | "echo Fastboot asked by reboot reason;" \ |
| 46 | "setenv run_fastboot 1;" \ |
| 47 | "fi;" \ |
| 48 | "if test \"${skip_fastboot}\" -eq 1; then " \ |
| 49 | "echo Fastboot skipped by environment;" \ |
| 50 | "setenv run_fastboot 0;" \ |
| 51 | "fi;" \ |
| 52 | "if test \"${force_fastboot}\" -eq 1; then " \ |
| 53 | "echo Fastboot forced by environment;" \ |
| 54 | "setenv run_fastboot 1;" \ |
| 55 | "fi;" \ |
| 56 | "if test \"${run_fastboot}\" -eq 1; then " \ |
| 57 | "echo Running Fastboot...;" \ |
| 58 | "fastboot 0;" \ |
| 59 | "fi\0" |
| 60 | |
| 61 | #define BOOTENV_DEV_NAME_FASTBOOT(devtypeu, devtypel, instance) \ |
| 62 | "fastboot " |
| 63 | |
| 64 | /* TOFIX: Run actual recovery instead of fastboot */ |
| 65 | #define BOOTENV_DEV_RECOVERY(devtypeu, devtypel, instance) \ |
| 66 | "bootcmd_recovery=" \ |
| 67 | "pinmux dev pinctrl@14;" \ |
| 68 | "pinmux dev pinctrl@40;" \ |
| 69 | "sm reboot_reason reason;" \ |
| 70 | "setenv run_recovery 0;" \ |
| 71 | "if run check_button; then " \ |
| 72 | "echo Recovery button is pressed;" \ |
| 73 | "setenv run_recovery 1;" \ |
| 74 | "elif test \"${reason}\" = \"recovery\" -o " \ |
| 75 | "\"${reason}\" = \"update\"; then " \ |
| 76 | "echo Recovery asked by reboot reason;" \ |
| 77 | "setenv run_recovery 1;" \ |
| 78 | "fi;" \ |
| 79 | "if test \"${skip_recovery}\" -eq 1; then " \ |
| 80 | "echo Recovery skipped by environment;" \ |
| 81 | "setenv run_recovery 0;" \ |
| 82 | "fi;" \ |
| 83 | "if test \"${force_recovery}\" -eq 1; then " \ |
| 84 | "echo Recovery forced by environment;" \ |
| 85 | "setenv run_recovery 1;" \ |
| 86 | "fi;" \ |
| 87 | "if test \"${run_recovery}\" -eq 1; then " \ |
| 88 | "echo Running Recovery...;" \ |
| 89 | "fastboot 0;" \ |
| 90 | "fi\0" |
| 91 | |
| 92 | #define BOOTENV_DEV_NAME_RECOVERY(devtypeu, devtypel, instance) \ |
| 93 | "recovery " |
| 94 | |
| 95 | #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \ |
| 96 | "bootcmd_system=" \ |
| 97 | "echo Loading Android boot partition...;" \ |
| 98 | "mmc dev ${mmcdev};" \ |
| 99 | "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \ |
| 100 | "part start mmc ${mmcdev} ${bootpart} boot_start;" \ |
| 101 | "part size mmc ${mmcdev} ${bootpart} boot_size;" \ |
| 102 | "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \ |
| 103 | "echo Running Android...;" \ |
| 104 | "bootm ${loadaddr};" \ |
| 105 | "fi;" \ |
| 106 | "echo Failed to boot Android...;" \ |
| 107 | "reset\0" |
| 108 | |
| 109 | #define BOOTENV_DEV_NAME_SYSTEM(devtypeu, devtypel, instance) \ |
| 110 | "system " |
| 111 | |
| 112 | #define BOOT_TARGET_DEVICES(func) \ |
| 113 | func(ROMUSB, romusb, na) \ |
| 114 | func(FASTBOOT, fastboot, na) \ |
| 115 | func(RECOVERY, recovery, na) \ |
| 116 | func(SYSTEM, system, na) \ |
| 117 | |
Neil Armstrong | 3b12fec | 2019-08-30 14:09:28 +0200 | [diff] [blame^] | 118 | #define PREBOOT_LOAD_LOGO \ |
| 119 | "mmc dev ${mmcdev};" \ |
| 120 | "part start mmc ${mmcdev} ${logopart} boot_start;" \ |
| 121 | "part size mmc ${mmcdev} ${logopart} boot_size;" \ |
| 122 | "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \ |
| 123 | "bmp display ${loadaddr} m m;" \ |
| 124 | "fi;" |
| 125 | |
Jerome Brunet | 0998367 | 2019-02-15 13:53:59 +0100 | [diff] [blame] | 126 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 127 | "partitions=" PARTS_DEFAULT "\0" \ |
| 128 | "mmcdev=2\0" \ |
| 129 | "bootpart=1\0" \ |
Neil Armstrong | 3b12fec | 2019-08-30 14:09:28 +0200 | [diff] [blame^] | 130 | "logopart=2\0" \ |
Jerome Brunet | 0998367 | 2019-02-15 13:53:59 +0100 | [diff] [blame] | 131 | "gpio_recovery=88\0" \ |
| 132 | "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0" \ |
Neil Armstrong | 3b12fec | 2019-08-30 14:09:28 +0200 | [diff] [blame^] | 133 | "load_logo=" PREBOOT_LOAD_LOGO "\0" \ |
Jerome Brunet | 0998367 | 2019-02-15 13:53:59 +0100 | [diff] [blame] | 134 | "console=/dev/ttyAML0\0" \ |
| 135 | "bootargs=no_console_suspend\0" \ |
| 136 | "stdin=" STDIN_CFG "\0" \ |
| 137 | "stdout=" STDOUT_CFG "\0" \ |
| 138 | "stderr=" STDOUT_CFG "\0" \ |
| 139 | "loadaddr=0x01000000\0" \ |
| 140 | "fdt_addr_r=0x01000000\0" \ |
| 141 | "scriptaddr=0x08000000\0" \ |
| 142 | "kernel_addr_r=0x01080000\0" \ |
| 143 | "pxefile_addr_r=0x01080000\0" \ |
| 144 | "ramdisk_addr_r=0x13000000\0" \ |
| 145 | "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" BOOTENV |
| 146 | |
| 147 | #include <configs/meson64.h> |
| 148 | |
| 149 | #endif /* __CONFIG_H */ |