Re: [PATCH v8 09/19] scmi_protocols: update struct scmi_base_discover_list_protocols_out

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

[...]


@@ -276,22 +276,31 @@ static int scmi_base_discover_list_protocols_int(struct 
udevice *dev,
if (ret)
return ret;
  


This math here could really use a code comment to explain what is going 
on here.


I assume there is 1 byte per protocol in the struct 
scmi_base_discover_list_protocols_out { .protocols[] } member, right ? 
If so, why not simply change u32 protocols[] to u8 protocols[] and use some:


out_size = sizeof(*out) + roundup(num_protocols, sizeof(u32))

?

That might make the whole parsing using for (i = 0; i < 
out->num_protocols; i++, cur++) simpler too ?



+   out_size = sizeof(*out) + sizeof(u32) * (1 + (num_protocols - 1) / 4);
+   out = calloc(1, out_size);
+   if (!out)
+   return -ENOMEM;
+   msg.out_msg = (u8 *)out;
+   msg.out_msg_sz = out_size;
+
buf = calloc(sizeof(u8), num_protocols);
-   if (!buf)
+   if (!buf) {
+   free(out);
return -ENOMEM;
+   }
  
  	cur = 0;

do {
ret = devm_scmi_process_msg(dev, &msg);
if (ret)
goto err;
-   if (out.status) {
-   ret = scmi_to_linux_errno(out.status);
+   if (out->status) {
+   ret = scmi_to_linux_errno(out->status);
goto err;
}
  
-		for (i = 0; i < out.num_protocols; i++, cur++)

-   buf[cur] = out.protocols[i / 4] >> ((i % 4) * 8);
+   for (i = 0; i < out->num_protocols; i++, cur++)
+   buf[cur] = out->protocols[i / 4] >> ((i % 4) * 8);
} while (cur < num_protocols);
  
  	*protocols = buf;

@@ -299,6 +308,7 @@ static int scmi_base_discover_list_protocols_int(struct 
udevice *dev,
return num_protocols;
  err:
free(buf);
+   free(out);
  
  	return ret;

  }
diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 519b906b4ce..9046de7e3e7 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -145,7 +145,7 @@ struct scmi_base_discover_impl_version_out {
  struct scmi_base_discover_list_protocols_out {
s32 status;
u32 num_protocols;
-   u32 protocols[3];
+   u32 protocols[];
  };

[...]


Re: [PATCH v8 03/19] firmware: scmi_agent: add SCMI pin control protocol support

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:
[...]


@@ -352,6 +358,22 @@ static int scmi_fill_base_info(struct udevice *agent, 
struct udevice *dev)
return 0;
  }
  
+static struct driver *scmi_proto_driver_get(unsigned int proto_id)

+{
+   struct scmi_proto_driver *start, *entry;
+   int n_ents;
+
+   start = ll_entry_start(struct scmi_proto_driver, scmi_proto_driver);
+   n_ents = ll_entry_count(struct scmi_proto_driver, scmi_proto_driver);
+
+   for (entry = start; entry != start + n_ents; entry++) {
+   if (entry->match->proto_id == proto_id)
+   return entry->driver;
+   }
+
+   return NULL;
+}


Ideally, the addition of core code like scmi_proto_driver_get() should 
be a separate preparatory patch.


Please also make sure to convert the four SCMI protocol drivers to 
U_BOOT_SCMI_PROTO_DRIVER() , otherwise the code become inconsistent. 
That should be easy, since there are literally four SCMI protocol drivers.



  /*
   * SCMI agent devices binds devices of various uclasses depending on
   * the FDT description. scmi_bind_protocol() is a generic bind sequence
@@ -436,6 +458,9 @@ static int scmi_bind_protocols(struct udevice *dev)
drv = DM_DRIVER_GET(scmi_voltage_domain);
}
break;
+   case SCMI_PROTOCOL_ID_PINCTRL:
+   drv = scmi_proto_driver_get(SCMI_PROTOCOL_ID_PINCTRL);


Please have a look at patch I just sent and give it a try:

[PATCH] power: regulator: scmi: Move regulator subnode hack to 
scmi_regulator


With that and the conversion above in place, you should be able to 
entirely eliminate this switch-case code and make use of the full 
potential of your newly added scmi_proto_driver_get(), this way:


diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c 
b/drivers/firmware/scmi/scmi_agent-uclass.c

index 09a25d0067c..98e0c4d7c93 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -431,34 +431,10 @@ static int scmi_bind_protocols(struct udevice *dev)

drv = NULL;
name = ofnode_get_name(node);
-   switch (protocol_id) {
-   case SCMI_PROTOCOL_ID_POWER_DOMAIN:
-   if (CONFIG_IS_ENABLED(SCMI_POWER_DOMAIN) &&
-   scmi_protocol_is_supported(dev, protocol_id))
-   drv = DM_DRIVER_GET(scmi_power_domain);
-   break;
-   case SCMI_PROTOCOL_ID_CLOCK:
-   if (CONFIG_IS_ENABLED(CLK_SCMI) &&
-   scmi_protocol_is_supported(dev, protocol_id))
-   drv = DM_DRIVER_GET(scmi_clock);
-   break;
-   case SCMI_PROTOCOL_ID_RESET_DOMAIN:
-   if (IS_ENABLED(CONFIG_RESET_SCMI) &&
-   scmi_protocol_is_supported(dev, protocol_id))
-   drv = DM_DRIVER_GET(scmi_reset_domain);
-   break;
-   case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
-   if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI) &&
-   scmi_protocol_is_supported(dev, protocol_id))
-   drv = DM_DRIVER_GET(scmi_voltage_domain);
-   break;
-   case SCMI_PROTOCOL_ID_PINCTRL:
-   drv = scmi_proto_driver_get(SCMI_PROTOCOL_ID_PINCTRL);
-   break;
-   default:
-   break;
-   }
+   if (!scmi_protocol_is_supported(dev, protocol_id))
+   continue;

+   drv = scmi_proto_driver_get(protocol_id);
if (!drv) {
dev_dbg(dev, "Ignore unsupported SCMI protocol %#x\n",
protocol_id);


+   break;
default:
break;
}
diff --git a/drivers/pinctrl/nxp/pinctrl-imx-scmi.c 
b/drivers/pinctrl/nxp/pinctrl-imx-scmi.c
index 0ed971369a3..dbd6ff437e5 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx-scmi.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx-scmi.c
@@ -9,6 +9,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  
  #include "pinctrl-imx.h"

@@ -150,3 +151,9 @@ U_BOOT_DRIVER(scmi_pinctrl_imx) = {
.ops = &imx_scmi_pinctrl_ops,
.flags = DM_FLAG_PRE_RELOC,
  };
+
+static struct scmi_proto_match match = {
+   .proto_id = SCMI_PROTOCOL_ID_PINCTRL,
+};



This should be a zero terminated array I think ?

static struct scmi_proto_match match[] = {
  { SCMI_PROTOCOL_ID_PINCTRL },
  { /* Sentinel */ }
};

[...]


[PATCH v8 00/19] imx: add i.MX95 support

2025-03-21 Thread Alice Guo (OSS)
600131c21a7c4b5ca935
change-id: 20250321-imx95-aec019806ab6

Best regards,
-- 
Alice Guo 



[PATCH v8 01/19] firmware: scmi: smt: Interrupt communication enable

2025-03-21 Thread Alice Guo (OSS)
From: Viorel Suman 

i.MX95 System Manager uses interrupt driven communication which requires
the caller to set Bit[0] of channel flags to 1. When transmission
completes and the previous general purpose interrupt has been processed
by the other core, i.MX95 System Manager will set General Purpose
Interrupt Control Register (GCR). U-Boot polls General-purpose Status
(GSR) to check if the operation is finished.

Signed-off-by: Viorel Suman 
Signed-off-by: Alice Guo 
Reviewed-by: Ye Li 
---
 drivers/firmware/scmi/Kconfig |  6 ++
 drivers/firmware/scmi/smt.c   | 13 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/firmware/scmi/Kconfig b/drivers/firmware/scmi/Kconfig
index 8cf85f0d7a1..eb62b88615b 100644
--- a/drivers/firmware/scmi/Kconfig
+++ b/drivers/firmware/scmi/Kconfig
@@ -41,3 +41,9 @@ config SCMI_AGENT_OPTEE
help
  Enable the SCMI communication channel based on OP-TEE transport
  for compatible "linaro,scmi-optee".
+
+config SCMI_TRANSPORT_SMT_INTR
+   bool
+   depends on SCMI_FIRMWARE
+   help
+ Enable interrupt communication of shared memory based transport.
diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c
index 67d2f450024..a0489f9718a 100644
--- a/drivers/firmware/scmi/smt.c
+++ b/drivers/firmware/scmi/smt.c
@@ -20,6 +20,16 @@
 
 #include "smt.h"
 
+static void scmi_smt_enable_intr(struct scmi_smt *smt, bool enable)
+{
+   struct scmi_smt_header *hdr = (void *)smt->buf;
+
+   if (enable)
+   hdr->flags |= SCMI_SHMEM_FLAG_INTR_ENABLED;
+   else
+   hdr->flags &= ~SCMI_SHMEM_FLAG_INTR_ENABLED;
+}
+
 /**
  * Get shared memory configuration defined by the referred DT phandle
  * Return with a errno compliant value.
@@ -48,6 +58,9 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct 
scmi_smt *smt)
if (!smt->buf)
return -ENOMEM;
 
+   if (IS_ENABLED(CONFIG_SCMI_TRANSPORT_SMT_INTR))
+   scmi_smt_enable_intr(smt, true);
+
 #ifdef CONFIG_ARM
if (dcache_status())
mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, 
MMU_SECTION_SIZE),

-- 
2.43.0



[PATCH v8 03/19] firmware: scmi_agent: add SCMI pin control protocol support

2025-03-21 Thread Alice Guo (OSS)
From: Alice Guo 

This patch adds SCMI pin control protocol support to make the pin
controller driver based on SCMI, such as
drivers/pinctrl/nxp/pinctrl-imx-scmi.c, can be bound to the SCMI agent
device whose protocol id is 0x19.

Add U_BOOT_SCMI_PROTO_DRIVER() so that the SCMI agent device can choose
which SCMI protocol driver to bind by the bind function of struct
driver. This can avoid putting i.MX related code in scmi_agent-uclass.c.

Signed-off-by: Alice Guo 
---
 drivers/firmware/scmi/scmi_agent-uclass.c | 25 +
 drivers/pinctrl/nxp/pinctrl-imx-scmi.c|  7 +++
 include/scmi_agent-uclass.h   | 17 +
 3 files changed, 49 insertions(+)

diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c 
b/drivers/firmware/scmi/scmi_agent-uclass.c
index 8c907c3b032..2ffdd5c881e 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -97,6 +97,9 @@ struct udevice *scmi_get_protocol(struct udevice *dev,
case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
proto = priv->voltagedom_dev;
break;
+   case SCMI_PROTOCOL_ID_PINCTRL:
+   proto = priv->pinctrl_dev;
+   break;
default:
dev_err(dev, "Protocol not supported\n");
proto = NULL;
@@ -147,6 +150,9 @@ static int scmi_add_protocol(struct udevice *dev,
case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
priv->voltagedom_dev = proto;
break;
+   case SCMI_PROTOCOL_ID_PINCTRL:
+   priv->pinctrl_dev = proto;
+   break;
default:
dev_err(dev, "Protocol not supported\n");
return -EPROTO;
@@ -352,6 +358,22 @@ static int scmi_fill_base_info(struct udevice *agent, 
struct udevice *dev)
return 0;
 }
 
+static struct driver *scmi_proto_driver_get(unsigned int proto_id)
+{
+   struct scmi_proto_driver *start, *entry;
+   int n_ents;
+
+   start = ll_entry_start(struct scmi_proto_driver, scmi_proto_driver);
+   n_ents = ll_entry_count(struct scmi_proto_driver, scmi_proto_driver);
+
+   for (entry = start; entry != start + n_ents; entry++) {
+   if (entry->match->proto_id == proto_id)
+   return entry->driver;
+   }
+
+   return NULL;
+}
+
 /*
  * SCMI agent devices binds devices of various uclasses depending on
  * the FDT description. scmi_bind_protocol() is a generic bind sequence
@@ -436,6 +458,9 @@ static int scmi_bind_protocols(struct udevice *dev)
drv = DM_DRIVER_GET(scmi_voltage_domain);
}
break;
+   case SCMI_PROTOCOL_ID_PINCTRL:
+   drv = scmi_proto_driver_get(SCMI_PROTOCOL_ID_PINCTRL);
+   break;
default:
break;
}
diff --git a/drivers/pinctrl/nxp/pinctrl-imx-scmi.c 
b/drivers/pinctrl/nxp/pinctrl-imx-scmi.c
index 0ed971369a3..dbd6ff437e5 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx-scmi.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx-scmi.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "pinctrl-imx.h"
@@ -150,3 +151,9 @@ U_BOOT_DRIVER(scmi_pinctrl_imx) = {
.ops = &imx_scmi_pinctrl_ops,
.flags = DM_FLAG_PRE_RELOC,
 };
+
+static struct scmi_proto_match match = {
+   .proto_id = SCMI_PROTOCOL_ID_PINCTRL,
+};
+
+U_BOOT_SCMI_PROTO_DRIVER(scmi_pinctrl_imx, &match);
diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h
index 33e0e18c30d..d6586eb3ff9 100644
--- a/include/scmi_agent-uclass.h
+++ b/include/scmi_agent-uclass.h
@@ -27,6 +27,7 @@ struct scmi_channel;
  * @clock_dev: SCMI clock protocol device
  * @resetdom_dev:  SCMI reset domain protocol device
  * @voltagedom_dev:SCMI voltage domain protocol device
+ * @pinctrl_dev:   SCMI pin control protocol device
  */
 struct scmi_agent_priv {
u32 version;
@@ -43,6 +44,7 @@ struct scmi_agent_priv {
struct udevice *clock_dev;
struct udevice *resetdom_dev;
struct udevice *voltagedom_dev;
+   struct udevice *pinctrl_dev;
 };
 
 static inline u32 scmi_version(struct udevice *dev)
@@ -115,4 +117,19 @@ struct scmi_agent_ops {
   struct scmi_msg *msg);
 };
 
