From patchwork Fri Nov 27 12:26:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 549427 X-Patchwork-Delegate: marek.vasut@gmail.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 AED791402D4 for ; Fri, 27 Nov 2015 23:26:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F5CC4B8F3; Fri, 27 Nov 2015 13:26:27 +0100 (CET) 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 OmGQ3ztcJgNQ; Fri, 27 Nov 2015 13:26:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C626E4B8EE; Fri, 27 Nov 2015 13:26:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 963494B8EE for ; Fri, 27 Nov 2015 13:26:23 +0100 (CET) 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 22IvLuUvvVCb for ; Fri, 27 Nov 2015 13:26:23 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 523F54B8ED for ; Fri, 27 Nov 2015 13:26:20 +0100 (CET) Received: from mail.nefkom.net (unknown [192.168.8.184]) by mail-out.m-online.net (Postfix) with ESMTP id 3p6Ztz4CJYz3hj7X; Fri, 27 Nov 2015 13:26:19 +0100 (CET) X-Auth-Info: F0PNentsyDVpYDTY/6UlzqGG4V8gXxxXBwMYkurgreU= Received: from chi.localnet (unknown [195.140.253.167]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mnet-online.de (Postfix) with ESMTPSA id 3p6Ztz214WzvdWt; Fri, 27 Nov 2015 13:26:19 +0100 (CET) From: Marek Vasut To: Chin Liang See Date: Fri, 27 Nov 2015 13:26:18 +0100 User-Agent: KMail/1.13.7 (Linux/3.14-2-amd64; KDE/4.13.1; x86_64; ; ) References: <1448505155-3367-1-git-send-email-clsee@altera.com> <201511271311.02266.marex@denx.de> <1448626579.2125.10.camel@altera.com> In-Reply-To: <1448626579.2125.10.camel@altera.com> MIME-Version: 1.0 Message-Id: <201511271326.18246.marex@denx.de> Cc: Pavel Machek , Stefan Roese , u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH v1] arm: socfpga: Enable load zImage and Linux DTB from QSPI X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" On Friday, November 27, 2015 at 01:16:19 PM, Chin Liang See wrote: > On Fri, 2015-11-27 at 13:11 +0100, Marek Vasut wrote: > > On Friday, November 27, 2015 at 01:07:23 PM, Chin Liang See wrote: > > > On Fri, 2015-11-27 at 11:20 +0100, Marek Vasut wrote: > > > > On Friday, November 27, 2015 at 02:34:27 AM, Chin Liang See > > > > > > > > wrote: > > > > > Hi Marek, > > > > > > > > > > On Fri, 2015-11-27 at 02:27 +0100, Marek Vasut wrote: > > > > > > On Friday, November 27, 2015 at 02:24:49 AM, Chin Liang See > > > > > > > > > > > > wrote: > > > > > > > Hi Pavel, > > > > > > > > > > > > > > On Thu, 2015-11-26 at 15:43 +0100, Pavel Machek wrote: > > > > > > > > Hi! > > > > > > > > > > > > > > > > > Adding new environment qspiload which will load zImage > > > > > > > > > and > > > > > > > > > Linux DTB from serial NOR flash. The default flash > > > > > > > > > offset > > > > > > > > > for > > > > > > > > > the images as below and they are configurable during > > > > > > > > > run > > > > > > > > > time. > > > > > > > > > > > > > > > > > > - zImage located at 0xa0000 with assuming file size > > > > > > > > > 6MB > > > > > > > > > - Linux DTB located at 0x50000 with assuming file size > > > > > > > > > 28kB > > > > > > > > > > > > > > > > Hmm. Ok, zImage second, so that it can grow. Makes sense. > > > > > > > > Not > > > > > > > > sure if > > > > > > > > 28kB is not a bit small for DTB. I'd reserve at least > > > > > > > > 64kB. > > > > > > > > > > > > > > Yup, it can grow up to 64kB as the size for a sector. We > > > > > > > used > > > > > > > 28KB > > > > > > > mainly for boot time performance. > > > > > > > > > > > > So why don't you use UBI on the QSPI NOR ? That way, you'd > > > > > > secure > > > > > > the > > > > > > binaries against bitrot as well. > > > > > > > > > > Good point. Its a nice enhancement as we were using raw access > > > > > for > > > > > the > > > > > images in NAND and QSPI. Will add a new command for fs support > > > > > once > > > > > we > > > > > enable the ubifs support in socfpga > > > > > > > > Why can't this be enabled now then ? > > > > > > Mainly for backward compatibility as customer might have their own > > > script on programming a blank flash in production. This is the same > > > where we can do mmc load or a load (with file system). > > > > Does that imply that we will have to get stuck in the past because > > some > > random customer of some random company might have a random script > > somewhere? :) > > Haha nope, we still need to advance. Just that we are giving choice for > classic and new :) Can you check if we can do both then? With the option to prefer the new one? Check the attached patch, it should give you an idea how to load files from UBI/UBIFS on QSPI. It even enables mtdparts for the QSPI, which is cool too. From 031c5c705c2726040d81cd7cbc9cd2361f35913b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 2 Aug 2015 22:18:19 +0200 Subject: [PATCH] FIXME: SoCkit OpenWRT tuning Signed-off-by: Marek Vasut --- include/configs/socfpga_sockit.h | 158 +++++++++++++++++++++++++++++++++------ 1 file changed, 137 insertions(+), 21 deletions(-) diff --git a/include/configs/socfpga_sockit.h b/include/configs/socfpga_sockit.h index 6c71ef4..3496ca5 100644 --- a/include/configs/socfpga_sockit.h +++ b/include/configs/socfpga_sockit.h @@ -36,13 +36,9 @@ /* Booting Linux */ #define CONFIG_BOOTDELAY 3 -#define CONFIG_BOOTFILE "fitImage" +#define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_sockit-fit-uImage.itb" #define CONFIG_BOOTARGS "console=ttyS0," __stringify(CONFIG_BAUDRATE) -#ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET -#define CONFIG_BOOTCOMMAND "run ramboot" -#else -#define CONFIG_BOOTCOMMAND "run mmcload; run mmcboot" -#endif +#define CONFIG_BOOTCOMMAND "run selboot" #define CONFIG_LOADADDR 0x01000000 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR @@ -72,25 +68,145 @@ /* Extra Environment */ #define CONFIG_HOSTNAME socfpga_sockit +#define CONFIG_PREBOOT \ + "run adddfltmtd ; " \ + "if gpio input 79 ; then " \ + "setenv bootdelay -1 ; " \ + "else " \ + "setenv bootdelay $dfltbootdelay ; " \ + "fi" + #define CONFIG_EXTRA_ENV_SETTINGS \ + "dfltbootdelay=" __stringify(CONFIG_BOOTDELAY) "\0" \ "verify=n\0" \ - "loadaddr= " __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ - "ramboot=setenv bootargs " CONFIG_BOOTARGS ";" \ - "bootm ${loadaddr} - ${fdt_addr}\0" \ - "bootimage=zImage\0" \ - "fdt_addr=100\0" \ - "fdtimage=socfpga.dtb\0" \ - "fsloadcmd=ext2load\0" \ - "bootm ${loadaddr} - ${fdt_addr}\0" \ - "mmcroot=/dev/mmcblk0p2\0" \ - "mmcboot=setenv bootargs " CONFIG_BOOTARGS \ - " root=${mmcroot} rw rootwait;" \ - "bootz ${loadaddr} - ${fdt_addr}\0" \ - "mmcload=mmc rescan;" \ - "load mmc 0:1 ${loadaddr} ${bootimage};" \ - "load mmc 0:1 ${fdt_addr} ${fdtimage}\0" \ + "consdev=ttyS0\0" \ + "baudrate=115200\0" \ + "bootscript=boot.scr\0" \ + "bootdev=/dev/mmcblk0p2\0" \ + "rootdev=/dev/mmcblk0p3\0" \ + "ubimtdnr=3\0" \ + "ubimtd=rootfs\0" \ + "ubipart=ubi0:rootfs\0" \ + "netdev=eth0\0" \ + "hostname=sockit\0" \ + "kernel_addr_r=0x10000000\0" \ + "update_filename=u-boot-with-spl-dtb.sfp\0" \ + "update_sd_offset=0x800\0" \ + "update_sd=" /* Update the SD firmware partition */ \ + "if mmc rescan ; then " \ + "if tftp ${update_filename} ; then " \ + "setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ + "setexpr fw_sz ${fw_sz} + 1 ; " \ + "mmc write ${loadaddr} ${update_sd_offset} ${fw_sz} ; " \ + "fi ; " \ + "fi\0" \ + "update_qspi_offset=0x0\0" \ + "update_qspi=" /* Update the QSPI firmware */ \ + "if sf probe ; then " \ + "if tftp ${update_filename} ; then " \ + "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \ + "fi ; " \ + "fi\0" \ + "fpga_filename=output_file.rbf\0" \ + "load_fpga=" /* Load FPGA bitstream */ \ + "if tftp ${fpga_filename} ; then " \ + "fpga load 0 $loadaddr $filesize ; " \ + "bridge enable ; " \ + "fi\0" \ + "addcons=" \ + "setenv bootargs ${bootargs} " \ + "console=${consdev},${baudrate}\0" \ + "addip=" \ + "setenv bootargs ${bootargs} " \ + "ip=${ipaddr}:${serverip}:${gatewayip}:" \ + "${netmask}:${hostname}:${netdev}:off\0" \ + "addmisc=" \ + "setenv bootargs ${bootargs} ${miscargs}\0" \ + "adddfltmtd=" \ + "if test \"x${mtdparts}\" == \"x\" ; then " \ + "mtdparts default ; " \ + "fi\0" \ + "addmtd=" \ + "run adddfltmtd ; " \ + "setenv bootargs ${bootargs} ${mtdparts}\0" \ + "addargs=run addcons addmtd addmisc\0" \ + "mmcload=" \ + "mmc rescan ; " \ + "load mmc 0:2 ${kernel_addr_r} ${bootfile}\0" \ + "ubiload=" \ + "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \ + "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \ + "netload=" \ + "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \ + "miscargs=nohlt panic=1\0" \ + "mmcargs=setenv bootargs root=${rootdev} rw rootwait\0" \ + "ubiargs=" \ + "setenv bootargs ubi.mtd=${ubimtdnr} " \ + "root=${ubipart} rootfstype=ubifs\0" \ + "nfsargs=" \ + "setenv bootargs root=/dev/nfs rw " \ + "nfsroot=${serverip}:${rootpath},v3,tcp\0" \ + "mmc_mmc=" \ + "run mmcload mmcargs addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "mmc_ubi=" \ + "run mmcload ubiargs addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "mmc_nfs=" \ + "run mmcload nfsargs addip addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "ubi_mmc=" \ + "run ubiload mmcargs addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "ubi_ubi=" \ + "sf probe ; " \ + "run ubiload ubiargs addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "ubi_nfs=" \ + "run ubiload nfsargs addip addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "net_mmc=" \ + "run netload mmcargs addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "net_ubi=" \ + "run netload ubiargs addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "net_nfs=" \ + "run netload nfsargs addip addargs ; " \ + "bootm ${kernel_addr_r}\0" \ + "selboot=" /* Select from where to boot. */ \ + "if test \"${bootmode}\" = \"sd\" ; then " \ + "run mmc_mmc ; " \ + "elif test \"${bootmode}\" = \"qspi\" ; then " \ + "run ubi_ubi ; " \ + "else echo \"Unsupported boot mode: \"${bootmode} ; " \ + "fi\0" /* The rest of the configuration is shared */ #include +#ifdef CONFIG_CMD_SF +#define CONFIG_CMD_UBI +#define CONFIG_CMD_UBIFS +#define CONFIG_CMD_MTDPARTS +#define CONFIG_RBTREE +#define CONFIG_LZO +#define MTDPARTS_DEFAULT \ + "mtdparts=ff705000.spi:" \ + "1m(u-boot)," \ + "64k(env1)," \ + "64k(env2)," \ + "16m(rootfs)," \ + "-(UBI)\0" + +#undef CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT +#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE +#define CONFIG_ENV_SECT_SIZE (64 * 1024) +#define CONFIG_ENV_OFFSET 0x100000 +#define CONFIG_ENV_OFFSET_REDUND \ + (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE) +#endif + #endif /* __CONFIG_TERASIC_SOCKIT_H__ */ -- 2.1.4