--- a/sys/dev/puc/pucdata.c
+++ b/sys/dev/puc/pucdata.c
@@ -68,6 +68,7 @@ static puc_config_f puc_config_siig;
static puc_config_f puc_config_sunix;
static puc_config_f puc_config_timedia;
static puc_config_f puc_config_titan;
+static puc_config_f puc_config_wch;
const struct puc_cfg puc_pci_devices[] = {
{ 0x0009, 0x7168, 0xffff, 0,
@@ -1278,6 +1279,13 @@ const struct puc_cfg puc_pci_devices[] = {
PUC_PORT_4S, 0x10, 0, 8,
.config_function = puc_config_icbook
},
+
+ { 0x1c00, 0x3250, 0xffff, 0,
+ "WCH CH 382 Multi-I/O",
+ DEFAULT_RCLK,
+ PUC_PORT_2S1P, 0x10, 4, 8,
+ .config_function = puc_config_wch
+ },
{ 0xffff, 0, 0xffff, 0, NULL, 0 }
};
@@ -1867,3 +1875,35 @@ puc_config_titan(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd,
}
return (ENXIO);
}
+
+static int
+puc_config_wch(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
+ intptr_t *res)
+{
+ const struct puc_cfg *cfg = sc->sc_cfg;
+
+ /* these are currently specific to the CH 382L */
+ switch (cmd) {
+ case PUC_CFG_GET_OFS:
+ if (port == 2)
+ *res = 0;
+ else
+ *res = 0xc0 + port * cfg->d_ofs;
+ return(0);
+ case PUC_CFG_GET_RID:
+ if (port == 1) {
+ *res = cfg->rid;
+ return (0);
+ }
+ break;
+ case PUC_CFG_GET_LEN:
+ if (port == 2) {
+ *res = 4;
+ return (0);
+ }
+ break;
+ default:
+ break;
+ }
+ return (ENXIO);
+}