commit
1d96cfe8f5
@ -0,0 +1,127 @@ |
||||
Overview: |
||||
========= |
||||
|
||||
The MPC8536E integrates a PowerPC processor core with system logic |
||||
required for imaging, networking, and communications applications. |
||||
|
||||
Boot from NAND: |
||||
=============== |
||||
|
||||
The MPC8536E is capable of booting from NAND flash which uses the image |
||||
u-boot-nand.bin. This image contains two parts: a first stage image(also |
||||
call 4K NAND loader and a second stage image. The former is appended to |
||||
the latter to produce u-boot-nand.bin. |
||||
|
||||
The bootup process can be divided into two stages: the first stage will |
||||
configure the L2SRAM, then copy the second stage image to L2SRAM and jump |
||||
to it. The second stage image is to configure all the hardware and boot up |
||||
to U-Boot command line. |
||||
|
||||
The 4K NAND loader's code comes from the corresponding nand_spl directory, |
||||
along with the code twisted by CONFIG_NAND_SPL. The macro CONFIG_NAND_SPL |
||||
is mainly used to shrink the code size to the 4K size limitation. |
||||
|
||||
The macro CONFIG_SYS_RAMBOOT is used to control the code to produce the |
||||
second stage image. It's set in the board config file when boot from NAND |
||||
is selected. |
||||
|
||||
Build and boot steps |
||||
-------------------- |
||||
|
||||
1. Building image |
||||
make MPC8536DS_NAND_config |
||||
make CROSS_COMPILE=powerpc-none-linux-gnuspe- all |
||||
|
||||
2. Change dip-switch |
||||
SW2[5-8] = 1011 |
||||
SW9[1-3] = 101 |
||||
Note: 1 stands for 'on', 0 stands for 'off' |
||||
|
||||
3. Flash image |
||||
tftp 1000000 u-boot-nand.bin |
||||
nand erase 0 a0000 |
||||
nand write 1000000 0 a0000 |
||||
|
||||
Boot from On-chip ROM: |
||||
====================== |
||||
|
||||
The MPC8536E is capable of booting from the on-chip ROM - boot from eSDHC |
||||
and boot from eSPI. When power on, the porcessor excutes the ROM code to |
||||
initialize the eSPI/eSDHC controller, and loads the mian U-Boot image from |
||||
the memory device that interfaced to the controller, such as the SDCard or |
||||
SPI EEPROM, to the target memory, e.g. SDRAM or L2SRAM, then boot from it. |
||||
|
||||
The memory device should contain a specific data structure with control word |
||||
and config word at the fixed address. The config word direct the process how |
||||
to config the memory device, and the control word direct the processor where |
||||
to find the image on the memory device, or where copy the main image to. The |
||||
user can use any method to store the data structure to the memory device, only |
||||
if store it on the assigned address. |
||||
|
||||
Build and boot steps |
||||
-------------------- |
||||
|
||||
For boot from eSDHC: |
||||
1. Build image |
||||
make MPC8536DS_SDCARD_config |
||||
make CROSS_COMPILE=powerpc-none-linux-gnuspe- all |
||||
|
||||
2. Change dip-switch |
||||
SW2[5-8] = 0111 |
||||
SW3[1] = 0 |
||||
SW8[7] = 0 - The on-board SD/MMC slot is active |
||||
SW8[7] = 1 - The externel SD/MMC slot is active |
||||
|
||||
3. Put image to SDCard |
||||
Put the follwing info at the assigned address on the SDCard: |
||||
|
||||
Offset | Data | Description |
||||
-------------------------------------------------------- |
||||
| 0x40-0x43 | 0x424F4F54 | BOOT signature | |
||||
-------------------------------------------------------- |
||||
| 0x48-0x4B | 0x00080000 | u-boot.bin's size | |
||||
-------------------------------------------------------- |
||||
| 0x50-0x53 | 0x???????? | u-boot.bin's Addr on SDCard | |
||||
-------------------------------------------------------- |
||||
| 0x58-0x5B | 0xF8F80000 | Target Address | |
||||
------------------------------------------------------- |
||||
| 0x60-0x63 | 0xF8FFF000 | Execution Starting Address | |
||||
-------------------------------------------------------- |
||||
| 0x68-0x6B | 0x6 | Number of Config Addr/Data | |
||||
-------------------------------------------------------- |
||||
| 0x80-0x83 | 0xFF720100 | Config Addr 1 | |
||||
| 0x84-0x87 | 0xF8F80000 | Config Data 1 | |
||||
-------------------------------------------------------- |
||||
| 0x88-0x8b | 0xFF720e44 | Config Addr 2 | |
||||
| 0x8c-0x8f | 0x0000000C | Config Data 2 | |
||||
-------------------------------------------------------- |
||||
| 0x90-0x93 | 0xFF720000 | Config Addr 3 | |
||||
| 0x94-0x97 | 0x80010000 | Config Data 3 | |
||||
-------------------------------------------------------- |
||||
| 0x98-0x9b | 0xFF72e40e | Config Addr 4 | |
||||
| 0x9c-0x9f | 0x00000040 | Config Data 4 | |
||||
-------------------------------------------------------- |
||||
| 0xa0-0xa3 | 0x40000001 | Config Addr 5 | |
||||
| 0xa4-0xa7 | 0x00000100 | Config Data 5 | |
||||
-------------------------------------------------------- |
||||
| 0xa8-0xab | 0x80000001 | Config Addr 6 | |
||||
| 0xac-0xaf | 0x80000001 | Config Data 6 | |
||||
-------------------------------------------------------- |
||||
| ...... | |
||||
-------------------------------------------------------- |
||||
| 0x???????? | u-boot.bin | |
||||
-------------------------------------------------------- |
||||
|
||||
then insert the SDCard to the active slot to boot up. |
||||
|
||||
For boot from eSPI: |
||||
1. Build image |
||||
make MPC8536DS_SPIFLASH_config |
||||
make CROSS_COMPILE=powerpc-none-linux-gnuspe- all |
||||
|
||||
2. Change dip-switch |
||||
SW2[5-8] = 0110 |
||||
|
||||
3. Put image to SPI flash |
||||
Put the info in the above table onto the SPI flash, then |
||||
boot up. |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,127 @@ |
||||
#
|
||||
# (C) Copyright 2007
|
||||
# Stefan Roese, DENX Software Engineering, sr@denx.de.
|
||||
#
|
||||
# Copyright 2009 Freescale Semiconductor, Inc.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
NAND_SPL := y
|
||||
TEXT_BASE := 0xfff00000
|
||||
PAD_TO := 0xfff01000
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LDSCRIPT= $(TOPDIR)/cpu/$(CPU)/u-boot-nand_spl.lds
|
||||
LDFLAGS = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
|
||||
AFLAGS += -DCONFIG_NAND_SPL
|
||||
CFLAGS += -DCONFIG_NAND_SPL
|
||||
|
||||
SOBJS = start.o resetvec.o
|
||||
COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
|
||||
nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
|
||||
|
||||
SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
|
||||
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
|
||||
__OBJS := $(SOBJS) $(COBJS)
|
||||
LNDIR := $(OBJTREE)/nand_spl/board/$(BOARDDIR)
|
||||
|
||||
nandobj := $(OBJTREE)/nand_spl/
|
||||
|
||||
ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
|
||||
|
||||
all: $(obj).depend $(ALL) |
||||
|
||||
$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
||||
$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
|
||||
|
||||
$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
||||
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
|
||||
|
||||
$(nandobj)u-boot-spl: $(OBJS) |
||||
cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
|
||||
-Map $(nandobj)u-boot-spl.map \
|
||||
-o $(nandobj)u-boot-spl
|
||||
|
||||
# create symbolic links for common files
|
||||
|
||||
$(obj)cache.c: |
||||
@rm -f $(obj)cache.c
|
||||
ln -sf $(SRCTREE)/lib_ppc/cache.c $(obj)cache.c
|
||||
|
||||
$(obj)cpu_init_early.c: |
||||
@rm -f $(obj)cpu_init_early.c
|
||||
ln -sf $(SRCTREE)/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c
|
||||
|
||||
$(obj)cpu_init_nand.c: |
||||
@rm -f $(obj)cpu_init_nand.c
|
||||
ln -sf $(SRCTREE)/cpu/mpc85xx/cpu_init_nand.c $(obj)cpu_init_nand.c
|
||||
|
||||
$(obj)fsl_law.c: |
||||
@rm -f $(obj)fsl_law.c
|
||||
ln -sf $(SRCTREE)/drivers/misc/fsl_law.c $(obj)fsl_law.c
|
||||
|
||||
$(obj)law.c: |
||||
@rm -f $(obj)law.c
|
||||
ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
|
||||
|
||||
$(obj)nand_boot_fsl_elbc.c: |
||||
@rm -f $(obj)nand_boot_fsl_elbc.c
|
||||
ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \
|
||||
$(obj)nand_boot_fsl_elbc.c
|
||||
|
||||
$(obj)ns16550.c: |
||||
@rm -f $(obj)ns16550.c
|
||||
ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
|
||||
|
||||
$(obj)resetvec.S: |
||||
@rm -f $(obj)resetvec.S
|
||||
ln -s $(SRCTREE)/cpu/$(CPU)/resetvec.S $(obj)resetvec.S
|
||||
|
||||
$(obj)fixed_ivor.S: |
||||
@rm -f $(obj)fixed_ivor.S
|
||||
ln -sf $(SRCTREE)/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S
|
||||
|
||||
$(obj)start.S: $(obj)fixed_ivor.S |
||||
@rm -f $(obj)start.S
|
||||
ln -sf $(SRCTREE)/cpu/mpc85xx/start.S $(obj)start.S
|
||||
|
||||
$(obj)tlb.c: |
||||
@rm -f $(obj)tlb.c
|
||||
ln -sf $(SRCTREE)/cpu/mpc85xx/tlb.c $(obj)tlb.c
|
||||
|
||||
$(obj)tlb_table.c: |
||||
@rm -f $(obj)tlb_table.c
|
||||
ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
|
||||
|
||||
#########################################################################
|
||||
|
||||
$(obj)%.o: $(obj)%.S |
||||
$(CC) $(AFLAGS) -c -o $@ $<
|
||||
|
||||
$(obj)%.o: $(obj)%.c |
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# defines $(obj).depend target
|
||||
include $(SRCTREE)/rules.mk |
||||
|
||||
sinclude $(obj).depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,83 @@ |
||||
/*
|
||||
* Copyright 2009 Freescale Semiconductor, Inc. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
* |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <ns16550.h> |
||||
#include <asm/io.h> |
||||
#include <nand.h> |
||||
|
||||
u32 sysclk_tbl[] = { |
||||
33333000, 39999600, 49999500, 66666000, |
||||
83332500, 99999000, 133332000, 166665000 |
||||
}; |
||||
|
||||
void board_init_f(ulong bootflag) |
||||
{ |
||||
int px_spd; |
||||
u32 plat_ratio, bus_clk, sys_clk; |
||||
ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; |
||||
ccsr_lbc_t *lbc = (void *)CONFIG_SYS_MPC85xx_LBC_ADDR; |
||||
|
||||
#if defined(CONFIG_SYS_BR3_PRELIM) && defined(CONFIG_SYS_OR3_PRELIM) |
||||
/* for FPGA */ |
||||
out_be32(&lbc->br3, CONFIG_SYS_BR3_PRELIM); |
||||
out_be32(&lbc->or3, CONFIG_SYS_OR3_PRELIM); |
||||
#else |
||||
#error CONFIG_SYS_BR3_PRELIM, CONFIG_SYS_OR3_PRELIM must be defined |
||||
#endif |
||||
|
||||
/* initialize selected port with appropriate baud rate */ |
||||
px_spd = in_8((unsigned char *)(PIXIS_BASE + PIXIS_SPD)); |
||||
sys_clk = sysclk_tbl[px_spd & PIXIS_SPD_SYSCLK]; |
||||
plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO; |
||||
bus_clk = sys_clk * plat_ratio / 2; |
||||
|
||||
NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1, |
||||
bus_clk / 16 / CONFIG_BAUDRATE); |
||||
|
||||
puts("\nNAND boot... "); |
||||
|
||||
/* copy code to RAM and jump to it - this should not return */ |
||||
/* NOTE - code has to be copied out of NAND buffer before
|
||||
* other blocks can be read. |
||||
*/ |
||||
relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, 0, |
||||
CONFIG_SYS_NAND_U_BOOT_RELOC); |
||||
} |
||||
|
||||
void board_init_r(gd_t *gd, ulong dest_addr) |
||||
{ |
||||
nand_boot(); |
||||
} |
||||
|
||||
void putc(char c) |
||||
{ |
||||
if (c == '\n') |
||||
NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r'); |
||||
|
||||
NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c); |
||||
} |
||||
|
||||
void puts(const char *str) |
||||
{ |
||||
while (*str) |
||||
putc(*str++); |
||||
} |
Loading…
Reference in new issue