Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
From: Shenwei Wang
Date: Fri Oct 10 2025 - 14:59:01 EST
> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Thursday, October 9, 2025 5:59 PM
> To: Shenwei Wang <shenwei.wang@xxxxxxx>
> Cc: Bjorn Andersson <andersson@xxxxxxxxxx>; Mathieu Poirier
> <mathieu.poirier@xxxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>; Krzysztof
> Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley <conor+dt@xxxxxxxxxx>; Shawn
> Guo <shawnguo@xxxxxxxxxx>; Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>; Linus
> Walleij <linus.walleij@xxxxxxxxxx>; Bartosz Golaszewski <brgl@xxxxxxxx>;
> Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>; Fabio Estevam
> <festevam@xxxxxxxxx>; Peng Fan <peng.fan@xxxxxxx>; linux-
> remoteproc@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; imx@xxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; dl-linux-imx
> <linux-imx@xxxxxxx>
> 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