+struct scmi_proto_match {
+   unsigned int proto_id;
+};
+
+struct scmi_proto_driver {
+   struct driver *driver;
+   const struct scmi_proto_match *match;
+};
+
+#define U_BOOT_SCMI_PROTO_DRIVER(__name, __match) \
+   ll_entry_declare(struct scmi_proto_driver, __name, scmi_proto_driver) = 
{ \
+   .driver = llsym(struct driver, __name, driver), \
+   .match = __match, \
+   }
+
 #endif /* _SCMI_TRANSPORT_UCLASS_H */

-- 
2.43.0



[PATCH v8 05/19] scmi_protocols: add SCMI Performance domain management protocol message IDs

2025-03-21 Thread Alice Guo (OSS)
From: Peng Fan 

SCMI Performance domain management protocol is intended for performance
management of groups of devices or APs that run in the same performance
domain. The functionality provided by the callee-side can be used by
passing the corresponding message_id.

Signed-off-by: Peng Fan 
Signed-off-by: Alice Guo 
Reviewed-by: Ye Li 
---
 include/scmi_protocols.h | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 06de4a601f8..34f272c448c 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -1046,4 +1046,22 @@ struct scmi_pinctrl_config_set_out {
s32 status;
 };
 
+/* SCMI Perf Protocol */
+enum scmi_perf_message_id {
+   SCMI_PERF_DOMAIN_ATTRIBUTES = 0x3,
+   SCMI_PERF_DESCRIBE_LEVELS = 0x4,
+   SCMI_PERF_LIMITS_SET = 0x5,
+   SCMI_PERF_LIMITS_GET = 0x6,
+   SCMI_PERF_LEVEL_SET = 0x7,
+   SCMI_PERF_LEVEL_GET = 0x8
+};
+
+struct scmi_perf_in {
+   u32 domain_id;
+   u32 perf_level;
+};
+
+struct scmi_perf_out {
+   s32 status;
+};
 #endif /* _SCMI_PROTOCOLS_H */

-- 
2.43.0



[PATCH v8 07/19] clk: scmi: check the clock state/parent/rate control permissions

2025-03-21 Thread Alice Guo (OSS)
From: Alice Guo 

Clock driver based on SCMI clock management protocol in Linux checks
clock state, parent and rate control permissions. To be consistent with
the kernel driver, add this check here.

When using common clock framework (CCF), use the clock signal ID to get
the clock registered by clk_register() in scmi_clk_probe(), and then
obatin the struct clk_scmi variable with container_of().

Signed-off-by: Alice Guo 
Signed-off-by: Ye Li 
Reviewed-by: Peng Fan 
---
 drivers/clk/clk_scmi.c   | 173 +++
 include/scmi_protocols.h |  24 +++
 2 files changed, 185 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index 84333cdd0cc..d120c1eba06 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -12,6 +12,56 @@
 #include 
 #include 
 
+struct clk_scmi {
+   struct clk clk;
+   u32 ctrl_flags;
+};
+
+static int scmi_clk_get_permissions(struct udevice *dev, int clkid, u32 *perm)
+{
+   u32 version;
+   int ret;
+
+   struct scmi_clk_get_permissions_in in = {
+   .clock_id = clkid,
+   };
+   struct scmi_clk_get_permissions_out out;
+   struct scmi_msg msg = {
+   .protocol_id = SCMI_PROTOCOL_ID_CLOCK,
+   .message_id = SCMI_CLOCK_GET_PERMISSIONS,
+   .in_msg = (u8 *)&in,
+   .in_msg_sz = sizeof(in),
+   .out_msg = (u8 *)&out,
+   .out_msg_sz = sizeof(out),
+   };
+
+   ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK, 
&version);
+   if (ret) {
+   log_debug("%s: get SCMI clock management protocol version 
failed\n", __func__);
+   return ret;
+   }
+
+   if (version < CLOCK_PROTOCOL_VERSION_3_0) {
+   log_debug("%s: SCMI clock management protocol version is less 
than 3.0.\n", __func__);
+   return -EINVAL;
+   }
+
+   ret = devm_scmi_process_msg(dev, &msg);
+   if (ret) {
+   log_debug("%s: get SCMI clock management protocol permissions 
failed\n", __func__);
+   return ret;
+   }
+
+   ret = scmi_to_linux_errno(out.status);
+   if (ret < 0) {
+   log_debug("%s: the status code of getting permissions: %d\n", 
__func__, ret);
+   return ret;
+   }
+
+   *perm = out.permissions;
+   return 0;
+}
+
 static int scmi_clk_get_num_clock(struct udevice *dev, size_t *num_clocks)
 {
struct scmi_clk_protocol_attr_out out;
@@ -32,7 +82,8 @@ static int scmi_clk_get_num_clock(struct udevice *dev, size_t 
*num_clocks)
return 0;
 }
 
-static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name)
+static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name,
+u32 *attr)
 {
struct scmi_clk_attribute_in in = {
.clock_id = clkid,
@@ -53,6 +104,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int 
clkid, char **name)
return ret;
 
*name = strdup(out.clock_name);
+   *attr = out.attributes;
 
return 0;
 }
@@ -78,12 +130,48 @@ static int scmi_clk_gate(struct clk *clk, int enable)
 
 static int scmi_clk_enable(struct clk *clk)
 {
-   return scmi_clk_gate(clk, 1);
+   struct clk_scmi *clkscmi;
+   struct clk *c;
+   int ret;
+
+   if (!CONFIG_IS_ENABLED(CLK_CCF))
+   return scmi_clk_gate(clk, 1);
+
+   ret = clk_get_by_id(clk->id, &c);
+   if (ret)
+   return ret;
+
+   clkscmi = container_of(c, struct clk_scmi, clk);
+
+   if (clkscmi->ctrl_flags & SUPPORT_CLK_STAT_CONTROL)
+   return scmi_clk_gate(clk, 1);
+
+   /* Following Linux drivers/clk/clk-scmi.c, directly return 0 if agent 
has no permission. */
+   log_debug("%s: SCMI CLOCK: the clock cannot be enabled by the 
agent.\n", __func__);
+   return 0;
 }
 
 static int scmi_clk_disable(struct clk *clk)
 {
-   return scmi_clk_gate(clk, 0);
+   struct clk_scmi *clkscmi;
+   struct clk *c;
+   int ret;
+
+   if (!CONFIG_IS_ENABLED(CLK_CCF))
+   return scmi_clk_gate(clk, 0);
+
+   ret = clk_get_by_id(clk->id, &c);
+   if (ret)
+   return ret;
+
+   clkscmi = container_of(c, struct clk_scmi, clk);
+
+   if (clkscmi->ctrl_flags & SUPPORT_CLK_STAT_CONTROL)
+   return scmi_clk_gate(clk, 0);
+
+   /* Following Linux drivers/clk/clk-scmi.c, directly return 0 if agent 
has no permission. */
+   log_debug("%s: SCMI CLOCK: the clock cannot be disabled by the 
agent.\n", __func__);
+   return 0;
 }
 
 static ulong scmi_clk_get_rate(struct clk *clk)
@@ -108,7 +196,7 @@ static ulong scmi_clk_get_rate(struct clk *clk)
return (ulong)(((u64)out.rate_msb << 32) | out.rate_lsb);
 }
 
-static ulong scmi_clk_set_rate(struct clk *clk, ulong rate)
+static ulong __scmi_clk_set_rate(struct clk *clk, ulong

[PATCH v8 16/19] imx: container: add V2X container support for i.MX95

2025-03-21 Thread Alice Guo (OSS)
From: Ye Li 

This patch adds V2X container support for i.MX95. Since V2X container
may not be included in ahab-container.img of i.MX95, check if V2X
container exists in order to get the correct image end.

Signed-off-by: Ye Li 
Signed-off-by: Alice Guo 
Reviewed-by: Peng Fan 
---
 arch/arm/mach-imx/image-container.c | 119 
 1 file changed, 95 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-imx/image-container.c 
b/arch/arm/mach-imx/image-container.c
index 2afe9d38a06..f84e23f4b2a 100644
--- a/arch/arm/mach-imx/image-container.c
+++ b/arch/arm/mach-imx/image-container.c
@@ -41,6 +41,52 @@
 #define FUSE_IMG_SET_OFF_WORD 720
 #endif
 
+#define MAX_V2X_CTNR_IMG_NUM   (4)
+#define MIN_V2X_CTNR_IMG_NUM   (2)
+
+#define IMG_FLAGS_IMG_TYPE_SHIFT  (0u)
+#define IMG_FLAGS_IMG_TYPE_MASK   (0xfU)
+#define IMG_FLAGS_IMG_TYPE(x) (((x) & IMG_FLAGS_IMG_TYPE_MASK) >> \
+  
IMG_FLAGS_IMG_TYPE_SHIFT)
+
+#define IMG_FLAGS_CORE_ID_SHIFT   (4u)
+#define IMG_FLAGS_CORE_ID_MASK(0xf0U)
+#define IMG_FLAGS_CORE_ID(x)  (((x) & IMG_FLAGS_CORE_ID_MASK) >> \
+  
IMG_FLAGS_CORE_ID_SHIFT)
+
+#define IMG_TYPE_V2X_PRI_FW (0x0Bu)   /* Primary V2X FW */
+#define IMG_TYPE_V2X_SND_FW (0x0Cu)   /* Secondary V2X FW */
+
+#define CORE_V2X_PRI 9
+#define CORE_V2X_SND 10
+
+static bool is_v2x_fw_container(ulong addr)
+{
+   struct container_hdr *phdr;
+   struct boot_img_t *img_entry;
+
+   phdr = (struct container_hdr *)addr;
+   if (phdr->tag != 0x87 || phdr->version != 0x0) {
+   debug("Wrong container header\n");
+   return false;
+   }
+
+   if (phdr->num_images >= MIN_V2X_CTNR_IMG_NUM && phdr->num_images <= 
MAX_V2X_CTNR_IMG_NUM) {
+   img_entry = (struct boot_img_t *)(addr + sizeof(struct 
container_hdr));
+
+   if (IMG_FLAGS_IMG_TYPE(img_entry->hab_flags) == 
IMG_TYPE_V2X_PRI_FW &&
+   IMG_FLAGS_CORE_ID(img_entry->hab_flags) == CORE_V2X_PRI) {
+   img_entry++;
+
+   if (IMG_FLAGS_IMG_TYPE(img_entry->hab_flags) == 
IMG_TYPE_V2X_SND_FW &&
+   IMG_FLAGS_CORE_ID(img_entry->hab_flags) == 
CORE_V2X_SND)
+   return true;
+   }
+   }
+
+   return false;
+}
+
 int get_container_size(ulong addr, u16 *header_length)
 {
struct container_hdr *phdr;
@@ -83,7 +129,7 @@ int get_container_size(ulong addr, u16 *header_length)
return max_offset;
 }
 
