1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
/* #define DEBUG */
#include <common.h>
#include <autoboot.h>
#include <cli.h>
#include <console.h>
#include <version.h>
#if defined(CONFIG_BCMBCA_BUTTON)
#include "bcmbca_button.h"
#endif
/*
* Board-specific Platform code can reimplement show_boot_progress () if needed
*/
__weak void show_boot_progress(int val) {}
static void run_preboot_environment_command(void)
{
#ifdef CONFIG_PREBOOT
char *p;
p = env_get("preboot");
if (p != NULL) {
int prev = 0;
if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
prev = disable_ctrlc(1); /* disable Ctrl-C checking */
run_command_list(p, -1, 0);
if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
disable_ctrlc(prev); /* restore Ctrl-C checking */
}
#endif /* CONFIG_PREBOOT */
}
#if 0
int g_restore_default;
void check_restore_default(void)
{
#define Button_Reg 0xff800528
#define Reset_GPIO_Mask 0x00200000
unsigned int *addr_button = (unsigned int*)Button_Reg;
int i;
g_restore_default=1;
for( i=0; i<50; i++ )
{
if( ((*addr_button) & Reset_GPIO_Mask) != 0 ) // Reset button not pressed
{
g_restore_default=0;
break;
}
udelay(100000); //delay 100ms
}
if( g_restore_default==1 )
{
printf("===== Restore default =====\n");
run_command("sdk restoredefault", 0);
for( i=0; i<20; i++ )
{
if ((i % 2) == 0) {
board_test_led(0);
} else {
board_test_led(1);
}
udelay(250000);
}
board_test_led(0);
}
return;
}
#endif
#if 0
void bootup_turn_on_power_led(void)
{
//power up, turn on power led
printf("===== POWER ON TURN ON POWER LED =====\n");
board_test_led(0);
}
void bootup_enable_dhd_offload(void)
{
//power up, turn on power led
printf("===== Enable DHD tx offload =====\n");
env_set("dhd0", "11");
env_set("dhd1", "11");
env_set("dhd2", "11");
}
#endif
/* We come here after U-Boot is initialised and ready to process commands */
void main_loop(void)
{
const char *s;
bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
env_set("ver", version_string); /* set version variable */
cli_init();
#if 0
/*Foxconn add start*/
bootup_turn_on_power_led();
bootup_enable_dhd_offload();
/*Foxconn add end*/
#endif
run_preboot_environment_command();
#if 0
check_restore_default();
#endif
#ifdef CONFIG_SYS_NMRP
StartNmrpClient();
#endif
if (IS_ENABLED(CONFIG_UPDATE_TFTP))
update_tftp(0UL, NULL, NULL);
#if defined(CONFIG_BCMBCA_BUTTON)
btn_poll_block();
#endif
s = bootdelay_process();
if (cli_process_fdt(&s))
cli_secure_boot_cmd(s);
autoboot_command(s);
cli_loop();
panic("No CLI available");
}
|