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 | /* MMC Config*/ |
| 17 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 18 | #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 19 | #define CONFIG_SYS_FSL_USDHC_NUM 1 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 20 | #elif CONFIG_TARGET_COLIBRI_IMX7_EMMC |
| 21 | #define CONFIG_SYS_FSL_USDHC_NUM 2 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 22 | #endif |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 23 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 24 | #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 Opaniuk | a22f975 | 2019-12-09 12:33:28 +0200 | [diff] [blame] | 28 | #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 Opaniuk | b4924a3 | 2019-06-18 14:57:32 +0300 | [diff] [blame] | 44 | #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 Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 84 | #define MEM_LAYOUT_ENV_SETTINGS \ |
Stefan Agner | 35eebee | 2017-03-09 17:17:51 -0800 | [diff] [blame] | 85 | "bootm_size=0x10000000\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 86 | "fdt_addr_r=0x82000000\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 87 | "kernel_addr_r=0x81000000\0" \ |
Stefan Agner | fa7dffe | 2020-06-16 22:20:02 +0300 | [diff] [blame] | 88 | "pxefile_addr_r=0x87100000\0" \ |
Igor Opaniuk | 8ff1c24 | 2019-08-23 20:00:48 +0300 | [diff] [blame] | 89 | "ramdisk_addr_r=0x82100000\0" \ |
Stefan Agner | fa7dffe | 2020-06-16 22:20:02 +0300 | [diff] [blame] | 90 | "scriptaddr=0x87000000\0" |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 91 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 92 | #define UBI_BOOTCMD \ |
| 93 | "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \ |
| 94 | "ubi.fm_autoconvert=1\0" \ |
| 95 | "ubiboot=run setup; " \ |
| 96 | "setenv bootargs ${defargs} ${ubiargs} " \ |
Philippe Schenker | bc5c954 | 2021-03-11 22:00:35 +0200 | [diff] [blame] | 97 | "${setupargs} ${vidargs} ${tdxargs}; echo Booting from NAND...; " \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 98 | "ubi part ubi && run m4boot && " \ |
| 99 | "ubi read ${kernel_addr_r} kernel && " \ |
| 100 | "ubi read ${fdt_addr_r} dtb && " \ |
| 101 | "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \ |
| 102 | |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 103 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 104 | #define MODULE_EXTRA_ENV_SETTINGS \ |
| 105 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
| 106 | UBI_BOOTCMD |
| 107 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 108 | #define MODULE_EXTRA_ENV_SETTINGS \ |
| 109 | "variant=-emmc\0" \ |
Igor Opaniuk | b4924a3 | 2019-06-18 14:57:32 +0300 | [diff] [blame] | 110 | EMMC_ANDROID_BOOTCMD |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 111 | #endif |
| 112 | |
| 113 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
| 114 | #define BOOT_TARGET_DEVICES(func) \ |
| 115 | func(MMC, mmc, 0) \ |
| 116 | func(USB, usb, 0) \ |
| 117 | func(DHCP, dhcp, na) |
| 118 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
| 119 | #define BOOT_TARGET_DEVICES(func) \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 120 | func(MMC, mmc, 1) \ |
Igor Opaniuk | 3b20d6e | 2020-06-16 22:20:10 +0300 | [diff] [blame] | 121 | func(MMC, mmc, 0) \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 122 | func(USB, usb, 0) \ |
| 123 | func(DHCP, dhcp, na) |
| 124 | #endif |
| 125 | #include <config_distro_bootcmd.h> |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 126 | |
| 127 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 128 | BOOTENV \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 129 | MEM_LAYOUT_ENV_SETTINGS \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 130 | MODULE_EXTRA_ENV_SETTINGS \ |
Igor Opaniuk | a22f975 | 2019-12-09 12:33:28 +0200 | [diff] [blame] | 131 | UBOOT_UPDATE \ |
Stefan Agner | 7df0ce8 | 2019-01-08 12:42:28 +0100 | [diff] [blame] | 132 | "boot_file=zImage\0" \ |
Igor Opaniuk | 84c1a2d | 2022-04-13 11:33:27 +0200 | [diff] [blame] | 133 | "boot_script_dhcp=boot.scr\0" \ |
Stefan Agner | a72a1f5 | 2020-06-16 22:20:03 +0300 | [diff] [blame] | 134 | "bootubipart=ubi\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 135 | "console=ttymxc0\0" \ |
| 136 | "defargs=\0" \ |
| 137 | "fdt_board=eval-v3\0" \ |
| 138 | "fdt_fixup=;\0" \ |
| 139 | "m4boot=;\0" \ |
| 140 | "ip_dyn=yes\0" \ |
| 141 | "kernel_file=zImage\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 142 | "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \ |
| 143 | "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \ |
| 144 | "${board}/flash_eth.img && source ${loadaddr}\0" \ |
| 145 | "setsdupdate=mmc rescan && setenv interface mmc && " \ |
| 146 | "fatload ${interface} 0:1 ${loadaddr} " \ |
| 147 | "${board}/flash_blk.img && source ${loadaddr}\0" \ |
| 148 | "setup=setenv setupargs " \ |
| 149 | "console=tty1 console=${console}" \ |
Stefan Agner | 6a66748 | 2017-03-09 17:17:54 -0800 | [diff] [blame] | 150 | ",${baudrate}n8 ${memargs} consoleblank=0\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 151 | "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \ |
| 152 | "setusbupdate=usb start && setenv interface usb && " \ |
| 153 | "fatload ${interface} 0:1 ${loadaddr} " \ |
| 154 | "${board}/flash_blk.img && source ${loadaddr}\0" \ |
| 155 | "splashpos=m,m\0" \ |
Tom Rini | 9004ee0 | 2021-08-23 10:25:30 -0400 | [diff] [blame] | 156 | "splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 157 | "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] | 158 | "updlevel=2\0" |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 159 | |
| 160 | /* Miscellaneous configurable options */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 161 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 162 | /* Physical Memory Map */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 163 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 164 | |
| 165 | #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM |
| 166 | #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 167 | #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE |
| 168 | |
| 169 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
| 170 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
| 171 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 172 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
| 173 | |
Francesco Dolcini | ac7997d | 2021-09-01 09:48:03 +0200 | [diff] [blame] | 174 | /* environment organization */ |
| 175 | #if defined(CONFIG_ENV_IS_IN_NAND) |
| 176 | #define CONFIG_ENV_RANGE (4 * CONFIG_ENV_SIZE) |
| 177 | #endif |
| 178 | |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 179 | #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 180 | /* NAND stuff */ |
| 181 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 182 | #define CONFIG_SYS_NAND_BASE 0x40000000 |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 183 | #define CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 184 | #endif |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 185 | |
| 186 | /* USB Configs */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 187 | #define CONFIG_EHCI_HCD_INIT_AFTER_RESET |
| 188 | |
| 189 | #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) |
| 190 | #define CONFIG_MXC_USB_FLAGS 0 |
| 191 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 |
| 192 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 193 | #define CONFIG_USBD_HS |
| 194 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 195 | #endif |