mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 08:07:59 +00:00
net: fm: Support loading firmware from a filesystem
This adds a new method to load Fman firmware from a filesystem. This allows users to use regular files instead of hard-coded offsets for the firmware. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
e4f0cc5ddf
commit
f4426fd68d
2 changed files with 28 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <env.h>
|
#include <env.h>
|
||||||
|
#include <fs_loader.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
@ -452,7 +453,29 @@ int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name)
|
||||||
int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name)
|
int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
#if defined(CONFIG_SYS_QE_FMAN_FW_IN_NOR)
|
#if defined(CONFIG_SYS_QE_FMAN_FW_IN_FS)
|
||||||
|
struct udevice *fs_loader;
|
||||||
|
void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
|
||||||
|
|
||||||
|
if (!addr)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
rc = get_fs_loader(&fs_loader);
|
||||||
|
if (rc) {
|
||||||
|
debug("could not get fs loader: %d\n", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!firmware_name)
|
||||||
|
firmware_name = "fman.itb";
|
||||||
|
|
||||||
|
rc = request_firmware_into_buf(fs_loader, firmware_name, addr,
|
||||||
|
CONFIG_SYS_QE_FMAN_FW_LENGTH, 0);
|
||||||
|
if (rc < 0) {
|
||||||
|
debug("could not request %s: %d\n", firmware_name, rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
#elif defined(CONFIG_SYS_QE_FMAN_FW_IN_NOR)
|
||||||
void *addr = (void *)CONFIG_SYS_FMAN_FW_ADDR;
|
void *addr = (void *)CONFIG_SYS_FMAN_FW_ADDR;
|
||||||
#elif defined(CONFIG_SYS_QE_FMAN_FW_IN_NAND)
|
#elif defined(CONFIG_SYS_QE_FMAN_FW_IN_NAND)
|
||||||
size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH;
|
size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH;
|
||||||
|
|
|
@ -27,6 +27,10 @@ choice
|
||||||
depends on FMAN_ENET || QE
|
depends on FMAN_ENET || QE
|
||||||
default SYS_QE_FMAN_FW_IN_ROM
|
default SYS_QE_FMAN_FW_IN_ROM
|
||||||
|
|
||||||
|
config SYS_QE_FMAN_FW_IN_FS
|
||||||
|
depends on FS_LOADER && FMAN_ENET
|
||||||
|
bool "Filesystem"
|
||||||
|
|
||||||
config SYS_QE_FMAN_FW_IN_NOR
|
config SYS_QE_FMAN_FW_IN_NOR
|
||||||
bool "NOR flash"
|
bool "NOR flash"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue