Re: [patch] support 8 port Decision serial card (pci) in 5.01

2000-08-11 Thread Craig Schlenter

On Thu, Aug 10, 2000 at 12:15:27PM -0400, Stuart MacDonald wrote:
 From: "Craig Schlenter" [EMAIL PROTECTED]
  0x0002 should be replaced by PCI_DEVICE_ID_DCI_PCCOM8 with
  #define PCI_DEVICE_ID_DCI_PCCOM8  0x0002
  in pci.h (pci_ids.h?) or something but then people without updated
  pci.h are in trouble - perhaps use a #ifdef PCI_DEVICE_ID_DCI_PCCOM8
  so driver will still compile on older kernel/pci.h versions? Yukky
  either way.
 
 This is what serial_compat.h is for. Check in there and you will
 see that the Connect Tech PCI IDs are setup if they don't
 already exist. You should do the same.

Cool.

 If you didn't explicitly mean the subsystem and subvendor slots
 to be PCI_ANY_ID, then you should use lspci -v to find out
 what values those are and use them.

Well spotted. I cut-and-pasted large bits of it from lines above
and fiddled till it worked. I had a vague suspicion that PCI_ANY_ID
was probably a bit on the generous side but I lost motivation once
it started working ;)

00:0a.0 Serial controller: Decision Computer International Co. PCCOM8 (rev 02) (
prog-if 02 [16550])
Subsystem: Unknown device 0008:0200

I'd assume it's these IDs that I'd use? Will test it later.

Flags: medium devsel, IRQ 10
Memory at f7101000 (32-bit, non-prefetchable)
I/O ports at d000
I/O ports at cc00


  PS. Decision have their own patches on their website against
  significantly older versions of serial.c which don't have the nifty
  generic pci functions. Those patches do support cards other than the
  PCCOM8. I've ported those patches to 2.2.16's serial.c if anyone wants
  a copy. Available under the no warranty, no support, "works for me but
  may eat your hard drive or do other nasty things" licence of course ...
 
 In the spirit of world domination, all info gleaned should go
 into the driver. :-) Send them on. You might also want to
 contact the company and mention "Oh BTW in my spare
 time I hacked a driver for your boards."

"Butchered an older patch without knowing what I was doing" would be a more
apt description ;)

Will post the patch against 2.2.16 later.

Cheers,

--Craig

-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]



Re: [patch] support 8 port Decision serial card (pci) in 5.01

2000-08-11 Thread Craig Schlenter

On Thu, Aug 10, 2000 at 02:22:02PM -0400, Theodore Ts'o wrote:
   [me]
  5.01 wouldn't compile in 2.2.16. Had to change the rs_init thing as
  in patch ... Ted?
 
 I haven't tried to compile a 5.x serial driver into a 2.2 kernel in a
 while.  How does it not work?  __init has be defined in init.h since
 before 2.2.0 was released.

This is what I get with a vanilla 2.2.16 and doing the install-in-kernel
with 5.01 (see below).

I cut and pasted the rs_init line from 2.2.16's serial.c originally
to solve the problem but I suspect the real problem is that in the
5.01 serial.c rs_init is declared as static. Removing the static,
makes it link ok.

gcc -D__KERNEL__ -I/usr/src/linux/include -E -C -P -I/usr/src/linux/include -imacros 
/usr/src/linux/include/asm-i386/page_offset.h -Ui386 arch/i386/vmlinux.lds.S 
arch/i386/vmlinux.lds
ld -m elf_i386 -T /usr/src/linux/arch/i386/vmlinux.lds -e stext 
arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o init/version.o \
--start-group \
arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o fs/fs.o 
ipc/ipc.o \
fs/filesystems.a \
net/network.a \
drivers/block/block.a drivers/char/char.a drivers/misc/misc.a 
drivers/net/net.a drivers/scsi/scsi.a drivers/cdrom/cdrom.a drivers/pci/pci.a 
drivers/pnp/pnp.a drivers/video/video.a \
/usr/src/linux/arch/i386/lib/lib.a /usr/src/linux/lib/lib.a 
/usr/src/linux/arch/i386/lib/lib.a \
--end-group \
-o vmlinux
drivers/char/char.a(tty_io.o): In function `tty_init':
tty_io.o(.text.init+0x232): undefined reference to `rs_init'
make: *** [vmlinux] Error 1

--Craig

-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]



decision serial patch ported to 2.2.16

