Skip to contentSkip to conversation

parport_serial: Add support for WCH CH382L PCI-E single parallel port card.

PATCH In review Sudip Mukherjee 4 participants 10 messages Jun 17, 2017 – Feb 3, 2018 Parallel port

lore
Share & tools
lore

Sudip Mukherjee

author maintainer
#0 lore raw

PATCH 1/1 parport_serial: Add support for WCH CH382L PCI-E single parallel port card.

From: Alexander Gerasiov <[email protected]>

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

---
 drivers/parport/parport_serial.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/parport/parport_serial.c +9 -0
index e15b484..f26fc87 100644
@@ -65,6 +65,7 @@ enum parport_pc_pci_cards {
 	wch_ch353_1s1p,
 	wch_ch353_2s1p,
 	wch_ch382_2s1p,
+	wch_ch382_0s1p,
 	sunix_2s1p,
 };
 
@@ -153,6 +154,7 @@ static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par,
 	/* wch_ch353_1s1p*/             { 1, { { 1, -1}, } },
 	/* wch_ch353_2s1p*/             { 1, { { 2, -1}, } },
 	/* wch_ch382_2s1p*/             { 1, { { 2, -1}, } },
+	/* wch_ch382_0s1p*/		{ 1, { { 2, -1}, } },
 	/* sunix_2s1p */                { 1, { { 3, -1 }, } },
 };
 
@@ -260,6 +262,7 @@ static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par,
 	{ 0x4348, 0x5053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, wch_ch353_1s1p},
 	{ 0x4348, 0x7053, 0x4348, 0x3253, 0, 0, wch_ch353_2s1p},
 	{ 0x1c00, 0x3250, 0x1c00, 0x3250, 0, 0, wch_ch382_2s1p},
+	{ 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382_0s1p},
 
 	/*
 	 * More SUNIX variations. At least one of these has part number
@@ -504,6 +507,12 @@ static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par,
 		.uart_offset    = 8,
 		.first_offset   = 0xC0,
 	},
+	[wch_ch382_0s1p] = {
+		.flags          = FL_BASE0,
+		.num_ports      = 0,
+		.base_baud      = 115200,
+		.uart_offset    = 8,
+	},
 	[sunix_2s1p] = {
 		.flags		= FL_BASE0|FL_BASE_BARS,
 		.num_ports	= 2,
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · Sudip Mukherjee

From: Alexander Gerasiov <[email protected]>

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

        wch_ch382_2s1p,

Review

Quoted 7 lines
(quoted diff) +3 -0
+       wch_ch382_0s1p,
 
        /* wch_ch382_2s1p*/             { 1, { { 2, -1}, } },
+       /* wch_ch382_0s1p*/             { 1, { { 2, -1}, } },
 
        { 0x1c00, 0x3250, 0x1c00, 0x3250, 0, 0, wch_ch382_2s1p},
+       { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382_0s1p},

Just a nit, wouldn't be better to preserve alphanumerical sorting? (Exchange lines in above pairs)

Quoted 1 line

