blob: 2c998cdcfc726ea802d5f36b24ad186bed839e90 [file] [log] [blame]
Philip Oberfichtner55d15372022-05-19 13:52:48 +02001/* 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 Riniacf29d82022-12-04 10:03:40 -050048#define CFG_ENV_FLAGS_LIST_STATIC \
Philip Oberfichtner55d15372022-05-19 13:52:48 +020049 "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 Rini0613c362022-12-04 10:03:50 -050075#define CFG_EXTRA_ENV_SETTINGS \
Philip Oberfichtner55d15372022-05-19 13:52:48 +020076 "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 Riniaa6e94d2022-11-16 13:10:37 -050088#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini65cc0e22022-11-16 13:10:41 -050089#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
90#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Philip Oberfichtner55d15372022-05-19 13:52:48 +020091
Philip Oberfichtner55d15372022-05-19 13:52:48 +020092/* SPL */
93#ifdef CONFIG_SPL
Philip Oberfichtner55d15372022-05-19 13:52:48 +020094
95#ifdef CONFIG_SPL_BUILD
Tom Rini6cc04542022-10-28 20:27:13 -040096#define CFG_SYS_FSL_USDHC_NUM 2
Philip Oberfichtner55d15372022-05-19 13:52:48 +020097
98#ifdef CONFIG_SYS_BOOT_EMMC
99
100/* Boot from eMMC */
Tom Rini6cc04542022-10-28 20:27:13 -0400101#define CFG_SYS_FSL_ESDHC_ADDR 1
Philip Oberfichtner55d15372022-05-19 13:52:48 +0200102
103#else
104
105/* Boot from SD-card */
Tom Rini6cc04542022-10-28 20:27:13 -0400106# define CFG_SYS_FSL_ESDHC_ADDR 0
Philip Oberfichtner55d15372022-05-19 13:52:48 +0200107
108#endif
109
110#endif
111#endif
112
Tom Rinidd11fdc2022-12-04 10:04:56 -0500113#define CFG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
114#define CFG_MXC_USB_FLAGS 0
Philip Oberfichtner55d15372022-05-19 13:52:48 +0200115
116#endif /* __IMX6Q_ACC_H */