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*/ |
Tom Rini | 376b88a | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 17 | #define CFG_SYS_FSL_ESDHC_ADDR 0 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 18 | #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND |
Tom Rini | 376b88a | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 19 | #define CFG_SYS_FSL_USDHC_NUM 1 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 20 | #elif CONFIG_TARGET_COLIBRI_IMX7_EMMC |
Tom Rini | 376b88a | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 21 | #define CFG_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 | |
Igor Opaniuk | a22f975 | 2019-12-09 12:33:28 +0200 | [diff] [blame] | 24 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
| 25 | #define UBOOT_UPDATE \ |
| 26 | "uboot_hwpart=1\0" \ |
| 27 | "uboot_blk=2\0" \ |
| 28 | "set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && " \ |
| 29 | "setexpr blkcnt ${blkcnt} / 0x200\0" \ |
| 30 | "update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} && " \ |
| 31 | "mmc write ${loadaddr} ${uboot_blk} ${blkcnt}\0" |
| 32 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
| 33 | #define UBOOT_UPDATE \ |
| 34 | "update_uboot=nand erase.part u-boot1 && " \ |
| 35 | "nand write ${loadaddr} u-boot1 ${filesize} && " \ |
| 36 | "nand erase.part u-boot2 && " \ |
| 37 | "nand write ${loadaddr} u-boot2 ${filesize}\0" |
| 38 | #endif |
| 39 | |
Igor Opaniuk | b4924a3 | 2019-06-18 14:57:32 +0300 | [diff] [blame] | 40 | #ifndef PARTS_DEFAULT |
| 41 | /* Define the default GPT table for eMMC */ |
| 42 | #define PARTS_DEFAULT \ |
| 43 | /* Android partitions */ \ |
| 44 | "partitions_android=" \ |
| 45 | "uuid_disk=${uuid_gpt_disk};" \ |
| 46 | "name=boot,start=1M,size=32M,uuid=${uuid_gpt_boot};" \ |
| 47 | "name=environment,size=4M,uuid=${uuid_gpt_environment};" \ |
| 48 | "name=recovery,size=16M,uuid=${uuid_gpt_recovery};" \ |
| 49 | "name=system,size=1536M,uuid=${uuid_gpt_system};" \ |
| 50 | "name=cache,size=512M,uuid=${uuid_gpt_cache};" \ |
| 51 | "name=device,size=8M,uuid=${uuid_gpt_device};" \ |
| 52 | "name=misc,size=4M,uuid=${uuid_gpt_misc};" \ |
| 53 | "name=datafooter,size=2M,uuid=${uuid_gpt_datafooter};" \ |
| 54 | "name=metadata,size=2M,uuid=${uuid_gpt_metadata};" \ |
| 55 | "name=persistdata,size=2M,uuid=${uuid_gpt_persistdata};" \ |
| 56 | "name=userdata,size=128M,uuid=${uuid_gpt_userdata};" \ |
| 57 | "name=fbmisc,size=-,uuid=${uuid_gpt_fbmisc}\0" |
| 58 | #endif /* PARTS_DEFAULT */ |
| 59 | |
| 60 | #define EMMC_ANDROID_BOOTCMD \ |
| 61 | "android_args=androidboot.storage_type=emmc\0" \ |
| 62 | PARTS_DEFAULT \ |
| 63 | "android_fdt_addr=0x83700000\0" \ |
| 64 | "android_mmc_dev=0\0" \ |
| 65 | "m4binary=rpmsg_imu_freertos.elf\0" \ |
| 66 | "androidboot=ext4load mmc 0:a ${loadaddr} media/0/${m4binary}; "\ |
| 67 | "bootaux ${loadaddr}; " \ |
| 68 | "setenv loadaddr 0x88000000; " \ |
| 69 | "setenv bootm_boot_mode sec;" \ |
| 70 | "setenv bootargs androidboot.serialno=${serial#} " \ |
| 71 | "$android_args; " \ |
| 72 | "part start mmc ${android_mmc_dev} boot boot_start; " \ |
| 73 | "part size mmc ${android_mmc_dev} boot boot_size; " \ |
| 74 | "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \ |
| 75 | "part start mmc ${android_mmc_dev} environment env_start; " \ |
| 76 | "part size mmc ${android_mmc_dev} environment env_size; " \ |
| 77 | "mmc read ${android_fdt_addr} ${env_start} ${env_size}; " \ |
| 78 | "bootm ${loadaddr} ${loadaddr} ${android_fdt_addr}\0 " |
| 79 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 80 | #define MEM_LAYOUT_ENV_SETTINGS \ |
Stefan Agner | 35eebee | 2017-03-09 17:17:51 -0800 | [diff] [blame] | 81 | "bootm_size=0x10000000\0" \ |
Marcel Ziswiler | 351d831 | 2022-09-27 17:50:52 +0200 | [diff] [blame] | 82 | "fdt_addr_r=0x88200000\0" \ |
| 83 | "kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ |
| 84 | "pxefile_addr_r=0x88300000\0" \ |
| 85 | "ramdisk_addr_r=0x88400000\0" \ |
| 86 | "scriptaddr=0x88280000\0" |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 87 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 88 | #define UBI_BOOTCMD \ |
| 89 | "ubiargs=ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs " \ |
| 90 | "ubi.fm_autoconvert=1\0" \ |
| 91 | "ubiboot=run setup; " \ |
| 92 | "setenv bootargs ${defargs} ${ubiargs} " \ |
Philippe Schenker | bc5c954 | 2021-03-11 22:00:35 +0200 | [diff] [blame] | 93 | "${setupargs} ${vidargs} ${tdxargs}; echo Booting from NAND...; " \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 94 | "ubi part ubi && run m4boot && " \ |
| 95 | "ubi read ${kernel_addr_r} kernel && " \ |
| 96 | "ubi read ${fdt_addr_r} dtb && " \ |
| 97 | "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \ |
| 98 | |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 99 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 100 | #define MODULE_EXTRA_ENV_SETTINGS \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 101 | UBI_BOOTCMD |
| 102 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 103 | #define MODULE_EXTRA_ENV_SETTINGS \ |
| 104 | "variant=-emmc\0" \ |
Igor Opaniuk | b4924a3 | 2019-06-18 14:57:32 +0300 | [diff] [blame] | 105 | EMMC_ANDROID_BOOTCMD |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 106 | #endif |
| 107 | |
| 108 | #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND) |
| 109 | #define BOOT_TARGET_DEVICES(func) \ |
| 110 | func(MMC, mmc, 0) \ |
| 111 | func(USB, usb, 0) \ |
| 112 | func(DHCP, dhcp, na) |
| 113 | #elif defined(CONFIG_TARGET_COLIBRI_IMX7_EMMC) |
| 114 | #define BOOT_TARGET_DEVICES(func) \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 115 | func(MMC, mmc, 1) \ |
Igor Opaniuk | 3b20d6e | 2020-06-16 22:20:10 +0300 | [diff] [blame] | 116 | func(MMC, mmc, 0) \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 117 | func(USB, usb, 0) \ |
| 118 | func(DHCP, dhcp, na) |
| 119 | #endif |
| 120 | #include <config_distro_bootcmd.h> |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 121 | |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 122 | #define CFG_EXTRA_ENV_SETTINGS \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 123 | BOOTENV \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 124 | MEM_LAYOUT_ENV_SETTINGS \ |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 125 | MODULE_EXTRA_ENV_SETTINGS \ |
Igor Opaniuk | a22f975 | 2019-12-09 12:33:28 +0200 | [diff] [blame] | 126 | UBOOT_UPDATE \ |
Stefan Agner | 7df0ce8 | 2019-01-08 12:42:28 +0100 | [diff] [blame] | 127 | "boot_file=zImage\0" \ |
Igor Opaniuk | 84c1a2d | 2022-04-13 11:33:27 +0200 | [diff] [blame] | 128 | "boot_script_dhcp=boot.scr\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 129 | "console=ttymxc0\0" \ |
| 130 | "defargs=\0" \ |
| 131 | "fdt_board=eval-v3\0" \ |
| 132 | "fdt_fixup=;\0" \ |
| 133 | "m4boot=;\0" \ |
| 134 | "ip_dyn=yes\0" \ |
| 135 | "kernel_file=zImage\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 136 | "setethupdate=if env exists ethaddr; then; else setenv ethaddr " \ |
| 137 | "00:14:2d:00:00:00; fi; tftpboot ${loadaddr} " \ |
| 138 | "${board}/flash_eth.img && source ${loadaddr}\0" \ |
| 139 | "setsdupdate=mmc rescan && setenv interface mmc && " \ |
| 140 | "fatload ${interface} 0:1 ${loadaddr} " \ |
| 141 | "${board}/flash_blk.img && source ${loadaddr}\0" \ |
| 142 | "setup=setenv setupargs " \ |
| 143 | "console=tty1 console=${console}" \ |
Stefan Agner | 6a66748 | 2017-03-09 17:17:54 -0800 | [diff] [blame] | 144 | ",${baudrate}n8 ${memargs} consoleblank=0\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 145 | "setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \ |
| 146 | "setusbupdate=usb start && setenv interface usb && " \ |
| 147 | "fatload ${interface} 0:1 ${loadaddr} " \ |
| 148 | "${board}/flash_blk.img && source ${loadaddr}\0" \ |
| 149 | "splashpos=m,m\0" \ |
Tom Rini | 9004ee0 | 2021-08-23 10:25:30 -0400 | [diff] [blame] | 150 | "splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 151 | "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] | 152 | "updlevel=2\0" |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 153 | |
| 154 | /* Miscellaneous configurable options */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 155 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 156 | /* Physical Memory Map */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 157 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 158 | |
Tom Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 159 | #define CFG_SYS_SDRAM_BASE PHYS_SDRAM |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 160 | #define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 161 | #define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 162 | |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 163 | #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 164 | /* NAND stuff */ |
Tom Rini | b421349 | 2022-11-12 17:36:51 -0500 | [diff] [blame] | 165 | #define CFG_SYS_NAND_BASE 0x40000000 |
Stefan Agner | cbd59fe | 2018-08-06 09:19:19 +0200 | [diff] [blame] | 166 | #endif |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 167 | |
| 168 | /* USB Configs */ |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 169 | |
Tom Rini | b9796e8 | 2022-12-04 10:04:56 -0500 | [diff] [blame] | 170 | #define CFG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) |
| 171 | #define CFG_MXC_USB_FLAGS 0 |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 172 | |
Stefan Agner | 41f75bb | 2016-07-20 21:27:49 -0700 | [diff] [blame] | 173 | #endif |