2000-08-11 Thread Craig Schlenter

Hi

Attached is my port of decision's serial patch to 2.2.16 as promised. I
have removed some bits out of the original patch (available from
decision.com.tw iirc, against some oldish 2.2.x kernel) that I didn't
think were important. What I know about the serial driver borders on
dangerous so YMMV. I've only tested it on the PCCOM8 card but it "works
for me".

No warranties/support/guarantees. I don't plan on using this anymore
as the 4 line patch to the 5.01 serial driver is much nicer IMHO ...

Cheers,

--Craig


diff -urN linux-2.2.16.vanilla/drivers/char/Config.in 
linux-2.2.16.decision/drivers/char/Config.in
--- linux-2.2.16.vanilla/drivers/char/Config.in Wed Jul 26 14:12:18 2000
+++ linux-2.2.16.decision/drivers/char/Config.inWed Jul 26 14:17:38 2000
@@ -19,6 +19,7 @@
bool '   Autodetect IRQ on standard ports (unsafe)' CONFIG_SERIAL_DETECT_IRQ
bool '   Support special multiport boards' CONFIG_SERIAL_MULTIPORT
bool '   Support the Bell Technologies HUB6 card' CONFIG_HUB6
+   bool '   Support the Decision PCCOM PCI card' CONFIG_DCIPCCOM_PCI
 fi
 bool 'Non-standard serial port support' CONFIG_SERIAL_NONSTANDARD
 if [ "$CONFIG_SERIAL_NONSTANDARD" = "y" ]; then
diff -urN linux-2.2.16.vanilla/drivers/char/serial.c 
linux-2.2.16.decision/drivers/char/serial.c
--- linux-2.2.16.vanilla/drivers/char/serial.c  Wed Jul 26 14:12:18 2000
+++ linux-2.2.16.decision/drivers/char/serial.c Wed Jul 26 14:36:48 2000
@@ -40,6 +40,10 @@
 /*
  * Serial driver configuration section.  Here are the various options:
  *
+ * CONFIG_DCIPCCOM_PCI
+ * Enable support for the Decision PCCOM PCI 4/8-Port
+ * cards if CONFIG_PCI is defined
+ *
  * CONFIG_HUB6
  * Enables support for the venerable Bell Technologies
  * HUB6 card.
@@ -63,6 +67,12 @@
  */
 #include linux/config.h
 
+#ifndef CONFIG_PCI
+#ifdef CONFIG_DCIPCCOM_PCI
+#undef CONFIG_DCIPCCOM_PCI
+#endif /* CONFIG_DCIPCCOM_PCI */
+#endif /* CONFIG_PCI */
+
 #undef SERIAL_PARANOIA_CHECK
 #define CONFIG_SERIAL_NOPAUSE_IO
 #define SERIAL_DO_RESTART
@@ -94,6 +104,15 @@
 #endif
 #endif
 
+#ifdef CONFIG_DCIPCCOM_PCI
+#ifndef CONFIG_SERIAL_MANY_PORTS
+#define CONFIG_SERIAL_MANY_PORTS
+#endif
+#ifndef CONFIG_SERIAL_SHARE_IRQ
+#define CONFIG_SERIAL_SHARE_IRQ
+#endif
+#endif /* CONFIG_DCIPCCOM_PCI */
+
 /* Set of debugging defines */
 
 #undef SERIAL_DEBUG_INTR
@@ -143,6 +162,10 @@
 #include linux/console.h
 #endif
 
+#ifdef CONFIG_PCI
+#include linux/pci.h
+#endif /* CONFIG_PCI */
+
 #include asm/system.h
 #include asm/io.h
 #include asm/irq.h
@@ -179,6 +202,46 @@
 static struct console sercons;
 #endif
 
