public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andreas Dannenberg <dannenberg@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 04/11] misc: fs_loader: Allow initializing blkdev using platform data
Date: Thu, 16 May 2019 15:54:47 -0500	[thread overview]
Message-ID: <20190516205454.22150-5-dannenberg@ti.com> (raw)
In-Reply-To: <20190516205454.22150-1-dannenberg@ti.com>

To give us more flexibility using the FS loader eliminate the need of
always having to use the ENV to configure the block device but rather
allow the respective block device and partition to be setup through
platform data.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
---
 drivers/misc/fs_loader.c | 17 ++++++++++++++++-
 include/fs_loader.h      |  4 ++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index f42eeff8f6..69f474da99 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -81,6 +81,15 @@ static int select_fs_dev(struct device_platdata *plat)
 				return -ENODEV;
 			}
 		}
+	} else if (plat->blkdev) {
+		struct blk_desc *desc = blk_get_by_device(plat->blkdev);
+
+		if (desc) {
+			ret = fs_set_blk_dev_with_part(desc, plat->blkpart);
+		} else {
+			debug("%s: No device found\n", __func__);
+			return -ENODEV;
+		}
 	} else if (plat->mtdpart && plat->ubivol) {
 		ret = mount_ubifs(plat->mtdpart, plat->ubivol);
 		if (ret)
@@ -138,13 +147,18 @@ static int _request_firmware_prepare(struct udevice *dev,
 static int fw_get_filesystem_firmware(struct udevice *dev)
 {
 	loff_t actread;
-	char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
+	char *storage_interface = NULL;
+	char *dev_part = NULL;
+	char *ubi_mtdpart = NULL;
+	char *ubi_volume = NULL;
 	int ret;
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
 	storage_interface = env_get("storage_interface");
 	dev_part = env_get("fw_dev_part");
 	ubi_mtdpart = env_get("fw_ubi_mtdpart");
 	ubi_volume = env_get("fw_ubi_volume");
+#endif
 
 	if (storage_interface && dev_part) {
 		ret = fs_set_blk_dev(storage_interface, dev_part, FS_TYPE_ANY);
@@ -159,6 +173,7 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
 		else
 			ret = -ENODEV;
 	} else {
+		debug("%s: init via platdata\n", __func__);
 		ret = select_fs_dev(dev->platdata);
 	}
 
diff --git a/include/fs_loader.h b/include/fs_loader.h
index b728c06fcf..adaa2b5db8 100644
--- a/include/fs_loader.h
+++ b/include/fs_loader.h
@@ -28,11 +28,15 @@ struct phandle_part {
  * This holds information about all supported storage devices for driver use.
  *
  * @phandlepart: Attribute data for block device.
+ * @blkdev: Block device (alternative to using phandlepart)
+ * @blkpart: Partition number of block device (alternative to using phandlepart)
  * @mtdpart: MTD partition for ubi partition.
  * @ubivol: UBI volume-name for ubifsmount.
  */
 struct device_platdata {
 	struct phandle_part phandlepart;
+	struct udevice *blkdev;
+	u32 blkpart;
 	char *mtdpart;
 	char *ubivol;
 };
-- 
2.17.1

  parent reply	other threads:[~2019-05-16 20:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 20:54 [U-Boot] [RFC 00/11] SYSFW Loader for TI K3 family SoCs using FS Loader Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 01/11] mmc: k3_arasan: Allow driver to probe without PDs specified Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 02/11] spl: Allow skipping clearing BSS during relocation Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 03/11] spl: mmc: Export function to get device index Andreas Dannenberg
2019-05-16 20:54 ` Andreas Dannenberg [this message]
2019-05-21  5:40   ` [U-Boot] [RFC 04/11] misc: fs_loader: Allow initializing blkdev using platform data Chee, Tien Fong
2019-05-21 18:37     ` dannenberg at ti.com
2019-05-16 20:54 ` [U-Boot] [RFC 05/11] arm: K3: Introduce System Firmware loader framework Andreas Dannenberg
2019-05-21  5:21   ` Chee, Tien Fong
2019-05-21 18:42     ` dannenberg at ti.com
2019-05-21  5:41   ` Chee, Tien Fong
2019-05-16 20:54 ` [U-Boot] [RFC 06/11] armV7R: K3: am654: Allow using SPL BSS pre-relocation Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 07/11] armv7R: K3: am654: Use full malloc implementation in SPL Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 08/11] armV7R: K3: am654: Load SYSFW binary and config from boot media Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 09/11] armv7R: dts: k3: am654: Update for loading SYSFW from MMC Andreas Dannenberg
2019-05-21  5:40   ` Chee, Tien Fong
2019-05-21 18:53     ` dannenberg at ti.com
2019-05-16 20:54 ` [U-Boot] [RFC 10/11] configs: am65x_evm_r5: All sysfw to be loaded via MMC Andreas Dannenberg
2019-05-16 20:54 ` [U-Boot] [RFC 11/11] configs: am65x_hs_evm_r5: " Andreas Dannenberg
2019-05-17 11:24 ` [U-Boot] [RFC 00/11] SYSFW Loader for TI K3 family SoCs using FS Loader Tom Rini
2019-05-21 19:04   ` Andreas Dannenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190516205454.22150-5-dannenberg@ti.com \
    --to=dannenberg@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox