u-boot: add SCMI GPIO/Pinctrl support
Subsystems (6)
v2 cover u-boot: add SCMI GPIO/Pinctrl support
There is an existing SCMI pinctrl driver in drivers/pinctrl/nxp/ which lets you configure the initial state of the pins via device tree. This patchset is a more generic version which provides GPIO as well.
I wrote two small cleanup patches to the NXP driver, one which renamed an enum and another which made some white space changes.
The next patch adds an pinctrl driver which lets you configure the initial state for the pins. But the main thing is that we need one driver to handle the SCMI pinctrl protocol so the pinctrl driver does this.
The last patch adds GPIO support over SCMI.
I tested this code using the SCP SCMI server on OP-TEE over Qemu. I created a custom mock pinctrl device in SCP.
Changes since v1:
Address Peng Fang's review comments.
Use the standard gpio-ranges to describe the pins instead of inventing a custom format.
Dan Carpenter (4):
scmi: pinctrl: add pinctrl message IDs
scmi: update comments for scmi_pinctrl_config_set_in()
scmi: pinctrl: add pinctrl driver for SCMI
gpio: scmi: Add gpio_scmi driver
drivers/firmware/scmi/Makefile | 1 + drivers/firmware/scmi/pinctrl.c | 365 +++++++++++++++++++++ drivers/firmware/scmi/scmi_agent-uclass.c | 4 +- drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio_scmi.c | 248 ++++++++++++++ drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/nxp/pinctrl-imx-scmi.c | 2 +- drivers/pinctrl/pinctrl-scmi.c | 365 +++++++++++++++++++++ include/scmi_agent-uclass.h | 2 +- include/scmi_protocols.h | 379 +++++++++++++++++++++- 12 files changed, 1371 insertions(+), 12 deletions(-) create mode 100644 drivers/firmware/scmi/pinctrl.c create mode 100644 drivers/gpio/gpio_scmi.c create mode 100644 drivers/pinctrl/pinctrl-scmi.c
Signature · 1 line
2.51.0
PATCH v2 1/4 scmi: pinctrl: add pinctrl message IDs
Add all the pinctrl message IDs. I renamed SCMI_MSG_PINCTRL_CONFIG_SET to SCMI_PINCTRL_SETTINGS_CONFIGURE so the naming matches the spec better.
--- drivers/pinctrl/nxp/pinctrl-imx-scmi.c | 2 +- include/scmi_protocols.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/pinctrl/nxp/pinctrl-imx-scmi.c +1 -1
@@ -69,7 +69,7 @@ static int imx_pinconf_scmi_set(struct udevice *dev, u32 mux_ofs, u32 mux, u32 c in.attributes = num_cfgs <<PINCTRL_NUM_CFGS_SHIFT ; msg =SCMI_MSG_IN (SCMI_PROTOCOL_ID_PINCTRL , -SCMI_MSG_PINCTRL_CONFIG_SET , in, out); +SCMI_PINCTRL_SETTINGS_CONFIGURE , in, out); ret =devm_scmi_process_msg (dev, &msg);if (ret || out.status) {
include/scmi_protocols.h +8 -1
@@ -1088,7 +1088,14 @@ struct scmi_voltd_level_get_out {/* SCMI Pinctrl Protocol */ enum scmi_pinctrl_message_id { -SCMI_MSG_PINCTRL_CONFIG_SET =0x6 +SCMI_PINCTRL_ATTRIBUTES =0x3 , +SCMI_PINCTRL_LIST_ASSOCIATIONS =0x4 , +SCMI_PINCTRL_SETTINGS_GET =0x5 , +SCMI_PINCTRL_SETTINGS_CONFIGURE =0x6 , +SCMI_PINCTRL_REQUEST =0x7 , +SCMI_PINCTRL_RELEASE =0x8 , +SCMI_PINCTRL_NAME_GET =0x9 , +SCMI_PINCTRL_SET_PERMISSIONS =0xA , };struct scmi_pin_config {
Signature · 1 line
2.51.0
PATCH v2 2/4 scmi: update comments for scmi_pinctrl_config_set_in()
In reply to Dan CarpenterDelete some extra space characters to make checkpatch.pl happy:
WARNING: please, no space before tabs
--- include/scmi_protocols.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
include/scmi_protocols.h +7 -7
@@ -1107,14 +1107,14 @@ struct scmi_pin_config {* struct scmi_pinctrl_config_set_in - Message payload for PAD_CONFIG_SET command * @identifier: Identifier for the pin or group. * @function_id: Identifier for the function selected to be enabled -* for the selected pin or group. This field is set to -* 0xFFFFFFFF if no function should be enabled by the -* pin or group. +* for the selected pin or group. This field is set to +* 0xFFFFFFFF if no function should be enabled by the +* pin or group. * @attributes: Bits[31:11] Reserved, must be zero. -* Bit[10] Function valid. -* Bits[9:2] Number of configurations to set. -* Bits[1:0] Selector: Whether the identifier field -* refers to a pin or a group. +* Bit[10] Function valid. +* Bits[9:2] Number of configurations to set. +* Bits[1:0] Selector: Whether the identifier field +* refers to a pin or a group. * @configs: Array of configurations. */ struct scmi_pinctrl_config_set_in {
Signature · 1 line
2.51.0
PATCH v2 3/4 scmi: pinctrl: add pinctrl driver for SCMI
In reply to Dan CarpenterThis driver adds the base support of pinctrl over SCMI. The driver does two main things. First, it allows you to configure the initial pin states. Secondly, it's used a base to build a GPIO driver on top of it.
To configure the states then add a pinmux config to the scmi_pinctrl section:
scmi_pinctrl: protocol@19 {
reg = <0x19>;
pinmux1: pinmux_test {
pinmux = <0 1 0xFFFFFFFF 18 1
0 2 0xFFFFFFFF 18 1
0 3 0xFFFFFFFF 18 1>;
function = "f_gpio1";
groups = "grp_1", "grp_3";
};
};Under linux the pinctrl subsystem will parse the function and group properties and use that to handle muxing. However, under u-boot the pin muxing is done using the "pinmux" property, which feeds raw SCMI pinctrl PINCTRL_SETTINGS_CONFIGURE commands to the server. The numbers are: selector, identifier, function_id, config_type, and config_value. In the example above, it sets pins 1, 2, and 3 to 1. The linux-kernel ignores this pinmux property.
---
v2: Address Peng Fang's reveiw comments.
drivers/firmware/scmi/Makefile | 1 + drivers/firmware/scmi/pinctrl.c | 365 ++++++++++++++++++++++ drivers/firmware/scmi/scmi_agent-uclass.c | 4 +- drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-scmi.c | 365 ++++++++++++++++++++++ include/scmi_agent-uclass.h | 2 +- include/scmi_protocols.h | 356 +++++++++++++++++++++ 8 files changed, 1100 insertions(+), 3 deletions(-) create mode 100644 drivers/firmware/scmi/pinctrl.c create mode 100644 drivers/pinctrl/pinctrl-scmi.c
drivers/firmware/scmi/Makefile +1 -0
@@ -5,5 +5,6 @@ obj-$(CONFIG_SCMI_AGENT_SMCCC) += smccc_agent.o obj-$(CONFIG_SCMI_AGENT_MAILBOX) += mailbox_agent.o obj-$(CONFIG_SCMI_AGENT_OPTEE) += optee_agent.o obj-$(CONFIG_SCMI_POWER_DOMAIN) += pwdom.o +obj-$(CONFIG_PINCTRL_SCMI) += pinctrl.o obj-$(CONFIG_SANDBOX) += sandbox-scmi_agent.o sandbox-scmi_devices.o obj-y += vendors/imx/
drivers/firmware/scmi/pinctrl.c new file +365 -0
365 lines not on this page · raw message
drivers/firmware/scmi/scmi_agent-uclass.c +2 -2
@@ -106,7 +106,7 @@ struct udevice *scmi_get_protocol(struct udevice *dev, proto = priv->voltagedom_dev;break ;#endif -#if IS_ENABLED (CONFIG_PINCTRL_IMX_SCMI ) +#if IS_ENABLED (CONFIG_PINCTRL_SCMI ) ||IS_ENABLED (CONFIG_PINCTRL_IMX_SCMI )case SCMI_PROTOCOL_ID_PINCTRL : proto = priv->pinctrl_dev;break ;
@@ -179,7 +179,7 @@ static int scmi_add_protocol(struct udevice *dev, priv->voltagedom_dev = proto;break ;#endif -#if IS_ENABLED (CONFIG_PINCTRL_IMX_SCMI ) +#if IS_ENABLED (CONFIG_PINCTRL_SCMI ) ||IS_ENABLED (CONFIG_PINCTRL_IMX_SCMI )case SCMI_PROTOCOL_ID_PINCTRL : priv->pinctrl_dev = proto;break ;
drivers/pinctrl/Kconfig +9 -0
@@ -291,6 +291,15 @@ config PINCTRL_SANDBOX Currently, this driver actually does nothing but print debug messages when pinctrl operations are invoked. +config PINCTRL_SCMI + bool "Support SCMI pin controllers" + depends on PINCTRL_FULL && SCMI_FIRMWARE + help + This is for pinctrl over the SCMI protocol. This allows the + initial pin configuration to be set up from the device tree. The + gpio_scmi driver is built on top of this driver if GPIO is + required. + config PINCTRL_SINGLE bool "Single register pin-control and pin-multiplex driver" depends on DM
drivers/pinctrl/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_PINCTRL_MSCC) += mscc/ obj-$(CONFIG_ARCH_MVEBU) += mvebu/ obj-$(CONFIG_ARCH_NEXELL) += nexell/ obj-$(CONFIG_PINCTRL_QE) += pinctrl-qe-io.o +obj-$(CONFIG_PINCTRL_SCMI) += pinctrl-scmi.o obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o obj-$(CONFIG_PINCTRL_STI) += pinctrl-sti.o obj-$(CONFIG_PINCTRL_STM32) += pinctrl_stm32.o
drivers/pinctrl/pinctrl-scmi.c new file +365 -0
365 lines not on this page · raw message
include/scmi_agent-uclass.h +1 -1
@@ -52,7 +52,7 @@ struct scmi_agent_priv {#if IS_ENABLED (CONFIG_DM_REGULATOR_SCMI )struct udevice *voltagedom_dev;#endif -#if IS_ENABLED (CONFIG_PINCTRL_IMX_SCMI ) +#if IS_ENABLED (CONFIG_PINCTRL_SCMI ) ||IS_ENABLED (CONFIG_PINCTRL_IMX_SCMI )struct udevice *pinctrl_dev;#endif #if IS_ENABLED (CONFIG_SCMI_ID_VENDOR_80 )
include/scmi_protocols.h +356 -0
360 lines not on this page · raw message
Signature · 1 line
2.51.0
Re: [PATCH v2 3/4] scmi: pinctrl: add pinctrl driver for SCMI
Quoted 27 lines · Dan Carpenter
This driver adds the base support of pinctrl over SCMI. The driver does two main things. First, it allows you to configure the initial pin states. Secondly, it's used a base to build a GPIO driver on top of it.
To configure the states then add a pinmux config to the
scmi_pinctrlsection:scmi_pinctrl: protocol@19 { reg = <0x19>; pinmux1: pinmux_test { pinmux = <0 1 0xFFFFFFFF 18 1 0 2 0xFFFFFFFF 18 1 0 3 0xFFFFFFFF 18 1>; function = "f_gpio1"; groups = "grp_1", "grp_3"; }; };Under linux the pinctrl subsystem will parse the function and group properties and use that to handle muxing. However, under u-boot the pin muxing is done using the "pinmux" property, which feeds raw SCMI pinctrl
PINCTRL_SETTINGS_CONFIGUREcommands to the server. The numbers are: selector, identifier,function_id,config_type, andconfig_value. In the example above, it sets pins 1, 2, and 3 to 1. The linux-kernel ignores this pinmux property.
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>
Linus Walleij
maintainerRe: [PATCH v2 3/4] scmi: pinctrl: add pinctrl driver for SCMI
In reply to Dan CarpenterQuoted 11 lines · Dan Carpenter
scmi_pinctrl: protocol@19 {
reg = <0x19>;
pinmux1: pinmux_test {
pinmux = <0 1 0xFFFFFFFF 18 1
0 2 0xFFFFFFFF 18 1
0 3 0xFFFFFFFF 18 1>;
function = "f_gpio1";
groups = "grp_1", "grp_3";
};
};Quoted 7 lines
Under linux the pinctrl subsystem will parse the function and group properties and use that to handle muxing. However, under u-boot the pin muxing is done using the "pinmux" property, which feeds raw SCMI pinctrl
PINCTRL_SETTINGS_CONFIGUREcommands to the server. The numbers are: selector, identifier,function_id,config_type, andconfig_value. In the example above, it sets pins 1, 2, and 3 to 1. The linux-kernel ignores this pinmux property.
This whole thing is a bit of a hack and shortcut to make hard things simple isn't it?
The information encoded in the pinmux property is identical to what is found in the function+groups property and that is why Linux does not use it.
Also device trees looking like this will not pass validation or be accepted into Linux, as it is not part of the official bindings, nor will it be, so it creates a necessity to maintain forked device trees.
If U-Boot want to do things this way, I understand it: it does make the pinctrl default set-up simpler, especially it makes the code smaller and easier to write, which is something bootloaders like.
I really can't endorse it though: with deviant device trees and information stored in paralllel in two places we create a maintenance hurdle.
Yours,
Linus Walleij
Re: [PATCH v2 3/4] scmi: pinctrl: add pinctrl driver for SCMI
Quoted 21 lines · Linus Walleij
Quoted 11 lines · Dan Carpenter
scmi_pinctrl: protocol@19 { reg = <0x19>; pinmux1: pinmux_test { pinmux = <0 1 0xFFFFFFFF 18 1 0 2 0xFFFFFFFF 18 1 0 3 0xFFFFFFFF 18 1>; function = "f_gpio1"; groups = "grp_1", "grp_3"; }; };Quoted 7 lines
Under linux the pinctrl subsystem will parse the function and group properties and use that to handle muxing. However, under u-boot the pin muxing is done using the "pinmux" property, which feeds raw SCMI pinctrl
PINCTRL_SETTINGS_CONFIGUREcommands to the server. The numbers are: selector, identifier,function_id,config_type, andconfig_value. In the example above, it sets pins 1, 2, and 3 to 1. The linux-kernel ignores this pinmux property.
Quoted 2 lines
This whole thing is a bit of a hack and shortcut to make hard things simple isn't it?
I'm not disagreeing with you at all, but handling the default pinmux property is the only mandatory part of a pin controller driver in u-boot.
regards,
dan carpenter
Re: [PATCH v2 3/4] scmi: pinctrl: add pinctrl driver for SCMI
In reply to Linus WalleijQuoted 3 lines · Linus Walleij
I really can't endorse it though: with deviant device trees and information stored in paralllel in two places we create a maintenance hurdle.
Yeah. Looking at this more carefully, you're right. Let me do this in the right way.
regards,
dan carpenter
PATCH v2 4/4 gpio: scmi: Add gpio_scmi driver
In reply to Dan CarpenterThis provides GPIO support over SCMI. It is built on top of the pinctrl-scmi driver. The device tree entry would work the same as in linux. Perhaps something like this.
gpio1 {
compatible = "scmi-pinctrl-gpio";
gpio-controller;
#gpio-cells = <2>;
ngpios = <10>;
gpio-ranges = <&scmi_pinctrl 0 8 4>,
<&scmi_pinctrl 4 12 1>,
<&scmi_pinctrl 5 15 1>,
<&scmi_pinctrl 6 17 4>;
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins>;
};The &i2c2_pins phandle from the pinctrl section does pin muxing and the gpio-ranges property describes the pins.
---
v2: In the device tree, it should use gpio-ranges to configure the
GPIOs. I invented something non-standard in v1. Fixed now.
drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio_scmi.c | 248 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 drivers/gpio/gpio_scmi.c
drivers/gpio/Kconfig +6 -0
@@ -723,6 +723,12 @@ config SLG7XL45106_I2C_GPO 8-bit gpo expander, all gpo lines are controlled by writing value into data register. +config GPIO_SCMI + bool "SCMI GPIO pinctrl driver" + depends on DM_GPIO && PINCTRL_SCMI + help + Support pinctrl GPIO over the SCMI interface. + config ADP5585_GPIO bool "ADP5585 GPIO driver" depends on DM_GPIO && DM_I2C
drivers/gpio/Makefile +1 -0
@@ -77,6 +77,7 @@ obj-$(CONFIG_SL28CPLD_GPIO) += sl28cpld-gpio.o obj-$(CONFIG_ADP5588_GPIO) += adp5588_gpio.o obj-$(CONFIG_ZYNQMP_GPIO_MODEPIN) += zynqmp_gpio_modepin.o obj-$(CONFIG_SLG7XL45106_I2C_GPO) += gpio_slg7xl45106.o +obj-$(CONFIG_GPIO_SCMI) += gpio_scmi.o obj-$(CONFIG_$(PHASE_)ADP5585_GPIO) += adp5585_gpio.o obj-$(CONFIG_RZG2L_GPIO) += rzg2l-gpio.o obj-$(CONFIG_MPFS_GPIO) += mpfs_gpio.o
drivers/gpio/gpio_scmi.c new file +248 -0
248 lines not on this page · raw message
Signature · 1 line
2.51.0
Re: [PATCH v2 4/4] gpio: scmi: Add gpio_scmi driver
Hi Dan,
Quoted 17 lines · Dan Carpenter
This provides GPIO support over SCMI. It is built on top of the pinctrl-scmi driver. The device tree entry would work the same as in linux. Perhaps something like this.
gpio1 { compatible = "scmi-pinctrl-gpio"; gpio-controller; #gpio-cells = <2>; ngpios = <10>; gpio-ranges = <&scmi_pinctrl 0 8 4>, <&scmi_pinctrl 4 12 1>, <&scmi_pinctrl 5 15 1>, <&scmi_pinctrl 6 17 4>; pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins>; };
Quoted 4 lines
The
&i2c2_pinsphandle from the pinctrl section does pin muxing and the gpio-ranges property describes the pins.Signed-off-by Dan Carpenter <[email protected]>
Re: [PATCH v2 4/4] gpio: scmi: Add gpio_scmi driver
In reply to Dan CarpenterHi Dan,
Quoted 4 lines · Dan Carpenter
This provides GPIO support over SCMI. It is built on top of the pinctrl-scmi driver. The device tree entry would work the same as in linux. Perhaps something like this.
+
[....]
drivers/gpio/gpio_scmi.c line 227
Quoted 5 lines
drivers/gpio/gpio_scmi.c new file +5
-0+ ret =snprintf (NULL ,0 ,"gpio_scmi%d_" , bank_cnt); + uc_priv->bank_name =devm_kzalloc (dev, ret +1 ,GFP_KERNEL ); +if (!uc_priv->bank_name) +return -ENOMEM ; +snprintf (uc_priv->bank_name, ret +1 ,"gpio_scmi%d_" , bank_cnt);
build fail in CI [1]:
drivers/gpio/gpio_scmi.c: In function 'scmi_gpio_probe':drivers/gpio/gpio_scmi.c:227:25: error: passing argument 1 of 'snprintf' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
227 | snprintf(uc_priv->bank_name, ret + 1, "gpio_scmi%d_", bank_cnt);
| ~~~~~~~^~~~~~~~~~~
In file included from include/log.h:12,
from include/linux/printk.h:4,
from include/linux/kernel.h:5,
from include/linux/libfdt_env.h:13,
from include/linux/libfdt.h:6,
from include/fdtdec.h:17,
from include/dm/ofnode.h:11,
from include/asm-generic/gpio.h:10,
from ./arch/sandbox/include/asm/gpio.h:24,
from drivers/gpio/gpio_scmi.c:6:
include/stdio.h:60:20: note: expected 'char *' but argument is of type 'const char *'
60 | int snprintf(char *buf, size_t size, const char *fmt, ...)
| ~~~~~~^~~ CC drivers/net/phy/broadcom.o
[1] https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/jobs/1408382
Thanks,
Peng
Quoted 25 lines
drivers/gpio/gpio_scmi.c new file +21
-0+ bank_cnt++; + + uc_priv->gpio_count = priv->num_pins; + +return 0 ; +} + +static const struct udevice_id scmi_gpio_match[] = { + { .compatible ="scmi-pinctrl-gpio" }, + { } +}; + +U_BOOT_DRIVER (scmi_pinctrl_gpio) = { + .name ="scmi_pinctrl_gpio" , + .id =UCLASS_GPIO , + .of_match = scmi_gpio_match, + .probe = scmi_gpio_probe, + .priv_auto =sizeof (struct scmi_gpio_priv ), + .ops = &scmi_gpio_ops, +}; +Signature · 1 line
2.51.0
Re: [PATCH v2 4/4] gpio: scmi: Add gpio_scmi driver
On Mon, Mar 23, 2026 at 11:41:49AM +0800, Peng Fan wrote:
[....]
Quoted 7 lines
drivers/gpio/gpio_scmi.c line 227
Quoted 5 lines
drivers/gpio/gpio_scmi.c new file +5
-0+ ret =snprintf (NULL ,0 ,"gpio_scmi%d_" , bank_cnt); + uc_priv->bank_name =devm_kzalloc (dev, ret +1 ,GFP_KERNEL ); +if (!uc_priv->bank_name) +return -ENOMEM ; +snprintf (uc_priv->bank_name, ret +1 ,"gpio_scmi%d_" , bank_cnt);build fail in CI [1]:
Moreover, this is reinvention of devm_kasprintf() to begin with.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 4/4] gpio: scmi: Add gpio_scmi driver
Quoted 12 lines · Andy Shevchenko
On Mon, Mar 23, 2026 at 11:41:49AM +0800, Peng Fan wrote:
[....]
Quoted 7 lines
drivers/gpio/gpio_scmi.c line 227
Quoted 5 lines
drivers/gpio/gpio_scmi.c new file +5
-0+ ret =snprintf (NULL ,0 ,"gpio_scmi%d_" , bank_cnt); + uc_priv->bank_name =devm_kzalloc (dev, ret +1 ,GFP_KERNEL ); +if (!uc_priv->bank_name) +return -ENOMEM ; +snprintf (uc_priv->bank_name, ret +1 ,"gpio_scmi%d_" , bank_cnt);build fail in CI [1]:
Quoted 2 lines
Moreover, this is reinvention of
devm_kasprintf()to begin with.
devm_kasprintf() isn't an option in u-boot.
regards,
dan carpenter
Re: [PATCH v2 4/4] gpio: scmi: Add gpio_scmi driver
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Andy Shevchenko
On Mon, Mar 23, 2026 at 11:41:49AM +0800, Peng Fan wrote:
[....]
Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
drivers/gpio/gpio_scmi.c line 227
Quoted 5 lines
drivers/gpio/gpio_scmi.c new file +5
-0+ ret =snprintf (NULL ,0 ,"gpio_scmi%d_" , bank_cnt); + uc_priv->bank_name =devm_kzalloc (dev, ret +1 ,GFP_KERNEL ); +if (!uc_priv->bank_name) +return -ENOMEM ; +snprintf (uc_priv->bank_name, ret +1 ,"gpio_scmi%d_" , bank_cnt);build fail in CI [1]:
Moreover, this is reinvention of
devm_kasprintf()to begin with.
devm_kasprintf()isn't an option in u-boot.
Ah, that's what I missed :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi Dan,
Quoted 22 lines · Dan Carpenter
There is an existing SCMI pinctrl driver in
drivers/pinctrl/nxp/which lets you configure the initial state of the pins via device tree. This patchset is a more generic version which provides GPIO as well.I wrote two small cleanup patches to the NXP driver, one which renamed an enum and another which made some white space changes.
The next patch adds an pinctrl driver which lets you configure the initial state for the pins. But the main thing is that we need one driver to handle the SCMI pinctrl protocol so the pinctrl driver does this.
The last patch adds GPIO support over SCMI.
I tested this code using the SCP SCMI server on OP-TEE over Qemu. I created a custom mock pinctrl device in SCP.
Changes since v1:
Address Peng Fang's review comments.
Use the standard gpio-ranges to describe the pins instead of inventing a custom format.
Quoted 4 lines
Dan Carpenter (4):
scmi: pinctrl: add pinctrl message IDs
scmi: update comments forscmi_pinctrl_config_set_in()
scmi: pinctrl: add pinctrl driver for SCMI
I picked up the above three patches.
Thanks,
Peng
Quoted 23 lines
gpio: scmi: Add
gpio_scmidriverdrivers/firmware/scmi/Makefile | 1 + drivers/firmware/scmi/pinctrl.c | 365 +++++++++++++++++++++ drivers/firmware/scmi/scmi_agent-uclass.c | 4 +- drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio_scmi.c | 248 ++++++++++++++ drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/nxp/pinctrl-imx-scmi.c | 2 +- drivers/pinctrl/pinctrl-scmi.c | 365 +++++++++++++++++++++ include/scmi_agent-uclass.h | 2 +- include/scmi_protocols.h | 379 +++++++++++++++++++++- 12 files changed, 1371 insertions(+), 12 deletions(-)create mode 100644
drivers/firmware/scmi/pinctrl.ccreate mode 100644drivers/gpio/gpio_scmi.ccreate mode 100644drivers/pinctrl/pinctrl-scmi.cSignature · 1 line
2.51.0