[U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot from NOR.

Mark Jackson mpfj-list at newflow.co.uk
Mon Jun 17 17:23:33 CEST 2013


On 17/06/13 15:59, Mark Jackson wrote:
> On 17/06/13 15:49, Tom Rini wrote:
> 
> <snip>
> 
>> Did you copy the parts that setup the pinmuxing in s_init for NOR?
> 
> This bit ?
> 
> #ifdef CONFIG_NOR_BOOT
> 	asm("stmfd      sp!, {r2 - r4}");
> 	asm("movw       r4, #0x8A4");
> 	asm("movw       r3, #0x44E1");
> 	asm("orr        r4, r4, r3, lsl #16");
> 	asm("mov        r2, #9");
> 	asm("mov        r3, #8");
> 	asm("gpmc_mux:  str     r2, [r4], #4");
> 	asm("subs       r3, r3, #1");
> 	asm("bne        gpmc_mux");
> 	asm("ldmfd      sp!, {r2 - r4}");
> #endif
> 
> Yes ... :-)
> 

Below is my entire s_init() routine.

One question ... the SPL code has:-

	...
	gd = &gdata;
	...

But there seems to be no similar assignment when in NOR boot mode.
I'm no expert in the internal workings of u-boot, so I thought I'd
check, just in case !?!

Cheers
Mark J.
---
void s_init(void)
{
	/*
	 * The ROM will only have set up sufficient pinmux to allow for the
	 * first 4KiB NOR to be read, we must finish doing what we know of
	 * the NOR mux in this space in order to continue.
	 */
#ifdef CONFIG_NOR_BOOT
	asm("stmfd      sp!, {r2 - r4}");
	asm("movw       r4, #0x8A4");
	asm("movw       r3, #0x44E1");
	asm("orr        r4, r4, r3, lsl #16");
	asm("mov        r2, #9");
	asm("mov        r3, #8");
	asm("gpmc_mux:  str     r2, [r4], #4");
	asm("subs       r3, r3, #1");
	asm("bne        gpmc_mux");
	asm("ldmfd      sp!, {r2 - r4}");
#endif

	/*
	 * Save the boot parameters passed from romcode.
	 * We cannot delay the saving further than this,
	 * to prevent overwrites.
	 */
#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
	save_omap_boot_params();
#endif

	/* WDT1 is already running when the bootloader gets control
	 * Disable it to avoid "random" resets
	 */
	writel(0xAAAA, &wdtimer->wdtwspr);
	while (readl(&wdtimer->wdtwwps) != 0x0)
		;
	writel(0x5555, &wdtimer->wdtwspr);
	while (readl(&wdtimer->wdtwwps) != 0x0)
		;

#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
	/* Setup the PLLs and the clocks for the peripherals */
	pll_init();

	/* Enable RTC32K clock */
	rtc32k_enable();

	enable_board_pin_mux();

	/* UART softreset */
	u32 regVal;
	regVal = readl(&uart_base->uartsyscfg);
	regVal |= UART_RESET;
	writel(regVal, &uart_base->uartsyscfg);
	while ((readl(&uart_base->uartsyssts) &
		UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK)
		;

	/* Disable smart idle */
	regVal = readl(&uart_base->uartsyscfg);
	regVal |= UART_SMART_IDLE_EN;
	writel(regVal, &uart_base->uartsyscfg);

#if defined(CONFIG_NOR_BOOT)
	/* We want our console now. */
	gd->baudrate = CONFIG_BAUDRATE;
	serial_init();
	gd->have_console = 1;
	puts("\nU-Boot NOR Boot\n");
#else
	gd = &gdata;

	preloader_console_init();
#endif

	config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, &ddr3_data,
		   &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);

	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif /* CONFIG_SPL_BUILD */
}



More information about the U-Boot mailing list