blob: 201684ba802cae6a374f93ad1eaa8fdd5f9356ad [file] [log] [blame]
Philip Oberfichtner9d680d12022-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
48#define CONFIG_ENV_FLAGS_LIST_STATIC \
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 */
75#define CONFIG_EXTRA_ENV_SETTINGS \
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
88#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
89#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
90#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
91
Philip Oberfichtner9d680d12022-05-19 13:52:48 +020092/* SPL */
93#ifdef CONFIG_SPL
94#include "imx6_spl.h"
95
96#ifdef CONFIG_SPL_BUILD
97#define CONFIG_SYS_FSL_USDHC_NUM 2
98
99#ifdef CONFIG_SYS_BOOT_EMMC
100
101/* Boot from eMMC */
102#define CONFIG_SYS_FSL_ESDHC_ADDR 1
103
104#else
105
106/* Boot from SD-card */
107# define CONFIG_SYS_FSL_ESDHC_ADDR 0
108
109#endif
110
111#endif
112#endif
113
Philip Oberfichtner9d680d12022-05-19 13:52:48 +0200114#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
115#define CONFIG_MXC_USB_FLAGS 0
Philip Oberfichtner9d680d12022-05-19 13:52:48 +0200116
117#endif /* __IMX6Q_ACC_H */