Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 2 | /* |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 3 | * Copyright 2016-2018 Toradex AG |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 4 | * |
| 5 | * Configuration settings for the Colibri iMX7 module. |
| 6 | * |
| 7 | * based on mx7dsabresd.h: |
| 8 | * Copyright (C) 2015 Freescale Semiconductor, Inc. |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef __COLIBRI_IMX7_CONFIG_H |
| 12 | #define __COLIBRI_IMX7_CONFIG_H |
| 13 | |
| 14 | #include "mx7_common.h" |
| 15 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 16 | /* Size of malloc() pool */ |
| 17 | #define CONFIG_SYS_MALLOC_LEN (32 * SZ_1M) |
| 18 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 19 | /* MMC Config*/ |
| 20 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 21 | #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 22 | #define CONFIG_SYS_FSL_USDHC_NUM 1 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 23 | #elif CONFIG_TARGET_COLIBRI_IMX7_EMMC |
| 24 | #define CONFIG_SYS_FSL_USDHC_NUM 2 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 25 | #endif |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 26 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 27 | /* I2C configs */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 28 | #define CONFIG_SYS_I2C_MXC |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 29 | #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 Opaniuk | a22f975 | 2019-12-09 12:33:28 +0200 | [diff] [blame] | 35 | #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 Opaniuk | b4924a3 | 2019-06-18 14:57:32 +0300 | [diff] [blame] | 51 | #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 Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 91 | #define MEM_LAYOUT_ENV_SETTINGS \ |
Stefan Agner | 35eebee | 2017-03-09 17:17:51 -0800 | [diff] [blame] | 92 | "bootm_size=0x10000000\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 93 | "fdt_addr_r=0x82000000\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 94 | "kernel_addr_r=0x81000000\0" \ |
Stefan Agner | fa7dffe | 2020-06-16 22:20:02 +0300 | [diff] [blame] | 95 | "pxefile_addr_r=0x87100000\0" \ |
Igor Opaniuk | 8ff1c24 | 2019-08-23 20:00:48 +0300 | [diff] [blame] | 96 | "ramdisk_addr_r=0x82100000\0" \ |
Stefan Agner | fa7dffe | 2020-06-16 22:20:02 +0300 | [diff] [blame] | 97 | "scriptaddr=0x87000000\0" |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 98 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 99 | #define NFS_BOOTCMD \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 100 | "nfsargs=ip=:::::eth0: root=/dev/nfs\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 101 | "nfsboot=run setup; " \ |
| 102 | "setenv bootargs ${defargs} ${nfsargs} " \ |
| 103 | "${setupargs} ${vidargs}; echo Booting from NFS...;" \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 104 | "dhcp ${kernel_addr_r} && " \ |
| 105 | "tftp ${fdt_addr_r} ${soc}-colibri${variant}-${fdt_board}.dtb && " \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 106 | "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \ |
| 107 | |
| 108 | #define UBI_BOOTCMD \ |
| 109 | "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \ |
| 110 | "ubi.fm_autoconvert=1\0" \ |
| 111 | "ubiboot=run setup; " \ |
| 112 | "setenv bootargs ${defargs} ${ubiargs} " \ |
| 113 | "${setupargs} ${vidargs}; echo Booting from NAND...; " \ |
| 114 | "ubi part ubi && run m4boot && " \ |
| 115 | "ubi read ${kernel_addr_r} kernel && " \ |
| 116 | "ubi read ${fdt_addr_r} dtb && " \ |
| 117 | "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \ |
| 118 | |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 119 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
Stefan Agner | 7df0ce8 | 2019-01-08 12:42:28 +0100 | [diff] [blame] | 120 | #define CONFIG_BOOTCOMMAND "run ubiboot ; echo ; echo ubiboot failed ; " \ |
Igor Opaniuk | a692001 | 2020-09-14 11:01:10 +0300 | [diff] [blame] | 121 | "run distro_bootcmd;" |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 122 | #define MODULE_EXTRA_ENV_SETTINGS \ |
| 123 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
| 124 | UBI_BOOTCMD |
| 125 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 126 | #define MODULE_EXTRA_ENV_SETTINGS \ |
| 127 | "variant=-emmc\0" \ |
Igor Opaniuk | b4924a3 | 2019-06-18 14:57:32 +0300 | [diff] [blame] | 128 | EMMC_ANDROID_BOOTCMD |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 129 | #endif |
| 130 | |
| 131 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
| 132 | #define BOOT_TARGET_DEVICES(func) \ |
| 133 | func(MMC, mmc, 0) \ |
| 134 | func(USB, usb, 0) \ |
| 135 | func(DHCP, dhcp, na) |
| 136 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
| 137 | #define BOOT_TARGET_DEVICES(func) \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 138 | func(MMC, mmc, 1) \ |
Igor Opaniuk | 3b20d6e | 2020-06-16 22:20:10 +0300 | [diff] [blame] | 139 | func(MMC, mmc, 0) \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 140 | func(USB, usb, 0) \ |
| 141 | func(DHCP, dhcp, na) |
| 142 | #endif |
| 143 | #include <config_distro_bootcmd.h> |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 144 | |
| 145 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 146 | BOOTENV \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 147 | MEM_LAYOUT_ENV_SETTINGS \ |
| 148 | NFS_BOOTCMD \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 149 | MODULE_EXTRA_ENV_SETTINGS \ |
Igor Opaniuk | a22f975 | 2019-12-09 12:33:28 +0200 | [diff] [blame] | 150 | UBOOT_UPDATE \ |
Stefan Agner | 7df0ce8 | 2019-01-08 12:42:28 +0100 | [diff] [blame] | 151 | "boot_file=zImage\0" \ |
Stefan Agner | a72a1f5 | 2020-06-16 22:20:03 +0300 | [diff] [blame] | 152 | "bootubipart=ubi\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 153 | "console=ttymxc0\0" \ |
| 154 | "defargs=\0" \ |
| 155 | "fdt_board=eval-v3\0" \ |
| 156 | "fdt_fixup=;\0" \ |
| 157 | "m4boot=;\0" \ |
| 158 | "ip_dyn=yes\0" \ |
| 159 | "kernel_file=zImage\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 160 | "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \ |
| 161 | "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \ |
| 162 | "${board}/flash_eth.img && source ${loadaddr}\0" \ |
| 163 | "setsdupdate=mmc rescan && setenv interface mmc && " \ |
| 164 | "fatload ${interface} 0:1 ${loadaddr} " \ |
| 165 | "${board}/flash_blk.img && source ${loadaddr}\0" \ |
| 166 | "setup=setenv setupargs " \ |
| 167 | "console=tty1 console=${console}" \ |
Stefan Agner | 6a66748 | 2017-03-09 17:17:54 -0800 | [diff] [blame] | 168 | ",${baudrate}n8 ${memargs} consoleblank=0\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 169 | "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \ |
| 170 | "setusbupdate=usb start && setenv interface usb && " \ |
| 171 | "fatload ${interface} 0:1 ${loadaddr} " \ |
| 172 | "${board}/flash_blk.img && source ${loadaddr}\0" \ |
| 173 | "splashpos=m,m\0" \ |
Igor Opaniuk | d8e293b | 2020-09-14 11:01:05 +0300 | [diff] [blame] | 174 | "splashimage=" __stringify(CONFIG_LOADADDR) "\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 175 | "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 Agner | 1575b54 | 2017-03-09 17:17:55 -0800 | [diff] [blame] | 176 | "updlevel=2\0" |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 177 | |
| 178 | /* Miscellaneous configurable options */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 179 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 180 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
| 181 | #define CONFIG_SYS_HZ 1000 |
| 182 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 183 | /* Physical Memory Map */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 184 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 185 | |
| 186 | #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM |
| 187 | #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 188 | #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE |
| 189 | |
| 190 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
| 191 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
| 192 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 193 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
| 194 | |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 195 | #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 196 | /* NAND stuff */ |
| 197 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 198 | #define CONFIG_SYS_NAND_BASE 0x40000000 |
| 199 | #define CONFIG_SYS_NAND_5_ADDR_CYCLE |
| 200 | #define CONFIG_SYS_NAND_ONFI_DETECTION |
| 201 | #define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 202 | #endif |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 203 | |
| 204 | /* USB Configs */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 205 | #define CONFIG_EHCI_HCD_INIT_AFTER_RESET |
| 206 | |
| 207 | #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) |
| 208 | #define CONFIG_MXC_USB_FLAGS 0 |
| 209 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 |
| 210 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 211 | #define CONFIG_USBD_HS |
| 212 | |
Igor Opaniuk | f5abe40 | 2019-06-04 00:05:59 +0300 | [diff] [blame] | 213 | #if defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 214 | #define CONFIG_VIDEO_MXS |
| 215 | #define CONFIG_VIDEO_LOGO |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 216 | #define CONFIG_VIDEO_BMP_LOGO |
| 217 | #endif |
| 218 | |
| 219 | #endif |