Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Mar 2009 13:05:02 -0800
From:      Navdeep Parhar <nparhar@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   puc support for a generic card (patch attached)
Message-ID:  <d04e16b70903021305u69138cfav8b6838c7199a60ed@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--000e0cd32af00bdf650464292c0d
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

This may interest puc and uart maintainers.

I needed an extra serial port on my FreeBSD machine and bought a
store-branded "1-Port Serial PCI Adapter" from a local computer
store.

This is what pciconf shows:
puc0@pci0:4:1:0: class=0x070002 card=0x00011000 chip=0x98359710
rev=0x01 hdr=0x00

And here's what puc identified it as:
puc0: <NetMos NM9835 Dual UART and 1284 Printer port> port
0xec00-0xec07,0xe480-0xe487,0xe400-0xe407,0xe080-0xe087,0xe000-0xe007,0xdc00-0xdc0f
irq 16 at device 1.0 on pci4

Visual inspection shows the card has missing circuitry and headers
for the extra serial and parallel port that the chip supports.  puc
gave me 2 serial port and 1 parallel port devices for the card, and
none of them would work (not even the first serial port device).

I had to tweak pucdata.c to get the card working.  Patch against
HEAD is attached, and also pasted at the end of this email (in case
this list drops attachements).

Regards,
Navdeep

diff -r 025cb00d19d7 sys/dev/puc/puc.c
--- a/sys/dev/puc/puc.c	Sat Feb 28 12:42:37 2009 -0800
+++ b/sys/dev/puc/puc.c	Mon Mar 02 12:21:07 2009 -0800
@@ -440,9 +440,6 @@
 	sc->sc_dev = dev;
 	sc->sc_cfg = cfg;

-	/* We don't attach to single-port serial cards. */
-	if (cfg->ports == PUC_PORT_1S || cfg->ports == PUC_PORT_1P)
-		return (EDOOFUS);
 	error = puc_config(sc, PUC_CFG_GET_NPORTS, 0, &res);
 	if (error)
 		return (error);
diff -r 025cb00d19d7 sys/dev/puc/pucdata.c
--- a/sys/dev/puc/pucdata.c	Sat Feb 28 12:42:37 2009 -0800
+++ b/sys/dev/puc/pucdata.c	Mon Mar 02 12:21:07 2009 -0800
@@ -761,6 +761,12 @@
 	    PUC_PORT_2P, 0x10, 8, 0,
 	},

+	{   0x9710, 0x9835, 0x1000, 1,
+	    "NetMos NM9835 based 1-port serial",
+	    DEFAULT_RCLK,
+	    PUC_PORT_1S, 0x10, 4, 0,
+	},
+
 	{   0x9710, 0x9835, 0xffff, 0,
 	    "NetMos NM9835 Dual UART and 1284 Printer port",
 	    DEFAULT_RCLK,

--000e0cd32af00bdf650464292c0d
Content-Type: application/octet-stream; name="puc.patch"
Content-Disposition: attachment; filename="puc.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_frtmxci80

ZGlmZiAtciAwMjVjYjAwZDE5ZDcgc3lzL2Rldi9wdWMvcHVjLmMKLS0tIGEvc3lzL2Rldi9wdWMv
cHVjLmMJU2F0IEZlYiAyOCAxMjo0MjozNyAyMDA5IC0wODAwCisrKyBiL3N5cy9kZXYvcHVjL3B1
Yy5jCU1vbiBNYXIgMDIgMTI6NTU6MjYgMjAwOSAtMDgwMApAQCAtNDQwLDkgKzQ0MCw2IEBACiAJ
c2MtPnNjX2RldiA9IGRldjsKIAlzYy0+c2NfY2ZnID0gY2ZnOwogCi0JLyogV2UgZG9uJ3QgYXR0
YWNoIHRvIHNpbmdsZS1wb3J0IHNlcmlhbCBjYXJkcy4gKi8KLQlpZiAoY2ZnLT5wb3J0cyA9PSBQ
VUNfUE9SVF8xUyB8fCBjZmctPnBvcnRzID09IFBVQ19QT1JUXzFQKQotCQlyZXR1cm4gKEVET09G
VVMpOwogCWVycm9yID0gcHVjX2NvbmZpZyhzYywgUFVDX0NGR19HRVRfTlBPUlRTLCAwLCAmcmVz
KTsKIAlpZiAoZXJyb3IpCiAJCXJldHVybiAoZXJyb3IpOwpkaWZmIC1yIDAyNWNiMDBkMTlkNyBz
eXMvZGV2L3B1Yy9wdWNkYXRhLmMKLS0tIGEvc3lzL2Rldi9wdWMvcHVjZGF0YS5jCVNhdCBGZWIg
MjggMTI6NDI6MzcgMjAwOSAtMDgwMAorKysgYi9zeXMvZGV2L3B1Yy9wdWNkYXRhLmMJTW9uIE1h
ciAwMiAxMjo1NToyNiAyMDA5IC0wODAwCkBAIC03NjEsNiArNzYxLDEyIEBACiAJICAgIFBVQ19Q
T1JUXzJQLCAweDEwLCA4LCAwLAogCX0sIAogCisJeyAgIDB4OTcxMCwgMHg5ODM1LCAweDEwMDAs
IDEsCisJICAgICJOZXRNb3MgTk05ODM1IGJhc2VkIDEtcG9ydCBzZXJpYWwiLAorCSAgICBERUZB
VUxUX1JDTEssCisJICAgIFBVQ19QT1JUXzFTLCAweDEwLCA0LCAwLAorCX0sCisKIAl7ICAgMHg5
NzEwLCAweDk4MzUsIDB4ZmZmZiwgMCwKIAkgICAgIk5ldE1vcyBOTTk4MzUgRHVhbCBVQVJUIGFu
ZCAxMjg0IFByaW50ZXIgcG9ydCIsCiAJICAgIERFRkFVTFRfUkNMSywK
--000e0cd32af00bdf650464292c0d--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d04e16b70903021305u69138cfav8b6838c7199a60ed>