[PATCH 2/6] dt-bindings: usb: usb-device: relax compatible pattern to a contains
Quentin Schulz
foss+uboot at 0leil.net
Wed Jul 30 13:10:18 CEST 2025
From: Quentin Schulz <quentin.schulz at cherry.de>
The dt-core typically allows multiple compatibles[1] but usb-device
currently forces a single compatible.
This is an issue when multiple devices with slightly different productID
all behave the same. This would require the driver to keep updating its
compatible matching table to include this new productID instead of doing
what is usually done: have two compatibles, the leftmost which matches
exactly the HW device definition, and the rightmost one as a fallback
which is assumed to be 100% compatible with the device at hand. If this
assumption turns out to be wrong, it is easy to work around this without
having to modify the device tree by handling the leftmost compatible in the driver.
[1] https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/dt-core.yaml#L21-L25
Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
Reviewed-by: Rob Herring (Arm) <robh at kernel.org>
Link: https://lore.kernel.org/r/20250418-dt-binding-usb-device-compatibles-v2-1-b3029f14e800@cherry.de
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
[ upstream commit: 495df45f38c8ba3d74c3180a0a13a0ecbfa717d1 ]
(cherry picked from commit 932da7a8df7b6b43453d640b383d0076d5a7d9a5)
---
dts/upstream/Bindings/usb/usb-device.yaml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dts/upstream/Bindings/usb/usb-device.yaml b/dts/upstream/Bindings/usb/usb-device.yaml
index c676956810331b81f11f3624340fc3e612c98315..09fceb469f10525e9dcdb91435b142b0d21964b8 100644
--- a/dts/upstream/Bindings/usb/usb-device.yaml
+++ b/dts/upstream/Bindings/usb/usb-device.yaml
@@ -28,7 +28,8 @@ description: |
properties:
compatible:
- pattern: "^usb[0-9a-f]{1,4},[0-9a-f]{1,4}$"
+ contains:
+ pattern: "^usb[0-9a-f]{1,4},[0-9a-f]{1,4}$"
description: Device nodes or combined nodes.
"usbVID,PID", where VID is the vendor id and PID the product id.
The textual representation of VID and PID shall be in lower case
--
2.50.1
More information about the U-Boot
mailing list