blob: 09722f47e782a2ee1be7d9ffaca2e592152390ef [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Stefan Agner41f75bb2016-07-20 21:27:49 -07002/*
Stefan Agnercbd59fe2018-08-06 09:19:19 +02003 * Copyright 2016-2018 Toradex AG
Stefan Agner41f75bb2016-07-20 21:27:49 -07004 *
5 * Configuration settings for the Colibri iMX7 module.
6 *
7 * based on mx7dsabresd.h:
8 * Copyright (C) 2015 Freescale Semiconductor, Inc.
Stefan Agner41f75bb2016-07-20 21:27:49 -07009 */
10
11#ifndef __COLIBRI_IMX7_CONFIG_H
12#define __COLIBRI_IMX7_CONFIG_H
13
14#include "mx7_common.h"
15
Stefan Agner41f75bb2016-07-20 21:27:49 -070016/* Size of malloc() pool */
17#define CONFIG_SYS_MALLOC_LEN (32 * SZ_1M)
18
Stefan Agner41f75bb2016-07-20 21:27:49 -070019/* MMC Config*/
20#define CONFIG_SYS_FSL_ESDHC_ADDR 0
Stefan Agnercbd59fe2018-08-06 09:19:19 +020021#ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
Stefan Agner41f75bb2016-07-20 21:27:49 -070022#define CONFIG_SYS_FSL_USDHC_NUM 1
Stefan Agnercbd59fe2018-08-06 09:19:19 +020023#elif CONFIG_TARGET_COLIBRI_IMX7_EMMC
24#define CONFIG_SYS_FSL_USDHC_NUM 2
Stefan Agnercbd59fe2018-08-06 09:19:19 +020025#endif
Stefan Agner41f75bb2016-07-20 21:27:49 -070026
Stefan Agner41f75bb2016-07-20 21:27:49 -070027/* I2C configs */
Stefan Agner41f75bb2016-07-20 21:27:49 -070028#define CONFIG_SYS_I2C_MXC
Stefan Agner41f75bb2016-07-20 21:27:49 -070029#define CONFIG_SYS_I2C_SPEED 100000
30
31#define CONFIG_IPADDR 192.168.10.2
32#define CONFIG_NETMASK 255.255.255.0
33#define CONFIG_SERVERIP 192.168.10.1
34
Igor Opaniuka22f9752019-12-09 12:33:28 +020035#if defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
36#define UBOOT_UPDATE \
37 "uboot_hwpart=1\0" \
38 "uboot_blk=2\0" \
39 "set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && " \
40 "setexpr blkcnt ${blkcnt} / 0x200\0" \
41 "update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
42 "mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0"
43#elif defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
44#define UBOOT_UPDATE \
45 "update_uboot=nand erase.part u-boot1 && " \
46 "nand write ${loadaddr} u-boot1 ${filesize} && " \
47 "nand erase.part u-boot2 && " \
48 "nand write ${loadaddr} u-boot2 ${filesize}\0"
49#endif
50
Igor Opaniukb4924a32019-06-18 14:57:32 +030051#ifndef PARTS_DEFAULT
52/* Define the default GPT table for eMMC */
53#define PARTS_DEFAULT \
54 /* Android partitions */ \
55 "partitions_android=" \
56 "uuid_disk=${uuid_gpt_disk};" \
57 "name=boot,start=1M,size=32M,uuid=${uuid_gpt_boot};" \
58 "name=environment,size=4M,uuid=${uuid_gpt_environment};" \
59 "name=recovery,size=16M,uuid=${uuid_gpt_recovery};" \
60 "name=system,size=1536M,uuid=${uuid_gpt_system};" \
61 "name=cache,size=512M,uuid=${uuid_gpt_cache};" \
62 "name=device,size=8M,uuid=${uuid_gpt_device};" \
63 "name=misc,size=4M,uuid=${uuid_gpt_misc};" \
64 "name=datafooter,size=2M,uuid=${uuid_gpt_datafooter};" \
65 "name=metadata,size=2M,uuid=${uuid_gpt_metadata};" \
66 "name=persistdata,size=2M,uuid=${uuid_gpt_persistdata};" \
67 "name=userdata,size=128M,uuid=${uuid_gpt_userdata};" \
68 "name=fbmisc,size=-,uuid=${uuid_gpt_fbmisc}\0"
69#endif /* PARTS_DEFAULT */
70
71#define EMMC_ANDROID_BOOTCMD \
72 "android_args=androidboot.storage_type=emmc\0" \
73 PARTS_DEFAULT \
74 "android_fdt_addr=0x83700000\0" \
75 "android_mmc_dev=0\0" \
76 "m4binary=rpmsg_imu_freertos.elf\0" \
77 "androidboot=ext4load mmc 0:a ${loadaddr} media/0/${m4binary}; "\
78 "bootaux ${loadaddr}; " \
79 "setenv loadaddr 0x88000000; " \
80 "setenv bootm_boot_mode sec;" \
81 "setenv bootargs androidboot.serialno=${serial#} " \
82 "$android_args; " \
83 "part start mmc ${android_mmc_dev} boot boot_start; " \
84 "part size mmc ${android_mmc_dev} boot boot_size; " \
85 "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
86 "part start mmc ${android_mmc_dev} environment env_start; " \
87 "part size mmc ${android_mmc_dev} environment env_size; " \
88 "mmc read ${android_fdt_addr} ${env_start} ${env_size}; " \
89 "bootm ${loadaddr} ${loadaddr} ${android_fdt_addr}\0 "
90
Stefan Agnercbd59fe2018-08-06 09:19:19 +020091#define EMMC_BOOTCMD \
Igor Opaniuk4d454b02019-05-29 13:00:39 +030092 "set_emmcargs=setenv emmcargs ip=off root=PARTUUID=${uuid} ro " \
93 "rootfstype=ext4 rootwait\0" \
94 "emmcboot=run setup; run emmcfinduuid; run set_emmcargs; " \
Stefan Agnercbd59fe2018-08-06 09:19:19 +020095 "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \
96 "${vidargs}; echo Booting from internal eMMC chip...; " \
97 "run m4boot && " \
Igor Opaniuk4d454b02019-05-29 13:00:39 +030098 "load mmc ${emmcdev}:${emmcbootpart} ${fdt_addr_r} " \
99 "${soc}-colibri-emmc-${fdt_board}.dtb && " \
100 "load mmc ${emmcdev}:${emmcbootpart} ${kernel_addr_r} " \
101 "${boot_file} && run fdt_fixup && " \
102 "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
103 "emmcbootpart=1\0" \
104 "emmcdev=0\0" \
105 "emmcfinduuid=part uuid mmc ${emmcdev}:${emmcrootpart} uuid\0" \
106 "emmcrootpart=2\0"
107
Stefan Agner41f75bb2016-07-20 21:27:49 -0700108#define MEM_LAYOUT_ENV_SETTINGS \
Stefan Agner35eebee2017-03-09 17:17:51 -0800109 "bootm_size=0x10000000\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700110 "fdt_addr_r=0x82000000\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700111 "kernel_addr_r=0x81000000\0" \
Igor Opaniuk8ff1c242019-08-23 20:00:48 +0300112 "ramdisk_addr_r=0x82100000\0" \
113 "scriptaddr=0x82500000\0"
Stefan Agner41f75bb2016-07-20 21:27:49 -0700114
Stefan Agner41f75bb2016-07-20 21:27:49 -0700115#define NFS_BOOTCMD \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200116 "nfsargs=ip=:::::eth0: root=/dev/nfs\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700117 "nfsboot=run setup; " \
118 "setenv bootargs ${defargs} ${nfsargs} " \
119 "${setupargs} ${vidargs}; echo Booting from NFS...;" \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200120 "dhcp ${kernel_addr_r} && " \
121 "tftp ${fdt_addr_r} ${soc}-colibri${variant}-${fdt_board}.dtb && " \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700122 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
123
124#define UBI_BOOTCMD \
125 "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \
126 "ubi.fm_autoconvert=1\0" \
127 "ubiboot=run setup; " \
128 "setenv bootargs ${defargs} ${ubiargs} " \
129 "${setupargs} ${vidargs}; echo Booting from NAND...; " \
130 "ubi part ubi && run m4boot && " \
131 "ubi read ${kernel_addr_r} kernel && " \
132 "ubi read ${fdt_addr_r} dtb && " \
133 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
134
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200135#if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
Stefan Agner7df0ce82019-01-08 12:42:28 +0100136#define CONFIG_BOOTCOMMAND "run ubiboot ; echo ; echo ubiboot failed ; " \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200137 "setenv fdtfile ${soc}-colibri-${fdt_board}.dtb && run distro_bootcmd;"
138#define MODULE_EXTRA_ENV_SETTINGS \
139 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
140 UBI_BOOTCMD
141#elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
Igor Opaniuk8ff1c242019-08-23 20:00:48 +0300142#define CONFIG_BOOTCOMMAND \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200143 "setenv fdtfile ${soc}-colibri-emmc-${fdt_board}.dtb && run distro_bootcmd;"
144#define MODULE_EXTRA_ENV_SETTINGS \
145 "variant=-emmc\0" \
Igor Opaniukb4924a32019-06-18 14:57:32 +0300146 EMMC_BOOTCMD \
147 EMMC_ANDROID_BOOTCMD
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200148#endif
149
150#if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
151#define BOOT_TARGET_DEVICES(func) \
152 func(MMC, mmc, 0) \
153 func(USB, usb, 0) \
154 func(DHCP, dhcp, na)
155#elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
156#define BOOT_TARGET_DEVICES(func) \
157 func(MMC, mmc, 0) \
158 func(MMC, mmc, 1) \
159 func(USB, usb, 0) \
160 func(DHCP, dhcp, na)
161#endif
162#include <config_distro_bootcmd.h>
Stefan Agner41f75bb2016-07-20 21:27:49 -0700163
164#define CONFIG_EXTRA_ENV_SETTINGS \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200165 BOOTENV \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700166 MEM_LAYOUT_ENV_SETTINGS \
167 NFS_BOOTCMD \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200168 MODULE_EXTRA_ENV_SETTINGS \
Igor Opaniuka22f9752019-12-09 12:33:28 +0200169 UBOOT_UPDATE \
Stefan Agner7df0ce82019-01-08 12:42:28 +0100170 "boot_file=zImage\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700171 "console=ttymxc0\0" \
172 "defargs=\0" \
173 "fdt_board=eval-v3\0" \
174 "fdt_fixup=;\0" \
175 "m4boot=;\0" \
176 "ip_dyn=yes\0" \
177 "kernel_file=zImage\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700178 "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
179 "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
180 "${board}/flash_eth.img && source ${loadaddr}\0" \
181 "setsdupdate=mmc rescan && setenv interface mmc && " \
182 "fatload ${interface} 0:1 ${loadaddr} " \
183 "${board}/flash_blk.img && source ${loadaddr}\0" \
184 "setup=setenv setupargs " \
185 "console=tty1 console=${console}" \
Stefan Agner6a667482017-03-09 17:17:54 -0800186 ",${baudrate}n8 ${memargs} consoleblank=0\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700187 "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
188 "setusbupdate=usb start && setenv interface usb && " \
189 "fatload ${interface} 0:1 ${loadaddr} " \
190 "${board}/flash_blk.img && source ${loadaddr}\0" \
191 "splashpos=m,m\0" \
192 "videomode=video=ctfb:x:640,y:480,depth:18,pclk:39722,le:48,ri:16,up:33,lo:10,hs:96,vs:2,sync:0,vmode:0\0" \
Stefan Agner1575b542017-03-09 17:17:55 -0800193 "updlevel=2\0"
Stefan Agner41f75bb2016-07-20 21:27:49 -0700194
195/* Miscellaneous configurable options */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700196
Stefan Agner41f75bb2016-07-20 21:27:49 -0700197#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
198#define CONFIG_SYS_HZ 1000
199
Stefan Agner41f75bb2016-07-20 21:27:49 -0700200/* Physical Memory Map */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700201#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
202
203#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
204#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
205#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
206
207#define CONFIG_SYS_INIT_SP_OFFSET \
208 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
209#define CONFIG_SYS_INIT_SP_ADDR \
210 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
211
Masahiro Yamada8cea9b52017-02-11 22:43:54 +0900212/* environment organization */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700213
214#if defined(CONFIG_ENV_IS_IN_MMC)
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200215/* Environment in eMMC, before config block at the end of 1st "boot sector" */
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200216#define CONFIG_SYS_MMC_ENV_DEV 0
217#define CONFIG_SYS_MMC_ENV_PART 1
Stefan Agner41f75bb2016-07-20 21:27:49 -0700218#endif
219
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200220#ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
Stefan Agner41f75bb2016-07-20 21:27:49 -0700221/* NAND stuff */
222#define CONFIG_SYS_MAX_NAND_DEVICE 1
223#define CONFIG_SYS_NAND_BASE 0x40000000
224#define CONFIG_SYS_NAND_5_ADDR_CYCLE
225#define CONFIG_SYS_NAND_ONFI_DETECTION
226#define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200227#endif
Stefan Agner41f75bb2016-07-20 21:27:49 -0700228
229/* USB Configs */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700230#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
231
232#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
233#define CONFIG_MXC_USB_FLAGS 0
234#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
235
236#define CONFIG_IMX_THERMAL
237
238#define CONFIG_USBD_HS
239
Stefan Agner41f75bb2016-07-20 21:27:49 -0700240/* USB Device Firmware Update support */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700241#define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_16M
242#define DFU_DEFAULT_POLL_TIMEOUT 300
243
Igor Opaniukf5abe402019-06-04 00:05:59 +0300244#if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
Stefan Agner41f75bb2016-07-20 21:27:49 -0700245#define CONFIG_VIDEO_MXS
246#define CONFIG_VIDEO_LOGO
Stefan Agner41f75bb2016-07-20 21:27:49 -0700247#define CONFIG_SPLASH_SCREEN
248#define CONFIG_SPLASH_SCREEN_ALIGN
Stefan Agner41f75bb2016-07-20 21:27:49 -0700249#define CONFIG_BMP_16BPP
250#define CONFIG_VIDEO_BMP_RLE8
251#define CONFIG_VIDEO_BMP_LOGO
252#endif
253
254#endif