summaryrefslogtreecommitdiff
path: root/drivers/misc/fs_loader.c
AgeCommit message (Collapse)Author
2026-02-17treewide: Clean up DECLARE_GLOBAL_DATA_PTR usagePeng Fan
Remove DECLARE_GLOBAL_DATA_PTR from files where gd is not used, and drop the unnecessary inclusion of asm/global_data.h. Headers should be included directly by the files that need them, rather than indirectly via global_data.h. Reviewed-by: Patrice Chotard <[email protected]> #STMicroelectronics boards and STM32MP1 ram test driver Tested-by: Anshul Dalal <[email protected]> #TI boards Acked-by: Yao Zi <[email protected]> #TH1520 Signed-off-by: Peng Fan <[email protected]>
2025-10-09fw_loader: Split from fs_loader into separate library fileMarek Vasut
The script based firmware loader does not use anything from the fs_loader implementation. Separate it into its own library source file and convert the mediatek PHY to use this separate code. This should reduce the amount of code that is pulled in alongside the firmware loader, as the FS loader is no longer included. Signed-off-by: Marek Vasut <[email protected]>
2025-10-07misc: fs_loader: Use buffer pointer in request_firmware_into_buf_via_script()Marek Vasut
Use plain buffer pointer in request_firmware_into_buf_via_script() instead of a pointer to pointer. The later is not necessary as the request_firmware_into_buf_via_script() does not modify the buffer pointer. Update the mediatek driver to match. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Weijie Gao <[email protected]>
2025-09-18Merge patch series "Add support for MediaTek MT7987/MT7988 built-in 2.5Gb ↵Tom Rini
ethernet PHY (v4)" Weijie Gao <[email protected]> says: This patch adds PHY driver for MediaTek MT7987/MT7988 built-in 2.5Gb ethernet PHY. [trini: Change 'tristate' Kconfig to 'bool'] Link: https://lore.kernel.org/r/[email protected]
2025-09-18net: phy: Add MediaTek built-in 2.5Gb ethernet PHY driverWeijie Gao
The MediaTek MT7987/MT7988 SoCs features a built-in 2.5Gb PHY connected to GMAC1. The PHY supports 10/100/1000/2500 Mbps full-duplex only. The PHY requires one or two firmware files. Firmware for MT7988 has already been added to upstream: mediatek/mt7988/i2p5ge-phy-pmb.bin. MT7987 has two firmware files which will be add to upstream later: i2p5ge-phy-pmb.bin and i2p5ge-phy-DSPBitTb.bin. Environment variable can be set for firmware data loading: mt7987_i2p5ge_load_pmb_firmware for i2p5ge-phy-pmb.bin mt7987_i2p5ge_load_dspbit_firmware for i2p5ge-phy-DSPBitTb.bin mt7988_i2p5ge_load_pmb_firmware for i2p5ge-phy-pmb.bin This driver allows dedicated weak functions to be overridden by board to provide the firmware data: mt7987_i2p5ge_get_fw() for MT7987 mt7988_i2p5ge_get_fw() for MT7988 To enable the PHY, add the following not to device tree: &eth1 { status = "okay"; phy-mode = "xgmii"; phy-handle = <&phy15>; phy15: ethernet-phy@15 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <15>; phy-mode = "xgmii"; }; }; Signed-off-by: Sky Huang <[email protected]> Signed-off-by: Weijie Gao <[email protected]>
2025-09-18misc: fs_loader: allow using long script name in ↵Weijie Gao
request_firmware_into_buf_via_script() Use cmd_process() to remove the length limit of script name used for run_command(). Signed-off-by: Weijie Gao <[email protected]>
2025-09-18misc: fs_loader: allow returning actual firmware data size in ↵Weijie Gao
request_firmware_into_buf_via_script() It's important to return the actual firmware data size as some firmware files may have no checksum and need the size as the only way for firmware validation check. Signed-off-by: Weijie Gao <[email protected]>
2025-09-09misc: fs_loader: Initialize actread variableAlif Zakuan Yuslaimi
Initialize the actread variable to prevent undefined behavior that can occur if the variable is used before being assigned a value. This will help to prevent potential issues, especially if actread is used (e.g., read, incremented, or returned) before being explicitly set elsewhere in the code. Signed-off-by: Alif Zakuan Yuslaimi <[email protected]>
2025-08-26misc: fs_loader: Add request_firmware_into_buf_via_script() for flexible ↵Lucien.Jheng
firmware loading via U-Boot script This commit introduces a new API, request_firmware_into_buf_via_script(), to the fs_loader framework. This function allows firmware to be loaded into memory using a user-defined U-Boot script, providing greater flexibility for firmware loading scenarios that cannot be handled by static file paths or device/partition selection alone. Key features: - The API runs a specified U-Boot script (by name), which is responsible for loading the firmware into memory by any means (e.g., load from MMC, USB, network, etc.). - The script must set two environment variables: 'fw_addr' (the memory address where the firmware is loaded) and 'fw_size' (the size of the firmware in bytes). - The function validates these variables, copies the firmware into a newly allocated buffer (using memdup), and returns the pointer via the provided double pointer argument. - The maximum allowed firmware size is checked to prevent buffer overflows. - The environment variables are cleared after use to avoid stale data. - Detailed error messages are provided for all failure conditions to aid debugging. Usage example: 1. Define a U-Boot script in the environment that loads the firmware and sets the required variables: => env set my_fw_script 'load mmc 0:1 ${loadaddr} firmware.bin && env set fw_addr ${loadaddr} && env set fw_size ${filesize}' 2. In your code, call the new API: void *fw_buf = NULL; int ret = request_firmware_into_buf_via_script(&fw_buf, 0x46000000, "my_fw_script"); if (ret < 0) return ret; This approach allows board integrators and users to customize the firmware loading process without modifying the source code, simply by changing the script in the U-Boot environment. Signed-off-by: Lucien.Jheng <[email protected]> Reviewed-by: Marek Vasut <[email protected]> [trini: Fix printf of size_t needing to use %zx] Signed-off-by: Tom Rini <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-07misc: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini <[email protected]>
2023-10-11misc: fs_loader: Fix alignment of fs_loader driverSean Anderson
DM_DRIVER_GET will redeclare the fs_loader driver without the correct alignment. This causes GCC to use the default section alignment of 32 bytes. This in turn creates a gap in the linker list due to the padding required to achieve the correct alignment, corrupting all further entries. Use DM_DRIVER_REF instead, which doesn't redeclare anything. Fixes: 0998a20cfc6 ("misc: fs_loader: Add function to get the chosen loader") Signed-off-by: Sean Anderson <[email protected]>
2023-01-12misc: fs_loader: Add function to get the chosen loaderSean Anderson
The fs_loader device is used to pull in settings via the chosen node. However, there was no library function for this, so arria10 was doing it explicitly. This function subsumes that, and uses ofnode_get_chosen_node instead of navigating the device tree directly. Because fs_loader pulls its config from the environment by default, it's fine to create a device with nothing backing it at all. Doing this allows enabling CONFIG_FS_LOADER without needing to modify the device tree. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2022-05-05misc: fs_loader: Fix compile warnings when CONFIG_CMD_UBIFS is enabledPali Rohár
drivers/misc/fs_loader.c: In function ‘mount_ubifs’: drivers/misc/fs_loader.c:46:12: warning: implicit declaration of function ‘ubi_part’ [-Wimplicit-function-declaration] int ret = ubi_part(mtdpart, NULL); ^~~~~~~~ drivers/misc/fs_loader.c:53:9: warning: implicit declaration of function ‘cmd_ubifs_mount’ [-Wimplicit-function-declaration] return cmd_ubifs_mount(ubivol); ^~~~~~~~~~~~~~~ drivers/misc/fs_loader.c: In function ‘umount_ubifs’: drivers/misc/fs_loader.c:58:9: warning: implicit declaration of function ‘cmd_ubifs_umount’ [-Wimplicit-function-declaration] return cmd_ubifs_umount(); ^~~~~~~~~~~~~~~~ Signed-off-by: Pali Rohár <[email protected]>
2021-07-06dm: define LOG_CATEGORY for all uclassPatrick Delaunay
Define LOG_CATEGORY for all uclass to allow filtering with log command. Signed-off-by: Patrick Delaunay <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2021-02-02common: Drop asm/global_data.h from common headerSimon Glass
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2021-01-05dm: Use access methods for dev/uclass private dataSimon Glass
Most drivers use these access methods but a few do not. Update them. In some cases the access is not permitted, so mark those with a FIXME tag for the maintainer to check. Signed-off-by: Simon Glass <[email protected]> Acked-by: Andy Shevchenko <[email protected]> Acked-by: Pratyush Yadav <[email protected]>
2020-12-13dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass
Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass
This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass
We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <[email protected]>
2020-05-18common: Drop log.h from common headerSimon Glass
Move this header out of the common header. Signed-off-by: Simon Glass <[email protected]>
2019-08-11env: Move env_get() to env.hSimon Glass
Move env_get() over to the new header file. Acked-by: Joe Hershberger <[email protected]> Signed-off-by: Simon Glass <[email protected]>
2019-04-22misc: fs_loader: Replace label with DT phandleTien Fong Chee
In previously label which will be expanded to the node's full path was used, and now replacing label with most commonly used DT phandle. The codes were changed accordingly to the use of DT phandle and supporting multiple instances. Signed-off-by: Tien Fong Chee <[email protected]>
2019-04-22misc: fs_loader: Add support for initializing block deviceTien Fong Chee
Firmware loader would encounter problem if the block device is accessed before initializing it. This patch would adding the support of probing block device and initializing block before the block device is accessed by firmware loader. Signed-off-by: Tien Fong Chee <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2019-01-15misc: fs_loader: Switching private data allocation to DM auto allocationTien Fong Chee
Switching private data manual allocation to driver model auto allocation so users no longer need to deallocate themself because this would be deallocated by driver model when the device is no longer required. Signed-off-by: Tien Fong Chee <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2018-11-16misc: fs_loader: Fix compiler warningKeerthy
Fix compiler warning drivers/misc/fs_loader.c:193:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=] Signed-off-by: Keerthy <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2018-11-16misc: fs_loader: Use device_get_global_by_ofnode to get to nodeKeerthy
Instead of two staged ofnode_to_offset followed by device_get_global_by_of_offset approach, direcly use the device_get_global_by_ofnode to fetch the device. Signed-off-by: Keerthy <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2018-10-28drivers: cosmetic: Convert SPDX license tags to Linux Kernel stylePatrick Delaunay
Complete in the drivers directory the work started with commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style"). Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Patrick Delaunay <[email protected]>
2018-09-28common: Generic loader for file systemTien Fong Chee
This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device. Signed-off-by: Tien Fong Chee <[email protected]>