-static int get_dev_container_size(void *dev, int dev_type, unsigned long 
offset, u16 *header_length)
+static int get_dev_container_size(void *dev, int dev_type, unsigned long 
offset, u16 *header_length, bool *v2x_cntr)
 {
u8 *buf = malloc(CONTAINER_HDR_ALIGNMENT);
int ret = 0;
@@ -150,6 +196,9 @@ static int get_dev_container_size(void *dev, int dev_type, 
unsigned long offset,
 
ret = get_container_size((ulong)buf, header_length);
 
+   if (v2x_cntr)
+   *v2x_cntr = is_v2x_fw_container((ulong)buf);
+
free(buf);
 
return ret;
@@ -231,45 +280,67 @@ static unsigned long get_boot_device_offset(void *dev, 
int dev_type)
return offset;
 }
 
-static int get_imageset_end(void *dev, int dev_type)
+static ulong get_imageset_end(void *dev, int dev_type)
 {
-   unsigned long offset1 = 0, offset2 = 0;
-   int value_container[2];
+   unsigned long offset[3] = {};
+   int value_container[3] = {};
u16 hdr_length;
+   bool v2x_fw = false;
 
-   offset1 = get_boot_device_offset(dev, dev_type);
-   offset2 = CONTAINER_HDR_ALIGNMENT + offset1;
+   offset[0] = get_boot_device_offset(dev, dev_type);
 
-   value_container[0] = get_dev_container_size(dev, dev_type, offset1, 
&hdr_length);
+   value_container[0] = get_dev_container_size(dev, dev_type, offset[0], 
&hdr_length, NULL);
if (value_container[0] < 0) {
printf("Parse seco container failed %d\n", value_container[0]);
-   return value_container[0];
+   return 0;
}
 
debug("seco container size 0x%x\n", value_container[0]);
 
-   value_container[1] = get_dev_container_size(dev, dev_type, offset2, 
&hdr_length);
-   if (value_container[1] < 0) {
-   debug("Parse scu container failed %d, only seco container\n",
- value_container[1]);
-   /* return seco container total size */
-   return value_container[0] + offset1;
+   if (is_imx95()) {
+   offset[1] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + 
offset[0];
+
+   value_container[1] = get_dev_container_size(dev, dev_type, 
offset[1], &hdr_length, &v2x_fw);
+   if (value_container[1] < 0) {
+   printf("Parse v2x container failed %d\n"

[PATCH v8 17/19] doc: imx: add document for i.MX95 Image Container Format

2025-03-21 Thread Alice Guo (OSS)
From: Alice Guo 

This patch add a document for i.MX95 Image Container Format.

Signed-off-by: Alice Guo 
---
 doc/imx/imx95_container.txt | 136 
 1 file changed, 136 insertions(+)

diff --git a/doc/imx/imx95_container.txt b/doc/imx/imx95_container.txt
new file mode 100644
index 000..2ad57345069
--- /dev/null
+++ b/doc/imx/imx95_container.txt
@@ -0,0 +1,136 @@
+i.MX95 Image Container Format
+-
+
+The image container set consists of some image containers, and image container
+contains boot images. Each image container has its own container header which 
is
+defined in Figure 1. All container headers are placed together in a continuous
+8KB space at the beginning of the image container set - image container set 
header.
+
+ROM code addresses image containers in image container set one by one based on
+their headers’ order in image container set header.
+
+If ELE container exists, its container header must be the 1st one in the image
+container set header.
+
+If V2X container exists, its container header must be the 2nd one in the image
+container set header. V2X must be combined with ELE container.
+
+The information of boot images are recorded in image container header. System
+ROM code needs to retrieve the information from the image container header, 
like
+the offset on boot source, the target address in RAM, the length of boot image.
+The order of ROM code handling these boot images is based on the order of each
+boot image information present in image container header.
+
+Figure 1:
+--- 
+--+--+--+--+
+  ^ |Tag   |Length|Length|Version  
 |
+  | 
+--+--+--+--+
+  | |   Flags  
 |
+  | 
+--+--+--+--+
+  | |# of Images   |Fuse version  |SW version  
 |
+Image | 
+--+--+--+--+
+Conatiner | |Reserved |Signature Block Offset  
 |
+Header| --- 
+--+--+--+--+
+  |   ^ |Image0: Offset, Size, LoadAddr, EntryPoint, Flags, Hash, 
IV|
+  |   | 
+--+--+--+--+
+  | Image | |Image1: Offset, Size, LoadAddr, EntryPoint, Flags, Hash, 
IV|
+  | Array | 
+--+--+--+--+
+  |   | |...   
 |
+  |   | 
+--+--+--+--+
+  v   v |ImageN: Offset, Size, LoadAddr, EntryPoint, Flags, Hash, 
IV|
+--- 
+--+--+--+--+
+|...   
 |
+--- 
+--+--+--+--+ <-- SignOffset
+  ^ |Tag   |Length|Length|Version  
 |
+  | 
+--+--+--+--+
+  | |SRK table offset |Certificate Offset  
 |
+  | 
+--+--+--+--+
+  | |Blob Offset  |Signature Offset
 |
+  | 
+--+--+--+--+
+Signature | | SRK Table
 |
+Block | 
+--+--+--+--+
+  | | Signature
 |
+  | 
+--+--+--+--+
+  | |   Certificate (optional) 
 |
+  | 
+--+--+--+--+
+  v |  Blob (optional) 
 |
+--- 
+--+--+--+--+
+|...   
 |
+
+--+--+--+--+ <-- Image0Offset
+|   Image0 
 |
+
+--+--+--+--+
+|...   
 |
+
+--+--+--+--+ <-- ImageNOffset
+|   ImageN 
 |

[PATCH v8 06/19] clk: scmi: add the command CLOCK_PARENT_SET

2025-03-21 Thread Alice Guo (OSS)
From: Peng Fan 

This patch adds the command CLOCK_PARENT_SET that can be used to set the
parent of a clock. ARM SCMI Version 3.2 supports to change the parent of
a clock device.

Signed-off-by: Peng Fan 
Signed-off-by: Alice Guo 
Reviewed-by: Ye Li 
---
 drivers/clk/clk_scmi.c   | 20 
 include/scmi_protocols.h | 19 +++
 2 files changed, 39 insertions(+)

diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index e42d2032d45..84333cdd0cc 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -178,11 +178,31 @@ static int scmi_clk_probe(struct udevice *dev)
return 0;
 }
 
+static int scmi_clk_set_parent(struct clk *clk, struct clk *parent)
+{
+   struct scmi_clk_parent_set_in in = {
+   .clock_id = clk->id,
+   .parent_clk = parent->id,
+   };
+   struct scmi_clk_parent_set_out out;
+   struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
+ SCMI_CLOCK_PARENT_SET,
+ in, out);
+   int ret;
+
+   ret = devm_scmi_process_msg(clk->dev, &msg);
+   if (ret < 0)
+   return ret;
+
+   return scmi_to_linux_errno(out.status);
+}
+
 static const struct clk_ops scmi_clk_ops = {
.enable = scmi_clk_enable,
.disable = scmi_clk_disable,
.get_rate = scmi_clk_get_rate,
.set_rate = scmi_clk_set_rate,
+   .set_parent = scmi_clk_set_parent,
 };
 
 U_BOOT_DRIVER(scmi_clock) = {
diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 34f272c448c..342a65ae7f4 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -737,6 +737,7 @@ enum scmi_clock_message_id {
SCMI_CLOCK_RATE_SET = 0x5,
SCMI_CLOCK_RATE_GET = 0x6,
SCMI_CLOCK_CONFIG_SET = 0x7,
+   SCMI_CLOCK_PARENT_SET = 0xD,
 };
 
 #define SCMI_CLK_PROTO_ATTR_COUNT_MASK GENMASK(15, 0)
@@ -839,6 +840,24 @@ struct scmi_clk_rate_set_out {
s32 status;
 };
 
+/**
+ * struct scmi_clk_parent_state_in - Message payload for CLOCK_PARENT_SET 
command
+ * @clock_id:  SCMI clock ID
+ * @parent_clk:SCMI clock ID
+ */
+struct scmi_clk_parent_set_in {
+   u32 clock_id;
+   u32 parent_clk;
+};
+
+/**
+ * struct scmi_clk_parent_set_out - Response payload for CLOCK_PARENT_SET 
command
+ * @status:SCMI command status
+ */
+struct scmi_clk_parent_set_out {
+   s32 status;
+};
+
 /*
  * SCMI Reset Domain Protocol
  */

-- 
2.43.0



[PATCH v8 09/19] scmi_protocols: update struct scmi_base_discover_list_protocols_out

2025-03-21 Thread Alice Guo (OSS)
From: Ye Li 

@protocols is an array of protocol identifiers that are implemented,
excluding the Base protocol. The number of elements of @protocols is
specified by callee-side.

Signed-off-by: Ye Li 
Signed-off-by: Alice Guo 
---
 drivers/firmware/scmi/base.c | 24 +---
 include/scmi_protocols.h |  2 +-
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/firmware/scmi/base.c b/drivers/firmware/scmi/base.c
index f4e3974ff5b..3943d90fd40 100644
--- a/drivers/firmware/scmi/base.c
+++ b/drivers/firmware/scmi/base.c
@@ -258,7 +258,7 @@ static int scmi_base_discover_impl_version_int(struct 
udevice *dev,
 static int scmi_base_discover_list_protocols_int(struct udevice *dev,
 u8 **protocols)
 {
-   struct scmi_base_discover_list_protocols_out out;
+   struct scmi_base_discover_list_protocols_out *out;
int cur;
struct scmi_msg msg = {
.protocol_id = SCMI_PROTOCOL_ID_BASE,
@@ -268,7 +268,7 @@ static int scmi_base_discover_list_protocols_int(struct 
udevice *dev,
.out_msg = (u8 *)&out,
.out_msg_sz = sizeof(out),
};
-   u32 num_agents, num_protocols;
+   u32 num_agents, num_protocols, out_size;
u8 *buf;
int i, ret;
 
@@ -276,22 +276,31 @@ static int scmi_base_discover_list_protocols_int(struct 
udevice *dev,
if (ret)
return ret;
 
+   out_size = sizeof(*out) + sizeof(u32) * (1 + (num_protocols - 1) / 4);
+   out = calloc(1, out_size);
+   if (!out)
+   return -ENOMEM;
+   msg.out_msg = (u8 *)out;
+   msg.out_msg_sz = out_size;
+
buf = calloc(sizeof(u8), num_protocols);
-   if (!buf)
+   if (!buf) {
+   free(out);
return -ENOMEM;
+   }
 
cur = 0;
do {
ret = devm_scmi_process_msg(dev, &msg);
if (ret)
goto err;
-   if (out.status) {
-   ret = scmi_to_linux_errno(out.status);
+   if (out->status) {
+   ret = scmi_to_linux_errno(out->status);
goto err;
}
 
-   for (i = 0; i < out.num_protocols; i++, cur++)
-   buf[cur] = out.protocols[i / 4] >> ((i % 4) * 8);
+   for (i = 0; i < out->num_protocols; i++, cur++)
+   buf[cur] = out->protocols[i / 4] >> ((i % 4) * 8);
} while (cur < num_protocols);
 
*protocols = buf;
@@ -299,6 +308,7 @@ static int scmi_base_discover_list_protocols_int(struct 
udevice *dev,
return num_protocols;
 err:
free(buf);
+   free(out);
 
return ret;
 }
diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 519b906b4ce..9046de7e3e7 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -145,7 +145,7 @@ struct scmi_base_discover_impl_version_out {
 struct scmi_base_discover_list_protocols_out {
s32 status;
u32 num_protocols;
-   u32 protocols[3];
+   u32 protocols[];
 };
 
 /**

-- 
2.43.0



[PATCH v8 18/19] imx95_evk: add i.MX95 19x19 EVK board basic support

2025-03-21 Thread Alice Guo (OSS)
From: Ye Li 

This patch adds i.MX95 19x19 EVK board basic support.

Messaging unit for EdgeLock Secure Enclave, messaging unit for System
Manager, uSDHC for SD Card, gpio, lpuart are supported now.

Signed-off-by: Ye Li 
Signed-off-by: Alice Guo 
Reviewed-by: Peng Fan 
---
 arch/arm/dts/imx95-19x19-evk-u-boot.dtsi  |  62 ++
 arch/arm/dts/imx95-u-boot.dtsi| 157 ++
 arch/arm/mach-imx/imx9/Kconfig|   8 ++
 arch/arm/mach-imx/imx9/scmi/container.cfg |  10 ++
 arch/arm/mach-imx/imx9/scmi/imximage.cfg  |  15 +++
 board/freescale/imx95_evk/Kconfig |  12 ++
 board/freescale/imx95_evk/MAINTAINERS |   6 +
 board/freescale/imx95_evk/Makefile|  11 ++
 board/freescale/imx95_evk/imx95_19x19_evk.env |  91 +++
 board/freescale/imx95_evk/imx95_evk.c |  36 ++
 board/freescale/imx95_evk/spl.c   |  69 +++
 configs/imx95_19x19_evk_defconfig | 152 +
 doc/board/nxp/imx95_evk.rst   | 114 +++
 doc/board/nxp/index.rst   |   1 +
 include/configs/imx95_evk.h   |  24 
 15 files changed, 768 insertions(+)

diff --git a/arch/arm/dts/imx95-19x19-evk-u-boot.dtsi 
b/arch/arm/dts/imx95-19x19-evk-u-boot.dtsi
new file mode 100644
index 000..2d1f02baa5f
--- /dev/null
+++ b/arch/arm/dts/imx95-19x19-evk-u-boot.dtsi
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+#include "imx95-u-boot.dtsi"
+
+&lpuart1 {
+   bootph-pre-ram;
+};
+
+®_usdhc2_vmmc {
+   bootph-pre-ram;
+};
+
+&usdhc1 {
+   bootph-pre-ram;
+};
+
+&usdhc2 {
+   bootph-pre-ram;
+};
+
+&wdog3 {
+   status = "disabled";
+};
+
+&pinctrl_uart1 {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc1 {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_100mhz {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc1_200mhz {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc2 {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_100mhz {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_200mhz {
+   bootph-pre-ram;
+};
+
+&pinctrl_usdhc2_gpio {
+   bootph-pre-ram;
+};
+
+&pinctrl_reg_usdhc2_vmmc {
+   bootph-pre-ram;
+};
diff --git a/arch/arm/dts/imx95-u-boot.dtsi b/arch/arm/dts/imx95-u-boot.dtsi
new file mode 100644
index 000..84361d215e2
--- /dev/null
+++ b/arch/arm/dts/imx95-u-boot.dtsi
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+/ {
+   binman {
+   multiple-images;
+
+   m33-oei-ddrfw {
+   pad-byte = <0x00>;
+   align-size = <0x8>;
+   filename = "m33-oei-ddrfw.bin";
+
+   oei-m33-ddr {
+   align-size = <0x4>;
+   filename = "oei-m33-ddr.bin";
+   type = "blob-ext";
+   };
+
+   imx-lpddr {
+   type = "nxp-header-ddrfw";
+
+   imx-lpddr-imem {
+   filename = "lpddr5_imem_v202311.bin";
+   type = "blob-ext";
+   };
+
+   imx-lpddr-dmem {
+   filename = "lpddr5_dmem_v202311.bin";
+   type = "blob-ext";
+   };
+   };
+
+   imx-lpddr-qb {
+   type = "nxp-header-ddrfw";
+
+   imx-lpddr-imem-qb {
+   filename = "lpddr5_imem_qb_v202311.bin";
+   type = "blob-ext";
+   };
+
+   imx-lpddr-dmem-qb {
+   filename = "lpddr5_dmem_qb_v202311.bin";
+   type = "blob-ext";
+   };
+   };
+   };
+
+   imx-boot {
+   filename = "flash.bin";
+   pad-byte = <0x00>;
+
+   spl {
+   align = <0x400>;
+   align-size = <0x400>;
+   type = "mkimage";
+   args = "-n spl/u-boot-spl.cfgout -T imx8image";
+   };
+
+   u-boot {
+   type = "mkimage";
+   args = "-n u-boot-container.cfgout -T 
imx8image";
+   };
+   };
+   };
+};
+
+&aips1 {
+   bootph-all;
+};
+
+&aips2 {
+   bootph-all;
+};
+
+&aips3 {
+   bootph-pre-ram;
+};
+
+&clk_ext1 {
+   bootph-all;
+};
+
+&elemu1 {
+ 

[PATCH v8 19/19] Makefile: add some files to CLEAN_FILES

2025-03-21 Thread Alice Guo (OSS)
From: Alice Guo 

When building the flash.bin of i.MX95 with binman,
mkimage.imx-boot.spl, mkimage.imx-boot.u-boot,
mkimage-out.imx-boot.spl and mkimage-out.imx-boot.u-boot are created.
Add these files to CLEAN_FILES so that they can be removed when running
"make clean".

Signed-off-by: Alice Guo 
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ea6ca427496..cc02c8dd59f 100644
--- a/Makefile
+++ b/Makefile
@@ -2229,7 +2229,8 @@ CLEAN_FILES += include/autoconf.mk* include/bmp_logo.h 
include/bmp_logo_data.h \
   itb.fit.fit itb.fit.itb itb.map spl.map mkimage-out.rom.mkimage \
   mkimage.rom.mkimage mkimage-in-simple-bin* rom.map simple-bin* \
   idbloader-spi.img lib/efi_loader/helloworld_efi.S *.itb \
-  Test* capsule*.*.efi-capsule capsule*.map
+  Test* capsule*.*.efi-capsule capsule*.map mkimage.imx-boot.spl \
+  mkimage.imx-boot.u-boot mkimage-out.imx-boot.spl 
mkimage-out.imx-boot.u-boot
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl vpl \

-- 
2.43.0



Re: [PATCH v5 45/46] acpi: Support checking checksums

2025-03-21 Thread Heinrich Schuchardt

On 21.03.25 11:49, Heinrich Schuchardt wrote:

On 15.03.25 15:26, Simon Glass wrote:

When the ACPI tables come from an earlier bootloader it is helpful to
see whether the checksums are correct or not. Add a -c flag to the
'acpi list' command to support that.

Signed-off-by: Simon Glass 
---

(no changes since v3)

Changes in v3:
- Add new patch to support checking checksums with ACPI command

  cmd/acpi.c | 57 +++---
  doc/usage/cmd/acpi.rst | 20 ++-
  test/dm/acpi.c | 46 ++
  3 files changed, 102 insertions(+), 21 deletions(-)

diff --git a/cmd/acpi.c b/cmd/acpi.c
index 2273176f106..bb243202009 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -7,6 +7,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -15,6 +16,17 @@

  DECLARE_GLOBAL_DATA_PTR;

+static const char *show_checksum(void *ptr, uint size, bool chksums)
+{
+    uint checksum;
+
+    if (!chksums)
+    return "";
+    checksum = table_compute_checksum(ptr, size);
+
+    return checksum ? "  bad" : "  OK";


Please, move the leading spaces to the printf statements below.


+}
+
  /**
   * dump_hdr() - Dump an ACPI header
   *
@@ -23,16 +35,17 @@ DECLARE_GLOBAL_DATA_PTR;
   *
   * @hdr: ACPI header to dump
   */
-static void dump_hdr(struct acpi_table_header *hdr)
+static void dump_hdr(struct acpi_table_header *hdr, bool chksums)
  {
  bool has_hdr = memcmp(hdr->signature, "FACS", ACPI_NAME_LEN);

  printf("%.*s  %16lx  %5x", ACPI_NAME_LEN, hdr->signature,
 (ulong)map_to_sysmem(hdr), hdr->length);
  if (has_hdr) {
-    printf("  v%02d %.6s %.8s %x %.4s %x\n", hdr->revision,
+    printf("  v%02d %.6s %.8s %x %.4s %x%s\n", hdr->revision,


%x results in variable length output. To avoid ragged layout, please,
define the output length.

Best regards

Heinrich


 hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
-   hdr->creator_id, hdr->creator_revision);
+   hdr->creator_id, hdr->creator_revision,
+   show_checksum(hdr, hdr->length, chksums));
  } else {
  printf("\n");
  }
@@ -52,22 +65,22 @@ static int dump_table_name(const char *sig)
  return 0;
  }

-static void list_fadt(struct acpi_fadt *fadt)
+static void list_fadt(struct acpi_fadt *fadt, bool chksums)
  {
  if (fadt->header.revision >= 3 && fadt->x_dsdt)
-    dump_hdr(nomap_sysmem(fadt->x_dsdt, 0));
+    dump_hdr(nomap_sysmem(fadt->x_dsdt, 0), chksums);
  else if (fadt->dsdt)
-    dump_hdr(nomap_sysmem(fadt->dsdt, 0));
+    dump_hdr(nomap_sysmem(fadt->dsdt, 0), chksums);
  if (!IS_ENABLED(CONFIG_X86) && !IS_ENABLED(CONFIG_SANDBOX) &&
  !(fadt->flags & ACPI_FADT_HW_REDUCED_ACPI))
  log_err("FADT not ACPI-hardware-reduced-compliant\n");
  if (fadt->header.revision >= 3 && fadt->x_firmware_ctrl)
-    dump_hdr(nomap_sysmem(fadt->x_firmware_ctrl, 0));
+    dump_hdr(nomap_sysmem(fadt->x_firmware_ctrl, 0), chksums);
  else if (fadt->firmware_ctrl)
-    dump_hdr(nomap_sysmem(fadt->firmware_ctrl, 0));
+    dump_hdr(nomap_sysmem(fadt->firmware_ctrl, 0), chksums);
  }

-static void list_rsdt(struct acpi_rsdp *rsdp)
+static void list_rsdt(struct acpi_rsdp *rsdp, bool chksums)
  {
  int len, i, count;
  struct acpi_rsdt *rsdt;
@@ -75,11 +88,11 @@ static void list_rsdt(struct acpi_rsdp *rsdp)

  if (rsdp->rsdt_address) {
  rsdt = nomap_sysmem(rsdp->rsdt_address, 0);
-    dump_hdr(&rsdt->header);
+    dump_hdr(&rsdt->header, chksums);
  }
  if (rsdp->xsdt_address) {
  xsdt = nomap_sysmem(rsdp->xsdt_address, 0);
-    dump_hdr(&xsdt->header);
+    dump_hdr(&xsdt->header, chksums);
  len = xsdt->header.length - sizeof(xsdt->header);
  count = len / sizeof(u64);
  } else if (rsdp->rsdt_address) {
@@ -100,24 +113,28 @@ static void list_rsdt(struct acpi_rsdp *rsdp)
  if (!entry)
  break;
  hdr = nomap_sysmem(entry, 0);
-    dump_hdr(hdr);
+    dump_hdr(hdr, chksums);
  if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN))
-    list_fadt((struct acpi_fadt *)hdr);
+    list_fadt((struct acpi_fadt *)hdr, chksums);
  }
  }

-static void list_rsdp(struct acpi_rsdp *rsdp)
+static void list_rsdp(struct acpi_rsdp *rsdp, bool chksums)
  {
-    printf("RSDP  %16lx  %5x  v%02d %.6s\n", (ulong)map_to_sysmem(rsdp),
-   rsdp->length, rsdp->revision, rsdp->oem_id);
-    list_rsdt(rsdp);
+    printf("RSDP  %16lx  %5x  v%02d %.6s%s%s\n",
+   (ulong)map_to_sysmem(rsdp), rsdp->length, rsdp->revision,
+   rsdp->oem_id, show_checksum(rsdp, 0x14, chksums),
+   show_checksum(rsdp, rsdp->length, chksums));
+    list_rsdt(rsdp, chksums);
  }

  static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
  char *const argv[])
  {
  struct acpi_rs

Re: [PATCH] configs: Remove duplicated bootcmd 'mmc dev ${mmcdev}'

2025-03-21 Thread Fabio Estevam
On Wed, Mar 19, 2025 at 9:40 AM Aristo Chen  wrote:
>
> The 'mmc dev ${mmcdev}' is defined twice, so remove the duplicated one
>
> Signed-off-by: Aristo Chen 

Applied to u-boot-imx/next, thanks.


Re: [PATCH] phycore_imx8mp: Rework some of the RAM related Kconfig symbols

2025-03-21 Thread Fabio Estevam
On Fri, Mar 14, 2025 at 10:30 PM Tom Rini  wrote:
>
> As the code is today, we get a warning about "select" statements on
> "choice" options not doing anything. In this case we can easily fix this
> by dropping the select line as the following choice statement handles
> things correctly. We also drop the "default false" line as false / n is
> the default.
>
> Signed-off-by: Tom Rini 
> ---
> Cc: Teresa Remmet 

Applied to u-boot-imx/next, thanks.


Re: [PATCH v5 45/46] acpi: Support checking checksums

2025-03-21 Thread Heinrich Schuchardt

On 15.03.25 15:26, Simon Glass wrote:

When the ACPI tables come from an earlier bootloader it is helpful to
see whether the checksums are correct or not. Add a -c flag to the
'acpi list' command to support that.

Signed-off-by: Simon Glass 
---

(no changes since v3)

Changes in v3:
- Add new patch to support checking checksums with ACPI command

  cmd/acpi.c | 57 +++---
  doc/usage/cmd/acpi.rst | 20 ++-
  test/dm/acpi.c | 46 ++
  3 files changed, 102 insertions(+), 21 deletions(-)

diff --git a/cmd/acpi.c b/cmd/acpi.c
index 2273176f106..bb243202009 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -7,6 +7,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -15,6 +16,17 @@

  DECLARE_GLOBAL_DATA_PTR;

+static const char *show_checksum(void *ptr, uint size, bool chksums)
+{
+   uint checksum;
+
+   if (!chksums)
+   return "";
+   checksum = table_compute_checksum(ptr, size);
+
+   return checksum ? "  bad" : "  OK";


Please, move the leading spaces to the printf statements below.


+}
+
  /**
   * dump_hdr() - Dump an ACPI header
   *
@@ -23,16 +35,17 @@ DECLARE_GLOBAL_DATA_PTR;
   *
   * @hdr: ACPI header to dump
   */
-static void dump_hdr(struct acpi_table_header *hdr)
+static void dump_hdr(struct acpi_table_header *hdr, bool chksums)
  {
bool has_hdr = memcmp(hdr->signature, "FACS", ACPI_NAME_LEN);

printf("%.*s  %16lx  %5x", ACPI_NAME_LEN, hdr->signature,
   (ulong)map_to_sysmem(hdr), hdr->length);
if (has_hdr) {
-   printf("  v%02d %.6s %.8s %x %.4s %x\n", hdr->revision,
+   printf("  v%02d %.6s %.8s %x %.4s %x%s\n", hdr->revision,


%x results in variable length output. To avoid ragged layout, please,
define the output length.

Best regards

Heinrich


   hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
-  hdr->creator_id, hdr->creator_revision);
+  hdr->creator_id, hdr->creator_revision,
+  show_checksum(hdr, hdr->length, chksums));
} else {
printf("\n");
}
@@ -52,22 +65,22 @@ static int dump_table_name(const char *sig)
return 0;
  }

-static void list_fadt(struct acpi_fadt *fadt)
+static void list_fadt(struct acpi_fadt *fadt, bool chksums)
  {
if (fadt->header.revision >= 3 && fadt->x_dsdt)
-   dump_hdr(nomap_sysmem(fadt->x_dsdt, 0));
+   dump_hdr(nomap_sysmem(fadt->x_dsdt, 0), chksums);
else if (fadt->dsdt)
-   dump_hdr(nomap_sysmem(fadt->dsdt, 0));
+   dump_hdr(nomap_sysmem(fadt->dsdt, 0), chksums);
if (!IS_ENABLED(CONFIG_X86) && !IS_ENABLED(CONFIG_SANDBOX) &&
!(fadt->flags & ACPI_FADT_HW_REDUCED_ACPI))
log_err("FADT not ACPI-hardware-reduced-compliant\n");
if (fadt->header.revision >= 3 && fadt->x_firmware_ctrl)
-   dump_hdr(nomap_sysmem(fadt->x_firmware_ctrl, 0));
+   dump_hdr(nomap_sysmem(fadt->x_firmware_ctrl, 0), chksums);
else if (fadt->firmware_ctrl)
-   dump_hdr(nomap_sysmem(fadt->firmware_ctrl, 0));
+   dump_hdr(nomap_sysmem(fadt->firmware_ctrl, 0), chksums);
  }

-static void list_rsdt(struct acpi_rsdp *rsdp)
+static void list_rsdt(struct acpi_rsdp *rsdp, bool chksums)
  {
int len, i, count;
struct acpi_rsdt *rsdt;
@@ -75,11 +88,11 @@ static void list_rsdt(struct acpi_rsdp *rsdp)

if (rsdp->rsdt_address) {
rsdt = nomap_sysmem(rsdp->rsdt_address, 0);
-   dump_hdr(&rsdt->header);
+   dump_hdr(&rsdt->header, chksums);
}
if (rsdp->xsdt_address) {
xsdt = nomap_sysmem(rsdp->xsdt_address, 0);
-   dump_hdr(&xsdt->header);
+   dump_hdr(&xsdt->header, chksums);
len = xsdt->header.length - sizeof(xsdt->header);
count = len / sizeof(u64);
} else if (rsdp->rsdt_address) {
@@ -100,24 +113,28 @@ static void list_rsdt(struct acpi_rsdp *rsdp)
if (!entry)
break;
hdr = nomap_sysmem(entry, 0);
-   dump_hdr(hdr);
+   dump_hdr(hdr, chksums);
if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN))
-   list_fadt((struct acpi_fadt *)hdr);
+   list_fadt((struct acpi_fadt *)hdr, chksums);
}
  }

-static void list_rsdp(struct acpi_rsdp *rsdp)
+static void list_rsdp(struct acpi_rsdp *rsdp, bool chksums)
  {
-   printf("RSDP  %16lx  %5x  v%02d %.6s\n", (ulong)map_to_sysmem(rsdp),
-  rsdp->length, rsdp->revision, rsdp->oem_id);
-   list_rsdt(rsdp);
+   printf("RSDP  %16lx  %5x  v%02d %.6s%s%s\n",
+  (ulong)map_to_sysmem(rsdp), rsdp->length, rsdp->revision,
+  rsdp->oem_id, s

Re: [RFC PATCH] cmd: fwu: Dump custom fields from mdata structure

2025-03-21 Thread Michal Simek




On 3/21/25 08:40, Sughosh Ganu wrote:

On Wed, 5 Jun 2024 at 20:25, Michal Simek  wrote:


The commit cb9ae40a16f0 ("tools: mkfwumdata: add logic to append vendor
data to the FWU metadata") added support for adding vendor data to mdata
structure but it is not visible anywhere that's why extend fwu command to
dump it.

Signed-off-by: Michal Simek 
---


Looks good. Just a couple of nits.



I am using this for some time to check various configurations that's why it
can be useful for others too.
Sughosh: Maybe there is better way how to dump it.
---
  cmd/fwu_mdata.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c
index 9c048d69a131..ff6435505167 100644
--- a/cmd/fwu_mdata.c
+++ b/cmd/fwu_mdata.c
@@ -7,6 +7,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -45,6 +46,30 @@ static void print_mdata(struct fwu_data *data)
img_info->accepted == 0x1 ? "yes" : "no");
 }
 }
+
+   if (data->version == 2) {
+   struct fwu_mdata *mdata = data->fwu_mdata;
+   struct fwu_fw_store_desc *desc;
+   void *end;
+   u32 diff;
+
+   /*
+* fwu_mdata defines only header that's why taking it as array
+* which exactly point to image description location
+*/
+   desc = (struct fwu_fw_store_desc *)&mdata[1];
+
+   /* Number of entries is taken from for loop - variable i */
+   end = &desc->img_entry[i];
+   debug("mdata %p, desc %p, end %p\n", mdata, desc, end);
+
+   diff = data->metadata_size - ((void *)end - (void *)mdata);
+   if (diff) {
+   printf("Custom fields covered by CRC 0x%x\n", diff);


It would be better to mention that the value being printed is the
length of the vendor data. Or not print the value.



printf("Custom fields covered by CRC len: 0x%x\n", diff);




+   print_hex_dump_bytes("CUSTOM ", DUMP_PREFIX_OFFSET,
+end, diff);
+   }


Would be better to do a 'select HEXDUMP if FWU_MDATA_V2' under the
CMD_FWU_METADATA config.


I think select is too hard here because hexdump is implementing empty function 
if HEXDUMP is not enabled.


imply HEXDUMP if FWU_MDATA_V2

Thanks,
Michal


Re: [RFC PATCH] cmd: fwu: Dump custom fields from mdata structure

2025-03-21 Thread Sughosh Ganu
On Fri, 21 Mar 2025 at 14:09, Michal Simek  wrote:
>
>
>
> On 3/21/25 08:40, Sughosh Ganu wrote:
> > On Wed, 5 Jun 2024 at 20:25, Michal Simek  wrote:
> >>
> >> The commit cb9ae40a16f0 ("tools: mkfwumdata: add logic to append vendor
> >> data to the FWU metadata") added support for adding vendor data to mdata
> >> structure but it is not visible anywhere that's why extend fwu command to
> >> dump it.
> >>
> >> Signed-off-by: Michal Simek 
> >> ---
> >
> > Looks good. Just a couple of nits.
> >
> >>
> >> I am using this for some time to check various configurations that's why it
> >> can be useful for others too.
> >> Sughosh: Maybe there is better way how to dump it.
> >> ---
> >>   cmd/fwu_mdata.c | 25 +
> >>   1 file changed, 25 insertions(+)
> >>
> >> diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c
> >> index 9c048d69a131..ff6435505167 100644
> >> --- a/cmd/fwu_mdata.c
> >> +++ b/cmd/fwu_mdata.c
> >> @@ -7,6 +7,7 @@
> >>   #include 
> >>   #include 
> >>   #include 
> >> +#include 
> >>   #include 
> >>   #include 
> >>   #include 
> >> @@ -45,6 +46,30 @@ static void print_mdata(struct fwu_data *data)
> >> img_info->accepted == 0x1 ? "yes" : "no");
> >>  }
> >>  }
> >> +
> >> +   if (data->version == 2) {
> >> +   struct fwu_mdata *mdata = data->fwu_mdata;
> >> +   struct fwu_fw_store_desc *desc;
> >> +   void *end;
> >> +   u32 diff;
> >> +
> >> +   /*
> >> +* fwu_mdata defines only header that's why taking it as 
> >> array
> >> +* which exactly point to image description location
> >> +*/
> >> +   desc = (struct fwu_fw_store_desc *)&mdata[1];
> >> +
> >> +   /* Number of entries is taken from for loop - variable i */
> >> +   end = &desc->img_entry[i];
> >> +   debug("mdata %p, desc %p, end %p\n", mdata, desc, end);
> >> +
> >> +   diff = data->metadata_size - ((void *)end - (void *)mdata);
> >> +   if (diff) {
> >> +   printf("Custom fields covered by CRC 0x%x\n", 
> >> diff);
> >
> > It would be better to mention that the value being printed is the
> > length of the vendor data. Or not print the value.
>
>
> printf("Custom fields covered by CRC len: 0x%x\n", diff);
>
> >
> >> +   print_hex_dump_bytes("CUSTOM ", DUMP_PREFIX_OFFSET,
> >> +end, diff);
> >> +   }
> >
> > Would be better to do a 'select HEXDUMP if FWU_MDATA_V2' under the
> > CMD_FWU_METADATA config.
>
> I think select is too hard here because hexdump is implementing empty function
> if HEXDUMP is not enabled.
>
> imply HEXDUMP if FWU_MDATA_V2

Fine with me.

-sughosh


Re: [PATCH v5 44/46] test: acpi: Correct memory leaks

2025-03-21 Thread Heinrich Schuchardt

On 15.03.25 15:26, Simon Glass wrote:

Free the memory used in tests to avoid a leak. Also unmap the addresses
for sandbox.

Signed-off-by: Simon Glass 


Reviewed-by: Heinrich Schuchardt 


---

(no changes since v3)

Changes in v3:
- Add new patch to correct memory leaks in the ACPI test

  test/dm/acpi.c | 13 +
  1 file changed, 13 insertions(+)

diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 39a26bbb492..f98f9d1e74b 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -309,6 +309,8 @@ static int dm_test_acpi_write_tables(struct unit_test_state 
*uts)
}
ut_asserteq(0, ctx.rsdt->entry[3]);
ut_asserteq(0, ctx.xsdt->entry[3]);
+   unmap_sysmem(buf);
+   free(buf);

return 0;
  }
@@ -386,6 +388,8 @@ static int dm_test_acpi_ctx_and_base_tables(struct 
unit_test_state *uts)

ut_asserteq(nomap_to_sysmem(rsdt), rsdp->rsdt_address);
ut_asserteq(nomap_to_sysmem(xsdt), rsdp->xsdt_address);
+   unmap_sysmem(buf);
+   free(buf);

return 0;
  }
@@ -428,6 +432,8 @@ static int dm_test_acpi_cmd_list(struct unit_test_state 
*uts)
ut_assert_nextline("DMAR  %16lx  %5zx  v01 U-BOOT U-BOOTBL %x INTL 0",
   addr, sizeof(struct acpi_dmar), OEM_REVISION);
ut_assert_console_end();
+   unmap_sysmem(buf);
+   free(buf);

return 0;
  }
@@ -458,6 +464,8 @@ static int dm_test_acpi_cmd_dump(struct unit_test_state 
*uts)
ut_assert_nextline("DMAR @ %16lx", addr);
ut_assert_nextlines_are_dump(0x30);
ut_assert_console_end();
+   unmap_sysmem(buf);
+   free(buf);

return 0;
  }
@@ -642,6 +650,8 @@ static int dm_test_acpi_cmd_items(struct unit_test_state 
*uts)
ut_assert_nextlines_are_dump(2);
ut_assert_nextline("%s", "");
ut_assert_console_end();
+   unmap_sysmem(buf);
+   free(buf);

return 0;
  }
@@ -679,6 +689,8 @@ static int dm_test_acpi_cmd_set(struct unit_test_state *uts)
ut_asserteq(addr, gd_acpi_start());

ut_assert_console_end();
+   unmap_sysmem(buf);
+   free(buf);

return 0;
  }
