u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Ramon Fried <rfried.dev@gmail.com>
To: Sean Anderson <sean.anderson@seco.com>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Joe Hershberger <joe.hershberger@ni.com>,
	 Priyanka Jain <priyanka.jain@nxp.com>,
	York Sun <york.sun@nxp.com>
Subject: Re: [RESEND PATCH v2 3/3] net: fm: Support loading firmware from a filesystem
Date: Sun, 14 Aug 2022 23:46:52 +0300	[thread overview]
Message-ID: <CAGi-RUKB20=9-w8g27WDK1Ja5r+QnLiJ4bJZkwz0njnCYx_wYw@mail.gmail.com> (raw)
In-Reply-To: <20220422173032.2259019-4-sean.anderson@seco.com>

On Fri, Apr 22, 2022 at 8:30 PM Sean Anderson <sean.anderson@seco.com> wrote:
>
> 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>
> ---
>
> (no changes since v1)
>
>  drivers/net/fm/fm.c | 25 ++++++++++++++++++++++++-
>  drivers/qe/Kconfig  |  4 ++++
>  2 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
> index aa0cc69232..39b939cb97 100644
> --- a/drivers/net/fm/fm.c
> +++ b/drivers/net/fm/fm.c
> @@ -5,6 +5,7 @@
>   */
>  #include <common.h>
>  #include <env.h>
> +#include <fs_loader.h>
>  #include <malloc.h>
>  #include <asm/io.h>
>  #include <dm/device_compat.h>
> @@ -453,7 +454,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 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;
>  #elif defined(CONFIG_SYS_QE_FMAN_FW_IN_NAND)
>         size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH;
> diff --git a/drivers/qe/Kconfig b/drivers/qe/Kconfig
> index c44a81f69a..89a75c175b 100644
> --- a/drivers/qe/Kconfig
> +++ b/drivers/qe/Kconfig
> @@ -27,6 +27,10 @@ choice
>         depends on FMAN_ENET || QE
>         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
>         bool "NOR flash"
>
> --
> 2.35.1.1320.gc452695387.dirty
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

  reply	other threads:[~2022-08-14 20:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 17:30 [RESEND PATCH v2 0/3] net: fm: Add support for loading firmware from filesystem Sean Anderson
2022-04-22 17:30 ` [RESEND PATCH v2 1/3] misc: fs_loader: Add function to get the chosen loader Sean Anderson
2022-08-14 20:47   ` Ramon Fried
2022-04-22 17:30 ` [RESEND PATCH v2 2/3] net: fm: Add firmware name parameter Sean Anderson
2022-08-14 20:46   ` Ramon Fried
2022-04-22 17:30 ` [RESEND PATCH v2 3/3] net: fm: Support loading firmware from a filesystem Sean Anderson
2022-08-14 20:46   ` Ramon Fried [this message]
2022-08-13  6:15 ` [RESEND PATCH v2 0/3] net: fm: Add support for loading firmware from filesystem Sean Anderson
2022-08-14 20:48   ` Ramon Fried
2022-11-17 21:29     ` Sean Anderson
2022-11-26 22:47       ` Ramon Fried
2022-11-28 15:03         ` Tom Rini

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='CAGi-RUKB20=9-w8g27WDK1Ja5r+QnLiJ4bJZkwz0njnCYx_wYw@mail.gmail.com' \
    --to=rfried.dev@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=priyanka.jain@nxp.com \
    --cc=sean.anderson@seco.com \
    --cc=u-boot@lists.denx.de \
    --cc=york.sun@nxp.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;
as well as URLs for NNTP newsgroup(s).