Move custom button recovery mode to environment script
[oweals/u-boot_mod.git] / u-boot / include / configs / qca9k_common.h
1 /*
2  * Copyright (C) 2016 Piotr Dymacz <piotr@dymacz.pl>
3  *
4  * This file contains some of the common configs/defines
5  * for boards based on Qualcomm/Atheros QCA9xxx WiSoCs
6  *
7  * SPDX-License-Identifier: GPL-2.0
8  */
9
10 #ifndef __QCA9K_COMMON_H
11 #define __QCA9K_COMMON_H
12
13 /* No debug */
14 #if defined(DEBUG)
15         #undef DEBUG
16 #endif
17
18 /* Wait only 1 second by default */
19 #if !defined(CONFIG_BOOTDELAY)
20         #define CONFIG_BOOTDELAY        1
21 #endif
22
23 #if !defined(CONFIG_MENUPROMPT)
24         #define CONFIG_MENUPROMPT       "Hit any key to stop booting: %2d "
25 #endif
26
27 /* Allow to disable console output, don't display console info */
28 #define CONFIG_SILENT_CONSOLE   1
29 #define CFG_CONSOLE_INFO_QUIET  1
30
31 /* Use 115200 as default baudrate */
32 #if !defined(CONFIG_BAUDRATE)
33         #define CONFIG_BAUDRATE 115200
34 #endif
35
36 /* CLI parser, prompt */
37 #define CFG_HUSH_PARSER         1
38 #define CFG_LONGHELP            1
39 #define CFG_PROMPT              "u-boot> "
40 #define CFG_PROMPT_HUSH_PS2     "> "
41
42 #define CFG_CBSIZE              1024
43 #define CFG_PBSIZE              (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
44 #define CFG_MAXARGS             16
45 #define CFG_MALLOC_LEN          (512 * 1024)
46 #define CFG_BOOTPARAMS_LEN      (512 * 1024)
47
48 /* RAM memory start address */
49 #define CFG_SDRAM_BASE          0x80000000
50
51 /* Ethernet related */
52 #define CONFIG_NET_MULTI        1
53 #define CFG_MII0_RMII           1
54 #define CFG_RX_ETH_BUFFER       16
55
56 /* Memory test */
57 #define CFG_ALT_MEMTEST         1
58 #define CFG_MEMTEST_START       (CFG_SDRAM_BASE + (2 * 1024 * 1024))
59 #define CFG_MEMTEST_END         (CFG_SDRAM_BASE + bd->bi_memsize \
60                                  - (4 * 1024 * 1024) - 1)
61
62 /* FLASH */
63 #define CFG_MAX_FLASH_BANKS     1
64 #define CFG_MAX_FLASH_SECT      4096
65 #define CFG_FLASH_BASE          0x9F000000
66
67 #if defined(COMPRESSED_UBOOT)
68         #define BOOTSTRAP_TEXT_BASE             CFG_FLASH_BASE
69         #define BOOTSTRAP_CFG_MONITOR_BASE      BOOTSTRAP_TEXT_BASE
70 #endif
71
72 /* Boot related */
73 #define CFG_BOOTM_LEN           (16 << 20)
74
75 /* The following #defines are needed to get flash environment right */
76 #define CFG_MONITOR_BASE        TEXT_BASE
77 #define CFG_MONITOR_LEN         (192 << 10)
78
79 /* Default device and server IPs, net console */
80 #define CONFIG_IPADDR           192.168.1.1
81 #define CONFIG_SERVERIP         192.168.1.2
82 #define CONFIG_NETCONSOLE       1
83 #define CONFIG_NETCONSOLE_PORT  6666
84
85 /* Other environment variables */
86 #define CONFIG_BOOTFILE firmware.bin
87 #define CONFIG_LOADADDR 0x80800000
88
89 /* This is needed for time calculation */
90 #define CFG_HZ  (bd->bi_cfg_hz)
91
92 /* Cache */
93 #define CFG_INIT_SP_OFFSET      0x1000
94 #define CFG_CACHELINE_SIZE      32
95 #define CFG_DCACHE_SIZE         (32 * 1024)
96 #define CFG_ICACHE_SIZE         (64 * 1024)
97
98 /* Environment related */
99 #define CFG_ENV_IS_IN_FLASH     1
100 #undef  CFG_ENV_IS_NOWHERE
101
102 /* Available commands */
103 #define CONFIG_CMD_BOOTD
104 #define CONFIG_CMD_BUTTON
105 #define CONFIG_CMD_DATE
106 #define CONFIG_CMD_DHCP
107 #define CONFIG_CMD_ECHO
108 #define CONFIG_CMD_ENV
109 #define CONFIG_CMD_FLASH
110 #define CONFIG_CMD_IMI
111 #define CONFIG_CMD_ITEST
112 #define CONFIG_CMD_LED
113 #define CONFIG_CMD_LOADB
114 #define CONFIG_CMD_MEMORY
115 #define CONFIG_CMD_NET
116 #define CONFIG_CMD_PING
117 #define CONFIG_CMD_RUN
118 #define CONFIG_CMD_SETEXPR
119 #define CONFIG_CMD_SLEEP
120 #define CONFIG_CMD_SNTP
121
122 /* Simple upgrade scripts in environment */
123 #define CONFIG_UPG_SCRIPTS_UBOOT
124 #define CONFIG_UPG_SCRIPTS_FW
125
126 /* Recovery script with button */
127 #define CONFIG_BTN_RECOVERY_SCRIPT
128
129 /* For HTTP based recovery */
130 /* TODO: move it to httpd related header */
131 #define WEBFAILSAFE_PROGRESS_START              0
132 #define WEBFAILSAFE_PROGRESS_TIMEOUT            1
133 #define WEBFAILSAFE_PROGRESS_UPLOAD_READY       2
134 #define WEBFAILSAFE_PROGRESS_UPGRADE_READY      3
135 #define WEBFAILSAFE_PROGRESS_UPGRADE_FAILED     4
136
137 #define WEBFAILSAFE_UPGRADE_TYPE_FIRMWARE       0
138 #define WEBFAILSAFE_UPGRADE_TYPE_UBOOT          1
139 #define WEBFAILSAFE_UPGRADE_TYPE_ART            2
140
141 #define WEBFAILSAFE_UPLOAD_ART_SIZE_IN_BYTES    (64 * 1024)
142
143 /* Some helper macros */
144 /* TODO: move them out from here */
145 #define XMK_STR(x)      #x
146 #define MK_STR(x)       XMK_STR(x)
147
148 #endif /* __QCA9K_COMMON_H */