From f22ce41840ae966a6f465e90c8f05aed9ae5ef6b Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Fri, 28 Nov 2008 21:36:51 +0000 Subject: Add support for the AMD/ATI SB600 southbridge SPI functionality. This has been tested by Uwe Hermann on an RS690/SB600 board. Signed-off-by: Jason Wang Reviewed-by: Joe Bao Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3779 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/flashrom/chipset_enable.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'util/flashrom/chipset_enable.c') diff --git a/util/flashrom/chipset_enable.c b/util/flashrom/chipset_enable.c index 658313d548..22eceb296e 100644 --- a/util/flashrom/chipset_enable.c +++ b/util/flashrom/chipset_enable.c @@ -647,21 +647,36 @@ static int enable_flash_amd8111(struct pci_dev *dev, const char *name) static int enable_flash_sb600(struct pci_dev *dev, const char *name) { - uint32_t old, new; + uint32_t tmp, low_bits, num; uint8_t reg; - /* Clear ROM Protect 0-3 */ + low_bits = tmp = pci_read_long(dev, 0xa0); + low_bits &= ~0xffffc000; /* for mmap aligning requirements */ + low_bits &= 0xfffffff0; /* remove low 4 bits */ + tmp &= 0xffffc000; + printf_debug("SPI base address is at 0x%x\n", tmp + low_bits); + + sb600_spibar = mmap(0, 0x4000, PROT_READ | PROT_WRITE, MAP_SHARED, + fd_mem, (off_t)tmp); + if (sb600_spibar == MAP_FAILED) { + perror("Can't mmap memory using " MEM_DEV); + exit(1); + } + sb600_spibar += low_bits; + + /* Clear ROM protect 0-3. */ for (reg = 0x50; reg < 0x60; reg += 4) { - old = pci_read_long(dev, reg); - new = old & 0xFFFFFFFC; - if (new != old) { - pci_write_byte(dev, reg, new); - if (pci_read_long(dev, reg) != new) { - printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x50, new, name); - } - } + num = pci_read_long(dev, reg); + num &= 0xfffffffc; + pci_write_byte(dev, reg, num); } + flashbus = BUS_TYPE_SB600_SPI; + + /* Enable SPI ROM in SB600 PM register. */ + OUTB(0x8f, 0xcd6); + OUTB(0x0e, 0xcd7); + return 0; } -- cgit v1.2.3