Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dts/bindings/serial/zephyr,cp210x-uart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2025 Sergey Matsievskiy
# SPDX-License-Identifier: Apache-2.0

description: USB CP210X UART

compatible: "zephyr,cp210x-uart"
Copy link
Contributor

@tmon-nordic tmon-nordic Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is to not require interrupt endpoint, then why you don't make the CDC ACM interrupt endpoint optional?

Universal Serial Bus Class Definitions for Communications Devices Revision 1.2 (Errata 1)
3.4.1 Communications Class Interface

The Communications Class defines a Communications Class interface consisting of a management
element and optionally a notification element. The management element configures and controls the
device, and consists of endpoint 0. The notification element transports events to the host, and in most
cases, consists of a interrupt endpoint.

3.5.1 Communications Class Endpoint Requirements

The Communications Class interface requires one endpoint, a management element. It optionally can
have an additional endpoint, the notification element. The management element uses the default
endpoint for all standard and Communications Class-specific requests. The notification element normally
uses an interrupt endpoint.

Therefore it is not mandatory for CDC ACM device to use interrupt endpoint.

Working on making CDC ACM interrupt endpoint optional, and checking interoperability issues with different hosts would IMHO be more fruitful than abusing cp210x drivers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux's cdc-acm driver is a bit hard for me to understand, but it looks like the interrupt endpoint is mandatory. However, in some cases the driver does look for the endpoints in the alternate configurations, which is worth checking out.

abusing cp210x drivers

I wouldn't call it abuse. More of an emulation=)

Copy link
Contributor

@tmon-nordic tmon-nordic Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux's cdc-acm driver is a bit hard for me to understand, but it looks like the interrupt endpoint is mandatory.

Linux CDC ACM driver is just an implementation, not the specification. The specification states that notification element is optional. If what you want to achieve is to have Zephyr application having something that shows as tty under Linux, and consumes two endpoints per instance, then I would suggest:

  • make the notification endpoint optional in Zephyr CDC ACM implementation
  • send PATCH to linux kernel to not require interrupt notification endpoint

I see no reason why either of the above would be rejected. I am fairly confident that the interrupt endpoint is optional. If it is not, then please point me to relevant section in https://www.usb.org/document-library/class-definitions-communication-devices-12

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out I was wrong, 3.2.2 Abstract Control Model

A Communications Class interface of type Abstract Control Model will consist of a minimum of two
pipes; one is used to implement the management element and the other to implement a notification
element. In addition, the device can use two pipes to implement channels over which to carry unspecified
data, typically over a Data Class interface.

So while CDC itself does not require notification element, ACM does require it. :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abusing cp210x drivers

I wouldn't call it abuse. More of an emulation=)

However you name it, doing so will lead to a device that cannot pass USB certification.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, in some cases the driver does look for the endpoints in the alternate configurations, which is worth checking out.

Looking closely, this line only handles cases where three endpoints belong to the same interface. It does not reduce the number of the required endpoints.

lead to a device that cannot pass USB certification.

The company's PID/VID binding to the appropriate driver may be configured via udev. Are there any other certification blockers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've literally left the name of a vendor's device in here of whom you are entirely cloning, a company I would add that is a zephyr member, that is clearly not acceptable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhedberg for comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean "cloning"? I didn't use their IP or patent or anything. I've made a driver compatible with linux's cp210x driver and named it after that. There're 203 devices from different vendors in linux's PID-VID compatibility list for cp210x. Are they all cloning the original device? Quick search did not yield any restrictions on USB protocol emulation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the 203 devices just use the actual chip in them with their own VID/PID (so these can be certified).


include: uart-controller.yaml

on-bus: usb

properties:
tx-fifo-size:
type: int
default: 1024
description: |
Size of the virtual CP210X UART TX FIFO

rx-fifo-size:
type: int
default: 1024
description: |
Size of the virtual CP210X UART RX FIFO

label:
description: |
The string defined by the label property is also used for the USB
interface string descriptor.
Loading
Loading