+ [wch_ch382_0s1p] = {

...

Quoted 1 line
        [sunix_2s1p] = {

Similar here, though it's not visible in the patch.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hello Andy,

While preparing the update I suddenly found, that parport_serial.c is not the right place for this card. Since there is no serial ports on the board, it would be better to put it into parport_pc.c

So I'll resubmit the patch right after I get access to the hardware to check, that I did it the right way.

Quoted 26 lines · On Sat, 17 Jun 2017 16:45:49 +0300 Andy Shevchenko <[email protected]>…
Quoted 7 lines · Sudip Mukherjee

From: Alexander Gerasiov <[email protected]>

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

        wch_ch382_2s1p,

Review

Quoted 7 lines
(quoted diff) +3 -0
+       wch_ch382_0s1p,  
 
        /* wch_ch382_2s1p*/             { 1, { { 2, -1}, } },
+       /* wch_ch382_0s1p*/             { 1, { { 2, -1}, } },  
 
        { 0x1c00, 0x3250, 0x1c00, 0x3250, 0, 0, wch_ch382_2s1p},
+       { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382_0s1p},  

Just a nit, wouldn't be better to preserve alphanumerical sorting? (Exchange lines in above pairs)

Quoted 1 line

+ [wch_ch382_0s1p] = {

...

Quoted 1 line
        [sunix_2s1p] = {  

Similar here, though it's not visible in the patch.

Signature · 6 lines
Best regards,
 Alexander Gerasiov

 Contacts:
 e-mail: [email protected]  Homepage: http://gerasiov.net  Skype: gerasiov
 PGP fingerprint: 04B5 9D90 DF7C C2AB CD49  BAEA CA87 E9E8 2AAC 33F1
author maintainer
#3 lore raw
Quoted 5 lines · Alexander Gerasiov

Hello Andy,

While preparing the update I suddenly found, that parport_serial.c is not the right place for this card. Since there is no serial ports on the board, it would be better to put it into parport_pc.c

Yes, that will be better. Thanks.
I should have pointed that out but I was confused as I saw MOSCHIP 9900, which is parallel only, in that file also. But now digging into the past I found the reason for that.
So, yes, your change should be in parport_pc.c

--
Regards
Sudip

#4 lore raw
Quoted 8 lines · On Sun, 18 Jun 2017 22:06:59 +0100 Sudip Mukherjee…
Quoted 5 lines · Alexander Gerasiov

Hello Andy,

While preparing the update I suddenly found, that parport_serial.c is not the right place for this card. Since there is no serial ports on the board, it would be better to put it into parport_pc.c

Yes, that will be better. Thanks.

Are the uarts physically present but the connector unwired, or are they not detectable at all ?

If it's the former then can you add a comment in parport_serial.c giving the ID and explaining why it's not present, even if you put the code into parport_pc.

Alan

#5 lore raw

Hello Alan,

Quoted 12 lines · On Mon, 19 Jun 2017 19:37:34 +0100 Alan Cox <[email protected]> wrote:
Quoted 9 lines · On Sun, 18 Jun 2017 22:06:59 +0100 Sudip Mukherjee…
Quoted 6 lines · Alexander Gerasiov

Hello Andy,

While preparing the update I suddenly found, that parport_serial.c is not the right place for this card. Since there is no serial ports on the board, it would be better to put it into parport_pc.c

Quoted 8 lines
Quoted 1 line

Yes, that will be better. Thanks.

Are the uarts physically present but the connector unwired, or are they not detectable at all ?

If it's the former then can you add a comment in parport_serial.c giving the ID and explaining why it's not present, even if you put the code into parport_pc.

According to http://wiki.linuxcnc.org/cgi-bin/wiki.pl?WCH
the chip itself does not differ from one in card with dev-id 3253. So technically one can solder connectors and use this card as 2serial + 1parallel.
But he could also remove link between pins 62 and 63 and get the board indentified as 3252.

So, I believe, it would be less confusing (for users) if we do not create serial devices for this adapter.

Signature · 6 lines
Best regards,
 Alexander Gerasiov

 Contacts:
 e-mail: [email protected]  Homepage: http://gerasiov.net  Skype: gerasiov
 PGP fingerprint: 04B5 9D90 DF7C C2AB CD49  BAEA CA87 E9E8 2AAC 33F1
#6 lore raw

PATCH 1/1 parport_pc: Add support for WCH CH382L PCI-E single parallel port card.

In reply to Sudip Mukherjee

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

---
 drivers/parport/parport_pc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/parport/parport_pc.c +4 -0
index 78530d1714dc..f00a87cd9ea9 100644
@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards {
 	netmos_9901,
 	netmos_9865,
 	quatech_sppxp100,
+	wch_ch382_1p,
 };
 
 
@@ -2708,6 +2709,7 @@ static struct parport_pc_pci {
 	/* netmos_9901 */               { 1, { { 0, -1 }, } },
 	/* netmos_9865 */               { 1, { { 0, -1 }, } },
 	/* quatech_sppxp100 */		{ 1, { { 0, 1 }, } },
+	/* wch_ch382_1p*/		{ 1, { { 2, -1}, } },
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
 	/* Quatech SPPXP-100 Parallel port PCI ExpressCard */
 	{ PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
+	/* WCH CH382L PCI-E single parallel port card */
+	{ 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382_1p},
 	{ 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
Signature · 1 line
2.11.0
#7 lore raw

Re: [PATCH] parport_pc: Add support for WCH CH382L PCI-E single parallel port card.

Quoted 22 lines · Alexander Gerasiov

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

---
 drivers/parport/parport_pc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/parport/parport_pc.c +1 -0
index 78530d1714dc..f00a87cd9ea9 100644
@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards {
        netmos_9901,
        netmos_9865,
        quatech_sppxp100,
+       wch_ch382_1p,
 };
 
 

drivers/parport/parport_pc.c static struct parport_pc_pci { · line 2712

Quoted 4 lines
drivers/parport/parport_pc.c +1 -0
@@ -2708,6 +2709,7 @@ static struct parport_pc_pci {
        /* netmos_9901 */               { 1, { { 0, -1 }, } },
        /* netmos_9865 */               { 1, { { 0, -1 }, } },
        /* quatech_sppxp100 */          { 1, { { 0, 1 }, } },
+       /* wch_ch382_1p*/               { 1, { { 2, -1}, } },

Didn't you miss a space?

Quoted 15 lines
drivers/parport/parport_pc.c +2 -1
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
        /* Quatech SPPXP-100 Parallel port PCI ExpressCard */
        { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
+       /* WCH CH382L PCI-E single parallel port card */
+       { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382_1p},
        { 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
--

2.11.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw

PATCH 1/1 parport_pc: Add support for WCH CH382L PCI-E single parallel port card.

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

---
 drivers/parport/parport_pc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/parport/parport_pc.c +4 -0
index 489492b608cf..aa6bb50384ee 100644
@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards {
 	netmos_9901,
 	netmos_9865,
 	quatech_sppxp100,
+	wch_ch382l,
 };
 
 
@@ -2708,6 +2709,7 @@ static struct parport_pc_pci {
 	/* netmos_9901 */               { 1, { { 0, -1 }, } },
 	/* netmos_9865 */               { 1, { { 0, -1 }, } },
 	/* quatech_sppxp100 */		{ 1, { { 0, 1 }, } },
+	/* wch_ch382l */		{ 1, { { 2, -1 }, } },
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
 	/* Quatech SPPXP-100 Parallel port PCI ExpressCard */
 	{ PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
+	/* WCH CH382L PCI-E single parallel port card */
+	{ 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l},
 	{ 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
Signature · 1 line
2.11.0
#9 lore raw

PATCH 1/1 parport_pc: Add support for WCH CH382L PCI-E single parallel port card.

WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])

---
 drivers/parport/parport_pc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/parport/parport_pc.c +4 -0
index 489492b608cf..380916bff9e0 100644
@@ -2646,6 +2646,7 @@ enum parport_pc_pci_cards {
 	netmos_9901,
 	netmos_9865,
 	quatech_sppxp100,
+	wch_ch382l,
 };
 
 
@@ -2708,6 +2709,7 @@ static struct parport_pc_pci {
 	/* netmos_9901 */               { 1, { { 0, -1 }, } },
 	/* netmos_9865 */               { 1, { { 0, -1 }, } },
 	/* quatech_sppxp100 */		{ 1, { { 0, 1 }, } },
+	/* wch_ch382l */		{ 1, { { 2, -1 }, } },
 };
 
 static const struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2797,6 +2799,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
 	/* Quatech SPPXP-100 Parallel port PCI ExpressCard */
 	{ PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
+	/* WCH CH382L PCI-E single parallel port card */
+	{ 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l },
 	{ 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
Signature · 1 line
2.11.0