@@ -774,6 +786,7 @@ static int dm_test_acpi_find_table(struct unit_test_state 
*uts)

/* Restore previous ACPI tables */
gd_set_acpi_start(acpi_start);
+   unmap_sysmem(buf);
free(buf);

return 0;




Re: [PATCH] net: remove commented out line

2025-03-21 Thread Ilias Apalodimas
On Fri, 21 Mar 2025 at 14:42, Jerome Forissier
 wrote:
>
> Commit 1d5d292b7941 ("net: split net into net{,-common,-legacy,-lwip}")
> inadvertendly left a commented out declaration for do_wget() in
> net-common.h. Remove it.
>
> Signed-off-by: Jerome Forissier 
> ---
>  include/net-common.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/include/net-common.h b/include/net-common.h
> index 29d31f37263..89679e20860 100644
> --- a/include/net-common.h
> +++ b/include/net-common.h
> @@ -518,7 +518,6 @@ int wget_do_request(ulong dst_addr, char *uri);
>   * Return: true if uri is valid, false if uri is invalid
>   */
>  bool wget_validate_uri(char *uri);
> -//int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const 
> argv[]);
>
>  /**
>   * enum wget_http_method - http method
> --
> 2.43.0
>

Reviewed-by: Ilias Apalodimas 


[PATCH v8 04/19] scmi_protocols: add SCMI misc protocol protocol_id and message_id for getting the ROM passover data

2025-03-21 Thread Alice Guo (OSS)
From: Peng Fan 

SCMI misc protocol is intended for miscellaneous functions which are
device specific and are usually defined to access bit fields. It is i.MX
specific. This patch adds SCMI misc protocol protocol_id and message_id
for getting the ROM passover data.

Signed-off-by: Peng Fan 
Signed-off-by: Alice Guo 
Reviewed-by: Ye Li 
---
 include/scmi_protocols.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 279ebbad440..06de4a601f8 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -25,6 +25,7 @@ enum scmi_std_protocol {
SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16,
SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17,
SCMI_PROTOCOL_ID_PINCTRL = 0x19,
+   SCMI_PROTOCOL_ID_IMX_MISC = 0x84,
 };
 
 enum scmi_status_code {
@@ -50,6 +51,10 @@ enum scmi_discovery_id {
SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2,
 };
 
+enum scmi_imx_misc_message_id {
+   SCMI_MISC_ROM_PASSOVER_GET = 0x7
+};
+
 /*
  * SCMI Base Protocol
  */