+#ifdef CONFIG_DCIPCCOM_PCI
+
+/*
+ * Programming Interface
+ */
+#define PCI_PI_SERIAL_XT   0x00
+#define PCI_PI_SERIAL_164500x01
+#define PCI_PI_SERIAL_165500x02
+#define PCI_PI_SERIAL_166500x03
+
+/*
+ * Vendor
+ */
+#define PCI_DECISION   0x
+
+/*
+ * Class-, SubClass-, and Vendor-specific
+ */
+#define PCI_DC_SIO_PORT0x2F
+#define PCI_DC_SIO_2P  0x00
+#define PCI_DC_SIO_4P  0x01
+#define PCI_DC_SIO_8P  0x02
+#define PCI_DC_SIO_16P 0x03
+ 
+#define PCI_DC_SIO_TYPE0x2E
+#define PCI_DC_SIO_RS232   0x00
+#define PCI_DC_SIO_RS422   0x01
+#define PCI_DC_SIO_RS485   0x02
+
+/*
+ * Hardware configuration
+ */
+#define PCCOM_PCI_VECT_2P(base) (base + 0x10)
+#define PCCOM_PCI_SWID_2P(base) (base + 0x10)
+#define PCCOM_PCI_VECT_4P(base) (base + 0x20)
+#define PCCOM_PCI_SWID_4P(base) (base + 0x20)
+#define PCCOM_PCI_VECT_8P(base) (base + 0x40)
+#define PCCOM_PCI_SWID_8P(base) (base + 0x80)
+#endif /* CONFIG_DCIPCCOM_PCI */
+
 static unsigned detect_uart_irq (struct serial_state * state);
 static void autoconfig(struct serial_state * info);
 static void change_speed(struct async_struct *info, struct termios *old);
@@ -212,6 +275,16 @@
 static struct termios *serial_termios[NR_PORTS];
 static struct termios *serial_termios_locked[NR_PORTS];
 
+#ifdef CONFIG_DCIPCCOM_PCI
+#define serial_dcpci_nr_cards  2
+#define serial_dcpci_minor144
+#define serial_dcpci_minor252
+
+static int serial_dcpci_minor[serial_dcpci_nr_cards] = {
+   serial_dcpci_minor1, serial_dcpci_minor2
+};
+#endif /* CONFIG_DCIPCCOM_PCI */
+
 #ifndef MIN
 #define MIN(a,b)   ((a)  (b) ? (a) : (b))
 #endif
@@ -2825,6 +2898,10 @@
 static _INLINE_ void show_serial_version(void)
 {
printk(KERN_INFO "%s version %s with", serial_name, serial_version);
+#ifdef CONFIG_DCIPCCOM_PCI
+   printk(" DCI_PCCOM_PCI");
+#define SERIAL_OPT
+#endif /* CONFIG_DCIPCCOM_PCI */
 #ifdef CONFIG_HUB6
printk(" HUB-6");
 #define SERIAL_OPT
@@ -2853,6 +2930,178 @@
 #undef SERIAL_OPT
 }
 
+#ifdef CONFIG_DCIPCCOM_PCI
+
+/*
+ * dci_pci_detect() - Test PCI bus presence and Decision PCCOM PCI.
+ */
+static void
+dci_pci_detect(void)
+{
+#define DCIPCCOM_PCI_PI_MAX4
+
+   static unsigned char 

Re: [patch] support 8 port Decision serial card (pci) in 5.01

2000-08-11 Thread Craig Schlenter

 [Stu]
  If you didn't explicitly mean the subsystem and subvendor slots
  to be PCI_ANY_ID, then you should use lspci -v to find out
  what values those are and use them.
 [me]
 Well spotted. I cut-and-pasted large bits of it from lines above
 and fiddled till it worked. I had a vague suspicion that PCI_ANY_ID
 was probably a bit on the generous side but I lost motivation once
 it started working ;)
 
 00:0a.0 Serial controller: Decision Computer International Co. PCCOM8 (rev 02) 
(prog-if 02 [16550])
 Subsystem: Unknown device 0008:0200
   
 I'd assume it's these IDs that I'd use? Will test it later.

Revised patch against serial-5.01 attached. I even tested it. It worked too :)

--Craig


diff -urN serial-5.01/serial.c serial-5.01.craig/serial.c
--- serial-5.01/serial.cThu Jul 27 02:43:57 2000
+++ serial-5.01.craig/serial.c  Fri Aug 11 09:29:48 2000
@@ -4559,6 +4559,10 @@
SPCI_FL_BASE0, 1, 520833,
64, 3, NULL, 0x300 },
 #endif
