From patchwork Tue Jul 12 21:37:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Spinrath X-Patchwork-Id: 647646 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 3rpwMJ1JRgz9sds for ; Wed, 13 Jul 2016 07:38:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F174DA7527; Tue, 12 Jul 2016 23:38:39 +0200 (CEST) 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 oTshezeBafKU; Tue, 12 Jul 2016 23:38:39 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 251D0A7541; Tue, 12 Jul 2016 23:38:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4EFEDA751B for ; Tue, 12 Jul 2016 23:38:32 +0200 (CEST) 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 fS3fhxu4phne for ; Tue, 12 Jul 2016 23:38:32 +0200 (CEST) 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 mx-out-2.rwth-aachen.de (mx-out-2.rwth-aachen.de [134.130.5.187]) by theia.denx.de (Postfix) with ESMTPS id 02F56A7517 for ; Tue, 12 Jul 2016 23:38:20 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.28,353,1464645600"; d="scan'208";a="448816718" Received: from rwthex-s1-b.rwth-ad.de ([134.130.26.153]) by mx-2.rz.rwth-aachen.de with ESMTP; 12 Jul 2016 23:38:17 +0200 Received: from snowflake.lan (146.60.122.227) by rwthex-s1-b.rwth-ad.de (2002:8682:1a99::8682:1a99) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 12 Jul 2016 23:38:16 +0200 From: To: , , Date: Tue, 12 Jul 2016 23:37:37 +0200 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160712213737.2303-1-christopher.spinrath@rwth-aachen.de> References: <20160712213737.2303-1-christopher.spinrath@rwth-aachen.de> MIME-Version: 1.0 X-ClientProxiedBy: rwthex-s1-b.rwth-ad.de (2002:8682:1a99::8682:1a99) To rwthex-s1-b.rwth-ad.de (2002:8682:1a99::8682:1a99) Message-ID: <56eb9245d4344b6dbac260fa6335eeb7@rwthex-s1-b.rwth-ad.de> Cc: u-boot@lists.denx.de, christopher.spinrath@rwth-aachen.de Subject: [U-Boot] [PATCH v2 4/4] ARM: configs: cm_fx6: add mtd support 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" From: Christopher Spinrath The cm-fx6 module has an on-board spi flash chip. Enable mtd support and the mtdparts command. Also define a default partitioning, add it to the default environment, and enable support to overwrite the partitioning defined in a device tree by it. Finally, probe for the chip on preboot to register the flash chip and, thus, establish the connection between the mtd environment settings and the actual device. These changes move the effective default partitioning from the device tree shipped with the vendor kernels to U-Boot which becomes the single point of definition for the partitioning for all device tree based kernels (in particular, for the upstream Linux kernel which does not have a default partitioning defined in its device tree). Signed-off-by: Christopher Spinrath Reviewed-by: Stefano Babic Acked-by: Igor Grinberg --- Notes: Changes since v1: - explain the "sf probe" command added to preboot in the commit message include/configs/cm_fx6.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index f054ca8..c839b03 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -18,6 +18,7 @@ #define CONFIG_MACH_TYPE 4273 /* CMD */ +#define CONFIG_CMD_MTDPARTS /* MMC */ #define CONFIG_SYS_FSL_USDHC_NUM 3 @@ -53,6 +54,20 @@ #define CONFIG_SF_DEFAULT_SPEED 25000000 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0) +/* MTD support */ +#ifndef CONFIG_SPL_BUILD +#define CONFIG_FDT_FIXUP_PARTITIONS +#define CONFIG_MTD_DEVICE +#define CONFIG_MTD_PARTITIONS +#define CONFIG_SPI_FLASH_MTD +#endif + +#define MTDIDS_DEFAULT "nor0=spi0.0" +#define MTDPARTS_DEFAULT "mtdparts=spi0.0:" \ + "768k(uboot)," \ + "256k(uboot-environment)," \ + "-(reserved)" + /* Environment */ #define CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED @@ -83,6 +98,8 @@ "video_dvi=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32\0" \ "doboot=bootm ${loadaddr}\0" \ "doloadfdt=false\0" \ + "mtdids=" MTDIDS_DEFAULT "\0" \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ "setboottypez=setenv kernel ${zImage};" \ "setenv doboot bootz ${loadaddr} - ${fdtaddr};" \ "setenv doloadfdt true;\0" \ @@ -157,7 +174,7 @@ "run setupnandboot;" \ "run nandboot;" -#define CONFIG_PREBOOT "usb start" +#define CONFIG_PREBOOT "usb start;sf probe" /* SPI */ #define CONFIG_SPI