-- 
2.43.0



Re: [PATCH 00/52] expo: Various features and improvements

2025-03-21 Thread Simon Glass
Hi Tom,

On Thu, 20 Mar 2025 at 15:21, Tom Rini  wrote:
>
> On Thu, Mar 20, 2025 at 03:39:26AM +, Simon Glass wrote:
> > Hi Tom,
> >
> > On Wed, 19 Mar 2025 at 15:57, Tom Rini  wrote:
> > >
> > > On Wed, Mar 19, 2025 at 03:54:05PM +0100, Simon Glass wrote:
> > >
> > > > This series collects together some new features for expo to make it more
> > > > useful for boot menus:
> > > >
> > > > - measurement and display of multi-line text objects
> > > > - internal alignment for objects (e.g. centred text)
> > > > - editable strings in text fields
> > > > - new 'box' object to draw a rectangle
> > > > - highlighting of menu items, rather than just relying on a pointer
> > > >
> > > > Expo's boot menu is restructured so that it is possible to iterate
> > > > through various bootdevs and update the menu as new ones are found. This
> > > > is more in keeping with how bootstd works.
> > > >
> > > > A new textedit object is added, intended to provide a simple text
> > > > editor. Future work will complete this.
> > > >
> > > > With this series the boot menu has a better layout and appearance.
> > > >
> > > >
> > > > Simon Glass (52):
> > >
> > > I see you haven't internalized the "don't post massive series" feedback
> > > yet. Please, stop posting massive patch series. Figure out how to
> > > logically break things down in to smaller chunks that can be
> > > meaningfully reviewed.
> >
> > I could split this into two series of ~25 patches, perhaps. Would that be 
> > OK?
> >
> > I believe no one else is using expo yet, apart from postmarketOS,
> > except the trivial case of 'bootflow scan -m' but I'm hoping that will
> > change in the future. I believe that Linaro is mostly encouraging EFI
> > bootmgr and the text-based menu. That could be converted to use expo
> > but I doubt anyone has looked into that, particularly as grub is being
> > pushed as well. I did look at converting the existing menu code a year
> > or two ago, but it seemed better to eventually deprecate it.
> >
> > Also, there is a following series which I split out and will post
> > separately, but not for a while as I have a lot outstanding.
> >
>
> It would make sense to split expo out to its own series as there's not
> likely to be any feedback there. All of the other parts of the series
> already have something else in their subject and that would be logical
> places to split this up more and then assign to the appropriate
> custodian. Thanks.

This is the expo series and it only has expo patches, so I believe we
are OK there.

