From patchwork Wed Jan 23 20:30:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Otavio Salvador X-Patchwork-Id: 215034 X-Patchwork-Delegate: sbabic@denx.de 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 1A50D2C00A5 for ; Thu, 24 Jan 2013 07:26:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 74D494A140; Wed, 23 Jan 2013 21:26: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 X+M+DeMyioy3; Wed, 23 Jan 2013 21:26:36 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BB16D4A0F3; Wed, 23 Jan 2013 21:26:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F06EA4A0F1 for ; Wed, 23 Jan 2013 21:26:30 +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 I3rRENDcrVPS for ; Wed, 23 Jan 2013 21:26:30 +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-yh0-f46.google.com (mail-yh0-f46.google.com [209.85.213.46]) by theia.denx.de (Postfix) with ESMTPS id 0334E4A0F0 for ; Wed, 23 Jan 2013 21:26:28 +0100 (CET) Received: by mail-yh0-f46.google.com with SMTP id q15so108481yhf.19 for ; Wed, 23 Jan 2013 12:26:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=baK/4UyxSBAfrDHc2PqAxi1bYUpHHGnjDtVobx0O4Xk=; b=oUafstpP99uJ5FkjGB916XUnOP3uZNTAkrsBJGF4BfwMRPhppjZUy72DXLdhMVikUX Mg6s8Zyj2bem+aDgyuktCV0+lSdOy/XgOAXQ3C0uVCXnxvgPSx1rBWJH97XTVsjuc6J2 uSQUnDARG9K919KWnsc0JKH8U+/zMPZWoc/JbdhQy8BtAJV0wNZeNQRV6+q8ladJkLHV pJXyFyKpAdHO608C/0LVv24Rqlvpg0xv2vSE3KE15UgVUPMAz2e7qJEdgV7AAbSO2+Tu c8UHlaqxvnQH4L1sOpicKRIQkwuhdAij/suT0OumL+R1xDevRFFHr3jB43yXouEs2fuK dy3Q== X-Received: by 10.236.46.169 with SMTP id r29mr2920133yhb.14.1358972786152; Wed, 23 Jan 2013 12:26:26 -0800 (PST) Received: from nano.lab.ossystems.com.br ([177.35.66.48]) by mx.google.com with ESMTPS id h4sm21112575yhi.18.2013.01.23.12.26.23 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jan 2013 12:26:25 -0800 (PST) From: Otavio Salvador To: u-boot@lists.denx.de Date: Wed, 23 Jan 2013 18:30:33 -0200 Message-Id: <1358973034-21160-1-git-send-email-otavio@ossystems.com.br> X-Mailer: git-send-email 1.8.1 Cc: Fabio Estevam , Marek Vasut , Otavio Salvador Subject: [U-Boot] [PATCH v6 1/2] mx23_olinuxino: Add default environment 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This adds a default environment with support for MMC booting. Signed-off-by: Otavio Salvador --- Changes in v6: - Remove 'saveenv' command as it is not need - Move environment settings to environment section Changes in v5: - Remove duplicate environment setting - Improve commit log Changes in v4: None Changes in v3: None Changes in v2: None include/configs/mx23_olinuxino.h | 77 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h index bc63481..4658aea 100644 --- a/include/configs/mx23_olinuxino.h +++ b/include/configs/mx23_olinuxino.h @@ -127,21 +127,84 @@ #define CONFIG_APBH_DMA /* - * ENV -- nowhere so far - */ -#define CONFIG_ENV_SIZE (16 * 1024) -#define CONFIG_ENV_IS_NOWHERE - -/* * Boot Linux */ #define CONFIG_CMDLINE_TAG #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_BOOTDELAY 3 #define CONFIG_BOOTFILE "uImage" -#define CONFIG_BOOTARGS "console=ttyAMA0,115200n8 " #define CONFIG_LOADADDR 0x42000000 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR #define CONFIG_OF_LIBFDT +/* + * Environment + */ +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_ENV_OVERWRITE +#ifdef CONFIG_ENV_IS_IN_MMC +#define CONFIG_ENV_OFFSET (256 * 1024) +#define CONFIG_ENV_SIZE (16 * 1024) +#define CONFIG_SYS_MMC_ENV_DEV 0 +#endif + +/* + * Extra Environments + */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "update_sd_firmware_filename=u-boot.sd\0" \ + "update_sd_firmware=" /* Update the SD firmware partition */ \ + "if mmc rescan ; then " \ + "if tftp ${update_sd_firmware_filename} ; then " \ + "setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ + "setexpr fw_sz ${fw_sz} + 1 ; " \ + "mmc write ${loadaddr} 0x800 ${fw_sz} ; " \ + "fi ; " \ + "fi\0" \ + "script=boot.scr\0" \ + "uimage=uImage\0" \ + "console=ttyAMA0\0" \ + "fdt_file=imx23-olinuxino.dtb\0" \ + "fdt_addr=0x41000000\0" \ + "boot_fdt=try\0" \ + "mmcdev=0\0" \ + "mmcpart=2\0" \ + "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \ + "mmcargs=setenv bootargs console=${console},${baudrate} " \ + "root=${mmcroot}\0" \ + "loadbootscript=" \ + "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "bootscript=echo Running bootscript from mmc ...; " \ + "source\0" \ + "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ + "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + "run mmcargs; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if run loadfdt; then " \ + "bootm ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootm; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "fi; " \ + "else " \ + "bootm; " \ + "fi;\0" + +#define CONFIG_BOOTCOMMAND \ + "mmc dev ${mmcdev}; if mmc rescan; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loaduimage; then " \ + "run mmcboot; " \ + "else " \ + "echo ERR: Fail to boot from MMC; " \ + "fi; " \ + "fi; " \ + "else exit; fi" + #endif /* __MX23_OLINUXINO_CONFIG_H__ */