From: Christian Marangi <ansuelsmth@gmail.com>
To: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
Christian Marangi <ansuelsmth@gmail.com>,
Casey Connolly <casey.connolly@linaro.org>,
Quentin Schulz <quentin.schulz@cherry.de>,
Peng Fan <peng.fan@nxp.com>,
Justin Klaassen <justin@tidylabs.net>,
Neha Malcom Francis <n-francis@ti.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Jamie Gibbons <jamie.gibbons@microchip.com>,
Leo Yu-Chi Liang <ycliang@andestech.com>,
Harsha Vardhan V M <h-vm@ti.com>,
Weijie Gao <weijie.gao@mediatek.com>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Patrice Chotard <patrice.chotard@foss.st.com>,
Yao Zi <me@ziyao.cc>,
Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>,
"Lucien.Jheng" <lucienzx159@gmail.com>,
u-boot@lists.denx.de
Subject: [PATCH v5 0/6] misc: fs_loader: reorg and split to FS and FW loader + FIP loader
Date: Fri, 3 Apr 2026 15:51:57 +0200 [thread overview]
Message-ID: <20260403135205.26979-1-ansuelsmth@gmail.com> (raw)
This series mainly rework the FS loader to permit reading firmware from
container that are not exactly a readable filesystem.
Also splitting out the generic firmware loader infra from the
filesystem-specific code will make adding new loader types easier.
One scenario is when a firmware is shipped in a FIP container as
a generic blob with an UUID.
FIP are mostly used on ARM in the context of ATF.
In such context U-Boot is loaded as BL31 and the PHY firmware
can't be stored in the FIT image for the kernel as U-Boot should
not depend on the presence of the kernel to correctly enable PHY
for Ethernet port.
To handle such case the PHY firmware is stored in FIP with a
predictable UUID.
One example is with Airoha 8811H firmware where the FIP can
have a blob with UUID "d39d2cf2-9bd0-3ca7-93e9-e71b4f9250b2".
(generated from command "uuidgen -n @dns --md5 --name en8811h.bin")
With these example DTS entry:
fs_loader0: fip-loader {
bootph-all;
compatible = "u-boot,fip-loader";
phandlepart = <&mmc0 0>;
partoffset = <0x100>;
};
mdio {
en8811: ethernet-phy@f {
reg = <0xf>;
firmware-name = "d39d2cf2-9bd0-3ca7-93e9-e71b4f9250b2";
firmware-loader = <&fs_loader0>;
};
};
And PHY driver using the get_fw_loader_from_node() and the
common request_firmware_into_buf() it's possible to
load the PHY firmware transparently by just declaring
the required entry in the DTS.
get_fw_loader_from_node() is implemented to actual get the
loader from DT. This was something that was already in mind
from when the FS loader was implemented but then it was
never implemented in favor of a single loader per device.
The first patch is a minor fixup for something that probably
won't ever happen.
The second one is a good reworking of the FS and FW loader
moving the internal struct to a dedicated header. (this is
really to enforce what drivers should use and what
driver should not mess with)
Then there is the request_firmware_size() new OP to get only
the size of the firmware. Useful for case where the firmware
size is not always the same and change across different version.
(the patter might be get size -> alloc buffer -> get firmware).
Then the FIP loader as a basic parser of FIP. This only
read the FIP header, loop all the entry and search for a
matching UUID. If nothing is found then no firmware blob.
Very simple implementation.
This is being CI tested on [0]
[0] https://github.com/u-boot/u-boot/pull/884
Changes v5:
- Fix unment dependency for config flag
- Move request_firmware_size before FIP loader
- Add documentation patch
- Improve get_fw_loader_from_node() implementation
- use min() instead of custom MIN()
- Fix handling of some return value
Changes v4:
- Rebase on top of next
Changes v3:
- Add review tag where possible
- Check blk_dread ret
- Generalize mount_ubifs with generic_fw_loader_ubi_select
- Fix some typo
- Drop useless ubifs umount (nothing is mounted in FIP)
Changes v2:
- Better handle header include to fix compilation error
on some devices
- Fix typo for ubifs fix commit
Christian Marangi (6):
misc: fs_loader: fix ubifs not unmounted on dev_get_priv error
misc: fs_loader: reorganize and split to FS and FW loader
misc: fw_loader: implement generic get_fw_loader_from_node()
misc: fw_loader: implement request_firmware_size() OP
misc: fw_loader: introduce FIP loader driver
doc: dtbinding: Update documentation for Generic Firmware loader
.../misc/{fs_loader.txt => fw_loader.txt} | 15 +-
drivers/misc/Kconfig | 16 +
drivers/misc/Makefile | 2 +-
drivers/misc/fw_loader/Makefile | 5 +
drivers/misc/fw_loader/fip_loader.c | 578 ++++++++++++++++++
drivers/misc/{ => fw_loader}/fs_loader.c | 193 ++----
drivers/misc/fw_loader/fw_loader.c | 196 ++++++
drivers/misc/fw_loader/internal.h | 64 ++
include/dm/uclass-id.h | 3 +-
include/fs_loader.h | 47 +-
include/fw_loader.h | 43 ++
11 files changed, 983 insertions(+), 179 deletions(-)
rename doc/device-tree-bindings/misc/{fs_loader.txt => fw_loader.txt} (77%)
create mode 100644 drivers/misc/fw_loader/Makefile
create mode 100644 drivers/misc/fw_loader/fip_loader.c
rename drivers/misc/{ => fw_loader}/fs_loader.c (59%)
create mode 100644 drivers/misc/fw_loader/fw_loader.c
create mode 100644 drivers/misc/fw_loader/internal.h
--
2.53.0
next reply other threads:[~2026-04-03 13:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 13:51 Christian Marangi [this message]
2026-04-03 13:51 ` [PATCH v5 1/6] misc: fs_loader: fix ubifs not unmounted on dev_get_priv error Christian Marangi
2026-04-03 13:51 ` [PATCH v5 2/6] misc: fs_loader: reorganize and split to FS and FW loader Christian Marangi
2026-04-06 17:10 ` Simon Glass
2026-04-03 13:52 ` [PATCH v5 3/6] misc: fw_loader: implement generic get_fw_loader_from_node() Christian Marangi
2026-04-06 17:10 ` Simon Glass
2026-04-03 13:52 ` [PATCH v5 4/6] misc: fw_loader: implement request_firmware_size() OP Christian Marangi
2026-04-06 17:13 ` Simon Glass
2026-04-03 13:52 ` [PATCH v5 5/6] misc: fw_loader: introduce FIP loader driver Christian Marangi
2026-04-06 17:14 ` Simon Glass
2026-04-09 13:36 ` Christian Marangi
2026-04-03 13:52 ` [PATCH v5 6/6] doc: dtbinding: Update documentation for Generic Firmware loader Christian Marangi
2026-04-06 17:14 ` Simon Glass
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=20260403135205.26979-1-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=alif.zakuan.yuslaimi@altera.com \
--cc=casey.connolly@linaro.org \
--cc=h-vm@ti.com \
--cc=jamie.gibbons@microchip.com \
--cc=justin@tidylabs.net \
--cc=lucienzx159@gmail.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=me@ziyao.cc \
--cc=n-francis@ti.com \
--cc=patrice.chotard@foss.st.com \
--cc=peng.fan@nxp.com \
--cc=quentin.schulz@cherry.de \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=weijie.gao@mediatek.com \
--cc=xypron.glpk@gmx.de \
--cc=ycliang@andestech.com \
/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