* [PATCH v3 0/4] Enable Remote GPIO over RPMSG on i.MX Platform
@ 2025-10-09 22:27 Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support Shenwei Wang
` (3 more replies)
0 siblings, 4 replies; 19+ messages in thread
From: Shenwei Wang @ 2025-10-09 22:27 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx, Shenwei Wang, Arnaud POULIQUEN, linux-gpio
Support the remote devices on the remote processor via the RPMSG bus on
i.MX platform.
Changes in v3:
- fix various format issue and return value check per Peng 's review
comments.
- add the logic to also populate the subnodes which are not in the
device map per Arnaud's request. (in imx_rproc.c)
- update the yaml per Frank's review comments.
Changes in v2:
- re-implemented the gpio driver per Linus Walleij's feedback by using
GPIOLIB_IRQCHIP helper library.
- fix various format issue per Mathieu/Peng 's review comments.
- update the yaml doc per Rob's feedback
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Arnaud POULIQUEN <arnaud.pouliquen@foss.st.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Shenwei Wang (4):
dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
remoteproc: imx_rproc: Populate devices under "rpmsg" subnode
gpio: imx-rpmsg: add imx-rpmsg GPIO driver
arm64: dts: imx8ulp: Add rpmsg node under imx_rproc
.../bindings/remoteproc/fsl,imx-rproc.yaml | 123 +++++
arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 27 +
drivers/gpio/Kconfig | 17 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio-imx-rpmsg.c | 486 ++++++++++++++++++
drivers/remoteproc/imx_rproc.c | 146 ++++++
include/linux/rpmsg/imx_rpmsg.h | 48 ++
7 files changed, 848 insertions(+)
create mode 100644 drivers/gpio/gpio-imx-rpmsg.c
create mode 100644 include/linux/rpmsg/imx_rpmsg.h
--
2.43.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
2025-10-09 22:27 [PATCH v3 0/4] Enable Remote GPIO over RPMSG on i.MX Platform Shenwei Wang
@ 2025-10-09 22:27 ` Shenwei Wang
2025-10-20 10:08 ` (subset) " Krzysztof Kozlowski
2025-10-09 22:27 ` [PATCH v3 2/4] remoteproc: imx_rproc: Populate devices under "rpmsg" subnode Shenwei Wang
` (2 subsequent siblings)
3 siblings, 1 reply; 19+ messages in thread
From: Shenwei Wang @ 2025-10-09 22:27 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx, Shenwei Wang
Remote processors may announce multiple devices (e.g., I2C, GPIO) over
an RPMSG channel. These devices may require corresponding device tree
nodes, especially when acting as providers, to supply phandles for their
consumers.
Define an RPMSG node to work as a container for a group of RPMSG channels
under the imx_rproc node.
Each subnode within "rpmsg" represents an individual RPMSG channel. The
name of each subnode corresponds to the channel name as defined by the
remote processor.
All remote devices associated with a given channel are defined as child
nodes under the corresponding channel node.
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
.../bindings/remoteproc/fsl,imx-rproc.yaml | 123 ++++++++++++++++++
1 file changed, 123 insertions(+)
diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
index 57d75acb0b5e..897a16c4f7db 100644
--- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
@@ -84,6 +84,92 @@ properties:
This property is to specify the resource id of the remote processor in SoC
which supports SCFW
+ rpmsg:
+ type: object
+ additionalProperties: false
+ description:
+ Present a group of RPMSG channel devices.
+
+ properties:
+ rpmsg-io-channel:
+ type: object
+ additionalProperties: false
+ properties:
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+ patternProperties:
+ "gpio@[0-9a-f]+$":
+ type: object
+ unevaluatedProperties: false
+ properties:
+ compatible:
+ enum:
+ - fsl,imx-rpmsg-gpio
+
+ reg:
+ maxItems: 1
+
+ "#gpio-cells":
+ const: 2
+
+ gpio-controller: true
+
+ interrupt-controller: true
+
+ "#interrupt-cells":
+ const: 2
+
+ required:
+ - compatible
+ - reg
+ - "#gpio-cells"
+ - "#interrupt-cells"
+
+ allOf:
+ - $ref: /schemas/gpio/gpio.yaml#
+ - $ref: /schemas/interrupt-controller.yaml#
+
+ required:
+ - '#address-cells'
+ - '#size-cells'
+
+ rpmsg-i2c-channel:
+ type: object
+ unevaluatedProperties: false
+ properties:
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+ patternProperties:
+ "i2c@[0-9a-f]+$":
+ type: object
+ unevaluatedProperties: false
+ properties:
+ compatible:
+ enum:
+ - fsl,imx-rpmsg-i2c
+
+ reg:
+ maxItems: 1
+
+ required:
+ - compatible
+ - reg
+
+ allOf:
+ - $ref: /schemas/i2c/i2c-controller.yaml#
+
+ required:
+ - '#address-cells'
+ - '#size-cells'
+
required:
- compatible
@@ -146,5 +232,42 @@ examples:
&mu 3 1>;
memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&rsc_table>;
syscon = <&src>;
+
+ rpmsg {
+ rpmsg-io-channel {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ gpio@0 {
+ compatible = "fsl,imx-rpmsg-gpio";
+ reg = <0>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ #interrupt-cells = <2>;
+ interrupt-controller;
+ interrupt-parent = <&rpmsg_gpioa>;
+ };
+
+ gpio@1 {
+ compatible = "fsl,imx-rpmsg-gpio";
+ reg = <1>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ #interrupt-cells = <2>;
+ interrupt-controller;
+ interrupt-parent = <&rpmsg_gpiob>;
+ };
+ };
+
+ rpmsg-i2c-channel {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ i2c@0 {
+ compatible = "fsl,imx-rpmsg-i2c";
+ reg = <0>;
+ };
+ };
+ };
};
...
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 2/4] remoteproc: imx_rproc: Populate devices under "rpmsg" subnode
2025-10-09 22:27 [PATCH v3 0/4] Enable Remote GPIO over RPMSG on i.MX Platform Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support Shenwei Wang
@ 2025-10-09 22:27 ` Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 4/4] arm64: dts: imx8ulp: Add rpmsg node under imx_rproc Shenwei Wang
3 siblings, 0 replies; 19+ messages in thread
From: Shenwei Wang @ 2025-10-09 22:27 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx, Shenwei Wang
Register the RPMsg channel driver and populate remote devices defined
under the "rpmsg" subnode upon receiving their notification messages.
The following illustrates the expected DTS layout structure:
cm33: remoteproc-cm33 {
compatible = "fsl,imx8ulp-cm33";
rpmsg {
rpmsg-io-channel {
gpio@0 {
compatible = "fsl,imx-rpmsg-gpio";
reg = <0>;
};
gpio@1 {
compatible = "fsl,imx-rpmsg-gpio";
reg = <1>;
};
...
};
rpmsg-i2c-channel {
i2c@0 {
compatible = "fsl,imx-rpmsg-i2c";
reg = <0>;
};
};
...
};
};
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
drivers/remoteproc/imx_rproc.c | 146 ++++++++++++++++++++++++++++++++
include/linux/rpmsg/imx_rpmsg.h | 48 +++++++++++
2 files changed, 194 insertions(+)
create mode 100644 include/linux/rpmsg/imx_rpmsg.h
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index a6eef0080ca9..e21a7980c490 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -8,6 +8,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/firmware/imx/sci.h>
+#include <linux/rpmsg/imx_rpmsg.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mailbox_client.h>
@@ -15,6 +16,8 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
@@ -22,6 +25,7 @@
#include <linux/reboot.h>
#include <linux/regmap.h>
#include <linux/remoteproc.h>
+#include <linux/rpmsg.h>
#include <linux/workqueue.h>
#include "imx_rproc.h"
@@ -1084,6 +1088,144 @@ static int imx_rproc_sys_off_handler(struct sys_off_data *data)
return NOTIFY_DONE;
}
+struct imx_rpmsg_driver {
+ struct rpmsg_driver rpdrv;
+ void *driver_data;
+};
+
+static char *channel_device_map[][2] = {
+ {"rpmsg-io-channel", "fsl,imx-rpmsg-gpio"},
+ {"rpmsg-i2c-channel", "fsl,imx-rpmsg-i2c"},
+};
+
+static int imx_rpmsg_endpoint_cb(struct rpmsg_device *rpdev, void *data,
+ int len, void *priv, u32 src)
+{
+ struct imx_rpmsg_driver_data *drvdata;
+
+ drvdata = dev_get_drvdata(&rpdev->dev);
+ if (drvdata && drvdata->rx_callback)
+ return drvdata->rx_callback(rpdev, data, len, priv, src);
+
+ return 0;
+}
+
+static void imx_rpmsg_endpoint_remove(struct rpmsg_device *rpdev)
+{
+ of_platform_depopulate(&rpdev->dev);
+}
+
+static int imx_rpmsg_endpoint_probe(struct rpmsg_device *rpdev)
+{
+ struct imx_rpmsg_driver_data *drvdata;
+ struct imx_rpmsg_driver *imx_rpdrv;
+ struct device *dev = &rpdev->dev;
+ struct of_dev_auxdata *auxdata;
+ struct rpmsg_driver *rpdrv;
+ int i;
+
+ rpdrv = container_of(dev->driver, struct rpmsg_driver, drv);
+ imx_rpdrv = container_of(rpdrv, struct imx_rpmsg_driver, rpdrv);
+
+ if (!imx_rpdrv->driver_data)
+ return -EINVAL;
+
+ drvdata = devm_kmemdup(dev, imx_rpdrv->driver_data, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+
+ i = drvdata->map_idx;
+ if (i >= ARRAY_SIZE(channel_device_map))
+ return -ENODEV;
+
+ auxdata = devm_kzalloc(dev, sizeof(*auxdata) * 2, GFP_KERNEL);
+ if (!auxdata)
+ return -ENOMEM;
+
+ drvdata->rpdev = rpdev;
+ auxdata[0].compatible = channel_device_map[i][1];
+ auxdata[0].platform_data = drvdata;
+ dev_set_drvdata(dev, drvdata);
+
+ of_platform_populate(drvdata->channel_node, NULL, auxdata, dev);
+ of_node_put(drvdata->channel_node);
+
+ return 0;
+}
+
+static int imx_of_rpmsg_is_in_map(const char *name)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(channel_device_map); i++) {
+ if (strcmp(name, channel_device_map[i][0]) == 0)
+ return i;
+ }
+
+ return -1;
+}
+
+static int imx_of_rpmsg_register_rpdriver(struct device_node *channel,
+ struct device *dev, int idx)
+{
+ struct imx_rpmsg_driver_data *driver_data;
+ struct imx_rpmsg_driver *rp_driver;
+ struct rpmsg_device_id *rpdev_id;
+
+ rpdev_id = devm_kzalloc(dev, sizeof(*rpdev_id) * 2, GFP_KERNEL);
+ if (!rpdev_id)
+ return -ENOMEM;
+
+ strscpy(rpdev_id[0].name, channel_device_map[idx][0], RPMSG_NAME_SIZE);
+
+ rp_driver = devm_kzalloc(dev, sizeof(*rp_driver), GFP_KERNEL);
+ if (!rp_driver)
+ return -ENOMEM;
+
+ driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL);
+ if (!driver_data)
+ return -ENOMEM;
+
+ driver_data->rproc_name = dev->of_node->name;
+ driver_data->channel_node = channel;
+ driver_data->map_idx = idx;
+
+ rp_driver->rpdrv.drv.name = channel_device_map[idx][0];
+ rp_driver->rpdrv.id_table = rpdev_id;
+ rp_driver->rpdrv.probe = imx_rpmsg_endpoint_probe;
+ rp_driver->rpdrv.remove = imx_rpmsg_endpoint_remove;
+ rp_driver->rpdrv.callback = imx_rpmsg_endpoint_cb;
+ rp_driver->driver_data = driver_data;
+
+ register_rpmsg_driver(&rp_driver->rpdrv);
+
+ return 0;
+}
+
+static int imx_of_rpmsg_node_init(struct platform_device *pdev)
+{
+ struct device_node *np __free(device_node);
+ struct device *dev = &pdev->dev;
+ int idx, ret;
+
+ np = of_get_child_by_name(dev->of_node, "rpmsg");
+ if (!np)
+ return 0;
+
+ for_each_child_of_node_scoped(np, child) {
+ idx = imx_of_rpmsg_is_in_map(child->name);
+ if (idx < 0)
+ ret = of_platform_default_populate(child, NULL, dev);
+ else
+ ret = imx_of_rpmsg_register_rpdriver(child, dev, idx);
+
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
static int imx_rproc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1177,6 +1319,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
goto err_put_clk;
}
+ ret = imx_of_rpmsg_node_init(pdev);
+ if (ret < 0)
+ dev_info(dev, "populating 'rpmsg' node failed\n");
+
return 0;
err_put_clk:
diff --git a/include/linux/rpmsg/imx_rpmsg.h b/include/linux/rpmsg/imx_rpmsg.h
new file mode 100644
index 000000000000..04a5ad2d4a1d
--- /dev/null
+++ b/include/linux/rpmsg/imx_rpmsg.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright 2025 NXP */
+
+/*
+ * @file linux/imx_rpmsg.h
+ *
+ * @brief Global header file for iMX RPMSG
+ *
+ * @ingroup RPMSG
+ */
+#ifndef __LINUX_IMX_RPMSG_H__
+#define __LINUX_IMX_RPMSG_H__
+
+/* Category define */
+#define IMX_RMPSG_LIFECYCLE 1
+#define IMX_RPMSG_PMIC 2
+#define IMX_RPMSG_AUDIO 3
+#define IMX_RPMSG_KEY 4
+#define IMX_RPMSG_GPIO 5
+#define IMX_RPMSG_RTC 6
+#define IMX_RPMSG_SENSOR 7
+
+/* rpmsg version */
+#define IMX_RMPSG_MAJOR 1
+#define IMX_RMPSG_MINOR 0
+
+#define MAX_DEV_PER_CHANNEL 10
+
+struct imx_rpmsg_head {
+ u8 cate; /* Category */
+ u8 major; /* Major version */
+ u8 minor; /* Minor version */
+ u8 type; /* Message type */
+ u8 cmd; /* Command code */
+ u8 reserved[5];
+} __packed;
+
+struct imx_rpmsg_driver_data {
+ int map_idx;
+ const char *rproc_name;
+ struct rpmsg_device *rpdev;
+ struct device_node *channel_node;
+ int (*rx_callback)(struct rpmsg_device *rpdev, void *data,
+ int len, void *priv, u32 src);
+ void *channel_devices[MAX_DEV_PER_CHANNEL];
+};
+
+#endif /* __LINUX_IMX_RPMSG_H__ */
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-09 22:27 [PATCH v3 0/4] Enable Remote GPIO over RPMSG on i.MX Platform Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 2/4] remoteproc: imx_rproc: Populate devices under "rpmsg" subnode Shenwei Wang
@ 2025-10-09 22:27 ` Shenwei Wang
2025-10-09 22:58 ` Andrew Lunn
2025-10-09 22:27 ` [PATCH v3 4/4] arm64: dts: imx8ulp: Add rpmsg node under imx_rproc Shenwei Wang
3 siblings, 1 reply; 19+ messages in thread
From: Shenwei Wang @ 2025-10-09 22:27 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx, Shenwei Wang
On i.MX SoCs, the system may include two processors:
- An MCU running an RTOS
- An MPU running Linux
These processors communicate via the RPMSG protocol.
The driver implements the standard GPIO interface, allowing
the Linux side to control GPIO controllers which reside in
the remote processor via RPMSG protocol.
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
drivers/gpio/Kconfig | 17 ++
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio-imx-rpmsg.c | 486 ++++++++++++++++++++++++++++++++++
3 files changed, 504 insertions(+)
create mode 100644 drivers/gpio/gpio-imx-rpmsg.c
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index a437fe652dbc..97eda94b0ba1 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -1847,6 +1847,23 @@ config GPIO_SODAVILLE
endmenu
+menu "RPMSG GPIO drivers"
+ depends on RPMSG
+
+config GPIO_IMX_RPMSG
+ tristate "NXP i.MX SoC RPMSG GPIO support"
+ depends on IMX_REMOTEPROC
+ select GPIOLIB_IRQCHIP
+ default IMX_REMOTEPROC
+ help
+ Say yes here to support the RPMSG GPIO functions on i.MX SoC based
+ platform. Currently supported devices: i.MX7ULP, i.MX8ULP, i.MX8x,
+ and i.MX9x.
+
+ If unsure, say N.
+
+endmenu
+
menu "SPI GPIO expanders"
depends on SPI_MASTER
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 379f55e9ed1e..e01465c03431 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -83,6 +83,7 @@ obj-$(CONFIG_GPIO_I8255) += gpio-i8255.o
obj-$(CONFIG_GPIO_ICH) += gpio-ich.o
obj-$(CONFIG_GPIO_IDIO_16) += gpio-idio-16.o
obj-$(CONFIG_GPIO_IDT3243X) += gpio-idt3243x.o
+obj-$(CONFIG_GPIO_IMX_RPMSG) += gpio-imx-rpmsg.o
obj-$(CONFIG_GPIO_IMX_SCU) += gpio-imx-scu.o
obj-$(CONFIG_GPIO_IT87) += gpio-it87.o
obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o
diff --git a/drivers/gpio/gpio-imx-rpmsg.c b/drivers/gpio/gpio-imx-rpmsg.c
new file mode 100644
index 000000000000..d2db39693a37
--- /dev/null
+++ b/drivers/gpio/gpio-imx-rpmsg.c
@@ -0,0 +1,486 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright 2025 NXP
+ *
+ * The driver exports a standard gpiochip interface to control
+ * the GPIO controllers via RPMSG on a remote processor.
+ */
+
+#include <linux/err.h>
+#include <linux/gpio/driver.h>
+#include <linux/init.h>
+#include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/rpmsg.h>
+#include <linux/rpmsg/imx_rpmsg.h>
+
+#define IMX_RPMSG_GPIO_PER_PORT 32
+#define RPMSG_TIMEOUT 1000
+
+enum gpio_input_trigger_type {
+ GPIO_RPMSG_TRI_IGNORE,
+ GPIO_RPMSG_TRI_RISING,
+ GPIO_RPMSG_TRI_FALLING,
+ GPIO_RPMSG_TRI_BOTH_EDGE,
+ GPIO_RPMSG_TRI_LOW_LEVEL,
+ GPIO_RPMSG_TRI_HIGH_LEVEL,
+};
+
+enum gpio_rpmsg_header_type {
+ GPIO_RPMSG_SETUP,
+ GPIO_RPMSG_REPLY,
+ GPIO_RPMSG_NOTIFY,
+};
+
+enum gpio_rpmsg_header_cmd {
+ GPIO_RPMSG_INPUT_INIT,
+ GPIO_RPMSG_OUTPUT_INIT,
+ GPIO_RPMSG_INPUT_GET,
+};
+
+struct gpio_rpmsg_data {
+ struct imx_rpmsg_head header;
+ u8 pin_idx;
+ u8 port_idx;
+ union {
+ u8 event;
+ u8 retcode;
+ u8 value;
+ } out;
+ union {
+ u8 wakeup;
+ u8 value;
+ } in;
+} __packed __aligned(8);
+
+struct imx_rpmsg_gpio_pin {
+ u8 irq_shutdown;
+ u8 irq_unmask;
+ u8 irq_mask;
+ u32 irq_wake_enable;
+ u32 irq_type;
+ struct gpio_rpmsg_data msg;
+};
+
+struct imx_gpio_rpmsg_info {
+ struct rpmsg_device *rpdev;
+ struct gpio_rpmsg_data *notify_msg;
+ struct gpio_rpmsg_data *reply_msg;
+ struct completion cmd_complete;
+ struct mutex lock;
+ void **port_store;
+};
+
+struct imx_rpmsg_gpio_port {
+ struct gpio_chip gc;
+ struct imx_rpmsg_gpio_pin gpio_pins[IMX_RPMSG_GPIO_PER_PORT];
+ struct imx_gpio_rpmsg_info info;
+ int idx;
+};
+
+static int gpio_send_message(struct imx_rpmsg_gpio_port *port,
+ struct gpio_rpmsg_data *msg,
+ bool sync)
+{
+ struct imx_gpio_rpmsg_info *info = &port->info;
+ int err;
+
+ if (!info->rpdev) {
+ dev_dbg(&info->rpdev->dev,
+ "rpmsg channel doesn't exist, is remote core ready?\n");
+ return -EINVAL;
+ }
+
+ reinit_completion(&info->cmd_complete);
+ err = rpmsg_send(info->rpdev->ept, (void *)msg,
+ sizeof(struct gpio_rpmsg_data));
+ if (err) {
+ dev_err(&info->rpdev->dev, "rpmsg_send failed: %d\n", err);
+ return err;
+ }
+
+ if (sync) {
+ err = wait_for_completion_timeout(&info->cmd_complete,
+ msecs_to_jiffies(RPMSG_TIMEOUT));
+ if (!err) {
+ dev_err(&info->rpdev->dev, "rpmsg_send timeout!\n");
+ return -ETIMEDOUT;
+ }
+
+ if (info->reply_msg->out.retcode != 0) {
+ dev_err(&info->rpdev->dev, "rpmsg not ack %d!\n",
+ info->reply_msg->out.retcode);
+ return -EINVAL;
+ }
+
+ /* copy the reply message */
+ memcpy(&port->gpio_pins[info->reply_msg->pin_idx].msg,
+ info->reply_msg, sizeof(*info->reply_msg));
+ }
+
+ return 0;
+}
+
+static struct gpio_rpmsg_data *gpio_get_pin_msg(struct imx_rpmsg_gpio_port *port,
+ unsigned int offset)
+{
+ struct gpio_rpmsg_data *msg = &port->gpio_pins[offset].msg;
+
+ memset(msg, 0, sizeof(struct gpio_rpmsg_data));
+
+ return msg;
+};
+
+static int imx_rpmsg_gpio_get(struct gpio_chip *gc, unsigned int gpio)
+{
+ struct imx_rpmsg_gpio_port *port = gpiochip_get_data(gc);
+ struct gpio_rpmsg_data *msg = NULL;
+ int ret;
+
+ guard(mutex)(&port->info.lock);
+
+ msg = gpio_get_pin_msg(port, gpio);
+ msg->header.cate = IMX_RPMSG_GPIO;
+ msg->header.major = IMX_RMPSG_MAJOR;
+ msg->header.minor = IMX_RMPSG_MINOR;
+ msg->header.type = GPIO_RPMSG_SETUP;
+ msg->header.cmd = GPIO_RPMSG_INPUT_GET;
+ msg->pin_idx = gpio;
+ msg->port_idx = port->idx;
+
+ ret = gpio_send_message(port, msg, true);
+ if (!ret)
+ ret = !!port->gpio_pins[gpio].msg.in.value;
+
+ return ret;
+}
+
+static int imx_rpmsg_gpio_direction_input(struct gpio_chip *gc,
+ unsigned int gpio)
+{
+ struct imx_rpmsg_gpio_port *port = gpiochip_get_data(gc);
+ struct gpio_rpmsg_data *msg = NULL;
+
+ guard(mutex)(&port->info.lock);
+
+ msg = gpio_get_pin_msg(port, gpio);
+ msg->header.cate = IMX_RPMSG_GPIO;
+ msg->header.major = IMX_RMPSG_MAJOR;
+ msg->header.minor = IMX_RMPSG_MINOR;
+ msg->header.type = GPIO_RPMSG_SETUP;
+ msg->header.cmd = GPIO_RPMSG_INPUT_INIT;
+ msg->pin_idx = gpio;
+ msg->port_idx = port->idx;
+
+ msg->out.event = GPIO_RPMSG_TRI_IGNORE;
+ msg->in.wakeup = 0;
+
+ return gpio_send_message(port, msg, true);
+}
+
+static inline void imx_rpmsg_gpio_direction_output_init(struct gpio_chip *gc,
+ unsigned int gpio, int val, struct gpio_rpmsg_data *msg)
+{
+ struct imx_rpmsg_gpio_port *port = gpiochip_get_data(gc);
+
+ msg->header.cate = IMX_RPMSG_GPIO;
+ msg->header.major = IMX_RMPSG_MAJOR;
+ msg->header.minor = IMX_RMPSG_MINOR;
+ msg->header.type = GPIO_RPMSG_SETUP;
+ msg->header.cmd = GPIO_RPMSG_OUTPUT_INIT;
+ msg->pin_idx = gpio;
+ msg->port_idx = port->idx;
+ msg->out.value = val;
+}
+
+static int imx_rpmsg_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+ struct imx_rpmsg_gpio_port *port = gpiochip_get_data(gc);
+ struct gpio_rpmsg_data *msg = NULL;
+
+ guard(mutex)(&port->info.lock);
+
+ msg = gpio_get_pin_msg(port, gpio);
+ imx_rpmsg_gpio_direction_output_init(gc, gpio, val, msg);
+
+ return gpio_send_message(port, msg, true);
+}
+
+static int imx_rpmsg_gpio_direction_output(struct gpio_chip *gc,
+ unsigned int gpio, int val)
+{
+ struct imx_rpmsg_gpio_port *port = gpiochip_get_data(gc);
+ struct gpio_rpmsg_data *msg = NULL;
+
+ guard(mutex)(&port->info.lock);
+
+ msg = gpio_get_pin_msg(port, gpio);
+ imx_rpmsg_gpio_direction_output_init(gc, gpio, val, msg);
+
+ return gpio_send_message(port, msg, true);
+}
+
+static int imx_rpmsg_irq_set_type(struct irq_data *d, u32 type)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+ u32 gpio_idx = d->hwirq;
+ int edge = 0;
+ int ret = 0;
+
+ switch (type) {
+ case IRQ_TYPE_EDGE_RISING:
+ edge = GPIO_RPMSG_TRI_RISING;
+ break;
+ case IRQ_TYPE_EDGE_FALLING:
+ edge = GPIO_RPMSG_TRI_FALLING;
+ break;
+ case IRQ_TYPE_EDGE_BOTH:
+ edge = GPIO_RPMSG_TRI_BOTH_EDGE;
+ break;
+ case IRQ_TYPE_LEVEL_LOW:
+ edge = GPIO_RPMSG_TRI_LOW_LEVEL;
+ break;
+ case IRQ_TYPE_LEVEL_HIGH:
+ edge = GPIO_RPMSG_TRI_HIGH_LEVEL;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+ port->gpio_pins[gpio_idx].irq_type = edge;
+
+ return ret;
+}
+
+static int imx_rpmsg_irq_set_wake(struct irq_data *d, u32 enable)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+ u32 gpio_idx = d->hwirq;
+
+ port->gpio_pins[gpio_idx].irq_wake_enable = enable;
+
+ return 0;
+}
+
+/*
+ * This function will be called at:
+ * - one interrupt setup.
+ * - the end of one interrupt happened
+ * The gpio over rpmsg driver will not write the real register, so save
+ * all infos before this function and then send all infos to M core in this
+ * step.
+ */
+static void imx_rpmsg_unmask_irq(struct irq_data *d)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+ u32 gpio_idx = d->hwirq;
+
+ port->gpio_pins[gpio_idx].irq_unmask = 1;
+}
+
+static void imx_rpmsg_mask_irq(struct irq_data *d)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+ u32 gpio_idx = d->hwirq;
+ /*
+ * No need to implement the callback at A core side.
+ * M core will mask interrupt after a interrupt occurred, and then
+ * sends a notify to A core.
+ * After A core dealt with the notify, A core will send a rpmsg to
+ * M core to unmask this interrupt again.
+ */
+ port->gpio_pins[gpio_idx].irq_mask = 1;
+}
+
+static void imx_rpmsg_irq_shutdown(struct irq_data *d)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+ u32 gpio_idx = d->hwirq;
+
+ port->gpio_pins[gpio_idx].irq_shutdown = 1;
+}
+
+static void imx_rpmsg_irq_bus_lock(struct irq_data *d)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+
+ mutex_lock(&port->info.lock);
+}
+
+static void imx_rpmsg_irq_bus_sync_unlock(struct irq_data *d)
+{
+ struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
+ struct gpio_rpmsg_data *msg = NULL;
+ u32 gpio_idx = d->hwirq;
+
+ if (port == NULL) {
+ mutex_unlock(&port->info.lock);
+ return;
+ }
+
+ /*
+ * For mask irq, do nothing here.
+ * M core will mask interrupt after a interrupt occurred, and then
+ * sends a notify to A core.
+ * After A core dealt with the notify, A core will send a rpmsg to
+ * M core to unmask this interrupt again.
+ */
+
+ if (port->gpio_pins[gpio_idx].irq_mask && !port->gpio_pins[gpio_idx].irq_unmask) {
+ port->gpio_pins[gpio_idx].irq_mask = 0;
+ mutex_unlock(&port->info.lock);
+ return;
+ }
+
+ msg = gpio_get_pin_msg(port, gpio_idx);
+ msg->header.cate = IMX_RPMSG_GPIO;
+ msg->header.major = IMX_RMPSG_MAJOR;
+ msg->header.minor = IMX_RMPSG_MINOR;
+ msg->header.type = GPIO_RPMSG_SETUP;
+ msg->header.cmd = GPIO_RPMSG_INPUT_INIT;
+ msg->pin_idx = gpio_idx;
+ msg->port_idx = port->idx;
+
+ if (port->gpio_pins[gpio_idx].irq_shutdown) {
+ msg->out.event = GPIO_RPMSG_TRI_IGNORE;
+ msg->in.wakeup = 0;
+ port->gpio_pins[gpio_idx].irq_shutdown = 0;
+ } else {
+ /* if not set irq type, then use low level as trigger type */
+ msg->out.event = port->gpio_pins[gpio_idx].irq_type;
+ if (!msg->out.event)
+ msg->out.event = GPIO_RPMSG_TRI_LOW_LEVEL;
+ if (port->gpio_pins[gpio_idx].irq_unmask) {
+ msg->in.wakeup = 0;
+ port->gpio_pins[gpio_idx].irq_unmask = 0;
+ } else /* irq set wake */
+ msg->in.wakeup = port->gpio_pins[gpio_idx].irq_wake_enable;
+ }
+
+ gpio_send_message(port, msg, false);
+ mutex_unlock(&port->info.lock);
+}
+
+static const struct irq_chip imx_rpmsg_irq_chip = {
+ .irq_mask = imx_rpmsg_mask_irq,
+ .irq_unmask = imx_rpmsg_unmask_irq,
+ .irq_set_wake = imx_rpmsg_irq_set_wake,
+ .irq_set_type = imx_rpmsg_irq_set_type,
+ .irq_shutdown = imx_rpmsg_irq_shutdown,
+ .irq_bus_lock = imx_rpmsg_irq_bus_lock,
+ .irq_bus_sync_unlock = imx_rpmsg_irq_bus_sync_unlock,
+ .flags = IRQCHIP_IMMUTABLE,
+};
+
+static int imx_rpmsg_gpio_callback(struct rpmsg_device *rpdev,
+ void *data, int len, void *priv, u32 src)
+{
+ struct gpio_rpmsg_data *msg = (struct gpio_rpmsg_data *)data;
+ struct imx_rpmsg_gpio_port *port = NULL;
+ struct imx_rpmsg_driver_data *drvdata;
+
+ drvdata = dev_get_drvdata(&rpdev->dev);
+ if (msg)
+ port = drvdata->channel_devices[msg->port_idx];
+
+ if (!port)
+ return -ENODEV;
+
+ if (msg->header.type == GPIO_RPMSG_REPLY) {
+ port->info.reply_msg = msg;
+ complete(&port->info.cmd_complete);
+ } else if (msg->header.type == GPIO_RPMSG_NOTIFY) {
+ port->info.notify_msg = msg;
+ generic_handle_domain_irq_safe(port->gc.irq.domain, msg->pin_idx);
+ } else
+ dev_err(&rpdev->dev, "wrong command type!\n");
+
+ return 0;
+}
+
+static void imx_rpmsg_gpio_remove_action(void *data)
+{
+ struct imx_rpmsg_gpio_port *port = data;
+
+ port->info.port_store[port->idx] = NULL;
+}
+
+static int imx_rpmsg_gpio_probe(struct platform_device *pdev)
+{
+ struct imx_rpmsg_driver_data *pltdata = pdev->dev.platform_data;
+ struct imx_rpmsg_gpio_port *port;
+ struct gpio_irq_chip *girq;
+ struct gpio_chip *gc;
+ int ret;
+
+ if (!pltdata)
+ return -EPROBE_DEFER;
+
+ port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
+ if (!port)
+ return -ENOMEM;
+
+ ret = device_property_read_u32(&pdev->dev, "reg", &port->idx);
+ if (ret)
+ return ret;
+
+ if (port->idx > MAX_DEV_PER_CHANNEL)
+ return -EINVAL;
+
+ mutex_init(&port->info.lock);
+ init_completion(&port->info.cmd_complete);
+ port->info.rpdev = pltdata->rpdev;
+ port->info.port_store = pltdata->channel_devices;
+ port->info.port_store[port->idx] = port;
+ if (!pltdata->rx_callback)
+ pltdata->rx_callback = imx_rpmsg_gpio_callback;
+
+ gc = &port->gc;
+ gc->owner = THIS_MODULE;
+ gc->parent = &pltdata->rpdev->dev;
+ gc->label = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-gpio%d",
+ pltdata->rproc_name, port->idx);
+ gc->ngpio = IMX_RPMSG_GPIO_PER_PORT;
+ gc->base = -1;
+
+ gc->direction_input = imx_rpmsg_gpio_direction_input;
+ gc->direction_output = imx_rpmsg_gpio_direction_output;
+ gc->get = imx_rpmsg_gpio_get;
+ gc->set = imx_rpmsg_gpio_set;
+
+ platform_set_drvdata(pdev, port);
+ girq = &gc->irq;
+ gpio_irq_chip_set_chip(girq, &imx_rpmsg_irq_chip);
+ girq->parent_handler = NULL;
+ girq->num_parents = 0;
+ girq->parents = NULL;
+ girq->chip->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-gpio%d",
+ pltdata->rproc_name, port->idx);
+
+ ret = devm_add_action_or_reset(&pdev->dev, imx_rpmsg_gpio_remove_action, port);
+ if (ret)
+ return ret;
+
+ return devm_gpiochip_add_data(&pdev->dev, gc, port);
+}
+
+static const struct of_device_id imx_rpmsg_gpio_dt_ids[] = {
+ { .compatible = "fsl,imx-rpmsg-gpio" },
+ { /* sentinel */ }
+};
+
+static struct platform_driver imx_rpmsg_gpio_driver = {
+ .driver = {
+ .name = "gpio-imx-rpmsg",
+ .of_match_table = imx_rpmsg_gpio_dt_ids,
+ },
+ .probe = imx_rpmsg_gpio_probe,
+};
+
+module_platform_driver(imx_rpmsg_gpio_driver);
+
+MODULE_AUTHOR("NXP Semiconductor");
+MODULE_DESCRIPTION("NXP i.MX SoC rpmsg gpio driver");
+MODULE_LICENSE("GPL");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 4/4] arm64: dts: imx8ulp: Add rpmsg node under imx_rproc
2025-10-09 22:27 [PATCH v3 0/4] Enable Remote GPIO over RPMSG on i.MX Platform Shenwei Wang
` (2 preceding siblings ...)
2025-10-09 22:27 ` [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver Shenwei Wang
@ 2025-10-09 22:27 ` Shenwei Wang
3 siblings, 0 replies; 19+ messages in thread
From: Shenwei Wang @ 2025-10-09 22:27 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx, Shenwei Wang
Add the RPMSG bus node along with its GPIO subnodes to the device
tree.
Enable remote device communication and GPIO control via RPMSG on
the i.MX platform.
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi
index 13b01f3aa2a4..6ab1c12a3bc1 100644
--- a/arch/arm64/boot/dts/freescale/imx8ulp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8ulp.dtsi
@@ -191,6 +191,33 @@ scmi_sensor: protocol@15 {
cm33: remoteproc-cm33 {
compatible = "fsl,imx8ulp-cm33";
status = "disabled";
+
+ rpmsg {
+ rpmsg-io-channel {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ rpmsg_gpioa: gpio@0 {
+ compatible = "fsl,imx-rpmsg-gpio";
+ reg = <0>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ #interrupt-cells = <2>;
+ interrupt-controller;
+ interrupt-parent = <&rpmsg_gpioa>;
+ };
+
+ rpmsg_gpiob: gpio@1 {
+ compatible = "fsl,imx-rpmsg-gpio";
+ reg = <1>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ #interrupt-cells = <2>;
+ interrupt-controller;
+ interrupt-parent = <&rpmsg_gpiob>;
+ };
+ };
+ };
};
soc: soc@0 {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-09 22:27 ` [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver Shenwei Wang
@ 2025-10-09 22:58 ` Andrew Lunn
2025-10-10 16:31 ` Mathieu Poirier
2025-10-10 18:58 ` Shenwei Wang
0 siblings, 2 replies; 19+ messages in thread
From: Andrew Lunn @ 2025-10-09 22:58 UTC (permalink / raw)
To: Shenwei Wang
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, linux-imx
On Thu, Oct 09, 2025 at 05:27:15PM -0500, Shenwei Wang wrote:
> On i.MX SoCs, the system may include two processors:
> - An MCU running an RTOS
> - An MPU running Linux
>
> These processors communicate via the RPMSG protocol.
> The driver implements the standard GPIO interface, allowing
> the Linux side to control GPIO controllers which reside in
> the remote processor via RPMSG protocol.
I've not seen the discussion on earlier versions of this patchset, so
i might be asking something already asked and answered. Sorry if i am.
Is there anything IMX specific in here? This appears to be the first
RPMSG GPIO driver. Do we have the opportunity here to define a
protocol for all future RPMSG GPIO drivers, which any/all vendors
should follow, so we don't have lots of different implementations of
basically they same thing? So this would become gpio-rpmsg.c and a
Document somewhere describing the protocol?
Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-09 22:58 ` Andrew Lunn
@ 2025-10-10 16:31 ` Mathieu Poirier
2025-10-13 13:33 ` Linus Walleij
2025-10-10 18:58 ` Shenwei Wang
1 sibling, 1 reply; 19+ messages in thread
From: Mathieu Poirier @ 2025-10-10 16:31 UTC (permalink / raw)
To: Andrew Lunn
Cc: Shenwei Wang, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Shawn Guo, Sascha Hauer, Linus Walleij,
Bartosz Golaszewski, Pengutronix Kernel Team, Fabio Estevam,
Peng Fan, linux-remoteproc, devicetree, imx, linux-arm-kernel,
linux-kernel, linux-imx
On Fri, Oct 10, 2025 at 12:58:38AM +0200, Andrew Lunn wrote:
> On Thu, Oct 09, 2025 at 05:27:15PM -0500, Shenwei Wang wrote:
> > On i.MX SoCs, the system may include two processors:
> > - An MCU running an RTOS
> > - An MPU running Linux
> >
> > These processors communicate via the RPMSG protocol.
> > The driver implements the standard GPIO interface, allowing
> > the Linux side to control GPIO controllers which reside in
> > the remote processor via RPMSG protocol.
>
> I've not seen the discussion on earlier versions of this patchset, so
> i might be asking something already asked and answered. Sorry if i am.
>
> Is there anything IMX specific in here? This appears to be the first
> RPMSG GPIO driver. Do we have the opportunity here to define a
> protocol for all future RPMSG GPIO drivers, which any/all vendors
> should follow, so we don't have lots of different implementations of
> basically they same thing? So this would become gpio-rpmsg.c and a
> Document somewhere describing the protocol?
>
I haven't looked at this patchset yet but I think Andrew's proposal has merit.
> Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-09 22:58 ` Andrew Lunn
2025-10-10 16:31 ` Mathieu Poirier
@ 2025-10-10 18:58 ` Shenwei Wang
2025-10-10 19:31 ` Andrew Lunn
1 sibling, 1 reply; 19+ messages in thread
From: Shenwei Wang @ 2025-10-10 18:58 UTC (permalink / raw)
To: Andrew Lunn
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, October 9, 2025 5:59 PM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: Bjorn Andersson <andersson@kernel.org>; Mathieu Poirier
> <mathieu.poirier@linaro.org>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>; Linus
> Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski <brgl@bgdev.pl>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; Peng Fan <peng.fan@nxp.com>; linux-
> remoteproc@vger.kernel.org; devicetree@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [EXT] Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
> On Thu, Oct 09, 2025 at 05:27:15PM -0500, Shenwei Wang wrote:
> > On i.MX SoCs, the system may include two processors:
> > - An MCU running an RTOS
> > - An MPU running Linux
> >
> > These processors communicate via the RPMSG protocol.
> > The driver implements the standard GPIO interface, allowing the Linux
> > side to control GPIO controllers which reside in the remote processor
> > via RPMSG protocol.
>
> I've not seen the discussion on earlier versions of this patchset, so i might be
> asking something already asked and answered. Sorry if i am.
>
> Is there anything IMX specific in here? This appears to be the first RPMSG GPIO
> driver. Do we have the opportunity here to define a protocol for all future RPMSG
> GPIO drivers, which any/all vendors should follow, so we don't have lots of
> different implementations of basically they same thing? So this would become
> gpio-rpmsg.c and a Document somewhere describing the protocol?
>
The only platform-specific part is the message format exchanged between Linux and the remote processors.
As long as the remote processor follows the same message protocol, the driver should work as expected.
Here's the layout of the message packets:
+--------+--------+--------+--------+--------+----------------+--------+--------+---------------+---------------+
|0x00 |0x01 |0x02 |0x03 |0x04 |0x05..0x09 |0x0A |0x0B |0x0C |0x0D |
|cate |major |minor |type |cmd |reserved[5] |pin_idx |port_idx|out:{evt/rc/v} |in:{wkup/val} |
+--------+--------+--------+--------+--------+----------------+--------+--------+---------------+---------------+
Cate (Category field ): can be GPIO /I2C/PMIC/AUDIO ... etc
Major : Major version number
Minor: Minor version number
Type (Message Type): Can be SETUP / REPLY /NOTIFY for GPIO category
Cmd (Command): Can be Input INIT / Output INIT / Input GET for GPIO category
Pin_idx: The GPIO line index
Port_idx: The GPIO controller index
For Out packet:
if it is OUPUT INIT, the out field value is the gpio output level.
If it is INPUT INIT, the out filed is 0.
For In packet:
If it is a REPLY message, the out field is return code. 0 means success.
If it is a REPLY of INPUT GET, the in field is the value of GPIO line level.
If it is an NOTIFY type of message, it simulates an interrupt event from the remote processor.
I can add above comments in the commit log or the beginning of the driver source file.
Thanks,
Shenwei
> Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-10 18:58 ` Shenwei Wang
@ 2025-10-10 19:31 ` Andrew Lunn
2025-10-13 14:44 ` Shenwei Wang
0 siblings, 1 reply; 19+ messages in thread
From: Andrew Lunn @ 2025-10-10 19:31 UTC (permalink / raw)
To: Shenwei Wang
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> The only platform-specific part is the message format exchanged between Linux and the remote processors.
> As long as the remote processor follows the same message protocol, the driver should work as expected.
>
> Here's the layout of the message packets:
>
> +--------+--------+--------+--------+--------+----------------+--------+--------+---------------+---------------+
> |0x00 |0x01 |0x02 |0x03 |0x04 |0x05..0x09 |0x0A |0x0B |0x0C |0x0D |
> |cate |major |minor |type |cmd |reserved[5] |pin_idx |port_idx|out:{evt/rc/v} |in:{wkup/val} |
> +--------+--------+--------+--------+--------+----------------+--------+--------+---------------+---------------+
>
> Cate (Category field ): can be GPIO /I2C/PMIC/AUDIO ... etc
> Major : Major version number
> Minor: Minor version number
> Type (Message Type): Can be SETUP / REPLY /NOTIFY for GPIO category
> Cmd (Command): Can be Input INIT / Output INIT / Input GET for GPIO category
> Pin_idx: The GPIO line index
> Port_idx: The GPIO controller index
>
> For Out packet:
> if it is OUPUT INIT, the out field value is the gpio output level.
> If it is INPUT INIT, the out filed is 0.
>
> For In packet:
> If it is a REPLY message, the out field is return code. 0 means success.
> If it is a REPLY of INPUT GET, the in field is the value of GPIO line level.
> If it is an NOTIFY type of message, it simulates an interrupt event from the remote processor.
>
> I can add above comments in the commit log or the beginning of the driver source file.
Maybe Documentation/admin-guide/gpio-rpmsg.rst would be better. You
should also document how to handle features the device does not
support. e.g. i _think_ your hardware supports all 4 interrupt
types. But maybe other hardware needs to return something meaning
-EOPNOTSUP?
Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-10 16:31 ` Mathieu Poirier
@ 2025-10-13 13:33 ` Linus Walleij
0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2025-10-13 13:33 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Andrew Lunn, Shenwei Wang, Bjorn Andersson, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Bartosz Golaszewski, Pengutronix Kernel Team, Fabio Estevam,
Peng Fan, linux-remoteproc, devicetree, imx, linux-arm-kernel,
linux-kernel, linux-imx
On Fri, Oct 10, 2025 at 6:31 PM Mathieu Poirier
<mathieu.poirier@linaro.org> wrote:
> On Fri, Oct 10, 2025 at 12:58:38AM +0200, Andrew Lunn wrote:
> > On Thu, Oct 09, 2025 at 05:27:15PM -0500, Shenwei Wang wrote:
> > > On i.MX SoCs, the system may include two processors:
> > > - An MCU running an RTOS
> > > - An MPU running Linux
> > >
> > > These processors communicate via the RPMSG protocol.
> > > The driver implements the standard GPIO interface, allowing
> > > the Linux side to control GPIO controllers which reside in
> > > the remote processor via RPMSG protocol.
> >
> > I've not seen the discussion on earlier versions of this patchset, so
> > i might be asking something already asked and answered. Sorry if i am.
> >
> > Is there anything IMX specific in here? This appears to be the first
> > RPMSG GPIO driver. Do we have the opportunity here to define a
> > protocol for all future RPMSG GPIO drivers, which any/all vendors
> > should follow, so we don't have lots of different implementations of
> > basically they same thing? So this would become gpio-rpmsg.c and a
> > Document somewhere describing the protocol?
> >
>
> I haven't looked at this patchset yet but I think Andrew's proposal has merit.
Yeah this was my comment on v2 as well :D
I even posted a bug to the AMP mailing list to elicit some attention
from that camp. It worked because now Arnaud is on board reviewing
the patch set from an ST PoV.
Maybe it is possible to split the driver in one generic part and one
i.MX part, so it is easy to reuse for other SoCs?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-10 19:31 ` Andrew Lunn
@ 2025-10-13 14:44 ` Shenwei Wang
2025-10-13 14:56 ` Andrew Lunn
0 siblings, 1 reply; 19+ messages in thread
From: Shenwei Wang @ 2025-10-13 14:44 UTC (permalink / raw)
To: Andrew Lunn
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Friday, October 10, 2025 2:32 PM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: Bjorn Andersson <andersson@kernel.org>; Mathieu Poirier
> <mathieu.poirier@linaro.org>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>; Linus
> Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski <brgl@bgdev.pl>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; Peng Fan <peng.fan@nxp.com>; linux-
> remoteproc@vger.kernel.org; devicetree@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [EXT] Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
> > The only platform-specific part is the message format exchanged between
> Linux and the remote processors.
> > As long as the remote processor follows the same message protocol, the driver
> should work as expected.
> >
> > Here's the layout of the message packets:
> >
> > +--------+--------+--------+--------+--------+----------------+--------+--------+----------
> -----+---------------+
> > |0x00 |0x01 |0x02 |0x03 |0x04 |0x05..0x09 |0x0A |0x0B |0x0C
> |0x0D |
> > |cate |major |minor |type |cmd |reserved[5] |pin_idx
> |port_idx|out:{evt/rc/v} |in:{wkup/val} |
> > +--------+--------+--------+--------+--------+----------------+--------+--------+----------
> -----+---------------+
> >
> > Cate (Category field ): can be GPIO /I2C/PMIC/AUDIO ... etc Major :
> > Major version number
> > Minor: Minor version number
> > Type (Message Type): Can be SETUP / REPLY /NOTIFY for GPIO category
> > Cmd (Command): Can be Input INIT / Output INIT / Input GET for GPIO
> > category
> > Pin_idx: The GPIO line index
> > Port_idx: The GPIO controller index
> >
> > For Out packet:
> > if it is OUPUT INIT, the out field value is the gpio output level.
> > If it is INPUT INIT, the out filed is 0.
> >
> > For In packet:
> > If it is a REPLY message, the out field is return code. 0 means success.
> > If it is a REPLY of INPUT GET, the in field is the value of GPIO line level.
> > If it is an NOTIFY type of message, it simulates an interrupt event from the
> remote processor.
> >
> > I can add above comments in the commit log or the beginning of the driver
> source file.
>
> Maybe Documentation/admin-guide/gpio-rpmsg.rst would be better. You should
> also document how to handle features the device does not support. e.g. i _think_
> your hardware supports all 4 interrupt types. But maybe other hardware needs to
> return something meaning -EOPNOTSUP?
>
That should be one type of the error return code in the out field of REPLY message.
The return code of 0 means success, and the others are error codes.
I will add a gpio-rpmsg.rst file in the next patches.
Thanks,
Shenwei
> Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-13 14:44 ` Shenwei Wang
@ 2025-10-13 14:56 ` Andrew Lunn
2025-10-13 16:04 ` Shenwei Wang
0 siblings, 1 reply; 19+ messages in thread
From: Andrew Lunn @ 2025-10-13 14:56 UTC (permalink / raw)
To: Shenwei Wang
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> > Maybe Documentation/admin-guide/gpio-rpmsg.rst would be better. You should
> > also document how to handle features the device does not support. e.g. i _think_
> > your hardware supports all 4 interrupt types. But maybe other hardware needs to
> > return something meaning -EOPNOTSUP?
> >
>
> That should be one type of the error return code in the out field of REPLY message.
> The return code of 0 means success, and the others are error codes.
You need to be careful of architecture code:
https://elixir.bootlin.com/linux/v6.17.1/A/ident/EOPNOTSUPP
Notice how ENOPNOTSUPP can be 45, 122, 223, or 95. Returning EL2NSYNC
or EDQUOT to user space is going to cause confusion...
Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-13 14:56 ` Andrew Lunn
@ 2025-10-13 16:04 ` Shenwei Wang
2025-10-13 16:55 ` Andrew Lunn
0 siblings, 1 reply; 19+ messages in thread
From: Shenwei Wang @ 2025-10-13 16:04 UTC (permalink / raw)
To: Andrew Lunn
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Monday, October 13, 2025 9:56 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: Bjorn Andersson <andersson@kernel.org>; Mathieu Poirier
> <mathieu.poirier@linaro.org>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>; Linus
> Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski <brgl@bgdev.pl>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; Peng Fan <peng.fan@nxp.com>; linux-
> remoteproc@vger.kernel.org; devicetree@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [EXT] Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
> > > Maybe Documentation/admin-guide/gpio-rpmsg.rst would be better. You
> > > should also document how to handle features the device does not
> > > support. e.g. i _think_ your hardware supports all 4 interrupt
> > > types. But maybe other hardware needs to return something meaning -
> EOPNOTSUP?
> > >
> >
> > That should be one type of the error return code in the out field of REPLY
> message.
> > The return code of 0 means success, and the others are error codes.
>
> You need to be careful of architecture code:
>
> https://elixir.bootl/
> in.com%2Flinux%2Fv6.17.1%2FA%2Fident%2FEOPNOTSUPP&data=05%7C02%7
> Cshenwei.wang%40nxp.com%7Ce2c6c89bb8cb41882a5208de0a68aa7b%7C686
> ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638959641921284557%7CUn
> known%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIs
> IlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata
> =Lx%2B8iM3d8flgUq8kn8bnaDmxZDea8pPp2wL5V7JT%2BDM%3D&reserved=0
>
> Notice how ENOPNOTSUPP can be 45, 122, 223, or 95. Returning EL2NSYNC or
> EDQUOT to user space is going to cause confusion...
>
I think we should just follow the definitions in include/uapi/asm-generic/errno.h, right?
Thanks,
Shenwei
> Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-13 16:04 ` Shenwei Wang
@ 2025-10-13 16:55 ` Andrew Lunn
2025-10-13 18:41 ` Shenwei Wang
0 siblings, 1 reply; 19+ messages in thread
From: Andrew Lunn @ 2025-10-13 16:55 UTC (permalink / raw)
To: Shenwei Wang
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> > Notice how ENOPNOTSUPP can be 45, 122, 223, or 95. Returning EL2NSYNC or
> > EDQUOT to user space is going to cause confusion...
> >
>
> I think we should just follow the definitions in
> include/uapi/asm-generic/errno.h, right?
No.
Try a make for mips, and look at includes you end up with. You will
find it goes something like:
# 1 "./arch/mips/include/asm/errno.h" 1
# 11 "./arch/mips/include/asm/errno.h"
# 1 "./arch/mips/include/uapi/asm/errno.h" 1
# 16 "./arch/mips/include/uapi/asm/errno.h"
# 1 "./include/uapi/asm-generic/errno-base.h" 1
# 17 "./arch/mips/include/uapi/asm/errno.h" 2
and this results in
#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
not what you get from asm-generic/errno.h:
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-13 16:55 ` Andrew Lunn
@ 2025-10-13 18:41 ` Shenwei Wang
2025-10-13 19:14 ` Andrew Lunn
0 siblings, 1 reply; 19+ messages in thread
From: Shenwei Wang @ 2025-10-13 18:41 UTC (permalink / raw)
To: Andrew Lunn
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Monday, October 13, 2025 11:56 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> Cc: Bjorn Andersson <andersson@kernel.org>; Mathieu Poirier
> <mathieu.poirier@linaro.org>; Rob Herring <robh@kernel.org>; Krzysztof
> Kozlowski <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; Shawn
> Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>; Linus
> Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski <brgl@bgdev.pl>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; Peng Fan <peng.fan@nxp.com>; linux-
> remoteproc@vger.kernel.org; devicetree@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: [EXT] Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
> > > Notice how ENOPNOTSUPP can be 45, 122, 223, or 95. Returning
> > > EL2NSYNC or EDQUOT to user space is going to cause confusion...
> > >
> >
>
> > I think we should just follow the definitions in
> > include/uapi/asm-generic/errno.h, right?
>
> No.
>
> Try a make for mips, and look at includes you end up with. You will find it goes
> something like:
>
> # 1 "./arch/mips/include/asm/errno.h" 1
> # 11 "./arch/mips/include/asm/errno.h"
> # 1 "./arch/mips/include/uapi/asm/errno.h" 1 # 16
> "./arch/mips/include/uapi/asm/errno.h"
> # 1 "./include/uapi/asm-generic/errno-base.h" 1 # 17
> "./arch/mips/include/uapi/asm/errno.h" 2
>
> and this results in
>
> #define EOPNOTSUPP 122 /* Operation not supported on transport
> endpoint */
>
> not what you get from asm-generic/errno.h:
>
> #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint
> */
>
That shouldn't be an issue in this case.
For instance, if we define the error code as 1 in the return message, the driver will interpret it and just return -EOPNOTSUPP, regardless of the architecture.
Thanks,
Shenwei
> Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
2025-10-13 18:41 ` Shenwei Wang
@ 2025-10-13 19:14 ` Andrew Lunn
0 siblings, 0 replies; 19+ messages in thread
From: Andrew Lunn @ 2025-10-13 19:14 UTC (permalink / raw)
To: Shenwei Wang
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Pengutronix Kernel Team,
Fabio Estevam, Peng Fan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dl-linux-imx
> For instance, if we define the error code as 1 in the return
> message, the driver will interpret it and just return -EOPNOTSUPP,
> regardless of the architecture.
Yes, that is fine. Document the values the return code can take, and
what the mean. What we don't want is the protocol directly returning
errno values, because they are architecture specific.
Andrew
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: (subset) [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
2025-10-09 22:27 ` [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support Shenwei Wang
@ 2025-10-20 10:08 ` Krzysztof Kozlowski
2025-10-22 7:58 ` Arnaud POULIQUEN
2025-10-22 8:05 ` Krzysztof Kozlowski
0 siblings, 2 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2025-10-20 10:08 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Shenwei Wang
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx
On Thu, 09 Oct 2025 17:27:13 -0500, Shenwei Wang wrote:
> Remote processors may announce multiple devices (e.g., I2C, GPIO) over
> an RPMSG channel. These devices may require corresponding device tree
> nodes, especially when acting as providers, to supply phandles for their
> consumers.
>
> Define an RPMSG node to work as a container for a group of RPMSG channels
> under the imx_rproc node.
>
> [...]
Applied, thanks!
[1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
(no commit info)
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: (subset) [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
2025-10-20 10:08 ` (subset) " Krzysztof Kozlowski
@ 2025-10-22 7:58 ` Arnaud POULIQUEN
2025-10-22 8:05 ` Krzysztof Kozlowski
1 sibling, 0 replies; 19+ messages in thread
From: Arnaud POULIQUEN @ 2025-10-22 7:58 UTC (permalink / raw)
To: Krzysztof Kozlowski, Bjorn Andersson, Mathieu Poirier,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Linus Walleij, Bartosz Golaszewski, Shenwei Wang
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx
Hello Krzysztof,
On 10/20/25 12:08, Krzysztof Kozlowski wrote:
>
> On Thu, 09 Oct 2025 17:27:13 -0500, Shenwei Wang wrote:
>> Remote processors may announce multiple devices (e.g., I2C, GPIO) over
>> an RPMSG channel. These devices may require corresponding device tree
>> nodes, especially when acting as providers, to supply phandles for their
>> consumers.
>>
>> Define an RPMSG node to work as a container for a group of RPMSG channels
>> under the imx_rproc node.
>>
>> [...]
>
> Applied, thanks!
For your information, there are requirements to make the rpmsg-gpio
driver generic [1]. This could impact these bindings.
Best Regards,
Arnaud
[1] https://lkml.org/lkml/2025/10/13/790
>
> [1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
> (no commit info)
>
> Best regards,
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: (subset) [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
2025-10-20 10:08 ` (subset) " Krzysztof Kozlowski
2025-10-22 7:58 ` Arnaud POULIQUEN
@ 2025-10-22 8:05 ` Krzysztof Kozlowski
1 sibling, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2025-10-22 8:05 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Linus Walleij, Bartosz Golaszewski, Shenwei Wang
Cc: Pengutronix Kernel Team, Fabio Estevam, Peng Fan,
linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
linux-imx
On 20/10/2025 12:08, Krzysztof Kozlowski wrote:
>
> On Thu, 09 Oct 2025 17:27:13 -0500, Shenwei Wang wrote:
>> Remote processors may announce multiple devices (e.g., I2C, GPIO) over
>> an RPMSG channel. These devices may require corresponding device tree
>> nodes, especially when acting as providers, to supply phandles for their
>> consumers.
>>
>> Define an RPMSG node to work as a container for a group of RPMSG channels
>> under the imx_rproc node.
>>
>> [...]
>
> Applied, thanks!
>
> [1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support
> (no commit info)
>
This was not applied, I just b4-ty wrong patch.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-10-22 8:05 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 22:27 [PATCH v3 0/4] Enable Remote GPIO over RPMSG on i.MX Platform Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support Shenwei Wang
2025-10-20 10:08 ` (subset) " Krzysztof Kozlowski
2025-10-22 7:58 ` Arnaud POULIQUEN
2025-10-22 8:05 ` Krzysztof Kozlowski
2025-10-09 22:27 ` [PATCH v3 2/4] remoteproc: imx_rproc: Populate devices under "rpmsg" subnode Shenwei Wang
2025-10-09 22:27 ` [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver Shenwei Wang
2025-10-09 22:58 ` Andrew Lunn
2025-10-10 16:31 ` Mathieu Poirier
2025-10-13 13:33 ` Linus Walleij
2025-10-10 18:58 ` Shenwei Wang
2025-10-10 19:31 ` Andrew Lunn
2025-10-13 14:44 ` Shenwei Wang
2025-10-13 14:56 ` Andrew Lunn
2025-10-13 16:04 ` Shenwei Wang
2025-10-13 16:55 ` Andrew Lunn
2025-10-13 18:41 ` Shenwei Wang
2025-10-13 19:14 ` Andrew Lunn
2025-10-09 22:27 ` [PATCH v3 4/4] arm64: dts: imx8ulp: Add rpmsg node under imx_rproc Shenwei Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).