Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ |
| 2 | * |
| 3 | * Copyright (c) 2017 DENX Software Engineering GmbH, Heiko Schocher <hs@denx.de> |
| 4 | * Copyright (c) 2019 Bosch Thermotechnik GmbH |
| 5 | * Copyright (c) 2022 DENX Software Engineering GmbH, Philip Oberfichtner <pro@denx.de> |
| 6 | */ |
| 7 | |
| 8 | #ifndef __IMX6Q_ACC_H |
| 9 | #define __IMX6Q_ACC_H |
| 10 | |
| 11 | #include <linux/sizes.h> |
| 12 | #include "mx6_common.h" |
| 13 | |
| 14 | #ifdef CONFIG_SYS_BOOT_EMMC |
| 15 | #define MMC_ROOTFS_DEV 0 |
| 16 | #define MMC_ROOTFS_PART 2 |
| 17 | #endif |
| 18 | |
| 19 | #ifdef CONFIG_SYS_BOOT_EMMC |
| 20 | /* eMMC Boot */ |
| 21 | #define ENV_EXTRA \ |
| 22 | "mmcdev=" __stringify(MMC_ROOTFS_DEV) "\0" \ |
| 23 | "mmcpart=" __stringify(MMC_ROOTFS_PART) "\0" \ |
| 24 | "fitpart=1\0" \ |
| 25 | "optargs=ro quiet systemd.gpt_auto=false\0" \ |
| 26 | "production=1\0" \ |
| 27 | "mmcautodetect=yes\0" \ |
| 28 | "mmcrootfstype=ext4\0" \ |
| 29 | "finduuid=part uuid mmc ${mmcdev}:${mmcpart} uuid\0" \ |
| 30 | "mmcargs=run finduuid; setenv bootargs " \ |
| 31 | "root=PARTUUID=${uuid} ${optargs} rootfstype=${mmcrootfstype}\0" \ |
| 32 | "mmc_mmc_fit=run env_persist; run setbm; run mmcloadfit; " \ |
| 33 | "run auth_fit_or_reset; run mmcargs addcon; " \ |
| 34 | "bootm ${fit_addr}#${bootconf}\0" \ |
| 35 | "bootset=0\0" \ |
| 36 | "setbm=if test ${bootset} -eq 1; " \ |
| 37 | "then setenv mmcpart 4; setenv fitpart 3; " \ |
| 38 | "else; setenv mmcpart 2; setenv fitpart 1; fi\0" \ |
| 39 | "handle_ustate=if test ${ustate} -eq 2; then setenv ustate 3; fi\0" \ |
| 40 | "switch_bootset=if test ${bootset} -eq 1; then setenv bootset 0; " \ |
| 41 | "else; setenv bootset 1;fi\0" \ |
| 42 | "env_persisted=0\0" \ |
| 43 | "env_persist=if test ${env_persisted} != 1; " \ |
| 44 | "then env set env_persisted 1; run save_env; fi;\0" \ |
| 45 | "save_env=env save; env save\0" \ |
| 46 | "altbootcmd=run handle_ustate; run switch_bootset; run save_env; run bootcmd\0" |
| 47 | |
Tom Rini | 0297e5f | 2022-12-04 10:03:40 -0500 | [diff] [blame] | 48 | #define CFG_ENV_FLAGS_LIST_STATIC \ |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 49 | "bootset:bw," \ |
| 50 | "clone_pending:bw," \ |
| 51 | "endurance_test:bw," \ |
| 52 | "env_persisted:bw," \ |
| 53 | "factory_reset:bw," \ |
| 54 | "fdtcontroladdr:xw," \ |
| 55 | "fitpart:dw," \ |
| 56 | "mmcpart:dw," \ |
| 57 | "production:bw," \ |
| 58 | "ustate:dw" |
| 59 | |
| 60 | #else |
| 61 | /* SD Card boot */ |
| 62 | #define ENV_EXTRA \ |
| 63 | "mmcdev=1\0" \ |
| 64 | "fitpart=1\0" \ |
| 65 | "rootpart=2\0" \ |
| 66 | "optargs=ro systemd.gpt_auto=false\0" \ |
| 67 | "finduuid=part uuid mmc ${mmcdev}:${rootpart} uuid\0" \ |
| 68 | "mmcargs=run finduuid;setenv bootargs root=PARTUUID=${uuid} ${optargs}\0" \ |
| 69 | "mmc_mmc_fit=run mmcloadfit; run auth_fit_or_reset; run mmcargs addcon; " \ |
| 70 | "bootm ${fit_addr}#${bootconf}\0" |
| 71 | |
| 72 | #endif |
| 73 | |
| 74 | /* Default environment */ |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 75 | #define CFG_EXTRA_ENV_SETTINGS \ |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 76 | "bootconf=conf-imx6q-bosch-acc.dtb\0"\ |
| 77 | "mmcfit_name=fitImage\0" \ |
| 78 | "mmcloadfit=ext4load mmc ${mmcdev}:${fitpart} ${fit_addr} ${mmcfit_name}\0" \ |
| 79 | "auth_fit_or_reset=hab_auth_img ${fit_addr} ${filesize} || reset\0" \ |
| 80 | "console=ttymxc0\0" \ |
| 81 | "addcon=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \ |
| 82 | "fit_addr=19000000\0" \ |
| 83 | ENV_EXTRA |
| 84 | |
| 85 | /* Physical Memory Map */ |
| 86 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 87 | |
Tom Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 88 | #define CFG_SYS_SDRAM_BASE PHYS_SDRAM |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 89 | #define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 90 | #define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 91 | |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 92 | /* SPL */ |
| 93 | #ifdef CONFIG_SPL |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 94 | |
Simon Glass | 209ae76 | 2024-09-29 19:49:49 -0600 | [diff] [blame] | 95 | #ifdef CONFIG_XPL_BUILD |
Tom Rini | 376b88a | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 96 | #define CFG_SYS_FSL_USDHC_NUM 2 |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 97 | |
| 98 | #ifdef CONFIG_SYS_BOOT_EMMC |
| 99 | |
| 100 | /* Boot from eMMC */ |
Tom Rini | 376b88a | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 101 | #define CFG_SYS_FSL_ESDHC_ADDR 1 |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 102 | |
| 103 | #else |
| 104 | |
| 105 | /* Boot from SD-card */ |
Tom Rini | 376b88a | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 106 | # define CFG_SYS_FSL_ESDHC_ADDR 0 |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 107 | |
| 108 | #endif |
| 109 | |
| 110 | #endif |
| 111 | #endif |
| 112 | |
Philip Oberfichtner | 9d680d1 | 2022-05-19 13:52:48 +0200 | [diff] [blame] | 113 | |
| 114 | #endif /* __IMX6Q_ACC_H */ |