From patchwork Thu Jan 28 16:39:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 574795 X-Patchwork-Delegate: trini@ti.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 698C01402DE for ; Fri, 29 Jan 2016 03:42:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=cx7LUWq2; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 917FE6213A; Thu, 28 Jan 2016 17:41:57 +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 T8xyUA7880vx; Thu, 28 Jan 2016 17:41:57 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D3AAC62117; Thu, 28 Jan 2016 17:41:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C5C7239A5 for ; Thu, 28 Jan 2016 17:40:16 +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 aM3aA--WNTY5 for ; Thu, 28 Jan 2016 17:40:16 +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-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by theia.denx.de (Postfix) with ESMTPS id 96597B37D7 for ; Thu, 28 Jan 2016 17:40:12 +0100 (CET) Received: by mail-oi0-f52.google.com with SMTP id k206so30099004oia.1 for ; Thu, 28 Jan 2016 08:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ouo9lqGlL+JPDw8ztyJKDZT/vLchKOv+8WHX3GdsD/w=; b=cx7LUWq2VlRykpunb463dftHUCdqytD5/SKii3Cf2kgpqxKnmF90oHzwbfrdxoeEgC IR7GzZrSm9ikukZbm0OaNYuVIKTL8DLemjkNxCLhCLPTHJcnNVmLnlunUEDTa4tdvVNm kz5zpSJqF3zlsk0Nyuzvzs0TLA/U5EFLHZwI8DF6xT/tDLJHEYQWRN7y0sii9DxMij9n jdLYV7GEdJtoSZUVvki4sc2/WnazM3vjtQcLQihaeqXUCM5DMLPmkEmk+6Xp4VN4kTI4 Wn3CNI6L5qNtHCNNws6VCf1CUvO+koaBiGUusIEiZL/Kfa7vDq0KqMEG55pVOaX2tOgI p2NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ouo9lqGlL+JPDw8ztyJKDZT/vLchKOv+8WHX3GdsD/w=; b=mDvkgyA4JI260RR2bHbf8uTQ9OIGwspkR7HrfZTowRZLUYJPFUKfslR11puRmI3dMH H5CzCMaQlR2um0W1RnBLXPEX54mIL/bqDUPcGBJE0tz75BDNud45ySXBdi14m7w3p6sG O8yDS66a15tH6gyUe0z8mMHj6QKm0ebwTMsr1JN2FpidH+S2BbUedFkZNT5nteIV0UWo 9rvktT9xnuSIfrfdoJ+cKnK9gSMTKzS7mjth75y1aHzJc8qZVKVXjxpkXFF6OUXP2nFv 9u3yO5sesWX5/nUWskiAXOJ7zh2j7KFnoB9KHSnj9wyLlViEAkoRLq+KZCD10Ubqhmud 23Bw== X-Gm-Message-State: AG10YOT3WMvQexqQJKHQyGVLy6TA3LnIC4AjgBII4Gvdhx4inU1gaixNxk0Qh6clw4OahPtr X-Received: by 10.202.182.198 with SMTP id g189mr2897416oif.76.1453999211361; Thu, 28 Jan 2016 08:40:11 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id kz2sm5912189oeb.9.2016.01.28.08.40.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jan 2016 08:40:09 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id DA6D22216EC; Thu, 28 Jan 2016 09:40:04 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 28 Jan 2016 09:39:32 -0700 Message-Id: <1453999186-18747-13-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1453999186-18747-1-git-send-email-sjg@chromium.org> References: <1453999186-18747-1-git-send-email-sjg@chromium.org> Cc: Jerry Van Baren , Tom Rini Subject: [U-Boot] [PATCH 12/26] fdt: Allow libfdt to be used in SPL 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add an option to enable libfdt in SPL. This can be useful when decoding FIT files in SPL. We need to make sure this option is not enabled in SPL by this change. Also this option needs to be enabled in host builds. Si add a new IMAGE_USE_LIBFDT #define which can be used in files that are built on the host but must also build for U-Boot and SPL. Signed-off-by: Simon Glass --- common/Makefile | 4 ++-- common/bootm.c | 4 ++-- common/image.c | 4 ++-- include/common.h | 4 ++-- include/image.h | 8 ++------ lib/Kconfig | 10 ++++++++++ lib/Makefile | 4 +--- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/common/Makefile b/common/Makefile index 25083a4..2639e57 100644 --- a/common/Makefile +++ b/common/Makefile @@ -55,7 +55,7 @@ obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o obj-$(CONFIG_CMD_BEDBUG) += bedbug.o -obj-$(CONFIG_OF_LIBFDT) += fdt_support.o +obj-$(CONFIG_$(SPL_)OF_LIBFDT) += fdt_support.o obj-$(CONFIG_MII) += miiphyutil.o obj-$(CONFIG_CMD_MII) += miiphyutil.o @@ -130,7 +130,7 @@ obj-y += malloc_simple.o endif obj-y += image.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o -obj-$(CONFIG_OF_LIBFDT) += image-fdt.o +obj-$(CONFIG_$(SPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_)FIT) += image-fit.o obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o obj-$(CONFIG_IO_TRACE) += iotrace.o diff --git a/common/bootm.c b/common/bootm.c index 686d28b..947d19e 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -234,7 +234,7 @@ int bootm_find_images(int flag, int argc, char * const argv[]) return 1; } -#if defined(CONFIG_OF_LIBFDT) +#if IMAGE_ENABLE_OF_LIBFDT /* find flattened device tree */ ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images, &images.ft_addr, &images.ft_len); @@ -644,7 +644,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], } } #endif -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_LMB) +#if IMAGE_ENABLE_OF_LIBFDT && defined(CONFIG_LMB) if (!ret && (states & BOOTM_STATE_FDT)) { boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr); ret = boot_relocate_fdt(&images->lmb, &images->ft_addr, diff --git a/common/image.c b/common/image.c index ca43763..fad31b2 100644 --- a/common/image.c +++ b/common/image.c @@ -29,7 +29,7 @@ #include #include -#if IMAGE_USE_FIT || defined(CONFIG_OF_LIBFDT) +#if IMAGE_USE_FIT || IMAGE_ENABLE_OF_LIBFDT #include #include #endif @@ -757,7 +757,7 @@ int genimg_get_format(const void *img_addr) if (image_check_magic(hdr)) return IMAGE_FORMAT_LEGACY; #endif -#if IMAGE_USE_FIT || defined(CONFIG_OF_LIBFDT) +#if IMAGE_USE_FIT || IMAGE_ENABLE_OF_LIBFDT if (fdt_check_header(img_addr) == 0) return IMAGE_FORMAT_FIT; #endif diff --git a/include/common.h b/include/common.h index 1563d64..5153680 100644 --- a/include/common.h +++ b/include/common.h @@ -596,7 +596,7 @@ void upmconfig (unsigned int, unsigned int *, unsigned int); ulong get_tbclk (void); void reset_misc (void); void reset_cpu (ulong addr); -#if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP) +#if IMAGE_ENABLE_OF_LIBFDT && defined(CONFIG_OF_BOARD_SETUP) void ft_cpu_setup(void *blob, bd_t *bd); #ifdef CONFIG_PCI void ft_pci_setup(void *blob, bd_t *bd); @@ -660,7 +660,7 @@ int get_serial_clock(void); #if defined(CONFIG_MPC85xx) typedef MPC85xx_SYS_INFO sys_info_t; void get_sys_info ( sys_info_t * ); -# if defined(CONFIG_OF_LIBFDT) +# if IMAGE_ENABLE_OF_LIBFDT void ft_fixup_cpu(void *, u64); void ft_fixup_num_cores(void *); # endif diff --git a/include/image.h b/include/image.h index 061d6ed..9eb3616 100644 --- a/include/image.h +++ b/include/image.h @@ -28,6 +28,7 @@ struct lmb; /* new uImage format support enabled on host */ #define CONFIG_FIT 1 #define IMAGE_USE_FIT 1 +#define IMAGE_ENABLE_OF_LIBFDT 1 #define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */ #define IMAGE_ENABLE_IGNORE 0 @@ -44,6 +45,7 @@ struct lmb; #define IMAGE_INDENT_STRING " " #define IMAGE_USE_FIT CONFIG_IS_ENABLED(FIT) +#define IMAGE_ENABLE_OF_LIBFDT CONFIG_IS_ENABLED(OF_LIBFDT) #endif /* USE_HOSTCC */ @@ -104,12 +106,6 @@ struct lmb; # define IMAGE_ENABLE_RAMDISK_HIGH 0 #endif -#ifdef CONFIG_OF_LIBFDT -# define IMAGE_ENABLE_OF_LIBFDT 1 -#else -# define IMAGE_ENABLE_OF_LIBFDT 0 -#endif - #ifdef CONFIG_SYS_BOOT_GET_CMDLINE # define IMAGE_BOOT_GET_CMDLINE 1 #else diff --git a/lib/Kconfig b/lib/Kconfig index 90ed497..e382f97 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -138,6 +138,16 @@ config OF_LIBFDT particular compatible nodes. The library operates on a flattened version of the device tree. +config SPL_OF_LIBFDT + bool "Enable the FDT library for SPL" + default y if SPL_OF_CONTROL + help + This enables the FDT library (libfdt). It provides functions for + accessing binary device tree images in memory, such as adding and + removing notes and properties, scanning through the tree and finding + particular compatible nodes. The library operates on a flattened + version of the device tree. + source lib/efi/Kconfig endmenu diff --git a/lib/Makefile b/lib/Makefile index dd36f25..9a02754 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -50,9 +50,7 @@ obj-$(CONFIG_BITREVERSE) += bitrev.o obj-y += list_sort.o endif -ifndef CONFIG_SPL_BUILD -obj-$(CONFIG_OF_LIBFDT) += libfdt/ -endif +obj-$(CONFIG_$(SPL)OF_LIBFDT) += libfdt/ ifdef CONFIG_SPL_OF_CONTROL obj-$(CONFIG_OF_LIBFDT) += libfdt/ endif