From patchwork Thu Jun 26 14:15:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Przemyslaw Marczak X-Patchwork-Id: 364552 X-Patchwork-Delegate: promsoft@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 CA0951400B9 for ; Fri, 27 Jun 2014 00:17:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EF990A7727; Thu, 26 Jun 2014 16:16:54 +0200 (CEST) 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 ynqcRFAy7DHG; Thu, 26 Jun 2014 16:16:54 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7BB9EA7733; Thu, 26 Jun 2014 16:16:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F344CA7728 for ; Thu, 26 Jun 2014 16:16:08 +0200 (CEST) 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 JaDNZ3dSKfoA for ; Thu, 26 Jun 2014 16:16:05 +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 mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by theia.denx.de (Postfix) with ESMTPS id 42E64A771B for ; Thu, 26 Jun 2014 16:15:59 +0200 (CEST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7S008394YAGG00@mailout4.w1.samsung.com> for u-boot@lists.denx.de; Thu, 26 Jun 2014 15:15:46 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-25-53ac2b1af28e Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id EA.7C.19257.A1B2CA35; Thu, 26 Jun 2014 15:15:54 +0100 (BST) Received: from AMDC1186.digital.local ([106.116.147.185]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N7S00E7W4YB8V60@eusync2.samsung.com>; Thu, 26 Jun 2014 15:15:54 +0100 (BST) From: Przemyslaw Marczak To: u-boot@lists.denx.de Date: Thu, 26 Jun 2014 16:15:30 +0200 Message-id: <1403792137-3113-5-git-send-email-p.marczak@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1403792137-3113-1-git-send-email-p.marczak@samsung.com> References: <1402566394-23342-1-git-send-email-p.marczak@samsung.com> <1403792137-3113-1-git-send-email-p.marczak@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t/xK7pS2muCDd4/YLHY9fc+o8WNX22s Fm8ebma06DjSwmix4/INFot1T9ayWrzd28nuwO5x9s4ORo++LasYA5iiuGxSUnMyy1KL9O0S uDJOTzvAWvBetKLj2lbGBsZJQl2MnBwSAiYSO5aeZYWwxSQu3FvP1sXIxSEksJRRYsWih+wQ Th+TRPvFy0wgVWwCBhJ7Lp1hBrFFBCQkfvVfZQQpYhb4yijxYMNTsISwgL/E1XsrgLo5OFgE VCV2/KkGCfMKuEh8f7eOGWKbnMTJY5PBNnMKuEps23mOFWJZA6PEkyu7WCcw8i5gZFjFKJpa mlxQnJSea6RXnJhbXJqXrpecn7uJERI8X3cwLj1mdYhRgINRiYf3RNjqYCHWxLLiytxDjBIc zEoivMek1gQL8aYkVlalFuXHF5XmpBYfYmTi4JRqYJzY6m0XKreBf0mUnVKNq/od71MNdlND DLMO/91+a7pNYGF/kgRvapfem1rrx6lsho6XnjQqtTaGeoo8Olv+WvoCg+wOpVuis+VEeEW3 ztW38UvWqI1cnCx9v3jux/t/ApZazcmUtObuTpUN3XTZdlV1wdKcJ8EFcr7n5+/a8YdZN3gf p8ZjJZbijERDLeai4kQAXO+2BvwBAAA= Cc: Piotr Wilczek , Jaehoon Chung , Przemyslaw Marczak Subject: [U-Boot] [PATCH v3 04/11] samsung: misc: add function for setting $dfu_alt_info 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 change introduces new common function: - set_dfu_alt_info() - put dfu system and bootloader setting into $dfu_alt_info. functions declaration: - char *get_dfu_alt_system(void) - char *get_dfu_alt_boot(void) - void set_dfu_alt_info(void) and new config: - CONFIG_SET_DFU_ALT_INFO This function can be used for auto setting dfu configuration on boot. Such feature is useful for multi board support by one u-boot binary. Each board should define two functions: - get_dfu_alt_system() - get_dfu_alt_boot() Signed-off-by: Przemyslaw Marczak Cc: Piotr Wilczek Cc: Minkyu Kang --- Changes v2: - change config names: CONFIG_SET_DFU_BOOT_ALT to CONFIG_DFU_ALT_BOOTLOADER and CONFIG_DFU_BOOT_ALT_* to CONFIG_DFU_ALT_BOOT_* - change function name: set_dfu_boot_alt() to set_dfu_alt_boot() - remove superfluous ifdefs Changes v3: - set $dfu_alt_info at every boot - new config: CONFIG_SET_DFU_ALT_INFO - update commit msg --- board/samsung/common/misc.c | 36 ++++++++++++++++++++++++++++++++++++ include/samsung/misc.h | 6 ++++++ 2 files changed, 42 insertions(+) diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index a453a82..166ea83 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,41 @@ DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_SET_DFU_ALT_INFO +void set_dfu_alt_info(void) +{ + char *alt_boot = NULL; + char *alt_system = NULL; + char *buf = NULL; + int buf_len; + + puts("DFU alt info setting: "); + + alt_boot = get_dfu_alt_boot(); + if (!alt_boot) + goto error; + + alt_system = get_dfu_alt_system(); + if (!alt_system) + goto error; + + buf_len = strlen(alt_boot) + strlen(alt_system) + 2; + buf = malloc(buf_len); + + sprintf(buf, "%s;%s", alt_boot, alt_system); + setenv("dfu_alt_info", buf); + + free(buf); + + puts("done\n"); + + return; +error: + puts("error\n"); + setenv("dfu_alt_info", "Settings not found!"); +} +#endif + #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG void set_board_info(void) { diff --git a/include/samsung/misc.h b/include/samsung/misc.h index 57bac7d..c3fcc29 100644 --- a/include/samsung/misc.h +++ b/include/samsung/misc.h @@ -35,4 +35,10 @@ void draw_logo(void); unsigned int boot_device(void); +#ifdef CONFIG_SET_DFU_ALT_INFO +char *get_dfu_alt_system(void); +char *get_dfu_alt_boot(void); +void set_dfu_alt_info(void); +#endif + #endif /* __SAMSUNG_MISC_COMMON_H__ */