ARMv7: Clean up console code
- Guard console_init() with CONFIG_EARLY_CONSOLE in bootblock - Don't initialize console twice in the bootblock - remove printk in memory init that would mess up the UART - unconditionally run console_init() in romstage, as it is also unconditionally run in the bootblock. Change-Id: I8f0d60877433162367074d0e55e01f935fd81f8e Signed-off-by: Stefan Reinauer <reinauer@google.com> Signed-off-by: Gabe Black <gabeblack@chromium.org> Reviewed-on: http://review.coreboot.org/3647 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
		
				
					committed by
					
						
						Stefan Reinauer
					
				
			
			
				
	
			
			
			
						parent
						
							d3163abd43
						
					
				
				
					commit
					919c804425
				
			@@ -68,12 +68,12 @@ void main(void)
 | 
				
			|||||||
		bootblock_mainboard_init();
 | 
							bootblock_mainboard_init();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef CONFIG_EARLY_CONSOLE
 | 
				
			||||||
	console_init();
 | 
						console_init();
 | 
				
			||||||
	printk(BIOS_INFO, "hello from bootblock\n");
 | 
					#endif
 | 
				
			||||||
	printk(BIOS_INFO, "bootblock main(): loading romstage\n");
 | 
					
 | 
				
			||||||
	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name);
 | 
						entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	printk(BIOS_INFO, "bootblock main(): jumping to romstage\n");
 | 
					 | 
				
			||||||
	if (entry) stage_exit(entry);
 | 
						if (entry) stage_exit(entry);
 | 
				
			||||||
	hlt();
 | 
						hlt();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,6 @@
 | 
				
			|||||||
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 | 
					 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <console/console.h>
 | 
					 | 
				
			||||||
#include "clk.h"
 | 
					#include "clk.h"
 | 
				
			||||||
#include "wakeup.h"
 | 
					#include "wakeup.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -38,6 +37,4 @@ void bootblock_cpu_init(void)
 | 
				
			|||||||
	 * (ex, SPI, SD/MMC, or eMMC) now; but for Exynos platform, that is
 | 
						 * (ex, SPI, SD/MMC, or eMMC) now; but for Exynos platform, that is
 | 
				
			||||||
	 * already handled by iROM so there's no need to setup again.
 | 
						 * already handled by iROM so there's no need to setup again.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
	console_init();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -490,7 +490,6 @@ static int board_get_config(void)
 | 
				
			|||||||
	id1 = gpio_read_mvl3(BOARD_ID1_GPIO);
 | 
						id1 = gpio_read_mvl3(BOARD_ID1_GPIO);
 | 
				
			||||||
	if (id0 < 0 || id1 < 0)
 | 
						if (id0 < 0 || id1 < 0)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	printk(BIOS_DEBUG, "%s: id0: %u, id1: %u\n", __func__, id0, id1);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ARRAY_SIZE(id_map); i++) {
 | 
						for (i = 0; i < ARRAY_SIZE(id_map); i++) {
 | 
				
			||||||
		if (id0 == id_map[i].id0 && id1 == id_map[i].id1) {
 | 
							if (id0 == id_map[i].id0 && id1 == id_map[i].id1) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -129,7 +129,7 @@ static void setup_gpio(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void setup_memory(struct mem_timings *mem, int is_resume)
 | 
					static void setup_memory(struct mem_timings *mem, int is_resume)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	printk(BIOS_SPEW, "man: 0x%x type: 0x%x, div: 0x%x, mhz: 0x%x\n",
 | 
						printk(BIOS_SPEW, "man: 0x%x type: 0x%x, div: 0x%x, mhz: %d\n",
 | 
				
			||||||
	       mem->mem_manuf,
 | 
						       mem->mem_manuf,
 | 
				
			||||||
	       mem->mem_type,
 | 
						       mem->mem_type,
 | 
				
			||||||
	       mem->mpll_mdiv,
 | 
						       mem->mpll_mdiv,
 | 
				
			||||||
@@ -168,8 +168,9 @@ void main(void)
 | 
				
			|||||||
	 * to re-initialize serial console drivers again. */
 | 
						 * to re-initialize serial console drivers again. */
 | 
				
			||||||
	mem = setup_clock();
 | 
						mem = setup_clock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_resume) {
 | 
					 | 
				
			||||||
	console_init();
 | 
						console_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!is_resume) {
 | 
				
			||||||
		setup_power();
 | 
							setup_power();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user