blob: 92e24ea8c615aa557ebaac18e21ea53825925d11 [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/* MMC Config*/
17#define CONFIG_SYS_FSL_ESDHC_ADDR 0
Stefan Agnercbd59fe2018-08-06 09:19:19 +020018#ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
Stefan Agner41f75bb2016-07-20 21:27:49 -070019#define CONFIG_SYS_FSL_USDHC_NUM 1
Stefan Agnercbd59fe2018-08-06 09:19:19 +020020#elif CONFIG_TARGET_COLIBRI_IMX7_EMMC
21#define CONFIG_SYS_FSL_USDHC_NUM 2
Stefan Agnercbd59fe2018-08-06 09:19:19 +020022#endif
Stefan Agner41f75bb2016-07-20 21:27:49 -070023
Stefan Agner41f75bb2016-07-20 21:27:49 -070024#define CONFIG_IPADDR 192.168.10.2
25#define CONFIG_NETMASK 255.255.255.0
26#define CONFIG_SERVERIP 192.168.10.1
27
Igor Opaniuka22f9752019-12-09 12:33:28 +020028#if defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
29#define UBOOT_UPDATE \
30 "uboot_hwpart=1\0" \
31 "uboot_blk=2\0" \
32 "set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && " \
33 "setexpr blkcnt ${blkcnt} / 0x200\0" \
34 "update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \
35 "mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0"
36#elif defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
37#define UBOOT_UPDATE \
38 "update_uboot=nand erase.part u-boot1 && " \
39 "nand write ${loadaddr} u-boot1 ${filesize} && " \
40 "nand erase.part u-boot2 && " \
41 "nand write ${loadaddr} u-boot2 ${filesize}\0"
42#endif
43
Igor Opaniukb4924a32019-06-18 14:57:32 +030044#ifndef PARTS_DEFAULT
45/* Define the default GPT table for eMMC */
46#define PARTS_DEFAULT \
47 /* Android partitions */ \
48 "partitions_android=" \
49 "uuid_disk=${uuid_gpt_disk};" \
50 "name=boot,start=1M,size=32M,uuid=${uuid_gpt_boot};" \
51 "name=environment,size=4M,uuid=${uuid_gpt_environment};" \
52 "name=recovery,size=16M,uuid=${uuid_gpt_recovery};" \
53 "name=system,size=1536M,uuid=${uuid_gpt_system};" \
54 "name=cache,size=512M,uuid=${uuid_gpt_cache};" \
55 "name=device,size=8M,uuid=${uuid_gpt_device};" \
56 "name=misc,size=4M,uuid=${uuid_gpt_misc};" \
57 "name=datafooter,size=2M,uuid=${uuid_gpt_datafooter};" \
58 "name=metadata,size=2M,uuid=${uuid_gpt_metadata};" \
59 "name=persistdata,size=2M,uuid=${uuid_gpt_persistdata};" \
60 "name=userdata,size=128M,uuid=${uuid_gpt_userdata};" \
61 "name=fbmisc,size=-,uuid=${uuid_gpt_fbmisc}\0"
62#endif /* PARTS_DEFAULT */
63
64#define EMMC_ANDROID_BOOTCMD \
65 "android_args=androidboot.storage_type=emmc\0" \
66 PARTS_DEFAULT \
67 "android_fdt_addr=0x83700000\0" \
68 "android_mmc_dev=0\0" \
69 "m4binary=rpmsg_imu_freertos.elf\0" \
70 "androidboot=ext4load mmc 0:a ${loadaddr} media/0/${m4binary}; "\
71 "bootaux ${loadaddr}; " \
72 "setenv loadaddr 0x88000000; " \
73 "setenv bootm_boot_mode sec;" \
74 "setenv bootargs androidboot.serialno=${serial#} " \
75 "$android_args; " \
76 "part start mmc ${android_mmc_dev} boot boot_start; " \
77 "part size mmc ${android_mmc_dev} boot boot_size; " \
78 "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
79 "part start mmc ${android_mmc_dev} environment env_start; " \
80 "part size mmc ${android_mmc_dev} environment env_size; " \
81 "mmc read ${android_fdt_addr} ${env_start} ${env_size}; " \
82 "bootm ${loadaddr} ${loadaddr} ${android_fdt_addr}\0 "
83
Stefan Agner41f75bb2016-07-20 21:27:49 -070084#define MEM_LAYOUT_ENV_SETTINGS \
Stefan Agner35eebee2017-03-09 17:17:51 -080085 "bootm_size=0x10000000\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -070086 "fdt_addr_r=0x82000000\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -070087 "kernel_addr_r=0x81000000\0" \
Stefan Agnerfa7dffe2020-06-16 22:20:02 +030088 "pxefile_addr_r=0x87100000\0" \
Igor Opaniuk8ff1c242019-08-23 20:00:48 +030089 "ramdisk_addr_r=0x82100000\0" \
Stefan Agnerfa7dffe2020-06-16 22:20:02 +030090 "scriptaddr=0x87000000\0"
Stefan Agner41f75bb2016-07-20 21:27:49 -070091
Stefan Agner41f75bb2016-07-20 21:27:49 -070092#define NFS_BOOTCMD \
Stefan Agnercbd59fe2018-08-06 09:19:19 +020093 "nfsargs=ip=:::::eth0: root=/dev/nfs\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -070094 "nfsboot=run setup; " \
95 "setenv bootargs ${defargs} ${nfsargs} " \
96 "${setupargs} ${vidargs}; echo Booting from NFS...;" \
Stefan Agnercbd59fe2018-08-06 09:19:19 +020097 "dhcp ${kernel_addr_r} && " \
98 "tftp ${fdt_addr_r} ${soc}-colibri${variant}-${fdt_board}.dtb && " \
Stefan Agner41f75bb2016-07-20 21:27:49 -070099 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
100
101#define UBI_BOOTCMD \
102 "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \
103 "ubi.fm_autoconvert=1\0" \
104 "ubiboot=run setup; " \
105 "setenv bootargs ${defargs} ${ubiargs} " \
Philippe Schenkerbc5c9542021-03-11 22:00:35 +0200106 "${setupargs} ${vidargs} ${tdxargs}; echo Booting from NAND...; " \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700107 "ubi part ubi && run m4boot && " \
108 "ubi read ${kernel_addr_r} kernel && " \
109 "ubi read ${fdt_addr_r} dtb && " \
110 "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
111
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200112#if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200113#define MODULE_EXTRA_ENV_SETTINGS \
114 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
115 UBI_BOOTCMD
116#elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200117#define MODULE_EXTRA_ENV_SETTINGS \
118 "variant=-emmc\0" \
Igor Opaniukb4924a32019-06-18 14:57:32 +0300119 EMMC_ANDROID_BOOTCMD
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200120#endif
121
122#if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
123#define BOOT_TARGET_DEVICES(func) \
124 func(MMC, mmc, 0) \
125 func(USB, usb, 0) \
126 func(DHCP, dhcp, na)
127#elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC)
128#define BOOT_TARGET_DEVICES(func) \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200129 func(MMC, mmc, 1) \
Igor Opaniuk3b20d6e2020-06-16 22:20:10 +0300130 func(MMC, mmc, 0) \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200131 func(USB, usb, 0) \
132 func(DHCP, dhcp, na)
133#endif
134#include <config_distro_bootcmd.h>
Stefan Agner41f75bb2016-07-20 21:27:49 -0700135
136#define CONFIG_EXTRA_ENV_SETTINGS \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200137 BOOTENV \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700138 MEM_LAYOUT_ENV_SETTINGS \
139 NFS_BOOTCMD \
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200140 MODULE_EXTRA_ENV_SETTINGS \
Igor Opaniuka22f9752019-12-09 12:33:28 +0200141 UBOOT_UPDATE \
Stefan Agner7df0ce82019-01-08 12:42:28 +0100142 "boot_file=zImage\0" \
Stefan Agnera72a1f52020-06-16 22:20:03 +0300143 "bootubipart=ubi\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700144 "console=ttymxc0\0" \
145 "defargs=\0" \
146 "fdt_board=eval-v3\0" \
147 "fdt_fixup=;\0" \
148 "m4boot=;\0" \
149 "ip_dyn=yes\0" \
150 "kernel_file=zImage\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700151 "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
152 "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \
153 "${board}/flash_eth.img && source ${loadaddr}\0" \
154 "setsdupdate=mmc rescan && setenv interface mmc && " \
155 "fatload ${interface} 0:1 ${loadaddr} " \
156 "${board}/flash_blk.img && source ${loadaddr}\0" \
157 "setup=setenv setupargs " \
158 "console=tty1 console=${console}" \
Stefan Agner6a667482017-03-09 17:17:54 -0800159 ",${baudrate}n8 ${memargs} consoleblank=0\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700160 "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
161 "setusbupdate=usb start && setenv interface usb && " \
162 "fatload ${interface} 0:1 ${loadaddr} " \
163 "${board}/flash_blk.img && source ${loadaddr}\0" \
164 "splashpos=m,m\0" \
Tom Rini9004ee02021-08-23 10:25:30 -0400165 "splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
Stefan Agner41f75bb2016-07-20 21:27:49 -0700166 "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 -0800167 "updlevel=2\0"
Stefan Agner41f75bb2016-07-20 21:27:49 -0700168
169/* Miscellaneous configurable options */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700170
Stefan Agner41f75bb2016-07-20 21:27:49 -0700171/* Physical Memory Map */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700172#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
173
174#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
175#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
176#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
177
178#define CONFIG_SYS_INIT_SP_OFFSET \
179 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
180#define CONFIG_SYS_INIT_SP_ADDR \
181 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
182
Francesco Dolciniac7997d2021-09-01 09:48:03 +0200183/* environment organization */
184#if defined(CONFIG_ENV_IS_IN_NAND)
185#define CONFIG_ENV_RANGE (4 * CONFIG_ENV_SIZE)
186#endif
187
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200188#ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
Stefan Agner41f75bb2016-07-20 21:27:49 -0700189/* NAND stuff */
190#define CONFIG_SYS_MAX_NAND_DEVICE 1
191#define CONFIG_SYS_NAND_BASE 0x40000000
Stefan Agner41f75bb2016-07-20 21:27:49 -0700192#define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES
Stefan Agnercbd59fe2018-08-06 09:19:19 +0200193#endif
Stefan Agner41f75bb2016-07-20 21:27:49 -0700194
195/* USB Configs */
Stefan Agner41f75bb2016-07-20 21:27:49 -0700196#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
197
198#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
199#define CONFIG_MXC_USB_FLAGS 0
200#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
201
Stefan Agner41f75bb2016-07-20 21:27:49 -0700202#define CONFIG_USBD_HS
203
Anatolij Gustschine22e08e2021-10-04 17:33:12 +0200204#if defined(CONFIG_DM_VIDEO)
Stefan Agner41f75bb2016-07-20 21:27:49 -0700205#define CONFIG_VIDEO_BMP_LOGO
206#endif
207
208#endif