+   {   PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
+   PCI_SUBVENDOR_ID_DCI, PCI_SUBDEVICE_ID_DCI_PCCOM8,
+   SPCI_FL_BASE3, 8, 115200,
+   8 },
/* Generic serial board */
{   0, 0,
0, 0,
@@ -5081,7 +5085,7 @@
 /*
  * The serial driver boot-time initialization code!
  */
-static int __init rs_init(void)
+int __init rs_init(void)
 {
int i;
struct serial_state * state;
diff -urN serial-5.01/serial_compat.h serial-5.01.craig/serial_compat.h
--- serial-5.01/serial_compat.h Thu Jul 27 02:30:51 2000
+++ serial-5.01.craig/serial_compat.h   Fri Aug 11 09:31:58 2000
@@ -265,6 +265,12 @@
 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1   0x000B
 #endif
 
+#ifndef PCI_SUBVENDOR_ID_DCI
+#define PCI_SUBVENDOR_ID_DCI   0x0008
+#define PCI_SUBDEVICE_ID_DCI_PCCOM80x0200
+#define PCI_DEVICE_ID_DCI_PCCOM8   0x0002
+#endif
+
 #ifndef PCI_SUBVENDOR_ID_KEYSPAN
 #define PCI_SUBVENDOR_ID_KEYSPAN   0x11a9
 #define PCI_SUBDEVICE_ID_KEYSPAN_SX2   0x5334



[patch] support 8 port Decision serial card (pci) in 5.01

2000-08-10 Thread Craig Schlenter

Hi

See attachment for a patch that makes my PCCOM8 "work for me" (TM).

Card is manufactured by decision.com.tw AFAIK. I have no connection
with them other than that I have a few of their serial cards. 

Patch is against the 5.01 serial driver. I'm not suggesting it be
included yet, just looking for comments and/or testers with the 
right card.

TODO:
0x0002 should be replaced by PCI_DEVICE_ID_DCI_PCCOM8 with
#define PCI_DEVICE_ID_DCI_PCCOM8  0x0002
in pci.h (pci_ids.h?) or something but then people without updated
pci.h are in trouble - perhaps use a #ifdef PCI_DEVICE_ID_DCI_PCCOM8
so driver will still compile on older kernel/pci.h versions? Yukky
either way.

5.01 wouldn't compile in 2.2.16. Had to change the rs_init thing as
in patch ... Ted?

Apparently you can jumper the card to do 400K instead of 115K in
which case the max baud speed will need to be tuned.

PS. Decision have their own patches on their website against
significantly older versions of serial.c which don't have the nifty
generic pci functions. Those patches do support cards other than the
PCCOM8. I've ported those patches to 2.2.16's serial.c if anyone wants
a copy. Available under the no warranty, no support, "works for me but
may eat your hard drive or do other nasty things" licence of course ...

--Craig


--- /usr/src/linux/drivers/char/serial.c2000/08/09 17:43:57 1.1
+++ /usr/src/linux/drivers/char/serial.c2000/08/09 19:17:43
@@ -4559,6 +4559,10 @@
SPCI_FL_BASE0, 1, 520833,
64, 3, NULL, 0x300 },
 #endif
+   {   PCI_VENDOR_ID_DCI, 0x0002,
+   PCI_ANY_ID, PCI_ANY_ID,
+   SPCI_FL_BASE3, 8, 115200,
+   8 },
/* Generic serial board */
{   0, 0,
0, 0,
@@ -5081,7 +5085,7 @@
 /*
  * The serial driver boot-time initialization code!
  */
-static int __init rs_init(void)
+__initfunc(int rs_init(void))
 {
int i;
struct serial_state * state;



Re: modem control line checking - is polling the only way?

2000-05-17 Thread Craig Schlenter

On Tue, May 16, 2000 at 04:06:50PM -0400, [EMAIL PROTECTED] wrote:
 It is a pity you couldn't be bothered to read linux-serial.  It is not a
 terribly busy list, but this very question has been asked and answered
 in the last week.  Maybe you can find some list archives somewhere.

It's not a question of "couldn't be bothered", but rather "didn't need to
before". I have subscribed now but please keep me on the cc list as I
expect it will take a while to process.

I did uncover some messages on dejanews yesterday before posting but
they pointed at ioctl's that were unhelpful when you want to do more
than just wait for control lines - I need to wait for input on a range
of fd's too. The messages I saw ended the thread with 'perhaps select
can be used but I don't know how' (or something like that). Is this the
thread you are referring to?

 Use the source, Luke.  linux/drivers/char/serial.c is not awfully big
 and has some nice comments.

Done that now. Nothing obvious to a non-kernel guru like me other than
the ioctl's to wait for changes but that puts a large dent in doing
anything else in the program unless I resort to using threads or some
form of ipc between processes that I'd much rather avoid. Is that the
only way or can select be used?

Thank you,

--Craig

-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]