Thread (19 messages) 19 messages, 6 authors, 2025-10-22

Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver

From: Shenwei Wang <shenwei.wang@nxp.com>
Date: 2025-10-13 14:44:47
Also in: imx, linux-devicetree, linux-remoteproc, lkml

-----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
[off-list ref]; Rob Herring [off-list ref]; Krzysztof
Kozlowski [off-list ref]; Conor Dooley [off-list ref]; Shawn
Guo [off-list ref]; Sascha Hauer [off-list ref]; Linus
Walleij [off-list ref]; Bartosz Golaszewski [off-list ref];
Pengutronix Kernel Team [off-list ref]; Fabio Estevam
[off-list ref]; Peng Fan [off-list ref]; 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
[off-list ref]
Subject: [EXT] Re: [PATCH v3 3/4] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
quoted
The only platform-specific part is the message format exchanged between
Linux and the remote processors.
quoted
As long as the remote processor follows the same message protocol, the driver
should work as expected.
quoted
Here's the layout of the message packets:

+--------+--------+--------+--------+--------+----------------+--------+--------+----------
-----+---------------+
quoted
|0x00    |0x01    |0x02    |0x03    |0x04    |0x05..0x09      |0x0A    |0x0B    |0x0C
|0x0D           |
quoted
|cate    |major   |minor   |type    |cmd     |reserved[5]     |pin_idx
|port_idx|out:{evt/rc/v} |in:{wkup/val}  |
quoted
+--------+--------+--------+--------+--------+----------------+--------+--------+----------
-----+---------------+
quoted
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.
quoted
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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help