[PARPORT] PARPORT: Patch-2.3.99-pre6p3 SYBA PCI card "0782"

From: Gunther Mayer (gunther.mayer@braunschweig.netsurf.de)
Date: Sun Apr 16 2000 - 08:04:50 EDT

  • Next message: zhu qun ying: "[PARPORT] base address?"

    Hi,
    this patch adds support for my SYBA PCI Parallel Port card "PCI PT10".
    This features 2 EPP ports, that can be mapped to standard IO ports (0x278,
    0x378),
    with some write only Configuration Register (Register 44 in PCI config space).

    Currently the io ports (+0x78 and +0x178) from the 1K window (1st PCI BAR) are
    used,
    I don't know if aliases could be a problem (here they didn't show up).
    Perhaps Mr. Thomson can shed some more light on Register 44 (Is this preserved
    over cold
    reboots? Do changes take effect immediately? Is there some special
    intelligence to detect
    conflicts with other ports at init time?).

    Anothers issue is the configuration of the port mode (STD, Bidir, EPP...).
    This can be done in
    the Windows Config Utility, but my card features additionally 2 jumpers
    (EPP/SPP)? I would
    like to detect theses settings.

    Who knows about datasheets for the parallel port chip "ASP AP138B" on this
    card?

    Tim, please submit the patch to Linus if you like.

    Regards, Gunther

    P.S. Support for the other SYBA cards is probably straight forward, as we get
    more
    information and testers.

    P.S.2. The card doesn't conform stricty to PCI spec 2.2, as "Base
    Class=0x07,Sub-Class=0x82"
    is reserved and shall not be used. Better would be "Base Class=0x07,
    Sub-Class=0x80" which
    means "Simple communication controller, Other communications device".

    P.S.3 An upcoming "pci.ids" will contain this information:
    1592 Syba Tech Ltd
            0781 Multi-IO Card
            0782 PCI PT10, Parallel Port Card 2xEPP
            0783 Multi-IO Card
            0785 Multi-IO Card
            0786 Multi-IO Card
            0787 Multi-IO Card
            0788 Multi-IO Card
            078a Multi-IO Card

    P.S.4 Detect messages:
    # Onboard
    Apr 16 13:46:11 linux kernel: parport0: PC-style at 0x278 (0x678)
    [PCSPP,TRISTATE,EPP,ECP]
    Apr 16 13:46:11 linux kernel: parport0: irq 5 detected
    Apr 16 13:46:11 linux kernel: parport0: Found 1 daisy-chained devices
    Apr 16 13:46:11 linux kernel: parport0 (addr 0): SCSI adapter, IMG VP1

    #SYBA additional connector
    Apr 16 13:46:11 linux kernel: parport1: PC-style at 0xb078
    [PCSPP,TRISTATE,EPP]
    Apr 16 13:46:11 linux kernel: parport1: cpp_daisy: aa5500ff(98)
    Apr 16 13:46:11 linux kernel: parport1: assign_addrs: aa5500ff(98)
    Apr 16 13:46:11 linux kernel: parport1: Printer, Hewlett-Packard HP LaserJet
    1100

    #SYBA card connector
    Apr 16 13:46:11 linux kernel: parport2: PC-style at 0xb178
    [PCSPP,TRISTATE,EPP]
    Apr 16 13:46:11 linux kernel: parport2: cpp_daisy: aa5500ff(98)
    Apr 16 13:46:11 linux kernel: parport2: assign_addrs: aa5500ff(98)
    Apr 16 13:46:11 linux kernel: parport2: Printer, Hewlett-Packard OfficeJet
    Series 500

    P.S.5. THE PATCH

    --- linux-2.3.99-pre6-p3/drivers/parport/parport_pc.c Sun Apr 16 13:22:50
    2000
    +++ linux/drivers/parport/parport_pc.c Sun Apr 16 12:00:07 2000
    @@ -2263,6 +2263,7 @@
            plx_9050,
            afavlab_tk9902,
            timedia_1889,
    + syba_2p_epp,
     };

    @@ -2270,9 +2271,9 @@
      * (but offset by last_sio) */
     static struct parport_pc_pci {
            int numports;
    - struct {
    + struct { /* BAR (base address registers) numbers in the config space
    header*/
                    int lo;
    - int hi; /* -ve if not there */
    + int hi; /* ==-1 if not there, >6 for offset-method (max BAR is
    6)*/
            } addr[4];
     } cards[] __devinitdata = {
            /* siig_1s1p_10x_550 */ { 1, { { 3, 4 }, } },
    @@ -2301,6 +2302,8 @@
            /* plx_9050 */ { 2, { { 4, -1 }, { 5, -1 }, } },
            /* afavlab_tk9902 */ { 1, { { 0, 1 }, } },
            /* timedia_1889 */ { 1, { { 2, -1 }, } },
    + /* SYBA uses fixed offsets in a 1K io
    window*/
    + /* syba_2p_epp */ { 2,{ { 0, 0x078}, { 0, 0x178},} },
     };

     static struct pci_device_id parport_pc_pci_tbl[] __devinitdata = {
    @@ -2360,6 +2363,7 @@
              PCI_ANY_ID, PCI_ANY_ID, 0, 0, afavlab_tk9902 },
            { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
              PCI_ANY_ID, PCI_ANY_ID, 0, 0, timedia_1889 },
    + { 0x1592, 0x782, PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_2p_epp },
            { 0, }, /* terminate list */
     };
     MODULE_DEVICE_TABLE(pci,parport_pc_pci_tbl);
    @@ -2384,8 +2388,11 @@
                    unsigned long io_lo, io_hi;
                    io_lo = pci_resource_start (dev, lo);
                    io_hi = 0;
    - if (hi >= 0)
    + if ((hi >= 0) && (hi <=6))
                            io_hi = pci_resource_start (dev, hi);
    + else if (hi > 6)
    + io_lo = io_lo + hi; /* Reinterpret the meaning of "hi"
    as
    + as an offset (see SYBA def.) */

                    /* TODO: test if sharing interrupts works */
                    if (parport_pc_probe_port (io_lo, io_hi, PARPORT_IRQ_NONE,
                                               PARPORT_DMA_NONE, dev))


    --- linux-2.3.99-pre6-p3/drivers/parport/parport_pc.c Sun Apr 16 13:22:50 2000
    +++ linux/drivers/parport/parport_pc.c Sun Apr 16 12:00:07 2000
    @@ -2263,6 +2263,7 @@
             plx_9050,
             afavlab_tk9902,
             timedia_1889,
    + syba_2p_epp,
     };
     
     
    @@ -2270,9 +2271,9 @@
      * (but offset by last_sio) */
     static struct parport_pc_pci {
             int numports;
    - struct {
    + struct { /* BAR (base address registers) numbers in the config space header*/
                     int lo;
    - int hi; /* -ve if not there */
    + int hi; /* ==-1 if not there, >6 for offset-method (max BAR is 6)*/
             } addr[4];
     } cards[] __devinitdata = {
             /* siig_1s1p_10x_550 */ { 1, { { 3, 4 }, } },
    @@ -2301,6 +2302,8 @@
             /* plx_9050 */ { 2, { { 4, -1 }, { 5, -1 }, } },
             /* afavlab_tk9902 */ { 1, { { 0, 1 }, } },
             /* timedia_1889 */ { 1, { { 2, -1 }, } },
    + /* SYBA uses fixed offsets in a 1K io window*/
    + /* syba_2p_epp */ { 2,{ { 0, 0x078}, { 0, 0x178},} },
     };
     
     static struct pci_device_id parport_pc_pci_tbl[] __devinitdata = {
    @@ -2360,6 +2363,7 @@
               PCI_ANY_ID, PCI_ANY_ID, 0, 0, afavlab_tk9902 },
             { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
               PCI_ANY_ID, PCI_ANY_ID, 0, 0, timedia_1889 },
    + { 0x1592, 0x782, PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_2p_epp },
             { 0, }, /* terminate list */
     };
     MODULE_DEVICE_TABLE(pci,parport_pc_pci_tbl);
    @@ -2384,8 +2388,11 @@
                     unsigned long io_lo, io_hi;
                     io_lo = pci_resource_start (dev, lo);
                     io_hi = 0;
    - if (hi >= 0)
    + if ((hi >= 0) && (hi <=6))
                             io_hi = pci_resource_start (dev, hi);
    + else if (hi > 6)
    + io_lo = io_lo + hi; /* Reinterpret the meaning of "hi" as
    + as an offset (see SYBA def.) */
                     /* TODO: test if sharing interrupts works */
                     if (parport_pc_probe_port (io_lo, io_hi, PARPORT_IRQ_NONE,
                                                PARPORT_DMA_NONE, dev))

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Sun Apr 16 2000 - 08:15:12 EDT