[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v5 2/3] ns16550: add support for WCH CH382 serial adapters


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
  • Date: Wed, 3 Jun 2026 00:13:21 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EK6a2UFU+of/PuSh5uCUJHjyBKBPm7/2jZE4fVYKMsI=; b=bQvVfLJ0Atp8HIsmuQl8RdhNbE++F/Mc3vvv89RMN3bXv3LXYMlESR4Jo3Z5RrT5+5+pgrpJnZE5np0cbQk7jJQnJUYwT8Wy5eWx/4j47B7feO1LjIvwQ1a6Rul8oHciM8kSXTWjBrtCJIAffu/bXGEkfq9X7UB5NITems8AehhbxfXMkYVvo4O39/mAh+jD5JQUvT8v+Gzpypuwzid4QrvJ3HF//Y2YDBFhZk0S8AWka21ZuwLNnb86kcJzPm3b8/+dmNGraKY0+CK6ip/w1I8l9FuJVxtx0Gq5hNa+0AhhGPHw35v/wLi33HrZwXLFXdI0oKq+NHJenHf2BxBxnw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iRY/7TIPqFV49hixGWu7RUL8abSfIfUsTMJJerP/O7RWj1uS/NDsPQKDzv3sq/ib1NaVTrBTs6v+0R9oGINwzvWXpC4jZ96Gb2iFTeh0Ykq6TePjz0pacCKfshWD54K7ZohdwGroDf9HiGIIotS4w2SPmDqcYAydDRCoOrC4u4IE2xWqxtxUNkIULgux4907anUMddtYkQSOEWcPotoSZVdKoasGIJDP0SzFA4EF1qopFNqbL1SoiD9A2Kg7tfIrqg5Q44SdfRJB6w190u935r3kuOS57v5QI1PdHaY6+FO1bKU5SZmHv91vLFeaihBBSE2yiRQfkgC3kT5cFH+owg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Tue, 02 Jun 2026 16:14:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Add support for the WCH (Nanjing Qinheng Microelectronics Co., Ltd.)
CH382 PCIe dual port serial adapter. The CH382 is available in two
variants:
 - CH382 2S   [1c00:3253]: 2 serial ports
 - CH382 2S1P [1c00:3250]: 2 serial ports + 1 parallel port

This chip uses IO BAR0, base baud rate 115200, ports starting at offset
0xc0 and spaced 8 bytes apart, and a 256-byte FIFO. [1]

[1] https://www.wch-ic.com/downloads/CH382DS1_PDF.html

Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/drivers/char/ns16550.c | 23 +++++++++++++++++++++++
 xen/include/xen/pci_ids.h  |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index ed4e29ec25..5a93685da4 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -95,6 +95,7 @@ struct ns16550_config {
         param_exar_xr17v354,
         param_exar_xr17v358,
         param_intel_lpss,
+        param_wch_ch382,
     } param;
 };
 
@@ -861,6 +862,16 @@ static const struct ns16550_config_param __initconst 
uart_param[] = {
         .mmio = true,
         .max_ports = 1,
     },
+    [param_wch_ch382] = {
+        .base_baud = 115200,
+        .first_offset = 0xc0,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 256,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = true,
+        .max_ports = 2,
+    },
 };
 
 static const struct ns16550_config __initconst uart_config[] =
@@ -1189,6 +1200,18 @@ static const struct ns16550_config __initconst 
uart_config[] =
         .dev_id = 0x7adc,
         .param = param_intel_lpss
     },
+    /* WCH CH382 2S1P */
+    {
+        .vendor_id = PCI_VENDOR_ID_WCHIC,
+        .dev_id = 0x3250,
+        .param = param_wch_ch382
+    },
+    /* WCH CH382 2S */
+    {
+        .vendor_id = PCI_VENDOR_ID_WCHIC,
+        .dev_id = 0x3253,
+        .param = param_wch_ch382
+    },
 };
 
 static int __init
diff --git a/xen/include/xen/pci_ids.h b/xen/include/xen/pci_ids.h
index 5884a20b8f..15e938225c 100644
--- a/xen/include/xen/pci_ids.h
+++ b/xen/include/xen/pci_ids.h
@@ -13,6 +13,8 @@
 
 #define PCI_VENDOR_ID_BROADCOM           0x14e4
 
+#define PCI_VENDOR_ID_WCHIC              0x1c00
+
 #define PCI_VENDOR_ID_INTEL              0x8086
 
 #endif /* XEN_PCI_IDS_H */
-- 
2.53.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.