]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/x86/lib/init_wrappers.c
Merge 'u-boot-atmel/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / arch / x86 / lib / init_wrappers.c
1 /*
2  * (C) Copyright 2011
3  * Graeme Russ, <graeme.russ@gmail.com>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 #include <common.h>
24 #include <environment.h>
25 #include <serial.h>
26 #include <kgdb.h>
27 #include <scsi.h>
28 #include <post.h>
29 #include <miiphy.h>
30
31 #include <asm/init_wrappers.h>
32
33 int serial_initialize_r(void)
34 {
35         serial_initialize();
36
37         return 0;
38 }
39
40 /*
41  * Tell if it's OK to load the environment early in boot.
42  *
43  * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
44  * if this is OK (defaulting to saying it's not OK).
45  *
46  * NOTE: Loading the environment early can be a bad idea if security is
47  *       important, since no verification is done on the environment.
48  *
49  * @return 0 if environment should not be loaded, !=0 if it is ok to load
50  */
51 static int should_load_env(void)
52 {
53 #ifdef CONFIG_OF_CONTROL
54         return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 0);
55 #elif defined CONFIG_DELAY_ENVIRONMENT
56         return 0;
57 #else
58         return 1;
59 #endif
60 }
61
62 int env_relocate_r(void)
63 {
64         /* initialize environment */
65         if (should_load_env())
66                 env_relocate();
67         else
68                 set_default_env(NULL);
69
70         return 0;
71 }
72
73
74 int pci_init_r(void)
75 {
76         /* Do pci configuration */
77         pci_init();
78
79         return 0;
80 }
81
82 int jumptable_init_r(void)
83 {
84         jumptable_init();
85
86         return 0;
87 }
88
89 int pcmcia_init_r(void)
90 {
91         puts("PCMCIA:");
92         pcmcia_init();
93
94         return 0;
95 }
96
97 int kgdb_init_r(void)
98 {
99         puts("KGDB:  ");
100         kgdb_init();
101
102         return 0;
103 }
104
105 int enable_interrupts_r(void)
106 {
107         /* enable exceptions */
108         enable_interrupts();
109
110         return 0;
111 }
112
113 int eth_initialize_r(void)
114 {
115         puts("Net:   ");
116         eth_initialize(gd->bd);
117
118         return 0;
119 }
120
121 int reset_phy_r(void)
122 {
123 #ifdef DEBUG
124         puts("Reset Ethernet PHY\n");
125 #endif
126         reset_phy();
127
128         return 0;
129 }
130
131 int ide_init_r(void)
132 {
133         puts("IDE:   ");
134         ide_init();
135
136         return 0;
137 }
138
139 int scsi_init_r(void)
140 {
141         puts("SCSI:  ");
142         scsi_init();
143
144         return 0;
145 }
146
147 #ifdef CONFIG_BITBANGMII
148 int bb_miiphy_init_r(void)
149 {
150         bb_miiphy_init();
151
152         return 0;
153 }
154 #endif
155
156 #ifdef CONFIG_POST
157 int post_run_r(void)
158 {
159         post_run(NULL, POST_RAM | post_bootmode_get(0));
160
161         return 0;
162 }
163 #endif