From patchwork Fri Jan 10 02:10:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Po Liu X-Patchwork-Id: 309094 X-Patchwork-Delegate: yorksun@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id B94082C008F for ; Fri, 10 Jan 2014 14:07:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 247374AC00; Fri, 10 Jan 2014 04:07:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MV-nrOo-f82M; Fri, 10 Jan 2014 04:07:49 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 07E8D4AB2E; Fri, 10 Jan 2014 04:07:42 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A80084AA75 for ; Fri, 10 Jan 2014 04:07:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gG3zQNLgMpgC for ; Fri, 10 Jan 2014 04:07:29 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from db9outboundpool.messaging.microsoft.com (mail-db9lp0252.outbound.messaging.microsoft.com [213.199.154.252]) by theia.denx.de (Postfix) with ESMTPS id 1D4F34ABDF for ; Fri, 10 Jan 2014 04:07:17 +0100 (CET) Received: from mail142-db9-R.bigfish.com (10.174.16.253) by DB9EHSOBE012.bigfish.com (10.174.14.75) with Microsoft SMTP Server id 14.1.225.22; Fri, 10 Jan 2014 03:07:12 +0000 Received: from mail142-db9 (localhost [127.0.0.1]) by mail142-db9-R.bigfish.com (Postfix) with ESMTP id DB1242A010A for ; Fri, 10 Jan 2014 03:07:11 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h16a6h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1de2h1dfeh1dffh1e23h1fe8h1ff5h2218h2216h226dh22d0h2327h2336h2438h1155h) Received: from mail142-db9 (localhost.localdomain [127.0.0.1]) by mail142-db9 (MessageSwitch) id 1389323229423236_21974; Fri, 10 Jan 2014 03:07:09 +0000 (UTC) Received: from DB9EHSMHS003.bigfish.com (unknown [10.174.16.231]) by mail142-db9.bigfish.com (Postfix) with ESMTP id 57E0C400047; Fri, 10 Jan 2014 03:07:09 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS003.bigfish.com (10.174.14.13) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 10 Jan 2014 03:07:09 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.3.158.2; Fri, 10 Jan 2014 03:07:07 +0000 Received: from localhost (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s0A375fo030231; Thu, 9 Jan 2014 20:07:06 -0700 From: Po Liu To: Date: Fri, 10 Jan 2014 10:10:58 +0800 Message-ID: <1389319859-18547-1-git-send-email-Po.Liu@freescale.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1389065844-5391-1-git-send-email-Po.Liu@freescale.com> References: <1389065844-5391-1-git-send-email-Po.Liu@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-FOPE-CONNECTOR: Id%0$Dn%FREESCALE.MAIL.ONMICROSOFT.COM$RO%1$TLS%0$FQDN%$TlsDn% Cc: scottwood@freescale.com, Po Liu Subject: [U-Boot] [PATCH v6 1/2] powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot. - For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec. - Use a clear function name for nand spl boot. - Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile; Signed-off-by: Po Liu Acked-by: Scott Wood --- changes for v2: - seperate public code and c29xpcie board code - add ifc support changes for v3: - remove the redundant plus - ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT changes for v4: - modify the nand_load function - add comments in README.SPL changes for v5: -none changes for v6: - modify the readme file for the include lib file arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++------- doc/README.SPL | 1 + drivers/mtd/nand/fsl_ifc_spl.c | 31 ++++++++++++++++++++++++------- spl/Makefile | 1 + 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds index bc13267..acaa093 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds @@ -57,7 +57,14 @@ SECTIONS . = ALIGN(8); __init_begin = .; __init_end = .; -/* FIXME for non-NAND SPL */ + +/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */ +#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC + .bootpg ADDR(.text) - 0x1000 : + { + KEEP(*(.bootpg)) + } :text = 0xffff +#else #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */ .bootpg ADDR(.text) + 0x1000 : { @@ -69,12 +76,6 @@ SECTIONS #else #error unknown NAND controller #endif -#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC - .bootpg ADDR(.text) - 0x1000 : - { - KEEP(*(.bootpg)) - } :text = 0xffff -#else .resetvec ADDR(.text) + RESET_VECTOR_OFFSET : { KEEP(*(.resetvec)) } = 0xffff diff --git a/doc/README.SPL b/doc/README.SPL index 312a6a6..b1bc3ca 100644 --- a/doc/README.SPL +++ b/doc/README.SPL @@ -62,6 +62,7 @@ CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o) CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o) CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o) +CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc) CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o) diff --git a/drivers/mtd/nand/fsl_ifc_spl.c b/drivers/mtd/nand/fsl_ifc_spl.c index 9de327b..6b43496 100644 --- a/drivers/mtd/nand/fsl_ifc_spl.c +++ b/drivers/mtd/nand/fsl_ifc_spl.c @@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size) return __raw_readw((u16 *)marker) != 0xffff; } -static void nand_load(unsigned int offs, int uboot_size, uchar *dst) +#ifdef CONFIG_TPL_BUILD +int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst) +#else +static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst) +#endif { struct fsl_ifc *ifc = IFC_BASE_ADDR; uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE; @@ -105,6 +109,7 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst) int sram_addr; int pg_no; + uchar *dst = vdst; /* Get NAND Flash configuration */ csor = CONFIG_SYS_NAND_CSOR; @@ -208,9 +213,20 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst) offs += page_size; } while ((offs & (blk_size - 1)) && (pos < uboot_size)); } + + return 0; } /* + * Defines a static function nand_load_image() here, because non-static makes + * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes) + */ +#ifndef CONFIG_TPL_BUILD +#define nand_spl_load_image(offs, uboot_size, vdst) \ + nand_load(offs, uboot_size, vdst) +#endif + +/* * Main entrypoint for NAND Boot. It's necessary that SDRAM is already * configured and available since this code loads the main U-boot image * from NAND into SDRAM and starts from there. @@ -221,16 +237,17 @@ void nand_boot(void) /* * Load U-Boot image from NAND into RAM */ - nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, - (uchar *)CONFIG_SYS_NAND_U_BOOT_DST); + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + CONFIG_SYS_NAND_U_BOOT_SIZE, + (uchar *)CONFIG_SYS_NAND_U_BOOT_DST); #ifdef CONFIG_NAND_ENV_DST - nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, - (uchar *)CONFIG_NAND_ENV_DST); + nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, + (uchar *)CONFIG_NAND_ENV_DST); #ifdef CONFIG_ENV_OFFSET_REDUND - nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, - (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, + (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); #endif #endif /* diff --git a/spl/Makefile b/spl/Makefile index 1e88d74..4a0442b 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -72,6 +72,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \ drivers/power/pmic/ LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/ +LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/ LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/ LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/ LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/