firmware: scmi_agent: add SCMI pin control protocol support

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.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
This commit is contained in:
Alice Guo
2025-04-28 18:37:27 +08:00
committed by Fabio Estevam
parent 8706d383ad
commit bf2ea4fde7
3 changed files with 16 additions and 0 deletions

View File

@@ -97,6 +97,9 @@ struct udevice *scmi_get_protocol(struct udevice *dev,
case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN: case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
proto = priv->voltagedom_dev; proto = priv->voltagedom_dev;
break; break;
case SCMI_PROTOCOL_ID_PINCTRL:
proto = priv->pinctrl_dev;
break;
default: default:
dev_err(dev, "Protocol not supported\n"); dev_err(dev, "Protocol not supported\n");
proto = NULL; proto = NULL;
@@ -147,6 +150,9 @@ static int scmi_add_protocol(struct udevice *dev,
case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN: case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
priv->voltagedom_dev = proto; priv->voltagedom_dev = proto;
break; break;
case SCMI_PROTOCOL_ID_PINCTRL:
priv->pinctrl_dev = proto;
break;
default: default:
dev_err(dev, "Protocol not supported\n"); dev_err(dev, "Protocol not supported\n");
return -EPROTO; return -EPROTO;

View File

@@ -10,6 +10,7 @@
#include <dm/devres.h> #include <dm/devres.h>
#include <dm/pinctrl.h> #include <dm/pinctrl.h>
#include <scmi_agent.h> #include <scmi_agent.h>
#include <scmi_agent-uclass.h>
#include <scmi_protocols.h> #include <scmi_protocols.h>
#include "pinctrl-imx.h" #include "pinctrl-imx.h"
@@ -155,3 +156,10 @@ U_BOOT_DRIVER(scmi_pinctrl_imx) = {
.ops = &imx_scmi_pinctrl_ops, .ops = &imx_scmi_pinctrl_ops,
.flags = DM_FLAG_PRE_RELOC, .flags = DM_FLAG_PRE_RELOC,
}; };
static struct scmi_proto_match match[] = {
{ .proto_id = SCMI_PROTOCOL_ID_PINCTRL },
{ /* Sentinel */ }
};
U_BOOT_SCMI_PROTO_DRIVER(scmi_pinctrl_imx, match);

View File

@@ -27,6 +27,7 @@ struct scmi_channel;
* @clock_dev: SCMI clock protocol device * @clock_dev: SCMI clock protocol device
* @resetdom_dev: SCMI reset domain protocol device * @resetdom_dev: SCMI reset domain protocol device
* @voltagedom_dev: SCMI voltage domain protocol device * @voltagedom_dev: SCMI voltage domain protocol device
* @pinctrl_dev: SCMI pin control protocol device
*/ */
struct scmi_agent_priv { struct scmi_agent_priv {
u32 version; u32 version;
@@ -43,6 +44,7 @@ struct scmi_agent_priv {
struct udevice *clock_dev; struct udevice *clock_dev;
struct udevice *resetdom_dev; struct udevice *resetdom_dev;
struct udevice *voltagedom_dev; struct udevice *voltagedom_dev;
struct udevice *pinctrl_dev;
}; };
static inline u32 scmi_version(struct udevice *dev) static inline u32 scmi_version(struct udevice *dev)