From patchwork Thu Oct 29 09:54:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 537766 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 C3DD31402C2 for ; Thu, 29 Oct 2015 20:54:59 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9CAC94B615; Thu, 29 Oct 2015 10:54:58 +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 flQAOIvsBGMR; Thu, 29 Oct 2015 10:54:58 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7B8EC4B62A; Thu, 29 Oct 2015 10:54:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8EE954B62A for ; Thu, 29 Oct 2015 10:54:54 +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 l7BJrnwoPJLK for ; Thu, 29 Oct 2015 10:54:54 +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 compulab.co.il (softlayer.compulab.co.il [50.23.254.55]) by theia.denx.de (Postfix) with ESMTPS id 26FA74B615 for ; Thu, 29 Oct 2015 10:54:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=compulab.co.il; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From; bh=wFlZQFDeA9c2rMD0miZE8cTKE5zDZvF/cf/7d5WvMo8=; b=IuzDALcGzO9uN 7KuN7nHC4fW2jL7jcp45KGcxBOMkMOdV/muf2iQ91ZuQSEB/aiL6XIB1VjX4aF7+3Qyx+6USkEwEX c+MwTGUKSJTqsmFuIhcjKUNpKiwLoLiBN6SPjdc/EVoJcuTTXmVpZrxhGVtEL6Y/Zj+czjDPLm56g KwLs=; Received: from [82.166.188.245] (port=60116 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.86) (envelope-from ) id 1Zrjuz-0007x0-0M; Thu, 29 Oct 2015 11:54:49 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 15C86488450; Thu, 29 Oct 2015 11:54:48 +0200 (IST) Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id lNYpC9Lj4tRw; Thu, 29 Oct 2015 11:54:47 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 971CB48844A; Thu, 29 Oct 2015 11:54:47 +0200 (IST) X-Virus-Scanned: amavisd-new at zimbra-mta.compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FIYYbdFpeFAJ; Thu, 29 Oct 2015 11:54:47 +0200 (IST) Received: from skynet.compulab.local (nikita-pc.compulab.local [192.168.11.211]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 616EA488447; Thu, 29 Oct 2015 11:54:47 +0200 (IST) From: Nikita Kiryanov To: u-boot@lists.denx.de Date: Thu, 29 Oct 2015 11:54:42 +0200 Message-Id: <1446112484-24787-4-git-send-email-nikita@compulab.co.il> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446112484-24787-1-git-send-email-nikita@compulab.co.il> References: <1446112484-24787-1-git-send-email-nikita@compulab.co.il> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_recent_authed_mail_ips_text_entry: nikita@compulab.co.il|compulab.co.il X-Authenticated-Sender: softlayer.compulab.co.il: nikita@compulab.co.il Cc: Tom Rini Subject: [U-Boot] [PATCH V2 3/5] splash_source: add support for filesystem formatted usb 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 support for loading splash image from USB drive formatted with a filesystem. Cc: Igor Grinberg Cc: Tom Rini Signed-off-by: Nikita Kiryanov --- Changes in V2: - Refactored device initialization code so that #ifdefs are outside of the functions. This affects patches 3 and 4. common/splash_source.c | 31 ++++++++++++++++++++++++++++++- include/splash.h | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/common/splash_source.c b/common/splash_source.c index 7de8695..cf47569 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -112,6 +113,9 @@ static int splash_select_fs_dev(struct splash_location *location) case SPLASH_STORAGE_MMC: res = fs_set_blk_dev("mmc", location->devpart, FS_TYPE_ANY); break; + case SPLASH_STORAGE_USB: + res = fs_set_blk_dev("usb", location->devpart, FS_TYPE_ANY); + break; default: printf("Error: unsupported location storage.\n"); return -ENODEV; @@ -123,11 +127,30 @@ static int splash_select_fs_dev(struct splash_location *location) return res; } +#ifdef CONFIG_USB_STORAGE +static int splash_init_usb(void) +{ + int err; + + err = usb_init(); + if (err) + return err; + + return usb_stor_scan(1) < 0 ? -ENODEV : 0; +} +#else +static inline int splash_init_usb(void) +{ + printf("Cannot load splash image: no USB support\n"); + return -ENOSYS; +} +#endif + #define SPLASH_SOURCE_DEFAULT_FILE_NAME "splash.bmp" static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr) { - int res; + int res = 0; loff_t bmp_size; char *splash_file; @@ -135,6 +158,12 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr) if (!splash_file) splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME; + if (location->storage == SPLASH_STORAGE_USB) + res = splash_init_usb(); + + if (res) + return res; + res = splash_select_fs_dev(location); if (res) return res; diff --git a/include/splash.h b/include/splash.h index d1fba69..b728bd6 100644 --- a/include/splash.h +++ b/include/splash.h @@ -28,6 +28,7 @@ enum splash_storage { SPLASH_STORAGE_NAND, SPLASH_STORAGE_SF, SPLASH_STORAGE_MMC, + SPLASH_STORAGE_USB, }; enum splash_flags {