Subject: Re: different types of NetMos puc(4) devices
To: Christos Zoulas <christos@astron.com>
From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
List: tech-kern
Date: 01/24/2006 10:00:23
[ please Cc: me in replies ]

On Tue, Jan 24, 2006 at 01:17:08AM +0000, Christos Zoulas wrote:
> In article <20060123162200.GA24093@artax.karlin.mff.cuni.cz>,
> Pavel Cahyna  <pavel.cahyna@st.mff.cuni.cz> wrote:
> >Another problem is that the 2 "upper" ports in the 4S1P card do not work.
> >This is caused by the following lines in pucdata.c:
> >
> >               { PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ * 4 },
> >               { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ * 4 },
> >
> >COM_FREQ * 4 is wrong, e.g. if I have getty running at 9600, I have to set
> >2400 baud for cu on the remote machine.
> >
> >This entry was added by lukem, with a comment that all ports appear to
> >work. Unfortunately the card tested was different from mine and I suspect
> >that the subsystem ID would be again the only way to distinguish between
> >them.
> >
> >The following patch fixes both problems for me. The subsystem ID for the
> >card which needs COM_FREQ * 4 should be added as another special case, if
> >somebody will find it.
> >
> >I left the entry without subsystem ID at the end, hoping that it will
> >catch all the cards with an unknown ID.
> >
> >To summarize: there are at least those variants of puc cards, all with the
> >same PCI id 0x9845:
> >
> >4S1P: subsystem ID 0x0014
> >6S: subsystem ID 0x0006
> >4S1P, two ports need COM_FREQ * 4: subsystem ID unknown
> >4S (that's what OpenBSD founds): subsystem ID unknown

> >+       /* NetMos 4S1P PCI NM9845 : 4S, 1P */
> >+       {   "NetMos NM9845 Quad UART and 1284 Printer port (unknown type)",
> >            {   0x9710, 0x9845, 0,      0       },
> >            {   0xffff, 0xffff, 0,      0       },
> >            {
> >                { PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ },
> >                { PUC_PORT_TYPE_COM, 0x14, 0x00, COM_FREQ },
> >-               { PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ * 4 },
> >-               { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ * 4 },
> >+               { PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ },
> >+               { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ },
> >                { PUC_PORT_TYPE_LPT, 0x20, 0x00, 0x00 },
> >            },
> >        },
> 
> Can you please send-pr this so it does not get lost? What happens if we
> apply this diff? Does it break existing puc cards?

The last lines are a catch-all entry witch should match existing cards. In
this form, it will break the card for which the NetMos 9845 support was added
first, and unbreak cards like mine which don't multiply the frequency.
Support for the former can be re-added by a more specific entry (matching
subsystem IDs). I think the latter are more common, as OpenBSD also don't
have the COM_FREQ * 4 part for those cards.

Pavel