Patchwork New patch to review: 50f85d9 Move SB800 clock init earlier

login
register
about
Submitter gerrit@coreboot.org
Date 2011-06-15 04:36:29
Message ID <E1QWhq9-00059B-91@ra.coresystems.de>
Download mbox | patch
Permalink /patch/3141/
State New, archived
Headers show

Comments

gerrit@coreboot.org - 2011-06-15 04:36:29
Marshall Buschman (mbuschman@lucidmachines.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/32

-gerrit

Patch

commit 50f85d95e65f7429e2cea6a6649b30b789eda229
Author: Scott Duplichan <scott@notabs.org>
Date:   Tue Jun 14 23:29:16 2011 -0500

    Move SB800 clock init earlier
    
    Committing Scott's e350m1 changes (svn r6585):
    Move SB800 clock init earlier,
    Fixes problem where initial serial port output is garbled.
    
    Change-Id: If05aa37726b962e8994ee69bf1882fcfae56aa19
    Signed-off-by: Scott Duplichan <scott@notabs.org>
    Signed-off-by: Marshall Buschman <mbuschman@lucidmachines.com>

diff --git a/src/mainboard/asrock/e350m1/romstage.c b/src/mainboard/asrock/e350m1/romstage.c
index 7d25ec1..e64c869 100644
--- a/src/mainboard/asrock/e350m1/romstage.c
+++ b/src/mainboard/asrock/e350m1/romstage.c
@@ -55,6 +55,20 @@  void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
 	// all cores: set pstate 0 (1600 MHz) early to save a few ms of boot time
 	__writemsr(0xc0010062, 0);
 
+	if (boot_cpu()) {
+		u8 reg8;
+		// SB800: program AcpiMmioEn to enable MMIO access to MiscCntrl register
+		outb(0x24, 0xCD6);
+		reg8 = inb(0xCD7);
+		reg8 |= 1;
+		reg8 &= ~(1 << 1);
+		outb(reg8, 0xCD7);
+
+		// program SB800 MiscCntrl
+		*(volatile u32 *)(0xFED80000+0xE00+0x40) &= ~((1 << 0) | (1 << 2)); /* 48Mhz */
+		*(volatile u32 *)(0xFED80000+0xE00+0x40) |= 1 << 1; /* 48Mhz */
+	}
+
 	// early enable of PrefetchEnSPIFromHost
 	if (boot_cpu()) {
 		__outdword(0xcf8, 0x8000a3b8);
@@ -80,17 +94,6 @@  void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
 		w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
 		console_init();
 	}
-	//reg8 = pmio_read(0x24);
-	outb(0x24, 0xCD6);
-	reg8 = inb(0xCD7);
-	reg8 |= 1;
-	reg8 &= ~(1 << 1);
-	//pmio_write(0x24, reg8);
-	outb(0x24, 0xCD6);
-	outb(reg8, 0xCD7);
-
-	*(volatile u32 *)(0xFED80000 + 0xE00 + 0x40) &= ~((1 << 0) | (1 << 2));	/* 48Mhz */
-	*(volatile u32 *)(0xFED80000 + 0xE00 + 0x40) |= 1 << 1;	/* 48Mhz */
 
 	/* Halt if there was a built in self test failure */
 	post_code(0x34);