Add support for E7505 northbridge.
Adapted from northbridge/intel/e7501 with only minor changes. This commit provides minimal patch from e7501 and I prefer any cosmetic clean-up to be done after initial merge. Due the incomplete register specifications, it is safer to have e7505 as a separate directory in case I improve it to support wider range of memory configurations. I have no e7501 to test with. Change-Id: Iba3bf9d69ff5e9d9ef3a6ebf8259f048c55d637d Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/295 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
committed by
Stefan Reinauer
parent
20fc631ad2
commit
0a0d5e8b86
@@ -1,4 +1,5 @@
|
|||||||
source src/northbridge/intel/e7501/Kconfig
|
source src/northbridge/intel/e7501/Kconfig
|
||||||
|
source src/northbridge/intel/e7505/Kconfig
|
||||||
source src/northbridge/intel/e7520/Kconfig
|
source src/northbridge/intel/e7520/Kconfig
|
||||||
source src/northbridge/intel/e7525/Kconfig
|
source src/northbridge/intel/e7525/Kconfig
|
||||||
source src/northbridge/intel/i3100/Kconfig
|
source src/northbridge/intel/i3100/Kconfig
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7501) += e7501
|
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7501) += e7501
|
||||||
|
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7505) += e7505
|
||||||
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7520) += e7520
|
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7520) += e7520
|
||||||
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7525) += e7525
|
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_E7525) += e7525
|
||||||
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_I3100) += i3100
|
subdirs-$(CONFIG_NORTHBRIDGE_INTEL_I3100) += i3100
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
config NORTHBRIDGE_INTEL_E7501
|
config NORTHBRIDGE_INTEL_E7505
|
||||||
bool
|
bool
|
||||||
select HAVE_DEBUG_RAM_SETUP
|
select HAVE_DEBUG_RAM_SETUP
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
struct northbridge_intel_e7501_config
|
struct northbridge_intel_e7505_config
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct chip_operations northbridge_intel_e7501_ops;
|
extern struct chip_operations northbridge_intel_e7505_ops;
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ static void dump_pci_device(unsigned dev)
|
|||||||
for(i = 0; i < 256; i++) {
|
for(i = 0; i < 256; i++) {
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
if ((i & 0x0f) == 0) {
|
if ((i & 0x0f) == 0) {
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "\n%02x:",i);
|
printk(BIOS_DEBUG, "\n%02x:",i);
|
||||||
#else
|
#else
|
||||||
print_debug("\n");
|
print_debug("\n");
|
||||||
@@ -48,7 +48,7 @@ static void dump_pci_device(unsigned dev)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
val = pci_read_config8(dev, i);
|
val = pci_read_config8(dev, i);
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, " %02x", val);
|
printk(BIOS_DEBUG, " %02x", val);
|
||||||
#else
|
#else
|
||||||
print_debug_char(' ');
|
print_debug_char(' ');
|
||||||
@@ -101,7 +101,7 @@ static inline void dump_spd_registers(const struct mem_controller *ctrl)
|
|||||||
device = ctrl->channel0[i];
|
device = ctrl->channel0[i];
|
||||||
if (device) {
|
if (device) {
|
||||||
int j;
|
int j;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
|
printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
|
||||||
#else
|
#else
|
||||||
print_debug("dimm: ");
|
print_debug("dimm: ");
|
||||||
@@ -113,7 +113,7 @@ static inline void dump_spd_registers(const struct mem_controller *ctrl)
|
|||||||
int status;
|
int status;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
if ((j & 0xf) == 0) {
|
if ((j & 0xf) == 0) {
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "\n%02x: ", j);
|
printk(BIOS_DEBUG, "\n%02x: ", j);
|
||||||
#else
|
#else
|
||||||
print_debug("\n");
|
print_debug("\n");
|
||||||
@@ -126,7 +126,7 @@ static inline void dump_spd_registers(const struct mem_controller *ctrl)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
byte = status & 0xff;
|
byte = status & 0xff;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "%02x ", byte);
|
printk(BIOS_DEBUG, "%02x ", byte);
|
||||||
#else
|
#else
|
||||||
print_debug_hex8(byte);
|
print_debug_hex8(byte);
|
||||||
@@ -138,7 +138,7 @@ static inline void dump_spd_registers(const struct mem_controller *ctrl)
|
|||||||
device = ctrl->channel1[i];
|
device = ctrl->channel1[i];
|
||||||
if (device) {
|
if (device) {
|
||||||
int j;
|
int j;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
|
printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
|
||||||
#else
|
#else
|
||||||
print_debug("dimm: ");
|
print_debug("dimm: ");
|
||||||
@@ -150,7 +150,7 @@ static inline void dump_spd_registers(const struct mem_controller *ctrl)
|
|||||||
int status;
|
int status;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
if ((j & 0xf) == 0) {
|
if ((j & 0xf) == 0) {
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "\n%02x: ", j);
|
printk(BIOS_DEBUG, "\n%02x: ", j);
|
||||||
#else
|
#else
|
||||||
print_debug("\n");
|
print_debug("\n");
|
||||||
@@ -163,7 +163,7 @@ static inline void dump_spd_registers(const struct mem_controller *ctrl)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
byte = status & 0xff;
|
byte = status & 0xff;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "%02x ", byte);
|
printk(BIOS_DEBUG, "%02x ", byte);
|
||||||
#else
|
#else
|
||||||
print_debug_hex8(byte);
|
print_debug_hex8(byte);
|
||||||
@@ -181,7 +181,7 @@ static inline void dump_smbus_registers(void)
|
|||||||
for(device = 1; device < 0x80; device++) {
|
for(device = 1; device < 0x80; device++) {
|
||||||
int j;
|
int j;
|
||||||
if( smbus_read_byte(device, 0) < 0 ) continue;
|
if( smbus_read_byte(device, 0) < 0 ) continue;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "smbus: %02x", device);
|
printk(BIOS_DEBUG, "smbus: %02x", device);
|
||||||
#else
|
#else
|
||||||
print_debug("smbus: ");
|
print_debug("smbus: ");
|
||||||
@@ -195,7 +195,7 @@ static inline void dump_smbus_registers(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((j & 0xf) == 0) {
|
if ((j & 0xf) == 0) {
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "\n%02x: ",j);
|
printk(BIOS_DEBUG, "\n%02x: ",j);
|
||||||
#else
|
#else
|
||||||
print_debug("\n");
|
print_debug("\n");
|
||||||
@@ -204,7 +204,7 @@ static inline void dump_smbus_registers(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
byte = status & 0xff;
|
byte = status & 0xff;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "%02x ", byte);
|
printk(BIOS_DEBUG, "%02x ", byte);
|
||||||
#else
|
#else
|
||||||
print_debug_hex8(byte);
|
print_debug_hex8(byte);
|
||||||
@@ -219,7 +219,7 @@ static inline void dump_io_resources(unsigned port)
|
|||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "%04x:\n", port);
|
printk(BIOS_DEBUG, "%04x:\n", port);
|
||||||
#else
|
#else
|
||||||
print_debug_hex16(port);
|
print_debug_hex16(port);
|
||||||
@@ -228,7 +228,7 @@ static inline void dump_io_resources(unsigned port)
|
|||||||
for(i=0;i<256;i++) {
|
for(i=0;i<256;i++) {
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
if ((i & 0x0f) == 0) {
|
if ((i & 0x0f) == 0) {
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "%02x:", i);
|
printk(BIOS_DEBUG, "%02x:", i);
|
||||||
#else
|
#else
|
||||||
print_debug_hex8(i);
|
print_debug_hex8(i);
|
||||||
@@ -236,7 +236,7 @@ static inline void dump_io_resources(unsigned port)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
val = inb(port);
|
val = inb(port);
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, " %02x",val);
|
printk(BIOS_DEBUG, " %02x",val);
|
||||||
#else
|
#else
|
||||||
print_debug_char(' ');
|
print_debug_char(' ');
|
||||||
@@ -255,7 +255,7 @@ static inline void dump_mem(unsigned start, unsigned end)
|
|||||||
print_debug("dump_mem:");
|
print_debug("dump_mem:");
|
||||||
for(i=start;i<end;i++) {
|
for(i=start;i<end;i++) {
|
||||||
if((i & 0xf)==0) {
|
if((i & 0xf)==0) {
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, "\n%08x:", i);
|
printk(BIOS_DEBUG, "\n%08x:", i);
|
||||||
#else
|
#else
|
||||||
print_debug("\n");
|
print_debug("\n");
|
||||||
@@ -263,7 +263,7 @@ static inline void dump_mem(unsigned start, unsigned end)
|
|||||||
print_debug(":");
|
print_debug(":");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if CONFIG_CACHE_AS_RAM
|
#if !defined(__ROMCC__)
|
||||||
printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));
|
printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));
|
||||||
#else
|
#else
|
||||||
print_debug(" ");
|
print_debug(" ");
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* e7501.h: PCI configuration space for the Intel E7501 memory controller
|
* e7505.h: PCI configuration space for the Intel E7501 memory controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/************ D0:F0 ************/
|
/************ D0:F0 ************/
|
@@ -8,6 +8,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <bitops.h>
|
#include <bitops.h>
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
#include "e7505.h"
|
||||||
|
|
||||||
#if CONFIG_WRITE_HIGH_TABLES==1
|
#if CONFIG_WRITE_HIGH_TABLES==1
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
@@ -65,17 +66,17 @@ static void pci_domain_set_resources(device_t dev)
|
|||||||
/* Write the ram configuration registers,
|
/* Write the ram configuration registers,
|
||||||
* preserving the reserved bits.
|
* preserving the reserved bits.
|
||||||
*/
|
*/
|
||||||
tolm_r = pci_read_config16(mc_dev, 0xc4);
|
tolm_r = pci_read_config16(mc_dev, TOLM);
|
||||||
tolm_r = ((tolmk >> 17) << 11) | (tolm_r & 0x7ff);
|
tolm_r = ((tolmk >> 17) << 11) | (tolm_r & 0x7ff);
|
||||||
pci_write_config16(mc_dev, 0xc4, tolm_r);
|
pci_write_config16(mc_dev, TOLM, tolm_r);
|
||||||
|
|
||||||
remapbase_r = pci_read_config16(mc_dev, 0xc6);
|
remapbase_r = pci_read_config16(mc_dev, REMAPBASE);
|
||||||
remapbase_r = (remapbasek >> 16) | (remapbase_r & 0xfc00);
|
remapbase_r = (remapbasek >> 16) | (remapbase_r & 0xfc00);
|
||||||
pci_write_config16(mc_dev, 0xc6, remapbase_r);
|
pci_write_config16(mc_dev, REMAPBASE, remapbase_r);
|
||||||
|
|
||||||
remaplimit_r = pci_read_config16(mc_dev, 0xc8);
|
remaplimit_r = pci_read_config16(mc_dev, REMAPLIMIT);
|
||||||
remaplimit_r = (remaplimitk >> 16) | (remaplimit_r & 0xfc00);
|
remaplimit_r = (remaplimitk >> 16) | (remaplimit_r & 0xfc00);
|
||||||
pci_write_config16(mc_dev, 0xc8, remaplimit_r);
|
pci_write_config16(mc_dev, REMAPLIMIT, remaplimit_r);
|
||||||
|
|
||||||
/* Report the memory regions */
|
/* Report the memory regions */
|
||||||
idx = 10;
|
idx = 10;
|
||||||
@@ -98,12 +99,23 @@ static void pci_domain_set_resources(device_t dev)
|
|||||||
assign_resources(dev->link_list);
|
assign_resources(dev->link_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void intel_set_subsystem(device_t dev, unsigned vendor, unsigned device)
|
||||||
|
{
|
||||||
|
pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
|
||||||
|
((device & 0xffff) << 16) | (vendor & 0xffff));
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct pci_operations intel_pci_ops = {
|
||||||
|
.set_subsystem = intel_set_subsystem,
|
||||||
|
};
|
||||||
|
|
||||||
static struct device_operations pci_domain_ops = {
|
static struct device_operations pci_domain_ops = {
|
||||||
.read_resources = pci_domain_read_resources,
|
.read_resources = pci_domain_read_resources,
|
||||||
.set_resources = pci_domain_set_resources,
|
.set_resources = pci_domain_set_resources,
|
||||||
.enable_resources = NULL,
|
.enable_resources = NULL,
|
||||||
.init = NULL,
|
.init = NULL,
|
||||||
.scan_bus = pci_domain_scan_bus,
|
.scan_bus = pci_domain_scan_bus,
|
||||||
|
.ops_pci = &intel_pci_ops,
|
||||||
.ops_pci_bus = &pci_cf8_conf1,
|
.ops_pci_bus = &pci_cf8_conf1,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,7 +147,8 @@ static void enable_dev(struct device *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chip_operations northbridge_intel_e7501_ops = {
|
struct chip_operations northbridge_intel_e7505_ops = {
|
||||||
CHIP_NAME("Intel E7501 Northbridge")
|
CHIP_NAME("Intel E7505 Northbridge")
|
||||||
.enable_dev = enable_dev,
|
.enable_dev = enable_dev,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#include <spd.h>
|
#include <spd.h>
|
||||||
#include <sdram_mode.h>
|
#include <sdram_mode.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "e7501.h"
|
#include "e7505.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
Definitions:
|
Definitions:
|
||||||
@@ -176,7 +176,8 @@ static const long constant_register_values[] = {
|
|||||||
// without jumping through 36-bit adddressing hoops, even if the
|
// without jumping through 36-bit adddressing hoops, even if the
|
||||||
// total memory is > 4 GB. Changing these values may break do_ram_command()!
|
// total memory is > 4 GB. Changing these values may break do_ram_command()!
|
||||||
0x60, 0x00000000, (0x01 << 0) | (0x02 << 8) | (0x03 << 16) | (0x04 << 24),
|
0x60, 0x00000000, (0x01 << 0) | (0x02 << 8) | (0x03 << 16) | (0x04 << 24),
|
||||||
0x64, 0x00000000, (0x05 << 0) | (0x06 << 8) | (0x07 << 16) | (0x08 << 24),
|
// 0x64, 0x00000000, (0x05 << 0) | (0x06 << 8) | (0x07 << 16) | (0x08 << 24),
|
||||||
|
0x64, 0x00000000, (0x04 << 0) | (0x04 << 8) | (0x04 << 16) | (0x04 << 24),
|
||||||
|
|
||||||
/* DRA - DRAM Row Attribute Register
|
/* DRA - DRAM Row Attribute Register
|
||||||
* 0x70 Row 0,1
|
* 0x70 Row 0,1
|
||||||
@@ -260,7 +261,8 @@ static const long constant_register_values[] = {
|
|||||||
|
|
||||||
// The only things we need to set here are DRAM idle timer, Back-to-Back Read Turnaround, and
|
// The only things we need to set here are DRAM idle timer, Back-to-Back Read Turnaround, and
|
||||||
// Back-to-Back Write-Read Turnaround. All others are configured based on SPD.
|
// Back-to-Back Write-Read Turnaround. All others are configured based on SPD.
|
||||||
0x78, 0xD7F8FFFF, (1 << 29) | (1 << 27) | (1 << 16),
|
// 0x78, 0xD7F8FFFF, (1 << 29) | (1 << 27) | (1 << 16),
|
||||||
|
0x78, 0xC7F8FFFF, (0x03<<16)|(0x28<<24),
|
||||||
|
|
||||||
/* FIXME why was I attempting to set a reserved bit? */
|
/* FIXME why was I attempting to set a reserved bit? */
|
||||||
/* 0x0100040f */
|
/* 0x0100040f */
|
||||||
@@ -314,7 +316,8 @@ static const long constant_register_values[] = {
|
|||||||
|
|
||||||
// Default to dual-channel mode, ECC, 1-clock address/cmd hold
|
// Default to dual-channel mode, ECC, 1-clock address/cmd hold
|
||||||
// NOTE: configure_e7501_dram_controller_mode() configures further
|
// NOTE: configure_e7501_dram_controller_mode() configures further
|
||||||
0x7c, 0xff8ef8ff, (1 << 22) | (2 << 20) | (1 << 16) | (0 << 8),
|
// 0x7c, 0xff8ef8ff, (1 << 22) | (2 << 20) | (1 << 16) | (0 << 8),
|
||||||
|
0x7c, 0xffcef8f7, 0x00210008,
|
||||||
|
|
||||||
/* Another Intel undocumented register
|
/* Another Intel undocumented register
|
||||||
* 0x88 - 0x8B
|
* 0x88 - 0x8B
|
||||||
@@ -400,7 +403,8 @@ static const long constant_register_values[] = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Enable D0:D1, disable D2:F1, D3:F1, D4:F1
|
// Enable D0:D1, disable D2:F1, D3:F1, D4:F1
|
||||||
0xe0, 0xffffffe2, (1 << 4) | (1 << 3) | (1 << 2) | (0 << 0),
|
// 0xe0, 0xffffffe2, (1 << 4) | (1 << 3) | (1 << 2) | (0 << 0),
|
||||||
|
0xe0, 0xfffffffa, 0x0,
|
||||||
|
|
||||||
// Undocumented
|
// Undocumented
|
||||||
0xd8, 0xffff9fff, 0x00000000,
|
0xd8, 0xffff9fff, 0x00000000,
|
||||||
@@ -422,7 +426,7 @@ static const long constant_register_values[] = {
|
|||||||
* [00:00] Unknown - not used?
|
* [00:00] Unknown - not used?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
0xf4, 0x3f8ffffd, 0x40300002,
|
// 0xf4, 0x3f8ffffd, 0x40300002,
|
||||||
|
|
||||||
#ifdef SUSPICIOUS_LOOKING_CODE
|
#ifdef SUSPICIOUS_LOOKING_CODE
|
||||||
// SJM: Undocumented.
|
// SJM: Undocumented.
|
||||||
@@ -432,12 +436,13 @@ static const long constant_register_values[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* DDR RECOMP tables */
|
/* DDR RECOMP tables */
|
||||||
|
#if 0
|
||||||
// Slew table for 1x drive?
|
// Slew table for 1x drive?
|
||||||
static const uint32_t maybe_1x_slew_table[] = {
|
static const uint32_t maybe_1x_slew_table[] = {
|
||||||
0x44332211, 0xc9776655, 0xffffffff, 0xffffffff,
|
0x44332211, 0xc9776655, 0xffffffff, 0xffffffff,
|
||||||
0x22111111, 0x55444332, 0xfffca876, 0xffffffff,
|
0x22111111, 0x55444332, 0xfffca876, 0xffffffff,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// Slew table for 2x drive?
|
// Slew table for 2x drive?
|
||||||
static const uint32_t maybe_2x_slew_table[] = {
|
static const uint32_t maybe_2x_slew_table[] = {
|
||||||
@@ -478,16 +483,64 @@ static void do_delay(void)
|
|||||||
|
|
||||||
#define EXTRA_DELAY DO_DELAY
|
#define EXTRA_DELAY DO_DELAY
|
||||||
|
|
||||||
static void die_on_spd_error(int spd_return_value)
|
/*-----------------------------------------------------------------------------
|
||||||
|
Handle (undocumented) control bits in device 0:6.0
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void ram_handle_d060_1(void)
|
||||||
{
|
{
|
||||||
if (spd_return_value < 0)
|
uint32_t dword;
|
||||||
die("Error reading SPD info\n");
|
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,0,0), MAYBE_MCHTST);
|
||||||
|
dword |= 0x02;
|
||||||
|
pci_write_config32(PCI_DEV(0,0,0), MAYBE_MCHTST, dword);
|
||||||
|
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,6,0), 0xf0);
|
||||||
|
dword |= 0x04;
|
||||||
|
pci_write_config32(PCI_DEV(0,6,0), 0xf0, dword);
|
||||||
|
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,0,0), MAYBE_MCHTST);
|
||||||
|
dword &= ~0x02;
|
||||||
|
pci_write_config32(PCI_DEV(0,0,0), MAYBE_MCHTST, dword);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void ram_handle_d060_2(void)
|
||||||
|
{
|
||||||
|
uint32_t dword;
|
||||||
|
uint8_t revision;
|
||||||
|
|
||||||
|
revision = pci_read_config8(PCI_DEV(0,0,0), 0x08);
|
||||||
|
if (revision >= 3) {
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,0,0), MAYBE_MCHTST);
|
||||||
|
dword |= 0x02;
|
||||||
|
pci_write_config32(PCI_DEV(0,0,0), MAYBE_MCHTST, dword);
|
||||||
|
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,6,0), 0xf0);
|
||||||
|
dword |= 0x18000000;
|
||||||
|
pci_write_config32(PCI_DEV(0,6,0), 0xf0, dword);
|
||||||
|
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,0,0), MAYBE_MCHTST);
|
||||||
|
dword &= ~0x02;
|
||||||
|
pci_write_config32(PCI_DEV(0,0,0), MAYBE_MCHTST, dword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
Serial presence detect (SPD) functions:
|
Serial presence detect (SPD) functions:
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void die_on_spd_error(int spd_return_value)
|
||||||
|
{
|
||||||
|
if (spd_return_value < 0)
|
||||||
|
die("Error reading SPD info\n");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the page size for each physical bank of the DIMM:
|
* Calculate the page size for each physical bank of the DIMM:
|
||||||
* log2(page size) = (# columns) + log2(data width)
|
* log2(page size) = (# columns) + log2(data width)
|
||||||
@@ -843,10 +896,10 @@ SDRAM configuration functions:
|
|||||||
*/
|
*/
|
||||||
static void do_ram_command(uint8_t command, uint16_t jedec_mode_bits)
|
static void do_ram_command(uint8_t command, uint16_t jedec_mode_bits)
|
||||||
{
|
{
|
||||||
int i;
|
uint8_t dimm_start_64M_multiple;
|
||||||
|
uint32_t dimm_start_address;
|
||||||
uint32_t dram_controller_mode;
|
uint32_t dram_controller_mode;
|
||||||
uint8_t dimm_start_64M_multiple = 0;
|
uint8_t i;
|
||||||
uint16_t e7501_mode_bits = jedec_mode_bits;
|
|
||||||
|
|
||||||
// Configure the RAM command
|
// Configure the RAM command
|
||||||
dram_controller_mode = pci_read_config32(PCI_DEV(0, 0, 0), DRC);
|
dram_controller_mode = pci_read_config32(PCI_DEV(0, 0, 0), DRC);
|
||||||
@@ -856,58 +909,43 @@ static void do_ram_command(uint8_t command, uint16_t jedec_mode_bits)
|
|||||||
|
|
||||||
// RAM_COMMAND_NORMAL is an exception.
|
// RAM_COMMAND_NORMAL is an exception.
|
||||||
// It affects only the memory controller and does not need to be "sent" to the DIMMs.
|
// It affects only the memory controller and does not need to be "sent" to the DIMMs.
|
||||||
|
if (command == RAM_COMMAND_NORMAL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (command != RAM_COMMAND_NORMAL) {
|
// NOTE: for mode select commands, some of the location address bits are part of the command
|
||||||
|
// Map JEDEC mode bits to E7505
|
||||||
|
if (command == RAM_COMMAND_MRS) {
|
||||||
|
// Host address lines [25:18] map to DIMM address lines [7:0]
|
||||||
|
// Host address lines [17:16] map to DIMM address lines [9:8]
|
||||||
|
// Host address lines [15:4] map to DIMM address lines [11:0]
|
||||||
|
dimm_start_address = (jedec_mode_bits & 0x00ff) << 18;
|
||||||
|
dimm_start_address |= (jedec_mode_bits & 0x0300) << 8;
|
||||||
|
dimm_start_address |= (jedec_mode_bits & 0x0fff) << 4;
|
||||||
|
} else if (command == RAM_COMMAND_EMRS) {
|
||||||
|
// Host address lines [15:4] map to DIMM address lines [11:0]
|
||||||
|
dimm_start_address = (jedec_mode_bits << 4);
|
||||||
|
} else {
|
||||||
|
ASSERT(jedec_mode_bits == 0);
|
||||||
|
dimm_start_address = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Send the command to all DIMMs by accessing a memory location within each
|
// Send the command to all DIMMs by accessing a memory location within each
|
||||||
// NOTE: for mode select commands, some of the location address bits
|
|
||||||
// are part of the command
|
|
||||||
|
|
||||||
// Map JEDEC mode bits to E7501
|
|
||||||
if (command == RAM_COMMAND_MRS) {
|
|
||||||
// Host address lines [15:5] map to DIMM address lines [12:11, 9:1]
|
|
||||||
// The E7501 hard-sets DIMM address lines 10 & 0 to zero
|
|
||||||
|
|
||||||
ASSERT(!(jedec_mode_bits & 0x0401));
|
|
||||||
|
|
||||||
e7501_mode_bits = ((jedec_mode_bits & 0x1800) << (15 - 12)) | // JEDEC bits 11-12 move to bits 14-15
|
|
||||||
((jedec_mode_bits & 0x03FE) << (13 - 9)); // JEDEC bits 1-9 move to bits 5-13
|
|
||||||
|
|
||||||
} else if (command == RAM_COMMAND_EMRS) {
|
|
||||||
// Host address lines [15:3] map to DIMM address lines [12:0]
|
|
||||||
e7501_mode_bits = jedec_mode_bits <<= 3;
|
|
||||||
} else
|
|
||||||
ASSERT(jedec_mode_bits == 0);
|
|
||||||
|
|
||||||
dimm_start_64M_multiple = 0;
|
dimm_start_64M_multiple = 0;
|
||||||
|
|
||||||
for (i = 0; i < (MAX_NUM_CHANNELS * MAX_DIMM_SOCKETS_PER_CHANNEL); ++i) {
|
for (i = 0; i < (MAX_NUM_CHANNELS * MAX_DIMM_SOCKETS_PER_CHANNEL); ++i) {
|
||||||
|
|
||||||
uint8_t dimm_end_64M_multiple =
|
uint8_t dimm_end_64M_multiple = pci_read_config8(PCI_DEV(0, 0, 0), DRB_ROW_0 + i);
|
||||||
pci_read_config8(PCI_DEV(0, 0, 0), DRB_ROW_0 + i);
|
|
||||||
if (dimm_end_64M_multiple > dimm_start_64M_multiple) {
|
if (dimm_end_64M_multiple > dimm_start_64M_multiple) {
|
||||||
|
dimm_start_address &= 0x3ffffff;
|
||||||
// This code assumes DRAM row boundaries are all set below 4 GB
|
dimm_start_address |= dimm_start_64M_multiple << 26;
|
||||||
// NOTE: 0x40 * 64 MB == 4 GB
|
read32(dimm_start_address);
|
||||||
ASSERT(dimm_start_64M_multiple < 0x40);
|
|
||||||
|
|
||||||
// NOTE: 2^26 == 64 MB
|
|
||||||
|
|
||||||
uint32_t dimm_start_address =
|
|
||||||
dimm_start_64M_multiple << 26;
|
|
||||||
|
|
||||||
RAM_DEBUG_MESSAGE(" Sending RAM command to 0x");
|
|
||||||
RAM_DEBUG_HEX32(dimm_start_address + e7501_mode_bits);
|
|
||||||
RAM_DEBUG_MESSAGE("\n");
|
|
||||||
|
|
||||||
read32(dimm_start_address + e7501_mode_bits);
|
|
||||||
|
|
||||||
// Set the start of the next DIMM
|
// Set the start of the next DIMM
|
||||||
dimm_start_64M_multiple =
|
dimm_start_64M_multiple = dimm_end_64M_multiple;
|
||||||
dimm_end_64M_multiple;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1136,13 +1174,10 @@ static void initialize_ecc(void)
|
|||||||
dram_controller_mode >>= 20;
|
dram_controller_mode >>= 20;
|
||||||
dram_controller_mode &= 3;
|
dram_controller_mode &= 3;
|
||||||
if (dram_controller_mode == 2) {
|
if (dram_controller_mode == 2) {
|
||||||
|
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
|
|
||||||
RAM_DEBUG_MESSAGE("Initializing ECC state...\n");
|
RAM_DEBUG_MESSAGE("Initializing ECC state...\n");
|
||||||
/* Initialize ECC bits , use ECC zero mode (new to 7501) */
|
pci_write_config8(PCI_DEV(0, 0, 0), MCHCFGNS, 0x01);
|
||||||
pci_write_config8(PCI_DEV(0, 0, 0), MCHCFGNS, 0x06);
|
|
||||||
pci_write_config8(PCI_DEV(0, 0, 0), MCHCFGNS, 0x07);
|
|
||||||
|
|
||||||
// Wait for scrub cycle to complete
|
// Wait for scrub cycle to complete
|
||||||
do {
|
do {
|
||||||
@@ -1150,7 +1185,7 @@ static void initialize_ecc(void)
|
|||||||
pci_read_config8(PCI_DEV(0, 0, 0), MCHCFGNS);
|
pci_read_config8(PCI_DEV(0, 0, 0), MCHCFGNS);
|
||||||
} while ((byte & 0x08) == 0);
|
} while ((byte & 0x08) == 0);
|
||||||
|
|
||||||
pci_write_config8(PCI_DEV(0, 0, 0), MCHCFGNS, byte & 0xfc);
|
pci_write_config8(PCI_DEV(0, 0, 0), MCHCFGNS, (byte & 0xfc) | 0x04);
|
||||||
RAM_DEBUG_MESSAGE("ECC state initialized.\n");
|
RAM_DEBUG_MESSAGE("ECC state initialized.\n");
|
||||||
|
|
||||||
/* Clear the ECC error bits */
|
/* Clear the ECC error bits */
|
||||||
@@ -1160,9 +1195,6 @@ static void initialize_ecc(void)
|
|||||||
// Clear DRAM Interface error bits (write-one-clear)
|
// Clear DRAM Interface error bits (write-one-clear)
|
||||||
pci_write_config32(PCI_DEV(0, 0, 1), FERR_GLOBAL, 1 << 18);
|
pci_write_config32(PCI_DEV(0, 0, 1), FERR_GLOBAL, 1 << 18);
|
||||||
pci_write_config32(PCI_DEV(0, 0, 1), NERR_GLOBAL, 1 << 18);
|
pci_write_config32(PCI_DEV(0, 0, 1), NERR_GLOBAL, 1 << 18);
|
||||||
|
|
||||||
// Start normal ECC scrub
|
|
||||||
pci_write_config8(PCI_DEV(0, 0, 0), MCHCFGNS, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1403,11 +1435,11 @@ static void configure_e7501_cas_latency(const struct mem_controller *ctrl,
|
|||||||
|
|
||||||
maybe_dram_read_timing =
|
maybe_dram_read_timing =
|
||||||
pci_read_config16(PCI_DEV(0, 0, 0), MAYBE_DRDCTL);
|
pci_read_config16(PCI_DEV(0, 0, 0), MAYBE_DRDCTL);
|
||||||
maybe_dram_read_timing &= 0xF00C;
|
maybe_dram_read_timing &= 0xF000;
|
||||||
|
|
||||||
if (system_compatible_cas_latencies & SPD_CAS_LATENCY_2_0) {
|
if (system_compatible_cas_latencies & SPD_CAS_LATENCY_2_0) {
|
||||||
dram_timing |= DRT_CAS_2_0;
|
dram_timing |= DRT_CAS_2_0;
|
||||||
maybe_dram_read_timing |= 0xBB1;
|
maybe_dram_read_timing |= 0x0222;
|
||||||
} else if (system_compatible_cas_latencies & SPD_CAS_LATENCY_2_5) {
|
} else if (system_compatible_cas_latencies & SPD_CAS_LATENCY_2_5) {
|
||||||
|
|
||||||
uint32_t dram_row_attributes =
|
uint32_t dram_row_attributes =
|
||||||
@@ -1438,16 +1470,16 @@ static void configure_e7501_cas_latency(const struct mem_controller *ctrl,
|
|||||||
dword = pci_read_config32(PCI_DEV(0, 0, 0), 0x88);
|
dword = pci_read_config32(PCI_DEV(0, 0, 0), 0x88);
|
||||||
dword |= (1 << 26);
|
dword |= (1 << 26);
|
||||||
pci_write_config32(PCI_DEV(0, 0, 0), 0x88, dword);
|
pci_write_config32(PCI_DEV(0, 0, 0), 0x88, dword);
|
||||||
|
/* patch try register 88 is undocumented tnz */
|
||||||
dword &= 0x0c0007ff; /* patch try register 88 is undocumented tnz */
|
dword &= 0x0ca17fff;
|
||||||
dword |= 0xd2109800;
|
dword |= 0xd14a5000;
|
||||||
|
|
||||||
pci_write_config32(PCI_DEV(0, 0, 0), 0x88, dword);
|
pci_write_config32(PCI_DEV(0, 0, 0), 0x88, dword);
|
||||||
|
|
||||||
pci_write_config16(PCI_DEV(0, 0, 0), MAYBE_DRDCTL,
|
pci_write_config16(PCI_DEV(0, 0, 0), MAYBE_DRDCTL,
|
||||||
maybe_dram_read_timing);
|
maybe_dram_read_timing);
|
||||||
|
|
||||||
dword = pci_read_config32(PCI_DEV(0, 0, 0), 0x88); /* reset master DLL reset */
|
/* clear master DLL reset */
|
||||||
|
dword = pci_read_config32(PCI_DEV(0, 0, 0), 0x88);
|
||||||
dword &= ~(1 << 26);
|
dword &= ~(1 << 26);
|
||||||
pci_write_config32(PCI_DEV(0, 0, 0), 0x88, dword);
|
pci_write_config32(PCI_DEV(0, 0, 0), 0x88, dword);
|
||||||
|
|
||||||
@@ -1627,6 +1659,8 @@ static void enable_e7501_clocks(uint8_t dimm_mask)
|
|||||||
int i;
|
int i;
|
||||||
uint8_t clock_disable = pci_read_config8(PCI_DEV(0, 0, 0), CKDIS);
|
uint8_t clock_disable = pci_read_config8(PCI_DEV(0, 0, 0), CKDIS);
|
||||||
|
|
||||||
|
pci_write_config8(PCI_DEV(0,0,0), 0x8e, 0xb0);
|
||||||
|
|
||||||
for (i = 0; i < MAX_DIMM_SOCKETS_PER_CHANNEL; i++) {
|
for (i = 0; i < MAX_DIMM_SOCKETS_PER_CHANNEL; i++) {
|
||||||
|
|
||||||
uint8_t socket_mask = 1 << i;
|
uint8_t socket_mask = 1 << i;
|
||||||
@@ -1727,7 +1761,7 @@ static void write_8dwords(const uint32_t *src_addr, uint32_t dst_addr)
|
|||||||
static void ram_set_rcomp_regs(void)
|
static void ram_set_rcomp_regs(void)
|
||||||
{
|
{
|
||||||
uint32_t dword;
|
uint32_t dword;
|
||||||
uint8_t maybe_strength_control;
|
uint8_t maybe_strength_control, revision;
|
||||||
|
|
||||||
RAM_DEBUG_MESSAGE("Setting RCOMP registers.\n");
|
RAM_DEBUG_MESSAGE("Setting RCOMP registers.\n");
|
||||||
|
|
||||||
@@ -1745,81 +1779,105 @@ static void ram_set_rcomp_regs(void)
|
|||||||
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
||||||
|
|
||||||
/* Begin to write the RCOMP registers */
|
/* Begin to write the RCOMP registers */
|
||||||
|
write8(RCOMP_MMIO + 0x2c, 0x0);
|
||||||
|
|
||||||
// Set CMD and DQ/DQS strength to 2x (?)
|
// Set CMD and DQ/DQS strength to 2x (?)
|
||||||
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_DQCMDSTR) & 0x88;
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_DQCMDSTR) & 0x88;
|
||||||
maybe_strength_control |= 0x44;
|
maybe_strength_control |= 0x40;
|
||||||
write8(RCOMP_MMIO + MAYBE_DQCMDSTR, maybe_strength_control);
|
write8(RCOMP_MMIO + MAYBE_DQCMDSTR, maybe_strength_control);
|
||||||
|
|
||||||
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x80);
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x80);
|
||||||
write16(RCOMP_MMIO + 0x42, 0);
|
write16(RCOMP_MMIO + 0x42, 0);
|
||||||
|
|
||||||
write_8dwords(maybe_1x_slew_table, RCOMP_MMIO + 0x60);
|
// Set CMD and DQ/DQS strength to 2x (?)
|
||||||
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_DQCMDSTR) & 0xF8;
|
||||||
// NOTE: some factory BIOS set 0x9088 here. Seems to work either way.
|
maybe_strength_control |= 0x04;
|
||||||
|
write8(RCOMP_MMIO + MAYBE_DQCMDSTR, maybe_strength_control);
|
||||||
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x60);
|
||||||
write16(RCOMP_MMIO + 0x40, 0);
|
write16(RCOMP_MMIO + 0x40, 0);
|
||||||
|
|
||||||
// Set RCVEnOut# strength to 2x (?)
|
// Set RCVEnOut# strength to 2x (?)
|
||||||
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_RCVENSTR) & 0xF8;
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_RCVENSTR) & 0xF8;
|
||||||
maybe_strength_control |= 4;
|
maybe_strength_control |= 0x04;
|
||||||
write8(RCOMP_MMIO + MAYBE_RCVENSTR, maybe_strength_control);
|
write8(RCOMP_MMIO + MAYBE_RCVENSTR, maybe_strength_control);
|
||||||
|
|
||||||
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x1c0);
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x1c0);
|
||||||
write16(RCOMP_MMIO + 0x50, 0);
|
write16(RCOMP_MMIO + 0x50, 0);
|
||||||
|
|
||||||
// Set CS# strength for x4 SDRAM to 2x (?)
|
// Set CS# strength for x4 SDRAM to 2x (?)
|
||||||
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CSBSTR) & 0xF8;
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CSBSTR) & 0x88;
|
||||||
maybe_strength_control |= 4;
|
maybe_strength_control |= 0x04;
|
||||||
write8(RCOMP_MMIO + MAYBE_CSBSTR, maybe_strength_control);
|
write8(RCOMP_MMIO + MAYBE_CSBSTR, maybe_strength_control);
|
||||||
|
|
||||||
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x140);
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x140);
|
||||||
write16(RCOMP_MMIO + 0x48, 0);
|
write16(RCOMP_MMIO + 0x48, 0);
|
||||||
|
|
||||||
// Set CKE strength for x4 SDRAM to 2x (?)
|
// Set CS# strength for x4 SDRAM to 2x (?)
|
||||||
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CKESTR) & 0xF8;
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CSBSTR) & 0x8F;
|
||||||
maybe_strength_control |= 4;
|
maybe_strength_control |= 0x40;
|
||||||
write8(RCOMP_MMIO + MAYBE_CKESTR, maybe_strength_control);
|
write8(RCOMP_MMIO + MAYBE_CSBSTR, maybe_strength_control);
|
||||||
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0x160);
|
||||||
|
write16(RCOMP_MMIO + 0x4a, 0);
|
||||||
|
|
||||||
|
// Set CKE strength for x4 SDRAM to 2x (?)
|
||||||
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CKESTR) & 0x88;
|
||||||
|
maybe_strength_control |= 0x04;
|
||||||
|
write8(RCOMP_MMIO + MAYBE_CKESTR, maybe_strength_control);
|
||||||
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0xa0);
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0xa0);
|
||||||
write16(RCOMP_MMIO + 0x44, 0);
|
write16(RCOMP_MMIO + 0x44, 0);
|
||||||
|
|
||||||
// Set CK strength for x4 SDRAM to 1x (?)
|
// Set CKE strength for x4 SDRAM to 2x (?)
|
||||||
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CKSTR) & 0xF8;
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CKESTR) & 0x8F;
|
||||||
maybe_strength_control |= 1;
|
maybe_strength_control |= 0x40;
|
||||||
write8(RCOMP_MMIO + MAYBE_CKSTR, maybe_strength_control);
|
write8(RCOMP_MMIO + MAYBE_CKESTR, maybe_strength_control);
|
||||||
|
write_8dwords(maybe_2x_slew_table, RCOMP_MMIO + 0xc0);
|
||||||
|
write16(RCOMP_MMIO + 0x46, 0);
|
||||||
|
|
||||||
|
// Set CK strength for x4 SDRAM to 1x (?)
|
||||||
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CKSTR) & 0x88;
|
||||||
|
maybe_strength_control |= 0x01;
|
||||||
|
write8(RCOMP_MMIO + MAYBE_CKSTR, maybe_strength_control);
|
||||||
write_8dwords(maybe_pull_updown_offset_table, RCOMP_MMIO + 0x180);
|
write_8dwords(maybe_pull_updown_offset_table, RCOMP_MMIO + 0x180);
|
||||||
write16(RCOMP_MMIO + 0x4c, 0);
|
write16(RCOMP_MMIO + 0x4c, 0);
|
||||||
|
|
||||||
write8(RCOMP_MMIO + 0x2c, 0xff);
|
// Set CK strength for x4 SDRAM to 1x (?)
|
||||||
|
maybe_strength_control = read8(RCOMP_MMIO + MAYBE_CKSTR) & 0x8F;
|
||||||
|
maybe_strength_control |= 0x10;
|
||||||
|
write8(RCOMP_MMIO + MAYBE_CKSTR, maybe_strength_control);
|
||||||
|
write_8dwords(maybe_pull_updown_offset_table, RCOMP_MMIO + 0x1a0);
|
||||||
|
write16(RCOMP_MMIO + 0x4e, 0);
|
||||||
|
|
||||||
// Set the digital filter length to 8 (?)
|
|
||||||
|
dword = read32(RCOMP_MMIO + 0x400);
|
||||||
|
dword &= 0x7f7fffff;
|
||||||
|
write32(RCOMP_MMIO + 0x400, dword);
|
||||||
|
|
||||||
|
dword = read32(RCOMP_MMIO + 0x408);
|
||||||
|
dword &= 0x7f7fffff;
|
||||||
|
write32(RCOMP_MMIO + 0x408, dword);
|
||||||
|
|
||||||
|
ram_handle_d060_1();
|
||||||
|
|
||||||
|
dword = pci_read_config32(PCI_DEV(0,0,0), MAYBE_MCHTST);
|
||||||
|
dword &= 0x3fffffff;
|
||||||
|
pci_write_config32(PCI_DEV(0,0,0), MAYBE_MCHTST, dword);
|
||||||
|
|
||||||
|
revision = pci_read_config8(PCI_DEV(0,0,0), 0x08);
|
||||||
|
if (revision >= 3) {
|
||||||
dword = read32(RCOMP_MMIO + MAYBE_SMRCTL);
|
dword = read32(RCOMP_MMIO + MAYBE_SMRCTL);
|
||||||
|
dword &= ~0x100;
|
||||||
// NOTE: Some factory BIOS don't do this.
|
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
||||||
// Doesn't seem to matter either way.
|
dword = read32(RCOMP_MMIO + MAYBE_SMRCTL);
|
||||||
dword &= ~2;
|
dword |= 0x500;
|
||||||
|
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
||||||
dword |= 1;
|
}
|
||||||
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
dword = read32(RCOMP_MMIO + MAYBE_SMRCTL);
|
||||||
|
dword &= ~0x203;
|
||||||
/* Wait 40 usec */
|
dword |= 0x401;
|
||||||
SLOW_DOWN_IO;
|
|
||||||
|
|
||||||
/* unblock updates */
|
|
||||||
dword = read32(RCOMP_MMIO + MAYBE_SMRCTL);
|
|
||||||
dword &= ~(1 << 9);
|
|
||||||
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
|
||||||
|
|
||||||
// Force a RCOMP measurement cycle?
|
|
||||||
dword |= (1 << 8);
|
|
||||||
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
|
||||||
dword &= ~(1 << 8);
|
|
||||||
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
write32(RCOMP_MMIO + MAYBE_SMRCTL, dword);
|
||||||
|
|
||||||
/* Wait 40 usec */
|
/* Wait 40 usec */
|
||||||
SLOW_DOWN_IO;
|
SLOW_DOWN_IO;
|
||||||
|
|
||||||
|
// Clear the RCOMP MMIO base address
|
||||||
|
pci_write_config32(PCI_DEV(0, 0, 0), MAYBE_SMRBASE, 0);
|
||||||
/*disable access to the rcomp bar */
|
/*disable access to the rcomp bar */
|
||||||
dword = pci_read_config32(PCI_DEV(0, 0, 0), MAYBE_MCHTST);
|
dword = pci_read_config32(PCI_DEV(0, 0, 0), MAYBE_MCHTST);
|
||||||
dword &= ~(1 << 22);
|
dword &= ~(1 << 22);
|
||||||
@@ -2004,4 +2062,6 @@ static void sdram_set_registers(const struct mem_controller *ctrl)
|
|||||||
|
|
||||||
ram_set_rcomp_regs();
|
ram_set_rcomp_regs();
|
||||||
ram_set_d0f0_regs();
|
ram_set_d0f0_regs();
|
||||||
|
ram_handle_d060_2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user