The bootstd series is small and its own thing.

I can split up the strim() / test series, but I'm still unsure what
you are asking for with respect to code which is not yet used. I can't
reasonably do all of a) send code only when it is needed by later
patches in the series and b) keep series sizes small and c) keep
series related to a single topic.

Regards,
Simon


Re: [PATCH V2 3/5] arm64: imx: imx8mm-beacon: Enable CPU_IMX

2025-03-21 Thread Fabio Estevam
On Thu, Mar 20, 2025 at 11:27 PM Marek Vasut  wrote:

> Yes, I know. But then, I can safely say it is desired on hardware I
> maintain, I think we could try and run a quick poll and see if others
> see it the same way ?

I think it is a good idea to imply the thermal driver at the SoC level
instead of per board.

Thanks


[GIT PULL] Please pull u-boot-dfu-20250321

2025-03-21 Thread Mattijs Korpershoek
Hi Tom,

Please find the following fix for master:

Usb gadget:
- Fix NXP UUU tool compatibility regression with dwc3 gadget

CI Job:
- https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/25275

Thanks,
Mattijs

The following changes since commit 7ad543619463e8817b3044041ac74749a217bbe0:

  board: verdin-am62: remove spl_perform_fixups (2025-03-20 08:02:12 -0600)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-dfu.git 
tags/u-boot-dfu-20250321

for you to fetch changes up to 0916053ebc566245b06d0a179533f6622b6ad392:

  usb: dwc3: gadget: Fix match_ep callback for NXP UUU tool (2025-03-21 
09:37:40 +0100)


u-boot-dfu-20250321

Usb gadget:
- Fix NXP UUU tool compatibility regression with dwc3 gadget


Marek Vasut (1):
  usb: dwc3: gadget: Fix match_ep callback for NXP UUU tool

 drivers/usb/dwc3/gadget.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)



[PATCH] net: remove commented out line

2025-03-21 Thread Jerome Forissier
Commit 1d5d292b7941 ("net: split net into net{,-common,-legacy,-lwip}")
inadvertendly left a commented out declaration for do_wget() in
net-common.h. Remove it.

Signed-off-by: Jerome Forissier 
---
 include/net-common.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/net-common.h b/include/net-common.h
index 29d31f37263..89679e20860 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -518,7 +518,6 @@ int wget_do_request(ulong dst_addr, char *uri);
  * Return: true if uri is valid, false if uri is invalid
  */
 bool wget_validate_uri(char *uri);
-//int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
 
 /**
  * enum wget_http_method - http method
-- 
2.43.0



Re: [GIT PULL] Please pull u-boot-imx-next-20250321

2025-03-21 Thread Tom Rini
On Fri, 21 Mar 2025 09:29:47 -0300, Fabio Estevam wrote:

> Please pull from u-boot-imx/next, thanks.
> 
> The following changes since commit 8bc3542384e3a1219e5ffb62b79d16dddc1b1fb9:
> 
>   Merge patch series "pxe: Precursor series for supporting read_all() in 
> extlinux / PXE" (2025-03-18 13:12:51 -0600)
> 
> are available in the Git repository at:
> 
> [...]

Merged into u-boot/next, thanks!

-- 
Tom




[PATCH 1/5] acpi: new function acpi_update_checksum()

2025-03-21 Thread Heinrich Schuchardt
Introduce a new function to update ACPI table headers.
This allows to simplify the existing code.

Signed-off-by: Heinrich Schuchardt 
---
 include/acpi/acpi_table.h | 7 +++
 lib/acpi/acpi.c   | 7 +++
 2 files changed, 14 insertions(+)

diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h
index b8b1f1338c6..f8e5f552ab1 100644
--- a/include/acpi/acpi_table.h
+++ b/include/acpi/acpi_table.h
@@ -1274,6 +1274,13 @@ ulong write_acpi_tables(ulong start);
  */
 struct acpi_table_header *acpi_find_table(const char *sig);
 
+/**
+ * acpi_update_checksum() - update ACPI table checksum
+ *
+ * @header - header of an ACPI table
+ */
+void acpi_update_checksum(struct acpi_table_header *header);
+
 #endif /* !__ACPI__*/
 
 #include 
diff --git a/lib/acpi/acpi.c b/lib/acpi/acpi.c
index f4d5c1e25d0..596301a43fe 100644
--- a/lib/acpi/acpi.c
+++ b/lib/acpi/acpi.c
@@ -6,11 +6,18 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+void acpi_update_checksum(struct acpi_table_header *header)
+{
+   header->checksum = 0;
+   header->checksum = table_compute_checksum(header, header->length);
+}
+
 struct acpi_table_header *acpi_find_table(const char *sig)
 {
struct acpi_rsdp *rsdp;
-- 
2.48.1



[PATCH 4/5] qemu-sbsa: simplify updating ACPI table header checksum

2025-03-21 Thread Heinrich Schuchardt
Use acpi_update_checksum() to update table header.

Signed-off-by: Heinrich Schuchardt 
---
 board/emulation/qemu-sbsa/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/emulation/qemu-sbsa/acpi.c b/board/emulation/qemu-sbsa/acpi.c
index ba85e08fc7d..7e4c55cc818 100644
--- a/board/emulation/qemu-sbsa/acpi.c
+++ b/board/emulation/qemu-sbsa/acpi.c
@@ -133,7 +133,7 @@ static int sbsa_write_gtdt(struct acpi_ctx *ctx, const 
struct acpi_writer *entry
gtdt->cnt_read_base = 0x;
 
// FIXME: VirtualPL2Timer
-   header->checksum = table_compute_checksum(header, header->length);
+   acpi_update_checksum(header);
 
acpi_add_table(ctx, gtdt);
 
@@ -181,7 +181,7 @@ static int acpi_write_pptt(struct acpi_ctx *ctx, const 
struct acpi_writer *entry
}
 
header->length = ctx->current - ctx->tab_start;
-   header->checksum = table_compute_checksum(header, header->length);
+   acpi_update_checksum(header);
 
acpi_inc(ctx, header->length);
acpi_add_table(ctx, header);
-- 
2.48.1



[PATCH 2/5] acpi: simplify updating header checksum

2025-03-21 Thread Heinrich Schuchardt
Use acpi_update_checksum() for updating ACPI table header checksum.

Signed-off-by: Heinrich Schuchardt 
---
 lib/acpi/acpi_table.c | 18 +++---
 lib/acpi/base.c   |  6 ++
 lib/acpi/csrt.c   |  2 +-
 lib/acpi/mcfg.c   |  2 +-
 lib/acpi/ssdt.c   |  2 +-
 5 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index c0ed24984af..b5495d48a46 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -195,9 +195,7 @@ int acpi_add_table(struct acpi_ctx *ctx, void *table)
(sizeof(u32) * (i + 1));
 
/* Re-calculate checksum */
-   rsdt->header.checksum = 0;
-   rsdt->header.checksum = table_compute_checksum((u8 *)rsdt,
-  
rsdt->header.length);
+   acpi_update_checksum(&rsdt->header);
}
 
if (ctx->xsdt) {
@@ -228,9 +226,7 @@ int acpi_add_table(struct acpi_ctx *ctx, void *table)
(sizeof(u64) * (i + 1));
 
/* Re-calculate checksum */
-   xsdt->header.checksum = 0;
-   xsdt->header.checksum = table_compute_checksum((u8 *)xsdt,
-  
xsdt->header.length);
+   acpi_update_checksum(&xsdt->header);
}
 
return 0;
@@ -268,7 +264,7 @@ int acpi_write_fadt(struct acpi_ctx *ctx, const struct 
acpi_writer *entry)
 
acpi_fill_fadt(fadt);
 
-   header->checksum = table_compute_checksum(fadt, header->length);
+   acpi_update_checksum(header);
 
return acpi_add_fadt(ctx, fadt);
 }
@@ -303,7 +299,7 @@ int acpi_write_madt(struct acpi_ctx *ctx, const struct 
acpi_writer *entry)
if (IS_ENABLED(CONFIG_ACPI_PARKING_PROTOCOL))
acpi_write_park(madt);
 
-   header->checksum = table_compute_checksum((void *)madt, header->length);
+   acpi_update_checksum(header);
acpi_add_table(ctx, madt);
ctx->current = (void *)madt + madt->header.length;
 
@@ -374,7 +370,7 @@ void acpi_create_dbg2(struct acpi_dbg2_header *dbg2,
/* Update structure lengths and checksum */
device->length = current - (uintptr_t)device;
header->length = current - (uintptr_t)dbg2;
-   header->checksum = table_compute_checksum(dbg2, header->length);
+   acpi_update_checksum(header);
 }
 
 int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev,
