Re: [PATCH 1/2] imx-bbu-nand-fcb: do not use hardcoded devicefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sasha,

sorry but I changed my workstation recently and did not restore send-email as on the old one. I thought the mail client geary would be enough but it is not.
I will send a new patch series in these days.

Best,
Stefano

On ven, feb 21 2025 at 11:38:26 +01:00:00, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
Hi Stefano,

The patch is mangled. Could you send it using git send-email? Using a
web endpoint for b4 would be another possibility if git send-email
doesn't work for you.

The two patches should be sent as one to avoid intermediate breakage
between the patches.

Regards
  Sascha

On Thu, Feb 20, 2025 at 06:39:55PM +0100, Stefano Manni wrote:
 Device file was hardcoded to "nand0.barebox".
 This patch harmonize the signature of

 imx6_bbu_nand_register_handler()
 imx7_bbu_nand_register_handler()
 imx28_bbu_nand_register_handler()

 with the other bbu register functions in order to take
 the devicefile as parameter.

 Signed-off-by: Stefano Manni <stefano.manni@xxxxxxxxx>
 ---
 common/imx-bbu-nand-fcb.c | 23 ++++++++++++++++-------
 include/bbu.h | 18 ++++++++++++------
 2 files changed, 28 insertions(+), 13 deletions(-)

 diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
 index d0261140cf..0d17a7bf6a 100644
 --- a/common/imx-bbu-nand-fcb.c
 +++ b/common/imx-bbu-nand-fcb.c
@@ -1219,6 +1219,7 @@ static int imx_bbu_nand_update(struct bbu_handler
 *handler, struct bbu_data *dat
  int used = 0;
  int fw_orig_len = 0;
  int used_refresh = 0, unused_refresh = 0;
 + const char *devname = handler->devicefile;

  if (data->image) {
   filetype = file_detect_type(data->image, data->len);
@@ -1230,7 +1231,12 @@ static int imx_bbu_nand_update(struct bbu_handler
 *handler, struct bbu_data *dat
    return -EINVAL;
  }

 - bcb_cdev = cdev_by_name(handler->devicefile);
 + /* Support both boot /dev/nand0.barebox and boot nand0.barebox */
 + devname += str_has_prefix(devname, "/dev/");
 +
 + device_detect_by_name(devname);
 +
 + bcb_cdev = cdev_by_name(devname);
  if (!bcb_cdev) {
   pr_err("%s: No FCB device!\n", __func__);
   return -ENODEV;
 @@ -1432,7 +1438,8 @@ static void imx6_fcb_create(struct
 imx_nand_fcb_bbu_handler *imx_handler,
  fcb->MetadataBytes = 10;
 }

-int imx6_bbu_nand_register_handler(const char *name, unsigned long flags)
 +int imx6_bbu_nand_register_handler(const char *name,
 + const char *devicefile, unsigned long flags)
 {
  struct imx_nand_fcb_bbu_handler *imx_handler;
  struct bbu_handler *handler;
@@ -1451,7 +1458,7 @@ int imx6_bbu_nand_register_handler(const char *name,
 unsigned long flags)
  }

  handler = &imx_handler->handler;
 - handler->devicefile = "nand0.barebox";
 + handler->devicefile = devicefile;
  handler->name = name;
  handler->flags = flags | BBU_HANDLER_CAN_REFRESH;
  handler->handler = imx_bbu_nand_update;
 @@ -1526,7 +1533,8 @@ static void imx28_fcb_create(struct
 imx_nand_fcb_bbu_handler *imx_handler,
  fcb->EraseThreshold = readl(bch_regs + BCH_MODE);
 }

-int imx28_bbu_nand_register_handler(const char *name, unsigned long flags)
 +int imx28_bbu_nand_register_handler(const char *name,
 + const char *devicefile, unsigned long flags)
 {
  struct imx_nand_fcb_bbu_handler *imx_handler;
  struct bbu_handler *handler;
@@ -1540,7 +1548,7 @@ int imx28_bbu_nand_register_handler(const char *name,
 unsigned long flags)
  imx_handler->filetype = filetype_mxs_bootstream;

  handler = &imx_handler->handler;
 - handler->devicefile = "nand0.barebox";
 + handler->devicefile = devicefile;
  handler->name = name;
  handler->flags = flags | BBU_HANDLER_CAN_REFRESH;
  handler->handler = imx_bbu_nand_update;
@@ -1599,7 +1607,8 @@ static int imx7_fcb_write(struct mtd_info *mtd, int
 block, struct fcb_block *fcb
  return mxs_nand_write_fcb_bch62(block, fcb, sizeof(*fcb));
 }

-int imx7_bbu_nand_register_handler(const char *name, unsigned long flags)
 +int imx7_bbu_nand_register_handler(const char *name
 + const char *devicefile, unsigned long flags)
 {
  struct imx_nand_fcb_bbu_handler *imx_handler;
  struct bbu_handler *handler;
@@ -1612,7 +1621,7 @@ int imx7_bbu_nand_register_handler(const char *name,
 unsigned long flags)
  imx_handler->filetype = filetype_arm_barebox;

  handler = &imx_handler->handler;
 - handler->devicefile = "nand0.barebox";
 + handler->devicefile = devicefile;
  handler->name = name;
  handler->flags = flags | BBU_HANDLER_CAN_REFRESH;
  handler->handler = imx_bbu_nand_update;
 diff --git a/include/bbu.h b/include/bbu.h
 index 5105d2ac70..087d3ee827 100644
 --- a/include/bbu.h
 +++ b/include/bbu.h
@@ -98,19 +98,25 @@ static inline int bbu_mmcboot_register_handler(const
 char *name,
 #endif

 #if defined(CONFIG_BAREBOX_UPDATE_IMX_NAND_FCB)
-int imx6_bbu_nand_register_handler(const char *name, unsigned long flags); -int imx7_bbu_nand_register_handler(const char *name, unsigned long flags); -int imx28_bbu_nand_register_handler(const char *name, unsigned long flags);
 +int imx6_bbu_nand_register_handler(const char *name, const char
 *devicefile, unsigned long flags);
 +int imx7_bbu_nand_register_handler(const char *name, const char
 *devicefile, unsigned long flags);
 +int imx28_bbu_nand_register_handler(const char *name, const char
 *devicefile, unsigned long flags);
 #else
-static inline int imx6_bbu_nand_register_handler(const char *name, unsigned
 long flags)
 +static inline int imx6_bbu_nand_register_handler(const char *name,
 + const char *devicefile,
 + unsigned long flags)
 {
  return -ENOSYS;
 }
-static inline int imx7_bbu_nand_register_handler(const char *name, unsigned
 long flags)
 +static inline int imx7_bbu_nand_register_handler(const char *name,
 + const char *devicefile,
 + unsigned long flags)
 {
  return -ENOSYS;
 }
 -static inline int imx28_bbu_nand_register_handler(const char *name,
 unsigned long flags)
 +static inline int imx28_bbu_nand_register_handler(const char *name,
 + const char *devicefile,
 + unsigned long flags)
 {
  return -ENOSYS;
 }
 --
 2.25.1






--
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |






[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux