[PATCH v2 00/14] greybus: introduce CPC as transport layer

Damien Riégel posted 14 patches 3 weeks, 1 day ago
MAINTAINERS                    |   6 +
drivers/greybus/Kconfig        |   2 +
drivers/greybus/Makefile       |   2 +
drivers/greybus/cpc/Kconfig    |  22 ++
drivers/greybus/cpc/Makefile   |   9 +
drivers/greybus/cpc/cpc.h      |  75 +++++
drivers/greybus/cpc/cport.c    | 112 +++++++
drivers/greybus/cpc/header.c   | 136 +++++++++
drivers/greybus/cpc/header.h   |  55 ++++
drivers/greybus/cpc/host.c     | 313 +++++++++++++++++++
drivers/greybus/cpc/host.h     |  63 ++++
drivers/greybus/cpc/protocol.c | 168 +++++++++++
drivers/greybus/cpc/sdio.c     | 533 +++++++++++++++++++++++++++++++++
13 files changed, 1496 insertions(+)
create mode 100644 drivers/greybus/cpc/Kconfig
create mode 100644 drivers/greybus/cpc/Makefile
create mode 100644 drivers/greybus/cpc/cpc.h
create mode 100644 drivers/greybus/cpc/cport.c
create mode 100644 drivers/greybus/cpc/header.c
create mode 100644 drivers/greybus/cpc/header.h
create mode 100644 drivers/greybus/cpc/host.c
create mode 100644 drivers/greybus/cpc/host.h
create mode 100644 drivers/greybus/cpc/protocol.c
create mode 100644 drivers/greybus/cpc/sdio.c
[PATCH v2 00/14] greybus: introduce CPC as transport layer
Posted by Damien Riégel 3 weeks, 1 day ago
Hi,

This patchset brings support for Silicon Labs' CPC protocol as transport
layer for Greybus. This is introduced as a module that sits between
Greybus and CPC Host Device Drivers implementations, like SDIO or SPI.
This patchset includes SDIO as physical layer.

        +----------------------------------------------------+
        |                      Greybus                       |
        +----------------------------------------------------+
                                 /|\
                                  |
                                 \|/
        +----------------------------------------------------+
        |                        CPC                         |
        +----------------------------------------------------+
              /|\                /|\                /|\
               |                  |                  |
              \|/                \|/                \|/
          +----------+       +---------+       +-----------+
          |   SDIO   |       |   SPI   |       |   Others  |
          +----------+       +---------+       +-----------+

CPC implements some of the features of Unipro that Greybus relies upon,
like reliable transmission. CPC takes care of detecting transmission
errors and retransmit frames if necessary, but that feature is not part
of the RFC to keep it concise. There's also a flow-control
feature, preventing sending messages to already full cports.

In order to implement these features, a 4-byte header is prepended to
Greybus messages, making the whole header 12 bytes (Greybus header is 8
bytes).

This RFC starts by implementing a shim layer between physical bus
drivers (like SDIO and SPI) and Greybus, and progressively add more
elements to it to make it useful in its own right. Finally, an SDIO
driver is added to enable the communication with a remote device.


Changes in v2:
  - addressed review comments and errors reported by kernel bot
  - for SDIO driver, remove padding between headers and payloads when
    aggregating packets together

Damien Riégel (13):
  greybus: cpc: add minimal CPC Host Device infrastructure
  greybus: cpc: introduce CPC cport structure
  greybus: cpc: use socket buffers instead of gb_message in TX path
  greybus: cpc: pack cport ID in Greybus header
  greybus: cpc: switch RX path to socket buffers
  greybus: cpc: introduce CPC header structure
  greybus: cpc: account for CPC header size in RX and TX path
  greybus: cpc: add and validate sequence numbers
  greybus: cpc: acknowledge all incoming messages
  greybus: cpc: use holding queue instead of sending out immediately
  greybus: cpc: honour remote's RX window
  greybus: cpc: let host device drivers dequeue TX frames
  greybus: cpc: add private data pointer in CPC Host Device

Gabriel Beaulieu (1):
  greybus: cpc: add CPC SDIO host driver

 MAINTAINERS                    |   6 +
 drivers/greybus/Kconfig        |   2 +
 drivers/greybus/Makefile       |   2 +
 drivers/greybus/cpc/Kconfig    |  22 ++
 drivers/greybus/cpc/Makefile   |   9 +
 drivers/greybus/cpc/cpc.h      |  75 +++++
 drivers/greybus/cpc/cport.c    | 112 +++++++
 drivers/greybus/cpc/header.c   | 136 +++++++++
 drivers/greybus/cpc/header.h   |  55 ++++
 drivers/greybus/cpc/host.c     | 313 +++++++++++++++++++
 drivers/greybus/cpc/host.h     |  63 ++++
 drivers/greybus/cpc/protocol.c | 168 +++++++++++
 drivers/greybus/cpc/sdio.c     | 533 +++++++++++++++++++++++++++++++++
 13 files changed, 1496 insertions(+)
 create mode 100644 drivers/greybus/cpc/Kconfig
 create mode 100644 drivers/greybus/cpc/Makefile
 create mode 100644 drivers/greybus/cpc/cpc.h
 create mode 100644 drivers/greybus/cpc/cport.c
 create mode 100644 drivers/greybus/cpc/header.c
 create mode 100644 drivers/greybus/cpc/header.h
 create mode 100644 drivers/greybus/cpc/host.c
 create mode 100644 drivers/greybus/cpc/host.h
 create mode 100644 drivers/greybus/cpc/protocol.c
 create mode 100644 drivers/greybus/cpc/sdio.c

-- 
2.52.0

Re: [PATCH v2 00/14] greybus: introduce CPC as transport layer
Posted by Jérôme Pouiller 3 weeks, 1 day ago
On Thursday 15 January 2026 16:57:53 Central European Standard Time Damien Riégel wrote:
> Hi,
> 
> This patchset brings support for Silicon Labs' CPC protocol as transport
> layer for Greybus. This is introduced as a module that sits between
> Greybus and CPC Host Device Drivers implementations, like SDIO or SPI.
> This patchset includes SDIO as physical layer.
> 
>         +----------------------------------------------------+
>         |                      Greybus                       |
>         +----------------------------------------------------+
>                                  /|\
>                                   |
>                                  \|/
>         +----------------------------------------------------+
>         |                        CPC                         |
>         +----------------------------------------------------+
>               /|\                /|\                /|\
>                |                  |                  |
>               \|/                \|/                \|/
>           +----------+       +---------+       +-----------+
>           |   SDIO   |       |   SPI   |       |   Others  |
>           +----------+       +---------+       +-----------+
> 
> CPC implements some of the features of Unipro that Greybus relies upon,
> like reliable transmission. CPC takes care of detecting transmission
> errors and retransmit frames if necessary, but that feature is not part
> of the RFC to keep it concise. There's also a flow-control
> feature, preventing sending messages to already full cports.
> 
> In order to implement these features, a 4-byte header is prepended to
> Greybus messages, making the whole header 12 bytes (Greybus header is 8
> bytes).
> 
> This RFC starts by implementing a shim layer between physical bus
> drivers (like SDIO and SPI) and Greybus, and progressively add more
> elements to it to make it useful in its own right. Finally, an SDIO
> driver is added to enable the communication with a remote device.
> 
> 
> Changes in v2:
>   - addressed review comments and errors reported by kernel bot
>   - for SDIO driver, remove padding between headers and payloads when
>     aggregating packets together
> 

I have to review this PR for a while. Sorry for the delay. I should
have provided my feedback for the v1.

For now, the abstract interface seems a bit over-engineered. However,
I assume will make sense once other buses will be added. Globally,
this work looks good to me.

Until now, I was was a bit frustrated Greybus for Zephyr only addresses
devices with network capabilities. I hope to be able to easily expose the
services of my Zephyr devices to my Linux host with this PR.

Beside my small comments:

Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

-- 
Jérôme Pouiller
Re: [PATCH v2 00/14] greybus: introduce CPC as transport layer
Posted by Jérôme Pouiller 3 weeks, 1 day ago
On Thursday 15 January 2026 22:46:43 Central European Standard Time Jérôme Pouiller wrote:
[...]
> Beside my small comments:
> 
> Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

I have given my review a bit to quickly. The SDIO VID conflict in
patch 14 has to be fixed.


-- 
Jérôme Pouiller