@@ -549,7 +545,7 @@ static int acpi_write_spcr(struct acpi_ctx *ctx, const 
struct acpi_writer *entry
spcr->baud_rate = 0;
 
/* Fix checksum */
-   header->checksum = table_compute_checksum((void *)spcr, header->length);
+   acpi_update_checksum(header);
 
acpi_add_table(ctx, spcr);
acpi_inc(ctx, spcr->header.length);
@@ -759,7 +755,7 @@ static int acpi_write_iort(struct acpi_ctx *ctx, const 
struct acpi_writer *entry
 
/* (Re)calculate length and checksum */
iort->header.length = ctx->current - (void *)iort;
-   iort->header.checksum = table_compute_checksum((void *)iort, 
iort->header.length);
+   acpi_update_checksum(&iort->header);
log_debug("IORT at %p, length %x\n", iort, iort->header.length);
 
/* Drop the table if it is empty */
diff --git a/lib/acpi/base.c b/lib/acpi/base.c
index 8b6af2bc43a..5c755b14c16 100644
--- a/lib/acpi/base.c
+++ b/lib/acpi/base.c
@@ -50,8 +50,7 @@ static void acpi_write_rsdt(struct acpi_rsdt *rsdt)
/* Entries are filled in later, we come with an empty set */
 
/* Fix checksum */
-   header->checksum = table_compute_checksum(rsdt,
- sizeof(struct acpi_rsdt));
+   acpi_update_checksum(header);
 }
 
 static void acpi_write_xsdt(struct acpi_xsdt *xsdt)
@@ -66,8 +65,7 @@ static void acpi_write_xsdt(struct acpi_xsdt *xsdt)
/* Entries are filled in later, we come with an empty set */
 
/* Fix checksum */
-   header->checksum = table_compute_checksum(xsdt,
- sizeof(struct acpi_xsdt));
+   acpi_update_checksum(header);
 }
 
 static int acpi_write_base(struct acpi_ctx *ctx,
diff --git a/lib/acpi/csrt.c b/lib/acpi/csrt.c
index 00927e53406..b863c644c07 100644
--- a/lib/acpi/csrt.c
+++ b/lib/acpi/csrt.c
@@ -40,7 +40,7 @@ int acpi_write_csrt(struct acpi_ctx *ctx, const struct 
acpi_writer *entry)
 
/* (Re)calculate length and checksum */
header->length = (ulong)ctx->current - (ulong)csrt;
-   header->checksum = table_compute_checksum(csrt, header->length);
+   acpi_update_checksum(header);
 
acpi_add_table(ctx, csrt);
 
diff --git a/lib/acpi/mcfg.c b/lib/acpi/mcfg.c
index 8b8a5bfafae..e21fe7ce123 100644
--- a/lib/acpi/mcfg.c
+++ b/lib/acpi/mcfg.c
@@ -57,7 +57,7 @@ int acpi_write_mcfg(struct acpi_ctx *ctx, const struct 
acpi

[PATCH 5/5] arm: simplify updating ACPI table header checksum

2025-03-21 Thread Heinrich Schuchardt
Use acpi_update_checksum() to update table header.

Signed-off-by: Heinrich Schuchardt 
---
 arch/arm/mach-bcm283x/bcm2711_acpi.c | 4 ++--
 board/raspberrypi/rpi/rpi.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-bcm283x/bcm2711_acpi.c 
b/arch/arm/mach-bcm283x/bcm2711_acpi.c
index 79b283353cf..58f8ee232b9 100644
--- a/arch/arm/mach-bcm283x/bcm2711_acpi.c
+++ b/arch/arm/mach-bcm283x/bcm2711_acpi.c
@@ -81,7 +81,7 @@ static int acpi_write_pptt(struct acpi_ctx *ctx, const struct 
acpi_writer *entry
}
 
header->length = ctx->current - ctx->tab_start;
-   header->checksum = table_compute_checksum(header, header->length);
+   acpi_update_checksum(header);
 
acpi_inc(ctx, header->length);
acpi_add_table(ctx, header);
@@ -116,7 +116,7 @@ static int rpi_write_gtdt(struct acpi_ctx *ctx, const 
struct acpi_writer *entry)
gtdt->el2_flags = GTDT_FLAG_INT_ACTIVE_LOW;
gtdt->cnt_read_base = 0x;
 
-   header->checksum = table_compute_checksum(header, header->length);
+   acpi_update_checksum(header);
 
acpi_add_table(ctx, gtdt);
 
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 70d3c35499b..6ecd3eb120f 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -791,7 +791,7 @@ static int rpi_acpi_write_ssdt(struct acpi_ctx *ctx, const 
struct acpi_writer *e
 
/* (Re)calculate length and checksum */
ssdt->length = ctx->current - (void *)ssdt;
-   ssdt->checksum = table_compute_checksum((void *)ssdt, ssdt->length);
+   acpi_update_checksum(ssdt);
log_debug("SSDT at %p, length %x\n", ssdt, ssdt->length);
 
/* Drop the table if it is empty */
-- 
2.48.1



Re: [PATCH V2] cmd: env: select: Add output for available evironment targets

2025-03-21 Thread Marek Vasut

On 3/21/25 7:43 PM, Christoph Niedermaier wrote:

Add parameter "-l" for printing available environment targets. The
active target is marked with an asterisk. This is done by adding
the function env_select_print_list().

If "env select" is called without a target parameter the result is
"Select Environment on : driver not found". Replace this not
so useful output by showing the env usage message instead.

Signed-off-by: Christoph Niedermaier 
---
Cc: Marek Vasut 
Cc: Patrick Delaunay 
Cc: Joe Hershberger 
Cc: Tom Rini 
---
V2: - Showing available environment targets by parameter "-l"
 - Showing env usage message if env select is called without a target
---
  cmd/nvedit.c  | 19 ++-
  env/env.c | 16 
  include/env.h |  7 +++
  3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 1f259801293..de64094db4d 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -499,6 +499,23 @@ static int do_env_load(struct cmd_tbl *cmdtp, int flag, 
int argc,
  static int do_env_select(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
  {
+   if (!argv[1])
+   return CMD_RET_USAGE;
+
+   while (argc > 1 && **(argv + 1) == '-') {

Two higher level things:

- Can you first convert cmd/nvedit.h to use include/getopt.h and then
  use getopt() here too ? This hand rolled arg parsing is repulsive,
  the multiple ad-hoc copies of that are even worse.
- Please write a test for this, see test/cmd/ , maybe Simon can help
  with details of this ... ?


Re: [PATCH] net: remove commented out line

2025-03-21 Thread Heinrich Schuchardt

On 21.03.25 13:42, Jerome Forissier wrote:

Commit 1d5d292b7941 ("net: split net into net{,-common,-legacy,-lwip}")
inadvertendly left a commented out declaration for do_wget() in
net-common.h. Remove it.

Signed-off-by: Jerome Forissier 


The definition was moved to include/net-lwip.h.

Reviewed-by: Heinrich Schuchardt 


---
  include/net-common.h | 1 -
  1 file changed, 1 deletion(-)

diff --git a/include/net-common.h b/include/net-common.h
index 29d31f37263..89679e20860 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -518,7 +518,6 @@ int wget_do_request(ulong dst_addr, char *uri);
   * Return:true if uri is valid, false if uri is invalid
   */
  bool wget_validate_uri(char *uri);
-//int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);

  /**
   * enum wget_http_method - http method




Re: [PATCH v5 38/46] boot: Consider non-bootable partitions

2025-03-21 Thread Simon Glass
Hi Tom,

On Thu, 20 Mar 2025 at 15:22, Tom Rini  wrote:
>
> On Thu, Mar 20, 2025 at 03:43:36AM +, Simon Glass wrote:
> > Hi Tom,
> >
> > On Wed, 19 Mar 2025 at 16:40, Tom Rini  wrote:
> > >
> > > On Wed, Mar 19, 2025 at 03:03:49PM +, Simon Glass wrote:
> > > > Hi Tom,
> > > >
> > > > On Tue, 18 Mar 2025 at 16:53, Tom Rini  wrote:
> > > > >
> > > > > On Tue, Mar 18, 2025 at 03:24:02PM +, Simon Glass wrote:
> > > > > > Hi Tom,
> > > > > >
> > > > > > On Tue, 18 Mar 2025 at 15:04, Tom Rini  wrote:
> > > > > > >
> > > > > > > On Sat, Mar 15, 2025 at 02:25:58PM +, Simon Glass wrote:
> > > > > > >
> > > > > > > > Any 'bootable' flag in a DOS partition causes boostd to only 
> > > > > > > > scan
> > > > > > > > bootable partitions for that media. This can mean that 
> > > > > > > > extlinux.conf
> > > > > > > > files on the root disk are missed.
> > > > > > > >
> > > > > > > > Put this logic behind a flag and update the documentation.
> > > > > > > >
> > > > > > > > For now, the flag is enabled, to preserve existing behaviour. 
> > > > > > > > Future
> > > > > > > > work may provide a command (or some other mechanism) to control 
> > > > > > > > this.
> > > > > > > >
> > > > > > > > Signed-off-by: Simon Glass 
> > > > > > >
> > > > > > > Isn't this backwards as the existing behavior (prior to bootstd) 
> > > > > > > was to
> > > > > > > scan and use these files, and so that's the behavior we need to 
> > > > > > > preserve
> > > > > > > by default.
> > > > > >
> > > > > > Not so far as I know, but I've already spent too much time trying to
> > > > > > decode those scripts.
> > > > > >
> > > > > > If you look at scan_dev_for_boot_part, that is what I was trying to
> > > > > > replicate with bootstd.
> > > > >
> > > > > The feedback from the community call where this was brought up was 
> > > > > that
> > > > > it used to work and now didn't, I thought. Heinrich, I think you had 
> > > > > one
> > > > > of the cases here (something about RISC-V and multiple distros?) or 
> > > > > am I
> > > > > misremembering?
> > > >
> > > > OK let's see if Heinrich chimes in.
> > > >
> > > > Are there notes for the call? It would help me if they could all be in
> > > > a shared document, like we used to use[1].
> > >
> > > Yes, they're in email.
> >
> > What subject should I search for to find them? I looked for 'community
> > call' and a few other things, but cannot find them.
>
> They're in reply to every announcement email and sent to all three
> lists.

OK, well I can't find them, sorry. I did see the first one you sent
but after that I have no record.

It sounds like you don't want them in a doc for easy reference?

Regards,
Simon


[PATCH 0/5] acpi: simplify updating ACPI table header checksum

2025-03-21 Thread Heinrich Schuchardt
Introduce a new function to update ACPI table headers.
This allows to simplify the existing code.

Heinrich Schuchardt (5):
  acpi: new function acpi_update_checksum()
  acpi: simplify updating header checksum
  x86/acpi: simplify updating header checksum
  qemu-sbsa: simplify updating ACPI table header checksum
  arm: simplify updating ACPI table header checksum

 arch/arm/mach-bcm283x/bcm2711_acpi.c |  4 ++--
 arch/x86/cpu/apollolake/hostbridge.c |  2 +-
 arch/x86/lib/acpi_nhlt.c |  2 +-
 arch/x86/lib/acpi_table.c| 11 ---
 board/emulation/qemu-sbsa/acpi.c |  4 ++--
 board/raspberrypi/rpi/rpi.c  |  2 +-
 include/acpi/acpi_table.h|  7 +++
 lib/acpi/acpi.c  |  7 +++
 lib/acpi/acpi_table.c| 18 +++---
 lib/acpi/base.c  |  6 ++
 lib/acpi/csrt.c  |  2 +-
 lib/acpi/mcfg.c  |  2 +-
 lib/acpi/ssdt.c  |  2 +-
 13 files changed, 37 insertions(+), 32 deletions(-)

-- 
2.48.1



[PATCH 3/5] x86/acpi: simplify updating header checksum

2025-03-21 Thread Heinrich Schuchardt
Use acpi_update_checksum() for updating ACPI table header checksum.

Signed-off-by: Heinrich Schuchardt 
---
 arch/x86/cpu/apollolake/hostbridge.c |  2 +-
 arch/x86/lib/acpi_nhlt.c |  2 +-
 arch/x86/lib/acpi_table.c| 11 ---
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/x86/cpu/apollolake/hostbridge.c 
b/arch/x86/cpu/apollolake/hostbridge.c
index 039236df02d..284f16cfd91 100644
--- a/arch/x86/cpu/apollolake/hostbridge.c
+++ b/arch/x86/cpu/apollolake/hostbridge.c
@@ -298,7 +298,7 @@ static int apl_acpi_hb_write_tables(const struct udevice 
*dev,
 
/* (Re)calculate length and checksum */
header->length = ctx->current - (void *)dmar;
-   header->checksum = table_compute_checksum((void *)dmar, header->length);
+   acpi_update_checksum(header);
 
acpi_align(ctx);
acpi_add_table(ctx, dmar);
diff --git a/arch/x86/lib/acpi_nhlt.c b/arch/x86/lib/acpi_nhlt.c
index 880ef31df7d..8aae5fa5af7 100644
--- a/arch/x86/lib/acpi_nhlt.c
+++ b/arch/x86/lib/acpi_nhlt.c
@@ -414,7 +414,7 @@ int nhlt_serialise_oem_overrides(struct acpi_ctx *ctx, 
struct nhlt *nhlt,
cur.start = (void *)header;
nhlt_serialise_endpoints(nhlt, &cur);
 
-   header->checksum = table_compute_checksum(header, sz);
+   acpi_update_checksum(header);
nhlt_free_resources(nhlt);
assert(cur.buf - cur.start == sz);
 
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 3186e48d63b..b13292c4150 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -173,7 +173,7 @@ int acpi_write_tcpa(struct acpi_ctx *ctx, const struct 
acpi_writer *entry)
/* (Re)calculate length and checksum */
current = (u32)tcpa + sizeof(struct acpi_tcpa);
header->length = current - (u32)tcpa;
-   header->checksum = table_compute_checksum(tcpa, header->length);
+   acpi_update_checksum(header);
 
acpi_inc(ctx, tcpa->header.length);
acpi_add_table(ctx, tcpa);
@@ -242,7 +242,7 @@ static int acpi_write_tpm2(struct acpi_ctx *ctx,
tpm2->lasa = nomap_to_sysmem(lasa);
 
/* Calculate checksum. */
-   header->checksum = table_compute_checksum(tpm2, header->length);
+   acpi_update_checksum(header);
 
acpi_inc(ctx, tpm2->header.length);
acpi_add_table(ctx, tpm2);
@@ -279,9 +279,7 @@ int acpi_write_gnvs(struct acpi_ctx *ctx, const struct 
acpi_writer *entry)
 * patched the GNVS address. Set the checksum to zero since it
 * is part of the region being checksummed.
 */
-   ctx->dsdt->checksum = 0;
-   ctx->dsdt->checksum = table_compute_checksum((void *)ctx->dsdt,
-ctx->dsdt->length);
+   acpi_update_checksum(ctx->dsdt);
}
 
/* Fill in platform-specific global NVS variables */
@@ -330,8 +328,7 @@ static int acpi_create_hpet(struct acpi_hpet *hpet)
hpet->number = 0;
hpet->min_tick = 0; /* HPET_MIN_TICKS */
 
-   header->checksum = table_compute_checksum(hpet,
- sizeof(struct acpi_hpet));
+   acpi_update_checksum(header);
 
return 0;
 }
-- 
2.48.1



Re: [PATCH V2 3/5] arm64: imx: imx8mm-beacon: Enable CPU_IMX

2025-03-21 Thread Marek Vasut

On 3/21/25 2:27 PM, Adam Ford wrote:

On Fri, Mar 21, 2025 at 7:10 AM Fabio Estevam  wrote:


On Thu, Mar 20, 2025 at 11:27 PM Marek Vasut  wrote:


Yes, I know. But then, I can safely say it is desired on hardware I
maintain, I think we could try and run a quick poll and see if others
see it the same way ?


I think it is a good idea to imply the thermal driver at the SoC level
instead of per board.


OK.  I'll spin a V3 which implies the respective thermal driver at the
SoC level for IMX8 and 8M families, since those are what are supported
in the CPU driver.  Should I expand this list beyond those?  I am not
sure how far back to go.

8/8M and newer seems like the right way, thanks !


[PATCH v1 0/1] USB xHCI wrong act_len calculation in case of using multipe TRB

2025-03-21 Thread bigunclemax
From: Maksim Kiselev 

Hello everyone!

I've encountered an issue where the actual length of received data is
calculated incorrectly in the case of a multiple TRB request.

Below, I'll try to describe the essence of the problem:

A USB-ethernet adapter ASIX ax88179 is connected to my board Li4pi,
and I'm sending a DHCP request to the server via dhpc command.

The response from the DHCP server always has the same length (0x168).
However, in some cases, I noticed that the received response had
an incorrect length and network subsystem is completely ingnore
incoming packets.

The problem turned out to be in the xhci_bulk_tx() function.
I added some debugging[1] to better understand what's happening.

Here's the log from a working case:
```
dev=00057f786b90, pipe=c0010283, buffer=00057f787540, length=20480
PUSH. trb_len: 0x5000
POP. trb_len: 0x4e98, comp_code: 0xd
udev->act_len: 0x168
```

And here's the log from a non-working case:
```
dev=00057f78b610, pipe=c0010283, buffer=00057f78bfc0, length=20480
PUSH. trb_len: 0x4040
PUSH. trb_len: 0xfc0
POP. trb_len: 0x3ed8, comp_code: 0xd
POP. trb_len: 0x0, comp_code: 0x1
udev->act_len: 0x1128
```
As you can see, in the second case, the buffer spans a 64KB boundary
(buffer=00057f78bfc0 + 0x5000).
Therefore, it is split into two TRBs with lengths 0x4040 and 0xfc0.

Then, act_len is calculated as the difference between length and
trans_event.transfer_len:
```
0x5000 - 0x3ed8 = 0x1128
```

However, it seems that this is not entirely correct,
and act_len should be calculated as:

```
trb_buff_len - trans_event.transfer_len
(0x4040 - 0x3ed8 = 0x168)
```

0x168 is the correct length, which is the same as the length
obtained in the first case where network rx works fine.

Also I looked at the Linux xhci-ring code where urb->actual_length
calculated as:
[2]
```
requested = td->urb->transfer_buffer_length;
remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
```
[3]
```
td->urb->actual_length = requested - remaining;
```

Perhaps I missed something or misunderstood, so I would appreciate any help.

---

[1] Patch for debug output
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 89d2e54f20a..b1433a16a99 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -791,6 +791,8 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long 
pipe,
trb_fields[2] = length_field;
trb_fields[3] = field | TRB_TYPE(TRB_NORMAL);
 
+   debug("PUSH. trb_len: 0x%x\n", trb_buff_len);
+
last_transfer_trb_addr = queue_trb(ctrl, ring, (num_trbs > 1), 
trb_fields);
 
--num_trbs;
@@ -816,6 +818,10 @@ again:
return -ETIMEDOUT;
}
 
+   debug("POP. trb_len: 0x%x, comp_code: 0x%x\n",
+ (int)EVENT_TRB_LEN(le32_to_cpu(event->trans_event.transfer_len)),
+ GET_COMP_CODE(le32_to_cpu(event->trans_event.transfer_len)));
+
if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer)) !=
(uintptr_t)last_transfer_trb_addr) {
available_length -=
@@ -831,6 +837,7 @@ again:
available_length -= first_trb_trimmed_sz;
 
record_transfer_result(udev, event, available_length);
+   debug("udev->act_len: 0x%x\n", udev->act_len);
xhci_acknowledge_event(ctrl);
xhci_inval_cache((uintptr_t)buffer, length);
xhci_dma_unmap(ctrl, buf_64, length);


[2] 
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/host/xhci-ring.c?h=v6.14-rc7#n2346
[3] 
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/host/xhci-ring.c?h=v6.14-rc7#n2413

Maksim Kiselev (1):
  usb: xhci: fix calculation of act_len in case of using multipe TRB

 drivers/usb/host/xhci-ring.c | 5 +
 1 file changed, 5 insertions(+)

-- 
2.45.2



[PATCH v2] cmd: fwu: Dump custom fields from mdata structure

2025-03-21 Thread Michal Simek
The commit cb9ae40a16f0 ("tools: mkfwumdata: add logic to append vendor
data to the FWU metadata") added support for adding vendor data to mdata
structure but it is not visible anywhere that's why extend fwu command to
dump it.

Tested-by: Sughosh Ganu 
Reviewed-by: Sughosh Ganu 
Signed-off-by: Michal Simek 
---

Changes in v2:
- Extend print message
- Cover hexdump dependencies

RFC:
https://lore.kernel.org/r/75c697a4f819bb5e8649ed658c5a559fb8cd1fd9.1717599342.git.michal.si...@amd.com

---
 cmd/Kconfig |  1 +
 cmd/fwu_mdata.c | 25 +
 2 files changed, 26 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 642cc1116e87..1f8aa2521a8e 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -185,6 +185,7 @@ config CMD_UFETCH
 config CMD_FWU_METADATA
bool "fwu metadata read"
depends on FWU_MULTI_BANK_UPDATE
+   imply HEXDUMP if FWU_MDATA_V2
help
  Command to read the metadata and dump it's contents
 
diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c
index 9c048d69a131..5b5a2e4d1cda 100644
--- a/cmd/fwu_mdata.c
+++ b/cmd/fwu_mdata.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -45,6 +46,30 @@ static void print_mdata(struct fwu_data *data)
   img_info->accepted == 0x1 ? "yes" : "no");
}
}
+
+   if (data->version == 2) {
+   struct fwu_mdata *mdata = data->fwu_mdata;
+   struct fwu_fw_store_desc *desc;
+   void *end;
+   u32 diff;
+
+   /*
+* fwu_mdata defines only header that's why taking it as array
+* which exactly point to image description location
+*/
+   desc = (struct fwu_fw_store_desc *)&mdata[1];
+
+   /* Number of entries is taken from for loop - variable i */
+   end = &desc->img_entry[i];
+   debug("mdata %p, desc %p, end %p\n", mdata, desc, end);
+
+   diff = data->metadata_size - ((void *)end - (void *)mdata);
+   if (diff) {
+   printf("Custom fields covered by CRC len: 0x%x\n", 
diff);
+   print_hex_dump_bytes("CUSTOM ", DUMP_PREFIX_OFFSET,
+end, diff);
+   }
+   }
 }
 
 int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag,
-- 
2.43.0



Re: [PATCH v8 02/19] pinctrl: nxp: add a pin controller driver based on SCMI pin control protocol

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

[...]


+static int imx_scmi_pinctrl_probe(struct udevice *dev)
+{
+   struct imx_scmi_pinctrl_priv *priv = dev_get_priv(dev);
+
+   priv->daisy_offset = is_imx93() ? DAISY_OFFSET_IMX93 : 
DAISY_OFFSET_IMX95;
+
+   return devm_scmi_of_get_channel(dev);
+}
+
+static int imx_scmi_pinctrl_bind(struct udevice *dev)
+{
+   if (IS_ENABLED(CONFIG_IMX95))
+   return 0;


Why does this driver support iMX93 , but it is explicitly not going to 
bind on iMX93 ?


In case the MX93 support is going to be added, you probably need 
something like:


if (IS_ENABLED(CONFIG_IMX95) && is_imx95())
  return 0;

Because IS_ENABLED(CONFIG_IMX95) does not automatically imply that this 
code is started on MX95 , that is when is_imx95() comes into play and 
does runtime check for MX95 .



+   return -ENODEV;
+}
+
+U_BOOT_DRIVER(scmi_pinctrl_imx) = {
+   .name = "scmi_pinctrl_imx",
+   .id = UCLASS_PINCTRL,
+   .bind = imx_scmi_pinctrl_bind,
+   .probe = imx_scmi_pinctrl_probe,
+   .priv_auto = sizeof(struct imx_scmi_pinctrl_priv),
+   .ops = &imx_scmi_pinctrl_ops,
+   .flags = DM_FLAG_PRE_RELOC,
+};
diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 7abb2a6f36b..279ebbad440 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -24,6 +24,7 @@ enum scmi_std_protocol {
SCMI_PROTOCOL_ID_SENSOR = 0x15,
SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16,
SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17,
+   SCMI_PROTOCOL_ID_PINCTRL = 0x19,
If this is the IMX specific pinctrl protocol, please make sure to name 
it accordingly , SCMI_PROTOCOL_ID_PINCTRL_IMX or something .


Re: [PATCH v8 11/19] spl: imx: use trampoline buffer to load images to secure region

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

[...]


@@ -42,12 +53,30 @@ static struct boot_img_t *read_auth_image(struct 
spl_image_info *spl_image,
  
  	debug("%s: container: %p offset: %lu size: %lu\n", __func__,

  container, offset, size);
-   if (info->read(info, offset, size,
-  map_sysmem(images[image_index].dst - overhead,
- images[image_index].size)) <
-   images[image_index].size) {
-   printf("%s wrong\n", __func__);
-   return NULL;
+
+   buf = map_sysmem(images[image_index].dst - overhead, 
images[image_index].size);
+   if (IS_ENABLED(CONFIG_SPL_IMX_CONTAINER_USE_TRAMPOLINE) &&
+   arch_check_dst_in_secure(buf, size)) {
+   trampoline = arch_get_container_trampoline();
+   if (!trampoline) {
+   printf("%s: trampoline size is zero\n", __func__);
+   return NULL;
+   }
+
+   if (info->read(info, offset, size, trampoline) < 
images[image_index].size) {
+   printf("%s wrong\n", __func__);
+   return NULL;
+   }
+
+   memcpy(buf, trampoline, images[image_index].size);
+   } else {
+   if (info->read(info, offset, size,
+  map_sysmem(images[image_index].dst - overhead,
+ images[image_index].size)) <
+   images[image_index].size) {
+   printf("%s wrong\n", __func__);


Can you please make those debug prints a bit more informative about the 
failure that occurred ?


Re: 回复: [PATCH v7 10/19] imx9: scmi: add i.MX95 SoC and clock related code

2025-03-21 Thread Marek Vasut

On 3/21/25 8:17 AM, Alice Guo (OSS) wrote:

[...]


diff --git a/arch/arm/mach-imx/imx9/scmi/clock.c

b/arch/arm/mach-imx/imx9/scmi/clock.c

new file mode 100644
index 00..9ebd380976
--- /dev/null
+++ b/arch/arm/mach-imx/imx9/scmi/clock.c
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2025 NXP
+ */
+
+#include 
+#include 
+#include 
+#include "../../../../../dts/upstream/src/arm64/freescale/imx95-clock.h"


"Interesting" include path...
Shouldn't this file be located under dts/upstream/include/dt-bindings/ like all 
the
other imx*-clock.h files?
Then the file should be picked up via
#include 


Hi,

imx95-clock.h is not in this directory dts/upstream/include/dt-bindings/.
I noticed this odd location of imx95-clock.h in Linux too , it is not in 
the include/dt-bindings directory . Why is that ?


Re: [PATCH v8 06/19] clk: scmi: add the command CLOCK_PARENT_SET

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

From: Peng Fan 

This patch adds the command CLOCK_PARENT_SET that can be used to set the
parent of a clock. ARM SCMI Version 3.2 supports to change the parent of
a clock device.


Reviewed-by: Marek Vasut 


Re: [PATCH v8 13/19] imx: Kconfig: IMX8_ROMAPI is not configured for i.MX95

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

From: Alice Guo 

i.MX95 only supports low power boot, which means A55 is kicked by M33.
There is no ROM runs on A55 in such case so that deselect IMX8_ROMAPI
for i.MX95.

Signed-off-by: Alice Guo 
---
  arch/arm/mach-imx/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 134e42028c3..f38f3b2d338 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -180,7 +180,7 @@ config DDRMC_VF610_CALIBRATION
  
  config IMX8_ROMAPI

def_bool y
-   depends on IMX8MN || IMX8MP || IMX8ULP || IMX9
+   depends on IMX8MN || IMX8MP || IMX8ULP || IMX93 || IMX91

Keep the list sorted, MX91 goes before MX93


Re: [PATCH v8 00/19] imx: add i.MX95 support

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

Changes for v7:
  - separate i.MX Messaging Unit driver patch from this patch set
  - add U_BOOT_SCMI_PROTO_DRIVER() to avoid putting i.MX related code in 
scmi_agent-uclass.c.
  - update drivers/clk/clk_scmi.c according to comment
  - dynamically allocate the size of struct 
scmi_base_discover_list_protocols_out

Changes for v8:
  - add a comma to enum scmi_clock_message_id
  - use readl_poll_timeout instead of while to avoid to silent hang in
disable_wdog()
  - use the format "%pM" to print a MAC address
  - use "%u" to match the data type u32
  - add a comma enum imx8image_cmd, enum imx8image_core_type and so on
  - add a line at end of container.cfg, imximage.cfg and imx95_19x19_evk.env
  - update arch/arm/mach-imx/imx9/scmi/soc.c

I added a couple of comments , I'm sorry this took so long.

I think the SCMI part is starting to be pretty good.

It might make sense to split off the SCMI parts and get that in first, 
this way:


Separate patch:
[PATCH v8 01/19] firmware: scmi: smt: Interrupt communication enable

Separate patch:
[PATCH v8 09/19] scmi_protocols: update struct 
scmi_base_discover_list_protocols_out


Separate patchset:
[PATCH v8 03/19] firmware: scmi_agent: add SCMI pin control protocol support
...
[PATCH v8 08/19] sandbox: add SCMI clock control permissions to sandbox

And then the rest as a follow up series.

This will allow you to reduce the size of the series and get the pieces 
which are good in quickly, without having to resend them repeatedly as a 
part of larger series. (and yes, it also makes reviewing easier)


[PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

2025-03-21 Thread Marek Vasut
The current code attempts to bind scmi_voltage_domain to regulator subnode
of the SCMI protocol node, so scmi_voltage_domain can then bind regulators
directly to subnodes of its node. This kind of behavior should not be in
core code, move it into scmi_voltage_domain driver code. Let the driver
descend into regulator node and bind regulators to its subnodes.

Fixes: 1f213ee4dbf2 ("firmware: scmi: voltage regulator")
Signed-off-by: Marek Vasut 
---
Cc: Alice Guo 
Cc: Ilias Apalodimas 
Cc: Jaehoon Chung 
Cc: Tom Rini 
Cc: u-boot@lists.denx.de
---
 drivers/firmware/scmi/scmi_agent-uclass.c | 8 +---
 drivers/power/regulator/scmi_regulator.c  | 6 ++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c 
b/drivers/firmware/scmi/scmi_agent-uclass.c
index 8c907c3b032..e6e43ae936a 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
break;
case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI) &&
-   scmi_protocol_is_supported(dev, protocol_id)) {
-   node = ofnode_find_subnode(node, "regulators");
-   if (!ofnode_valid(node)) {
-   dev_err(dev, "no regulators node\n");
-   return -ENXIO;
-   }
+   scmi_protocol_is_supported(dev, protocol_id))
drv = DM_DRIVER_GET(scmi_voltage_domain);
-   }
break;
default:
break;
diff --git a/drivers/power/regulator/scmi_regulator.c 
b/drivers/power/regulator/scmi_regulator.c
index 99f6506f162..2550b27246f 100644
--- a/drivers/power/regulator/scmi_regulator.c
+++ b/drivers/power/regulator/scmi_regulator.c
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
ofnode node;
int ret;
 
+   node = ofnode_find_subnode(node, "regulators");
+   if (!ofnode_valid(node)) {
+   dev_err(dev, "no regulators node\n");
+   return -ENXIO;
+   }
+
drv = DM_DRIVER_GET(scmi_regulator);
 
ofnode_for_each_subnode(node, dev_ofnode(dev)) {
-- 
2.47.2



Re: [PATCH v8 04/19] scmi_protocols: add SCMI misc protocol protocol_id and message_id for getting the ROM passover data

2025-03-21 Thread Marek Vasut

On 3/21/25 8:15 AM, Alice Guo (OSS) wrote:

From: Peng Fan 

SCMI misc protocol is intended for miscellaneous functions which are
device specific and are usually defined to access bit fields. It is i.MX
specific. This patch adds SCMI misc protocol protocol_id and message_id
for getting the ROM passover data.

Reviewed-by: Marek Vasut