apalis-tk1: add update_uboot wrapper
[platform/kernel/u-boot.git] / include / configs / kp_imx6q_tpc.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * K+P iMX6Q KP_IMX6Q_TPC board configuration
4  *
5  * Copyright (C) 2018 Lukasz Majewski <lukma@denx.de>
6  */
7
8 #ifndef __KP_IMX6Q_TPC_IMX6_CONFIG_H_
9 #define __KP_IMX6Q_TPC_IMX6_CONFIG_H_
10
11 #include <asm/arch/imx-regs.h>
12
13 #include "mx6_common.h"
14
15 /* SPL */
16 #include "imx6_spl.h"                   /* common IMX6 SPL configuration */
17
18 /* Miscellaneous configurable options */
19 #define CONFIG_CMDLINE_TAG
20 #define CONFIG_SETUP_MEMORY_TAGS
21 #define CONFIG_INITRD_TAG
22 #define CONFIG_REVISION_TAG
23
24 /* Size of malloc() pool */
25 #define CONFIG_SYS_MALLOC_LEN           (4 * SZ_1M)
26
27 /* FEC ethernet */
28 #define CONFIG_ARP_TIMEOUT              200UL
29
30 #define CONFIG_SYS_MMC_ENV_DEV          1 /* 0 = SDHC2, 1 = SDHC4 (eMMC) */
31
32 /* USB Configs */
33 #ifdef CONFIG_CMD_USB
34 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
35 #define CONFIG_USB_HOST_ETHER
36 #define CONFIG_USB_ETHER_ASIX
37 #define CONFIG_MXC_USB_PORTSC           (PORT_PTS_UTMI | PORT_PTS_PTW)
38 #define CONFIG_MXC_USB_FLAGS            0
39 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 /* Enabled USB controller number */
40 #endif
41
42 /* Watchdog */
43
44 /* allow to overwrite serial and ethaddr */
45 #define CONFIG_ENV_OVERWRITE
46
47 #define CONFIG_LOADADDR                 0x12000000
48 #define CONFIG_SYS_LOAD_ADDR            CONFIG_LOADADDR
49
50 #ifndef CONFIG_SPL_BUILD
51 #define CONFIG_EXTRA_ENV_SETTINGS       \
52         "console=ttymxc0,115200\0"      \
53         "fdt_addr=0x18000000\0"         \
54         "fdt_high=0xffffffff\0"         \
55         "initrd_high=0xffffffff\0"      \
56         "kernel_addr_r=0x10008000\0"    \
57         "fdt_addr_r=0x13000000\0"       \
58         "ramdisk_addr_r=0x18000000\0"   \
59         "scriptaddr=0x14000000\0"       \
60         "kernel_file=fitImage\0"\
61         "rdinit=/sbin/init\0" \
62         "addinitrd=setenv bootargs ${bootargs} rdinit=${rdinit} ${debug} \0" \
63         "fit_config=mx6q_tpc70_conf\0" \
64         "uboot_file=u-boot.img\0" \
65         "SPL_file=SPL\0" \
66         "wic_file=kp-image-kpimx6qtpc.wic\0" \
67         "upd_image=st.4k\0" \
68         "updargs=setenv bootargs console=${console} ${smp} ${displayargs}\0" \
69         "initrd_ram_dev=/dev/ram\0" \
70         "addswupdate=setenv bootargs ${bootargs} root=${initrd_ram_dev} rw\0" \
71         "loadusb=usb start; " \
72                "fatload usb 0 ${loadaddr} ${upd_image}\0" \
73         "upd_uboot_sd=" \
74             "if tftp ${loadaddr} ${uboot_file}; then " \
75                "setexpr blkc ${filesize} / 0x200;" \
76                "setexpr blkc ${blkc} + 1;" \
77                "mmc write ${loadaddr} 0x8A ${blkc};" \
78             "fi;\0" \
79         "upd_SPL_sd=" \
80             "if tftp ${loadaddr} ${SPL_file}; then " \
81                "setexpr blkc ${filesize} / 0x200;" \
82                "setexpr blkc ${blkc} + 1;" \
83                "mmc write ${loadaddr} 0x2 ${blkc};" \
84             "fi;\0" \
85         "upd_SPL_mmc=mmc dev 1; mmc partconf 1 0 1 1; run upd_SPL_sd\0" \
86         "upd_uboot_mmc=mmc dev 1; mmc partconf 1 0 1 1; run upd_uboot_sd\0" \
87         "up_mmc=run upd_SPL_mmc; run upd_uboot_mmc\0" \
88         "up_sd=run upd_SPL_sd; run upd_uboot_sd\0" \
89         "upd_wic=" \
90             "if tftp ${loadaddr} ${wic_file}; then " \
91                "setexpr blkc ${filesize} / 0x200;" \
92                "setexpr blkc ${blkc} + 1;" \
93                "mmc write ${loadaddr} 0x0 ${blkc};" \
94             "fi;\0" \
95         "usbupd=echo Booting update from usb ...; " \
96                "setenv bootargs; " \
97                "run updargs; " \
98                "run addinitrd; " \
99                "run addswupdate; " \
100                "run loadusb; " \
101                "bootm ${loadaddr}#${fit_config}\0" \
102         BOOTENV
103
104 #define CONFIG_BOOTCOMMAND              "run usbupd; run distro_bootcmd"
105
106 #define BOOT_TARGET_DEVICES(func) \
107         func(MMC, mmc, 0) \
108         func(MMC, mmc, 1) \
109         func(USB, usb, 0) \
110         func(DHCP, dhcp, na)
111
112 #include <config_distro_bootcmd.h>
113 #endif
114
115 /* Physical Memory Map */
116 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
117
118 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
119 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
120 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
121
122 #define CONFIG_SYS_INIT_SP_OFFSET \
123         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
124
125 #define CONFIG_SYS_INIT_SP_ADDR \
126         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
127
128 /* Environment */
129
130 #endif  /* __KP_IMX6Q_TPC_IMX6_CONFIG_H_ */