blob: 467606ae4779d29fe3922606a6d8ce01ef4f3edd [file] [log] [blame]
Stefan Reinauer36a22682008-10-29 04:52:57 +00001/*
2 * This file is part of the coreboot project.
Stefan Reinauer14e22772010-04-27 06:56:47 +00003 *
Stefan Reinauerde3206a2010-02-22 06:09:43 +00004 * Copyright (C) 2007-2010 coresystems GmbH
Stefan Reinauer36a22682008-10-29 04:52:57 +00005 *
Uwe Hermann2bb4acf2010-03-01 17:19:55 +00006 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
Stefan Reinauer36a22682008-10-29 04:52:57 +00009 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Stefan Reinauer36a22682008-10-29 04:52:57 +000014 */
15
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020016/* __PRE_RAM__ means: use "unsigned" for device, not a struct. */
Stefan Reinauer5e328232010-03-29 19:19:16 +000017
Stefan Reinauer36a22682008-10-29 04:52:57 +000018#include <stdint.h>
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +020019#include <halt.h>
Paul Menzel6c20b652016-12-29 22:54:02 +010020#include <timestamp.h>
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +020021#include <console/console.h>
22#include <cpu/intel/romstage.h>
23#include <cpu/x86/bist.h>
24#include <cpu/x86/lapic.h>
Stefan Reinauer36a22682008-10-29 04:52:57 +000025#include <device/pci_def.h>
26#include <device/pnp_def.h>
Edwin Beasanteb50c7d2010-07-06 21:05:04 +000027#include <pc80/mc146818rtc.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110028#include <northbridge/intel/i945/i945.h>
29#include <northbridge/intel/i945/raminit.h>
30#include <southbridge/intel/i82801gx/i82801gx.h>
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +020031#include <superio/winbond/common/winbond.h>
32#include <superio/winbond/w83627thg/w83627thg.h>
33
34#include "option_table.h"
Patrick Georgid0835952010-10-05 09:07:10 +000035
Uwe Hermann57b2ff82010-11-21 17:29:59 +000036#define SERIAL_DEV PNP_DEV(0x2e, W83627THG_SP1)
37
Stefan Reinauer36a22682008-10-29 04:52:57 +000038static void ich7_enable_lpc(void)
39{
Patrick Georgia4700192011-01-27 07:39:38 +000040 int lpt_en = 0;
Arthur Heymansb451df22017-08-15 20:59:09 +020041 if (read_option(lpt, 0) != 0)
42 lpt_en = LPT_LPC_EN; /* enable LPT */
43
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020044 /* Enable Serial IRQ */
Arthur Heymansb451df22017-08-15 20:59:09 +020045 pci_write_config8(PCI_DEV(0, 0x1f, 0), SERIRQ_CNTL, 0xd0);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020046 /* Set COM1/COM2 decode range */
Arthur Heymansb451df22017-08-15 20:59:09 +020047 pci_write_config16(PCI_DEV(0, 0x1f, 0), LPC_IO_DEC, 0x0010);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020048 /* Enable COM1/COM2/KBD/SuperIO1+2 */
Arthur Heymansb451df22017-08-15 20:59:09 +020049 pci_write_config16(PCI_DEV(0, 0x1f, 0), LPC_EN, CNF2_LPC_EN
50 | CNF1_LPC_EN | KBC_LPC_EN | FDD_LPC_EN | COMA_LPC_EN
51 | COMB_LPC_EN | lpt_en);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020052 /* Enable HWM at 0xa00 */
Arthur Heymansb451df22017-08-15 20:59:09 +020053 pci_write_config32(PCI_DEV(0, 0x1f, 0), GEN1_DEC, 0x00fc0a01);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020054 /* COM3 decode */
Arthur Heymansb451df22017-08-15 20:59:09 +020055 pci_write_config32(PCI_DEV(0, 0x1f, 0), GEN2_DEC, 0x000403e9);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020056 /* COM4 decode */
Arthur Heymansb451df22017-08-15 20:59:09 +020057 pci_write_config32(PCI_DEV(0, 0x1f, 0), GEN3_DEC, 0x000402e9);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020058 /* io 0x300 decode */
Arthur Heymansb451df22017-08-15 20:59:09 +020059 pci_write_config32(PCI_DEV(0, 0x1f, 0), GEN4_DEC, 0x00000301);
Stefan Reinauer36a22682008-10-29 04:52:57 +000060}
61
Stefan Reinauer36a22682008-10-29 04:52:57 +000062/* This box has two superios, so enabling serial becomes slightly excessive.
63 * We disable a lot of stuff to make sure that there are no conflicts between
64 * the two. Also set up the GPIOs from the beginning. This is the "no schematic
65 * but safe anyways" method.
66 */
67static void early_superio_config_w83627thg(void)
68{
Antonello Dettori9ec11232016-11-08 18:44:46 +010069 pnp_devfn_t dev;
Stefan Reinauer14e22772010-04-27 06:56:47 +000070
Elyes HAOUAS531b87a2016-09-19 09:46:33 -060071 dev = PNP_DEV(0x2e, W83627THG_SP1);
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +020072 pnp_enter_conf_state(dev);
Stefan Reinauer36a22682008-10-29 04:52:57 +000073
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020074 pnp_write_config(dev, 0x24, 0xc6); /* PNPCSV */
Stefan Reinaueraca6ec62009-10-26 17:12:21 +000075
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +020076 pnp_write_config(dev, 0x29, 0x43); /* GPIO settings */
77 pnp_write_config(dev, 0x2a, 0x40); /* GPIO settings */
Stefan Reinaueraca6ec62009-10-26 17:12:21 +000078
Elyes HAOUAS531b87a2016-09-19 09:46:33 -060079 dev = PNP_DEV(0x2e, W83627THG_SP1);
Stefan Reinauer36a22682008-10-29 04:52:57 +000080 pnp_set_logical_device(dev);
81 pnp_set_enable(dev, 0);
82 pnp_set_iobase(dev, PNP_IDX_IO0, 0x3f8);
83 pnp_set_irq(dev, PNP_IDX_IRQ0, 4);
84 pnp_set_enable(dev, 1);
85
Elyes HAOUAS531b87a2016-09-19 09:46:33 -060086 dev = PNP_DEV(0x2e, W83627THG_SP2);
Stefan Reinauer36a22682008-10-29 04:52:57 +000087 pnp_set_logical_device(dev);
88 pnp_set_enable(dev, 0);
89 pnp_set_iobase(dev, PNP_IDX_IO0, 0x2f8);
90 pnp_set_irq(dev, PNP_IDX_IRQ0, 3);
Stefan Reinauer36a22682008-10-29 04:52:57 +000091 pnp_set_enable(dev, 1);
92
Elyes HAOUAS531b87a2016-09-19 09:46:33 -060093 dev = PNP_DEV(0x2e, W83627THG_KBC);
Stefan Reinauer36a22682008-10-29 04:52:57 +000094 pnp_set_logical_device(dev);
95 pnp_set_enable(dev, 0);
96 pnp_set_iobase(dev, PNP_IDX_IO0, 0x60);
97 pnp_set_iobase(dev, PNP_IDX_IO1, 0x64);
Stefan Reinauer36a22682008-10-29 04:52:57 +000098 pnp_set_enable(dev, 1);
99
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600100 dev = PNP_DEV(0x2e, W83627THG_GAME_MIDI_GPIO1);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000101 pnp_set_logical_device(dev);
102 pnp_set_enable(dev, 0);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200103 pnp_write_config(dev, 0xf5, 0xff); /* invert all GPIOs */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000104 pnp_set_enable(dev, 1);
105
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600106 dev = PNP_DEV(0x2e, W83627THG_GPIO2);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000107 pnp_set_logical_device(dev);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200108 pnp_set_enable(dev, 1); /* Just enable it */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000109
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600110 dev = PNP_DEV(0x2e, W83627THG_GPIO3);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000111 pnp_set_logical_device(dev);
112 pnp_set_enable(dev, 0);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200113 pnp_write_config(dev, 0xf0, 0xfb); /* GPIO bit 2 is output */
114 pnp_write_config(dev, 0xf1, 0x00); /* GPIO bit 2 is 0 */
115 pnp_write_config(dev, 0x30, 0x03); /* Enable GPIO3+4. pnp_set_enable is not sufficient */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000116
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600117 dev = PNP_DEV(0x2e, W83627THG_FDC);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000118 pnp_set_logical_device(dev);
119 pnp_set_enable(dev, 0);
120
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600121 dev = PNP_DEV(0x2e, W83627THG_PP);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000122 pnp_set_logical_device(dev);
123 pnp_set_enable(dev, 0);
124
Stefan Reinauer54309d62009-01-20 22:53:10 +0000125 /* Enable HWM */
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600126 dev = PNP_DEV(0x2e, W83627THG_HWM);
Stefan Reinauer54309d62009-01-20 22:53:10 +0000127 pnp_set_logical_device(dev);
128 pnp_set_enable(dev, 0);
129 pnp_set_iobase(dev, PNP_IDX_IO0, 0xa00);
130 pnp_set_enable(dev, 1);
131
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +0200132 pnp_exit_conf_state(dev);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000133
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600134 dev = PNP_DEV(0x4e, W83627THG_SP1);
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +0200135 pnp_enter_conf_state(dev);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000136
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200137 pnp_set_logical_device(dev); /* Set COM3 to sane non-conflicting values */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000138 pnp_set_enable(dev, 0);
139 pnp_set_iobase(dev, PNP_IDX_IO0, 0x3e8);
140 pnp_set_irq(dev, PNP_IDX_IRQ0, 11);
141 pnp_set_enable(dev, 1);
142
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600143 dev = PNP_DEV(0x4e, W83627THG_SP2);
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200144 pnp_set_logical_device(dev); /* Set COM4 to sane non-conflicting values */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000145 pnp_set_enable(dev, 0);
146 pnp_set_iobase(dev, PNP_IDX_IO0, 0x2e8);
147 pnp_set_irq(dev, PNP_IDX_IRQ0, 10);
148 pnp_set_enable(dev, 1);
149
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600150 dev = PNP_DEV(0x4e, W83627THG_FDC);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000151 pnp_set_logical_device(dev);
152 pnp_set_enable(dev, 0);
153
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600154 dev = PNP_DEV(0x4e, W83627THG_PP);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000155 pnp_set_logical_device(dev);
156 pnp_set_enable(dev, 0);
157
Elyes HAOUAS531b87a2016-09-19 09:46:33 -0600158 dev = PNP_DEV(0x4e, W83627THG_KBC);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000159 pnp_set_logical_device(dev);
160 pnp_set_enable(dev, 0);
161 pnp_set_iobase(dev, PNP_IDX_IO0, 0x00);
162 pnp_set_iobase(dev, PNP_IDX_IO1, 0x00);
163
Elyes HAOUAS5d4cf362018-08-06 09:58:28 +0200164 pnp_exit_conf_state(dev);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000165}
166
167static void rcba_config(void)
168{
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000169 u32 reg32;
170
Stefan Reinauer36a22682008-10-29 04:52:57 +0000171 /* Set up virtual channel 0 */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000172
173 /* Device 1f interrupt pin register */
Arthur Heymansb451df22017-08-15 20:59:09 +0200174 RCBA32(D31IP) = 0x00042210;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000175 /* Device 1d interrupt pin register */
Arthur Heymansb451df22017-08-15 20:59:09 +0200176 RCBA32(D28IP) = 0x00214321;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000177
178 /* dev irq route register */
Arthur Heymansb451df22017-08-15 20:59:09 +0200179 RCBA16(D31IR) = 0x0132;
180 RCBA16(D30IR) = 0x3241;
181 RCBA16(D29IR) = 0x0237;
182 RCBA16(D28IR) = 0x3210;
183 RCBA16(D27IR) = 0x3210;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000184
185 /* Enable IOAPIC */
Arthur Heymansb451df22017-08-15 20:59:09 +0200186 RCBA8(OIC) = 0x03;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000187
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000188 /* Now, this is a bit ugly. As per PCI specification, function 0 of a
189 * device always has to be implemented. So disabling ethernet port 1
190 * would essentially disable all three ethernet ports of the mainboard.
191 * It's possible to rename the ports to achieve compatibility to the
192 * PCI spec but this will confuse all (static!) tables containing
Stefan Reinauer14e22772010-04-27 06:56:47 +0000193 * interrupt routing information.
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000194 * To avoid this, we enable (unused) port 6 and swap it with port 1
195 * in the case that ethernet port 1 is disabled. Since no devices
196 * are connected to that port, we don't have to worry about interrupt
197 * routing.
198 */
199 int port_shuffle = 0;
200
Stefan Reinauer36a22682008-10-29 04:52:57 +0000201 /* Disable unused devices */
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000202 reg32 = FD_ACMOD|FD_ACAUD|FD_PATA;
203 reg32 |= FD_PCIE6|FD_PCIE5|FD_PCIE4;
204
Patrick Georgib2517532011-05-10 21:53:13 +0000205 if (read_option(ethernet1, 0) != 0) {
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000206 printk(BIOS_DEBUG, "Disabling ethernet adapter 1.\n");
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000207 reg32 |= FD_PCIE1;
208 }
Patrick Georgib2517532011-05-10 21:53:13 +0000209 if (read_option(ethernet2, 0) != 0) {
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000210 printk(BIOS_DEBUG, "Disabling ethernet adapter 2.\n");
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000211 reg32 |= FD_PCIE2;
212 } else {
213 if (reg32 & FD_PCIE1)
214 port_shuffle = 1;
215 }
Patrick Georgib2517532011-05-10 21:53:13 +0000216 if (read_option(ethernet3, 0) != 0) {
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000217 printk(BIOS_DEBUG, "Disabling ethernet adapter 3.\n");
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000218 reg32 |= FD_PCIE3;
219 } else {
220 if (reg32 & FD_PCIE1)
221 port_shuffle = 1;
222 }
223
224 if (port_shuffle) {
225 /* Enable PCIE6 again */
226 reg32 &= ~FD_PCIE6;
227 /* Swap PCIE6 and PCIE1 */
228 RCBA32(RPFN) = 0x00043215;
229 }
230
231 reg32 |= 1;
232
Arthur Heymansb451df22017-08-15 20:59:09 +0200233 RCBA32(FD) = reg32;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000234
235 /* Enable PCIe Root Port Clock Gate */
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200236
Stefan Reinauer36a22682008-10-29 04:52:57 +0000237}
238
239static void early_ich7_init(void)
240{
241 uint8_t reg8;
242 uint32_t reg32;
243
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200244 /* program secondary mlt XXX byte? */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000245 pci_write_config8(PCI_DEV(0, 0x1e, 0), 0x1b, 0x20);
246
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200247 /* reset rtc power status */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000248 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xa4);
249 reg8 &= ~(1 << 2);
250 pci_write_config8(PCI_DEV(0, 0x1f, 0), 0xa4, reg8);
251
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200252 /* usb transient disconnect */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000253 reg8 = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xad);
254 reg8 |= (3 << 0);
255 pci_write_config8(PCI_DEV(0, 0x1f, 0), 0xad, reg8);
256
257 reg32 = pci_read_config32(PCI_DEV(0, 0x1d, 7), 0xfc);
258 reg32 |= (1 << 29) | (1 << 17);
259 pci_write_config32(PCI_DEV(0, 0x1d, 7), 0xfc, reg32);
260
261 reg32 = pci_read_config32(PCI_DEV(0, 0x1d, 7), 0xdc);
262 reg32 |= (1 << 31) | (1 << 27);
263 pci_write_config32(PCI_DEV(0, 0x1d, 7), 0xdc, reg32);
264
265 RCBA32(0x0088) = 0x0011d000;
266 RCBA16(0x01fc) = 0x060f;
267 RCBA32(0x01f4) = 0x86000040;
268 RCBA32(0x0214) = 0x10030549;
269 RCBA32(0x0218) = 0x00020504;
270 RCBA8(0x0220) = 0xc5;
Arthur Heymansb451df22017-08-15 20:59:09 +0200271 reg32 = RCBA32(GCS);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000272 reg32 |= (1 << 6);
Arthur Heymansb451df22017-08-15 20:59:09 +0200273 RCBA32(GCS) = reg32;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000274 reg32 = RCBA32(0x3430);
275 reg32 &= ~(3 << 0);
276 reg32 |= (1 << 0);
277 RCBA32(0x3430) = reg32;
Arthur Heymansb451df22017-08-15 20:59:09 +0200278 RCBA32(FD) |= (1 << 0);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000279 RCBA16(0x0200) = 0x2008;
280 RCBA8(0x2027) = 0x0d;
281 RCBA16(0x3e08) |= (1 << 7);
282 RCBA16(0x3e48) |= (1 << 7);
283 RCBA32(0x3e0e) |= (1 << 7);
284 RCBA32(0x3e4e) |= (1 << 7);
285
Elyes HAOUASf10b5ff2016-10-06 19:49:55 +0200286 /* next step only on ich7m b0 and later: */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000287 reg32 = RCBA32(0x2034);
288 reg32 &= ~(0x0f << 16);
289 reg32 |= (5 << 16);
290 RCBA32(0x2034) = reg32;
291}
292
Kyösti Mälkki15fa9922016-06-17 10:00:28 +0300293void mainboard_romstage_entry(unsigned long bist)
Stefan Reinauer36a22682008-10-29 04:52:57 +0000294{
Vladimir Serbinenko55601882014-10-15 20:17:51 +0200295 int s3resume = 0;
Stefan Reinauer36a22682008-10-29 04:52:57 +0000296
Paul Menzel6c20b652016-12-29 22:54:02 +0100297
298 timestamp_init(get_initial_timestamp());
299 timestamp_add_now(TS_START_ROMSTAGE);
300
Uwe Hermann7b997052010-11-21 22:47:22 +0000301 if (bist == 0)
Stefan Reinauer36a22682008-10-29 04:52:57 +0000302 enable_lapic();
Stefan Reinauer36a22682008-10-29 04:52:57 +0000303
Stefan Reinauerbf264e92010-05-14 19:09:20 +0000304 /* Force PCIRST# */
305 pci_write_config16(PCI_DEV(0, 0x1e, 0), BCTRL, SBR);
Stefan Reinauerbc8613e2010-08-25 18:35:42 +0000306 udelay(200 * 1000);
Stefan Reinauerbf264e92010-05-14 19:09:20 +0000307 pci_write_config16(PCI_DEV(0, 0x1e, 0), BCTRL, 0);
Stefan Reinauerbf264e92010-05-14 19:09:20 +0000308
Stefan Reinauerbc8613e2010-08-25 18:35:42 +0000309 ich7_enable_lpc();
Stefan Reinauer36a22682008-10-29 04:52:57 +0000310 early_superio_config_w83627thg();
311
312 /* Set up the console */
Stefan Reinauer36a22682008-10-29 04:52:57 +0000313 console_init();
314
315 /* Halt if there was a built in self test failure */
316 report_bist_failure(bist);
317
318 if (MCHBAR16(SSKPD) == 0xCAFE) {
Stefan Reinauerbf264e92010-05-14 19:09:20 +0000319 printk(BIOS_DEBUG, "soft reset detected, rebooting properly\n");
320 outb(0x6, 0xcf9);
Patrick Georgi546953c2014-11-29 10:38:17 +0100321 halt();
Stefan Reinauer36a22682008-10-29 04:52:57 +0000322 }
323
324 /* Perform some early chipset initialization required
325 * before RAM initialization can work
326 */
327 i945_early_initialization();
328
Vladimir Serbinenko55601882014-10-15 20:17:51 +0200329 s3resume = southbridge_detect_s3_resume();
Stefan Reinauera5fdadf2009-07-21 21:58:20 +0000330
Stefan Reinauer36a22682008-10-29 04:52:57 +0000331 /* Enable SPD ROMs and DDR-II DRAM */
332 enable_smbus();
Stefan Reinauer14e22772010-04-27 06:56:47 +0000333
Stefan Reinauer08670622009-06-30 15:17:49 +0000334#if CONFIG_DEFAULT_CONSOLE_LOGLEVEL > 8
Stefan Reinauer36a22682008-10-29 04:52:57 +0000335 dump_spd_registers();
336#endif
337
Paul Menzel6c20b652016-12-29 22:54:02 +0100338 timestamp_add_now(TS_BEFORE_INITRAM);
Vladimir Serbinenko55601882014-10-15 20:17:51 +0200339 sdram_initialize(s3resume ? 2 : 0, NULL);
Paul Menzel6c20b652016-12-29 22:54:02 +0100340 timestamp_add_now(TS_AFTER_INITRAM);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000341
342 /* Perform some initialization that must run before stage2 */
343 early_ich7_init();
344
Stefan Reinauer14e22772010-04-27 06:56:47 +0000345 /* This should probably go away. Until now it is required
346 * and mainboard specific
Stefan Reinauer36a22682008-10-29 04:52:57 +0000347 */
348 rcba_config();
349
350 /* Chipset Errata! */
351 fixup_i945_errata();
352
353 /* Initialize the internal PCIe links before we go into stage2 */
Vladimir Serbinenko55601882014-10-15 20:17:51 +0200354 i945_late_initialization(s3resume);
Stefan Reinauer36a22682008-10-29 04:52:57 +0000355}