SPL is using ps7_init.c/h files which are generated from design tools which have to be copied to boards/xilinx/zynq folder before compilation. BSS section is moved to SDRAM because fat support requires more space than SRAM size. Added: - MMC and QSPI support - Boot OS directly from SPL - Enable SPL command Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@ti.com>master
parent
96a5d4dc1e
commit
d7e269cfbd
@ -0,0 +1,69 @@ |
||||
/*
|
||||
* (C) Copyright 2014 Xilinx, Inc. Michal Simek |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
#include <common.h> |
||||
#include <spl.h> |
||||
|
||||
#include <asm/io.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <asm/arch/spl.h> |
||||
#include <asm/arch/sys_proto.h> |
||||
|
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
void board_init_f(ulong dummy) |
||||
{ |
||||
ps7_init(); |
||||
|
||||
/* Clear the BSS. */ |
||||
memset(__bss_start, 0, __bss_end - __bss_start); |
||||
|
||||
/* Set global data pointer. */ |
||||
gd = &gdata; |
||||
|
||||
preloader_console_init(); |
||||
arch_cpu_init(); |
||||
board_init_r(NULL, 0); |
||||
} |
||||
|
||||
u32 spl_boot_device(void) |
||||
{ |
||||
u32 mode; |
||||
|
||||
switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { |
||||
#ifdef CONFIG_SPL_SPI_SUPPORT |
||||
case ZYNQ_BM_QSPI: |
||||
puts("qspi boot\n"); |
||||
mode = BOOT_DEVICE_SPI; |
||||
break; |
||||
#endif |
||||
#ifdef CONFIG_SPL_MMC_SUPPORT |
||||
case ZYNQ_BM_SD: |
||||
puts("mmc boot\n"); |
||||
mode = BOOT_DEVICE_MMC1; |
||||
break; |
||||
#endif |
||||
default: |
||||
puts("Unsupported boot mode selected\n"); |
||||
hang(); |
||||
} |
||||
|
||||
return mode; |
||||
} |
||||
|
||||
#ifdef CONFIG_SPL_MMC_SUPPORT |
||||
u32 spl_boot_mode(void) |
||||
{ |
||||
return MMCSD_MODE_FAT; |
||||
} |
||||
#endif |
||||
|
||||
#ifdef CONFIG_SPL_OS_BOOT |
||||
int spl_start_uboot(void) |
||||
{ |
||||
/* boot linux */ |
||||
return 0; |
||||
} |
||||
#endif |
@ -0,0 +1,61 @@ |
||||
/* |
||||
* Copyright (c) 2014 Xilinx, Inc. Michal Simek |
||||
* Copyright (c) 2004-2008 Texas Instruments |
||||
* |
||||
* (C) Copyright 2002 |
||||
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ |
||||
LENGTH = CONFIG_SPL_MAX_SIZE } |
||||
MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \ |
||||
LENGTH = CONFIG_SPL_BSS_MAX_SIZE } |
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") |
||||
OUTPUT_ARCH(arm) |
||||
ENTRY(_start) |
||||
SECTIONS |
||||
{ |
||||
. = ALIGN(4); |
||||
.text : |
||||
{ |
||||
__image_copy_start = .; |
||||
CPUDIR/start.o (.text*) |
||||
*(.text*) |
||||
} > .sram |
||||
|
||||
. = ALIGN(4); |
||||
.rodata : { |
||||
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) |
||||
} > .sram |
||||
|
||||
. = ALIGN(4); |
||||
.data : { |
||||
*(.data*) |
||||
} > .sram |
||||
|
||||
. = ALIGN(4); |
||||
|
||||
. = .; |
||||
|
||||
__image_copy_end = .; |
||||
|
||||
_end = .; |
||||
|
||||
/* Move BSS section to RAM because of FAT */ |
||||
.bss (NOLOAD) : { |
||||
__bss_start = .; |
||||
*(.bss*) |
||||
. = ALIGN(4); |
||||
__bss_end = .; |
||||
} > .sdram |
||||
|
||||
/DISCARD/ : { *(.dynsym) } |
||||
/DISCARD/ : { *(.dynstr*) } |
||||
/DISCARD/ : { *(.dynamic*) } |
||||
/DISCARD/ : { *(.plt*) } |
||||
/DISCARD/ : { *(.interp*) } |
||||
/DISCARD/ : { *(.gnu*) } |
||||
} |
@ -0,0 +1,18 @@ |
||||
/*
|
||||
* (C) Copyright 2014 Xilinx, Inc. Michal Simek |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
#ifndef _ASM_ARCH_SPL_H_ |
||||
#define _ASM_ARCH_SPL_H_ |
||||
|
||||
extern void ps7_init(void); |
||||
|
||||
#define BOOT_DEVICE_NONE 0 |
||||
#define BOOT_DEVICE_RAM 1 |
||||
#define BOOT_DEVICE_SPI 2 |
||||
#define BOOT_DEVICE_MMC1 3 |
||||
#define BOOT_DEVICE_MMC2 4 |
||||
#define BOOT_DEVICE_MMC2_2 5 |
||||
|
||||
#endif |
@ -0,0 +1,12 @@ |
||||
/*
|
||||
* (C) Copyright 2014 Xilinx, Inc. Michal Simek |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
#include <common.h> |
||||
#include <asm/arch/spl.h> |
||||
|
||||
__weak void ps7_init(void) |
||||
{ |
||||
puts("Please copy ps7_init.c/h from hw project\n"); |
||||
} |
Loading…
Reference in new issue