2010-03-19 03:33:40 +01:00
|
|
|
#include <lib.h> /* Prototypes */
|
2005-12-02 22:52:30 +01:00
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
/* Setup SDRAM */
|
2010-10-08 01:02:06 +02:00
|
|
|
#if CONFIG_RAMINIT_SYSINFO
|
2017-03-11 00:23:24 +01:00
|
|
|
void sdram_initialize(int controllers, const struct mem_controller *ctrl,
|
|
|
|
void *sysinfo)
|
2005-12-02 22:52:30 +01:00
|
|
|
#else
|
2003-07-21 22:13:45 +02:00
|
|
|
void sdram_initialize(int controllers, const struct mem_controller *ctrl)
|
2005-12-02 22:52:30 +01:00
|
|
|
#endif
|
2003-04-22 21:02:15 +02:00
|
|
|
{
|
2003-07-21 22:13:45 +02:00
|
|
|
int i;
|
2003-04-22 21:02:15 +02:00
|
|
|
/* Set the registers we can set once to reasonable values */
|
2017-03-09 03:02:24 +01:00
|
|
|
for (i = 0; i < controllers; i++) {
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "Ram1.%02x\n", i);
|
2005-12-02 22:52:30 +01:00
|
|
|
|
2010-10-08 01:02:06 +02:00
|
|
|
#if CONFIG_RAMINIT_SYSINFO
|
2010-03-31 00:21:06 +02:00
|
|
|
sdram_set_registers(ctrl + i, sysinfo);
|
2005-12-02 22:52:30 +01:00
|
|
|
#else
|
2003-07-21 22:13:45 +02:00
|
|
|
sdram_set_registers(ctrl + i);
|
2005-12-02 22:52:30 +01:00
|
|
|
#endif
|
2003-07-21 22:13:45 +02:00
|
|
|
}
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
/* Now setup those things we can auto detect */
|
2017-03-09 03:02:24 +01:00
|
|
|
for (i = 0; i < controllers; i++) {
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "Ram2.%02x\n", i);
|
2005-12-02 22:52:30 +01:00
|
|
|
|
2010-10-08 01:02:06 +02:00
|
|
|
#if CONFIG_RAMINIT_SYSINFO
|
2010-03-31 00:21:06 +02:00
|
|
|
sdram_set_spd_registers(ctrl + i, sysinfo);
|
2005-12-02 22:52:30 +01:00
|
|
|
#else
|
2017-03-10 01:21:34 +01:00
|
|
|
sdram_set_spd_registers(ctrl + i);
|
2005-12-02 22:52:30 +01:00
|
|
|
#endif
|
|
|
|
|
2003-07-21 22:13:45 +02:00
|
|
|
}
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
/* Now that everything is setup enable the SDRAM.
|
2010-04-27 08:56:47 +02:00
|
|
|
* Some chipsets do the work for us while on others
|
2003-04-22 21:02:15 +02:00
|
|
|
* we need to it by hand.
|
|
|
|
*/
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "Ram3\n");
|
2005-12-02 22:52:30 +01:00
|
|
|
|
2010-10-08 01:02:06 +02:00
|
|
|
#if CONFIG_RAMINIT_SYSINFO
|
2005-12-02 22:52:30 +01:00
|
|
|
sdram_enable(controllers, ctrl, sysinfo);
|
|
|
|
#else
|
2003-07-21 22:13:45 +02:00
|
|
|
sdram_enable(controllers, ctrl);
|
2005-12-02 22:52:30 +01:00
|
|
|
#endif
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "Ram4\n");
|
2003-04-22 21:02:15 +02:00
|
|
|
}
|