From patchwork Thu Jul 2 08:02:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 1321144 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=ZGd8yglC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yBSz5VS5z9sR4 for ; Thu, 2 Jul 2020 18:43:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D2B48227A; Thu, 2 Jul 2020 10:25:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="ZGd8yglC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09AED81B50; Thu, 2 Jul 2020 10:02:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DC0D381B44 for ; Thu, 2 Jul 2020 10:02:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=faiz_abbas@ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06282e4L080978 for ; Thu, 2 Jul 2020 03:02:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1593676960; bh=g5SOBp6GGvVQccfd7wDMGPMtLIrf4wVVSGi+CetFV6g=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZGd8yglCn5trOLdybT5yMfCLAku2nch7BijIVYyu1oJh8H+VEL2w1wMF4BgBD614o WKP0CRRalgsOKy6xx4kgr6cDyufyDDV7o/sR7Q65JWeBOzr4Vroah5ABWEJOkWBz6c TZenuzk0+n1sIwQ28Z0XPwpfrgHaNAw/+B5nVh7A= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06282emg031683 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 2 Jul 2020 03:02:40 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 2 Jul 2020 03:02:39 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 2 Jul 2020 03:02:39 -0500 Received: from a0230074-Latitude-E7470.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06282YsS118905; Thu, 2 Jul 2020 03:02:37 -0500 From: Faiz Abbas To: , CC: , , Subject: [PATCH 01/13] spl: usb: Create an API spl_usb_load() Date: Thu, 2 Jul 2020 13:32:21 +0530 Message-ID: <20200702080233.27582-2-faiz_abbas@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200702080233.27582-1-faiz_abbas@ti.com> References: <20200702080233.27582-1-faiz_abbas@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Create a new API spl_usb_load() that takes the filename as a parameter instead of taking the default U-boot PAYLOAD_NAME Signed-off-by: Faiz Abbas --- common/spl/spl_usb.c | 20 +++++++++++++------- include/spl.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index 08837b38fc..92ae96f66e 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -18,8 +18,9 @@ static int usb_stor_curr_dev = -1; /* current device */ -static int spl_usb_load_image(struct spl_image_info *spl_image, - struct spl_boot_device *bootdev) +int spl_usb_load(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, int partition, + const char *filename) { int err; struct blk_desc *stor_dev; @@ -43,13 +44,10 @@ static int spl_usb_load_image(struct spl_image_info *spl_image, #ifdef CONFIG_SPL_OS_BOOT if (spl_start_uboot() || - spl_load_image_fat_os(spl_image, stor_dev, - CONFIG_SYS_USB_FAT_BOOT_PARTITION)) + spl_load_image_fat_os(spl_image, stor_dev, partition)) #endif { - err = spl_load_image_fat(spl_image, stor_dev, - CONFIG_SYS_USB_FAT_BOOT_PARTITION, - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); + err = spl_load_image_fat(spl_image, stor_dev, partition, filename); } if (err) { @@ -59,4 +57,12 @@ static int spl_usb_load_image(struct spl_image_info *spl_image, return 0; } + +static int spl_usb_load_image(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev) +{ + return spl_usb_load(spl_image, bootdev, + CONFIG_SYS_USB_FAT_BOOT_PARTITION, + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); +} SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_usb_load_image); diff --git a/include/spl.h b/include/spl.h index b31c9bb4ab..9c050efcf9 100644 --- a/include/spl.h +++ b/include/spl.h @@ -503,6 +503,20 @@ int spl_mmc_load(struct spl_image_info *spl_image, int raw_part, unsigned long raw_sect); +/** + * spl_usb_load() - Load an image file from USB mass storage + * + * @param spl_image Image data filled in by loading process + * @param bootdev Describes which device to load from + * @param raw_part Fat partition to load from + * @param filename Name of file to load + * + * @return 0 on success, otherwise error code + */ +int spl_usb_load(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + int partition, const char *filename); + int spl_ymodem_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev);