I am using a board with CPU(TI AM3715). A NOR Flash(Micron PC28F512G18FF) attaches to GPMC CS0.
The CPU can not boot from the NOR Flash.
The operations are following,
Step 1: sys_boot[4:0] = 0b00110, boot from MMC1.
Configure the registers GPMC_CONFIGi_0(i=1,2,...7) related to CS0 in U-BOOT.
CS0 CONFIG 1: 0xe9401213
CS0 CONFIG 2: 0x000c1503
CS0 CONFIG 3: 0x00050503
CS0 CONFIG 4: 0x0b051506
CS0 CONFIG 5: 0x020e0c15
CS0 CONFIG 6: 0x0b0603c3
CS0 CONFIG 7: 0x00000c50
Copy x-load.bin to NOR Flash through the commands below.
OMAP3_Mulan # protect off all Un-Protect Flash Bank # 1
OMAP3_Mulan # erase 0x10000000 0x1003FFFF
. done
Erased 1 sectors
OMAP3_Mulan # mmc init mmc1 is available
OMAP3_Mulan # fatload mmc 0 0x80800000 MLO reading MLO
17788 bytes read
OMAP3_Mulan # cp.b 0x80800000 0x10000000 0x457C
Copy to Flash... done
Check data on the first sector of the NOR Flash through the following command,
OMAP3_Mulan # md 0x10000000 0x457C
The data on the first sector of the NOR Flash is the same as x-load.bin.
Step 2: sys_boot[4:0] = 0b01110, boot from NOR Flash.
After CPU powers on, the debug UART prints NOTHING.
I think that the CPU does not boot from NOR Flash.
Step 3: sys_boot[4:0] = 0b00110, boot from MMC1.
Added source code in the function void start_armboot (void) in the file lib/board.c in x-load.
void start_armboot (void)
{
init_fnc_t **init_fnc_ptr;
int i;
uchar *buf;
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
hang ();
}
}
misc_init_r();
buf = (uchar*) CFG_LOADADDR;
/* Added source code below to get the register value related to GPMC_CONFIG CS0 and read x-load from NOR Flash */
#if 1
u32 temp;
#define __raw_readl(a) (*(volatile unsigned int *)(a))
#define __raw_writel(v,a) (*(volatile unsigned int *)(a) = (v))
#define __raw_readw(a) (*(volatile unsigned short *)(a))
#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v))
#define BIT0 (1<<0)
#define BIT1 (1<<1)
#define BIT2 (1<<2)
#define BIT3 (1<<3)
#define BIT4 (1<<4)
#define BIT5 (1<<5)
#define SYSBOOT_MASK (BIT0|BIT1|BIT2|BIT3|BIT4)
/************************************************
* get_sysboot_value(void) - return SYS_BOOT[4:0]
************************************************/
int mode;
mode = __raw_readl(CONTROL_STATUS) & (SYSBOOT_MASK);
printf("SYS_BOOT: 0x%08x\n", mode);
i = 1;
temp = __raw_readl(GPMC_CONFIG1 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
temp = __raw_readl(GPMC_CONFIG2 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
temp = __raw_readl(GPMC_CONFIG3 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
temp = __raw_readl(GPMC_CONFIG4 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
temp = __raw_readl(GPMC_CONFIG5 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
temp = __raw_readl(GPMC_CONFIG6 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
temp = __raw_readl(GPMC_CONFIG7 + GPMC_CONFIG_CS0);
printf("CS0 CONFIG %d: 0x%08x\n", i++, temp);
unsigned short int *addr;
printf("Read xload from NOR Flash...\n");
temp = __raw_readl(GPMC_CONFIG7 + GPMC_CONFIG_CS0) & 0x3F;
addr = (unsigned short int *) (temp << 24);
printf("xLoad temp=0x%08x addr=0x%08x\n", temp, addr);
for (i = 0; i < 17788 ; i++)
{
printf("%04x", addr[i]);
}
printf("Read xload end\n");
#endif
......
}
Compile x-load and copy x-load.bin.ift to MMC/BOOT/MLO.
After CPU powers on, the debug UART only prints the information below,
Texas Instruments X-Loader 1.46 for Mulan(Apr 23 2013 - 18:04:39)
SYS_BOOT: 0x00000006
CS0 CONFIG 1: 0x00001200
CS0 CONFIG 2: 0x00101001
CS0 CONFIG 3: 0x00020201
CS0 CONFIG 4: 0x10031003
CS0 CONFIG 5: 0x010f1111
CS0 CONFIG 6: 0x8f030000
CS0 CONFIG 7: 0x00000f40
Starting X-loader on MMC
Reading boot sector
247968 Bytes Read from MMC
Starting OS Bootloader from MMC...
Read xload from NOR Flash...
xLoad temp=0x00000000 addr=0x00000000
-----------------------
The CPU already hanged.
GPMC_CONFIGi(i=1,2 ... 7)_0 remains default values.
Failed to read data from NOR Flash.
Please help solve the issue about NOR Flash boot. Thanks!