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 IMX_FEC_BASE			ENET_BASE_ADDR
29 #define CONFIG_FEC_XCV_TYPE		RGMII
30 #define CONFIG_ETHPRIME			"FEC"
31 #define CONFIG_FEC_MXC_PHYADDR		0
32 #define CONFIG_ARP_TIMEOUT		200UL
33 
34 /* Fuses */
35 #ifdef CONFIG_CMD_FUSE
36 #define CONFIG_MXC_OCOTP
37 #endif
38 
39 /* I2C Configs */
40 #define CONFIG_SYS_I2C
41 #define CONFIG_SYS_I2C_MXC
42 #define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
43 #define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
44 #define CONFIG_SYS_I2C_SPEED		100000
45 
46 /* MMC Configs */
47 #define CONFIG_FSL_ESDHC
48 #define CONFIG_FSL_USDHC
49 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
50 #define CONFIG_SYS_FSL_USDHC_NUM	2
51 #define CONFIG_SYS_MMC_ENV_DEV		1 /* 0 = SDHC2, 1 = SDHC4 (eMMC) */
52 
53 /* UART */
54 #define CONFIG_MXC_UART
55 #define CONFIG_MXC_UART_BASE		UART1_BASE
56 #define CONFIG_CONS_INDEX		1
57 #define CONFIG_BAUDRATE			115200
58 
59 /* USB Configs */
60 #ifdef CONFIG_CMD_USB
61 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
62 #define CONFIG_USB_HOST_ETHER
63 #define CONFIG_USB_ETHER_ASIX
64 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
65 #define CONFIG_MXC_USB_FLAGS		0
66 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2 /* Enabled USB controller number */
67 #endif
68 
69 /* Watchdog */
70 #define CONFIG_HW_WATCHDOG
71 #define CONFIG_IMX_WATCHDOG
72 #define CONFIG_WATCHDOG_TIMEOUT_MSECS	60000
73 
74 /* allow to overwrite serial and ethaddr */
75 #define CONFIG_ENV_OVERWRITE
76 
77 #define CONFIG_LOADADDR			0x12000000
78 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
79 
80 #ifndef CONFIG_SPL_BUILD
81 #define CONFIG_EXTRA_ENV_SETTINGS	\
82 	"console=ttymxc0,115200\0"	\
83 	"fdt_addr=0x18000000\0"		\
84 	"fdt_high=0xffffffff\0"		\
85 	"initrd_high=0xffffffff\0"	\
86 	"kernel_addr_r=0x10008000\0"	\
87 	"fdt_addr_r=0x13000000\0"	\
88 	"ramdisk_addr_r=0x18000000\0"	\
89 	"scriptaddr=0x14000000\0"	\
90 	"kernel_file=fitImage\0"\
91 	"rdinit=/sbin/init\0" \
92 	"addinitrd=setenv bootargs ${bootargs} rdinit=${rdinit} ${debug} \0" \
93 	"fit_config=mx6q_tpc70_conf\0" \
94 	"upd_image=st.4k\0" \
95 	"updargs=setenv bootargs console=${console} ${smp}"\
96 	       "rdinit=${rdinit} ${debug} ${displayargs}\0" \
97 	"loadusb=usb start; " \
98 	       "fatload usb 0 ${loadaddr} ${upd_image}\0" \
99 	"usbupd=echo Booting update from usb ...; " \
100 	       "setenv bootargs; " \
101 	       "run updargs; " \
102 	       "run loadusb; " \
103 	       "bootm ${loadaddr}#${fit_config}\0" \
104 	BOOTENV
105 
106 #define CONFIG_BOOTCOMMAND		"run usbupd; run distro_bootcmd"
107 
108 #define BOOT_TARGET_DEVICES(func) \
109 	func(MMC, mmc, 0) \
110 	func(MMC, mmc, 1) \
111 	func(USB, usb, 0) \
112 	func(DHCP, dhcp, na)
113 
114 #include <config_distro_bootcmd.h>
115 #endif
116 
117 /* Physical Memory Map */
118 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
119 
120 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
121 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
122 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
123 
124 #define CONFIG_SYS_INIT_SP_OFFSET \
125 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
126 
127 #define CONFIG_SYS_INIT_SP_ADDR \
128 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
129 
130 /* Environment */
131 #define CONFIG_ENV_SIZE	(SZ_8K)
132 #define CONFIG_ENV_OFFSET       0x100000
133 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
134 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
135 
136 #endif	/* __KP_IMX6Q_TPC_IMX6_CONFIG_H_ */
137