intel/e7505,i82801dx: Refactor raminit
Avoid direct enable_smbus() call from northbridge code. Change-Id: I077e455242db9fc0f86432bd1afab75cb6fb6f4c Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38267 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
61af679838
commit
d1141ab5a4
|
@ -1740,28 +1740,38 @@ static void sdram_set_registers(const struct mem_controller *ctrl)
|
||||||
d060_control(D060_CMD_1);
|
d060_control(D060_CMD_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static int e7505_mch_is_ready(void)
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void e7505_mch_init(const struct mem_controller *memctrl)
|
|
||||||
{
|
|
||||||
timestamp_add_now(TS_BEFORE_INITRAM);
|
|
||||||
|
|
||||||
sdram_set_registers(memctrl);
|
|
||||||
sdram_set_spd_registers(memctrl);
|
|
||||||
sdram_enable(memctrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void e7505_mch_done(const struct mem_controller *memctrl)
|
|
||||||
{
|
|
||||||
sdram_post_ecc(memctrl);
|
|
||||||
|
|
||||||
timestamp_add_now(TS_AFTER_INITRAM);
|
|
||||||
}
|
|
||||||
|
|
||||||
int e7505_mch_is_ready(void)
|
|
||||||
{
|
{
|
||||||
uint32_t dword = pci_read_config32(MCHDEV, DRC);
|
uint32_t dword = pci_read_config32(MCHDEV, DRC);
|
||||||
return !!(dword & DRC_DONE);
|
return !!(dword & DRC_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sdram_initialize(void)
|
||||||
|
{
|
||||||
|
static const struct mem_controller memctrl[] = {
|
||||||
|
{
|
||||||
|
.d0 = PCI_DEV(0, 0, 0),
|
||||||
|
.d0f1 = PCI_DEV(0, 0, 1),
|
||||||
|
.channel0 = { 0x50, 0x52, 0, 0 },
|
||||||
|
.channel1 = { 0x51, 0x53, 0, 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* If this is a warm boot, some initialisation can be skipped */
|
||||||
|
if (!e7505_mch_is_ready()) {
|
||||||
|
|
||||||
|
/* The real MCH initialisation. */
|
||||||
|
timestamp_add_now(TS_BEFORE_INITRAM);
|
||||||
|
|
||||||
|
sdram_set_registers(memctrl);
|
||||||
|
sdram_set_spd_registers(memctrl);
|
||||||
|
sdram_enable(memctrl);
|
||||||
|
|
||||||
|
/* Hook for post ECC scrub settings and debug. */
|
||||||
|
sdram_post_ecc(memctrl);
|
||||||
|
|
||||||
|
timestamp_add_now(TS_AFTER_INITRAM);
|
||||||
|
}
|
||||||
|
|
||||||
|
printk(BIOS_DEBUG, "SDRAM is up.\n");
|
||||||
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ struct mem_controller {
|
||||||
uint16_t channel1[MAX_DIMM_SOCKETS_PER_CHANNEL];
|
uint16_t channel1[MAX_DIMM_SOCKETS_PER_CHANNEL];
|
||||||
};
|
};
|
||||||
|
|
||||||
void e7505_mch_init(const struct mem_controller *memctrl);
|
void sdram_initialize(void);
|
||||||
void e7505_mch_done(const struct mem_controller *memctrl);
|
|
||||||
int e7505_mch_is_ready(void);
|
|
||||||
|
|
||||||
#endif /* RAMINIT_H */
|
#endif /* RAMINIT_H */
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
#include <console/console.h>
|
|
||||||
#include <arch/romstage.h>
|
#include <arch/romstage.h>
|
||||||
|
|
||||||
#include <southbridge/intel/i82801dx/i82801dx.h>
|
#include <southbridge/intel/i82801dx/i82801dx.h>
|
||||||
|
@ -23,27 +21,12 @@
|
||||||
|
|
||||||
void mainboard_romstage_entry(void)
|
void mainboard_romstage_entry(void)
|
||||||
{
|
{
|
||||||
static const struct mem_controller memctrl[] = {
|
/* Perform some early chipset initialization required
|
||||||
{
|
* before RAM initialization can work
|
||||||
.d0 = PCI_DEV(0, 0, 0),
|
*/
|
||||||
.d0f1 = PCI_DEV(0, 0, 1),
|
i82801dx_early_init();
|
||||||
.channel0 = { 0x50, 0x52, 0, 0 },
|
|
||||||
.channel1 = { 0x51, 0x53, 0, 0 },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/* If this is a warm boot, some initialization can be skipped */
|
sdram_initialize();
|
||||||
if (!e7505_mch_is_ready()) {
|
|
||||||
enable_smbus();
|
|
||||||
|
|
||||||
/* The real MCH initialisation. */
|
|
||||||
e7505_mch_init(memctrl);
|
|
||||||
|
|
||||||
/* Hook for post ECC scrub settings and debug. */
|
|
||||||
e7505_mch_done(memctrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "SDRAM is up.\n");
|
|
||||||
|
|
||||||
cbmem_recovery(0);
|
cbmem_recovery(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
|
|
||||||
#include "i82801dx.h"
|
#include "i82801dx.h"
|
||||||
|
|
||||||
|
void i82801dx_early_init(void)
|
||||||
|
{
|
||||||
|
enable_smbus();
|
||||||
|
}
|
||||||
|
|
||||||
void enable_smbus(void)
|
void enable_smbus(void)
|
||||||
{
|
{
|
||||||
pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
|
pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
void i82801dx_enable(struct device *dev);
|
void i82801dx_enable(struct device *dev);
|
||||||
|
void i82801dx_early_init(void);
|
||||||
void enable_smbus(void);
|
void enable_smbus(void);
|
||||||
int smbus_read_byte(unsigned int device, unsigned int address);
|
int smbus_read_byte(unsigned int device, unsigned int address);
|
||||||
void aseg_smm_lock(void);
|
void aseg_smm_lock(void);
|
||||||
|
|
Loading…
Reference in New Issue