Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*  Driver for the PPA3 parallel port SCSI HBA embedded in 
  2 * the Iomega ZIP drive
  3 * 
  4 * (c) 1996     Grant R. Guenther  grant@torque.net
  5 *              David Campbell
  6 *
  7 *      All comments to David.
  8 */
  9
 10#ifndef _PPA_H
 11#define _PPA_H
 12
 13#define   PPA_VERSION   "2.07 (for Linux 2.4.x)"
 14
 15/* 
 16 * this driver has been hacked by Matteo Frigo (athena@theory.lcs.mit.edu)
 17 * to support EPP and scatter-gather.                        [0.26-athena]
 18 *
 19 * additional hacks by David Campbell
 20 * in response to this driver "mis-behaving" on his machine.
 21 *      Fixed EPP to handle "software" changing of EPP port data direction.
 22 *      Chased down EPP timeouts
 23 *      Made this driver "kernel version friendly"           [0.28-athena]
 24 *
 25 * [ Stuff removed ]
 26 *
 27 * Corrected ppa.h for 2.1.x kernels (>=2.1.85)
 28 * Modified "Nat Semi Kludge" for extended chipsets
 29 *                                                      [1.41]
 30 *
 31 * Fixed id_probe for EPP 1.9 chipsets (misdetected as EPP 1.7)
 32 *                                                      [1.42]
 33 *
 34 * Development solely for 2.1.x kernels from now on!
 35 *                                                      [2.00]
 36 *
 37 * Hack and slash at the init code (EPP device check routine)
 38 * Added INSANE option.
 39 *                                                      [2.01]
 40 *
 41 * Patch applied to sync against the 2.1.x kernel code
 42 * Included qboot_zip.sh
 43 *                                                      [2.02]
 44 *
 45 * Cleaned up the mess left by someone else trying to fix the
 46 * asm section to keep egcc happy. The asm section no longer
 47 * exists, the nibble code is *almost* as fast as the asm code
 48 * providing it is compiled with egcc.
 49 *
 50 * Other clean ups include the follow changes:
 51 *    CONFIG_SCSI_PPA_HAVE_PEDANTIC => CONFIG_SCSI_IZIP_EPP16
 52 *    added CONFIG_SCSI_IZIP_SLOW_CTR option
 53 *                                                      [2.03]
 54 *
 55 * Use ppa_wait() to check for ready AND connected status bits
 56 * Add ppa_wait() calls to ppa_completion()
 57 *  by Peter Cherriman <pjc@ecs.soton.ac.uk> and
 58 *     Tim Waugh <twaugh@redhat.com>
 59 *							[2.04]
 60 *
 61 * Fix kernel panic on scsi timeout, 2000-08-18		[2.05]
 62 *
 63 * Avoid io_request_lock problems.
 64 * John Cavan <johncavan@home.com>			[2.06]
 65 *
 66 * Busy wait for connected status bit in ppa_completion()
 67 *  in order to cope with some hardware that has this bit low
 68 *  for short periods of time.
 69 * Add udelay() to ppa_select()
 70 *  by Peter Cherriman <pjc@ecs.soton.ac.uk> and
 71 *     Oleg Makarenko <omakarenko@cyberplat.ru>         
 72 *                                                      [2.07]
 73 */
 74/* ------ END OF USER CONFIGURABLE PARAMETERS ----- */
 75
 76#include  <linux/stddef.h>
 77#include  <linux/module.h>
 78#include  <linux/kernel.h>
 79#include  <linux/ioport.h>
 80#include  <linux/delay.h>
 81#include  <linux/proc_fs.h>
 82#include  <linux/stat.h>
 83#include  <linux/blkdev.h>
 84#include  <linux/sched.h>
 85#include  <linux/interrupt.h>
 86
 87#include  <asm/io.h>
 88#include  <scsi/scsi_host.h>
 89/* batteries not included :-) */
 90
 91/*
 92 * modes in which the driver can operate 
 93 */
 94#define   PPA_AUTODETECT        0	/* Autodetect mode                */
 95#define   PPA_NIBBLE            1	/* work in standard 4 bit mode    */
 96#define   PPA_PS2               2	/* PS/2 byte mode         */
 97#define   PPA_EPP_8             3	/* EPP mode, 8 bit                */
 98#define   PPA_EPP_16            4	/* EPP mode, 16 bit               */
 99#define   PPA_EPP_32            5	/* EPP mode, 32 bit               */
100#define   PPA_UNKNOWN           6	/* Just in case...                */
101
102static char *PPA_MODE_STRING[] =
103{
104    "Autodetect",
105    "SPP",
106    "PS/2",
107    "EPP 8 bit",
108    "EPP 16 bit",
109#ifdef CONFIG_SCSI_IZIP_EPP16
110    "EPP 16 bit",
111#else
112    "EPP 32 bit",
113#endif
114    "Unknown"};
115
116/* other options */
117#define PPA_BURST_SIZE	512	/* data burst size */
118#define PPA_SELECT_TMO  5000	/* how long to wait for target ? */
119#define PPA_SPIN_TMO    50000	/* ppa_wait loop limiter */
120#define PPA_RECON_TMO   500	/* scsi reconnection loop limiter */
121#define PPA_DEBUG	0	/* debugging option */
122#define IN_EPP_MODE(x) (x == PPA_EPP_8 || x == PPA_EPP_16 || x == PPA_EPP_32)
123
124/* args to ppa_connect */
125#define CONNECT_EPP_MAYBE 1
126#define CONNECT_NORMAL  0
127
128#define r_dtr(x)        (unsigned char)inb((x))
129#define r_str(x)        (unsigned char)inb((x)+1)
130#define r_ctr(x)        (unsigned char)inb((x)+2)
131#define r_epp(x)        (unsigned char)inb((x)+4)
132#define r_fifo(x)       (unsigned char)inb((x)) /* x must be base_hi */
133					/* On PCI is base+0x400 != base_hi */
134#define r_ecr(x)        (unsigned char)inb((x)+0x2) /* x must be base_hi */
135
136#define w_dtr(x,y)      outb(y, (x))
137#define w_str(x,y)      outb(y, (x)+1)
138#define w_epp(x,y)      outb(y, (x)+4)
139#define w_fifo(x,y)     outb(y, (x))	/* x must be base_hi */
140#define w_ecr(x,y)      outb(y, (x)+0x2)/* x must be base_hi */
141
142#ifdef CONFIG_SCSI_IZIP_SLOW_CTR
143#define w_ctr(x,y)      outb_p(y, (x)+2)
144#else
145#define w_ctr(x,y)      outb(y, (x)+2)
146#endif
147
148static int ppa_engine(ppa_struct *, struct scsi_cmnd *);
149
150#endif				/* _PPA_H */
v6.8
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*  Driver for the PPA3 parallel port SCSI HBA embedded in 
  3 * the Iomega ZIP drive
  4 * 
  5 * (c) 1996     Grant R. Guenther  grant@torque.net
  6 *              David Campbell
  7 *
  8 *      All comments to David.
  9 */
 10
 11#ifndef _PPA_H
 12#define _PPA_H
 13
 14#define   PPA_VERSION   "2.07 (for Linux 2.4.x)"
 15
 16/* 
 17 * this driver has been hacked by Matteo Frigo (athena@theory.lcs.mit.edu)
 18 * to support EPP and scatter-gather.                        [0.26-athena]
 19 *
 20 * additional hacks by David Campbell
 21 * in response to this driver "mis-behaving" on his machine.
 22 *      Fixed EPP to handle "software" changing of EPP port data direction.
 23 *      Chased down EPP timeouts
 24 *      Made this driver "kernel version friendly"           [0.28-athena]
 25 *
 26 * [ Stuff removed ]
 27 *
 28 * Corrected ppa.h for 2.1.x kernels (>=2.1.85)
 29 * Modified "Nat Semi Kludge" for extended chipsets
 30 *                                                      [1.41]
 31 *
 32 * Fixed id_probe for EPP 1.9 chipsets (misdetected as EPP 1.7)
 33 *                                                      [1.42]
 34 *
 35 * Development solely for 2.1.x kernels from now on!
 36 *                                                      [2.00]
 37 *
 38 * Hack and slash at the init code (EPP device check routine)
 39 * Added INSANE option.
 40 *                                                      [2.01]
 41 *
 42 * Patch applied to sync against the 2.1.x kernel code
 43 * Included qboot_zip.sh
 44 *                                                      [2.02]
 45 *
 46 * Cleaned up the mess left by someone else trying to fix the
 47 * asm section to keep egcc happy. The asm section no longer
 48 * exists, the nibble code is *almost* as fast as the asm code
 49 * providing it is compiled with egcc.
 50 *
 51 * Other clean ups include the follow changes:
 52 *    CONFIG_SCSI_PPA_HAVE_PEDANTIC => CONFIG_SCSI_IZIP_EPP16
 53 *    added CONFIG_SCSI_IZIP_SLOW_CTR option
 54 *                                                      [2.03]
 55 *
 56 * Use ppa_wait() to check for ready AND connected status bits
 57 * Add ppa_wait() calls to ppa_completion()
 58 *  by Peter Cherriman <pjc@ecs.soton.ac.uk> and
 59 *     Tim Waugh <twaugh@redhat.com>
 60 *							[2.04]
 61 *
 62 * Fix kernel panic on scsi timeout, 2000-08-18		[2.05]
 63 *
 64 * Avoid io_request_lock problems.
 65 * John Cavan <johncavan@home.com>			[2.06]
 66 *
 67 * Busy wait for connected status bit in ppa_completion()
 68 *  in order to cope with some hardware that has this bit low
 69 *  for short periods of time.
 70 * Add udelay() to ppa_select()
 71 *  by Peter Cherriman <pjc@ecs.soton.ac.uk> and
 72 *     Oleg Makarenko <omakarenko@cyberplat.ru>         
 73 *                                                      [2.07]
 74 */
 75/* ------ END OF USER CONFIGURABLE PARAMETERS ----- */
 76
 77#include  <linux/stddef.h>
 78#include  <linux/module.h>
 79#include  <linux/kernel.h>
 80#include  <linux/ioport.h>
 81#include  <linux/delay.h>
 82#include  <linux/proc_fs.h>
 83#include  <linux/stat.h>
 84#include  <linux/blkdev.h>
 85#include  <linux/sched.h>
 86#include  <linux/interrupt.h>
 87
 88#include  <asm/io.h>
 89#include  <scsi/scsi_host.h>
 90/* batteries not included :-) */
 91
 92/*
 93 * modes in which the driver can operate 
 94 */
 95#define   PPA_AUTODETECT        0	/* Autodetect mode                */
 96#define   PPA_NIBBLE            1	/* work in standard 4 bit mode    */
 97#define   PPA_PS2               2	/* PS/2 byte mode         */
 98#define   PPA_EPP_8             3	/* EPP mode, 8 bit                */
 99#define   PPA_EPP_16            4	/* EPP mode, 16 bit               */
100#define   PPA_EPP_32            5	/* EPP mode, 32 bit               */
101#define   PPA_UNKNOWN           6	/* Just in case...                */
102
103static char *PPA_MODE_STRING[] =
104{
105    "Autodetect",
106    "SPP",
107    "PS/2",
108    "EPP 8 bit",
109    "EPP 16 bit",
 
 
 
110    "EPP 32 bit",
 
111    "Unknown"};
112
113/* other options */
114#define PPA_BURST_SIZE	512	/* data burst size */
115#define PPA_SELECT_TMO  5000	/* how long to wait for target ? */
116#define PPA_SPIN_TMO    50000	/* ppa_wait loop limiter */
117#define PPA_RECON_TMO   500	/* scsi reconnection loop limiter */
118#define PPA_DEBUG	0	/* debugging option */
119#define IN_EPP_MODE(x) (x == PPA_EPP_8 || x == PPA_EPP_16 || x == PPA_EPP_32)
120
121/* args to ppa_connect */
122#define CONNECT_EPP_MAYBE 1
123#define CONNECT_NORMAL  0
124
125#define r_dtr(x)        (unsigned char)inb((x))
126#define r_str(x)        (unsigned char)inb((x)+1)
127#define r_ctr(x)        (unsigned char)inb((x)+2)
128#define r_epp(x)        (unsigned char)inb((x)+4)
129#define r_fifo(x)       (unsigned char)inb((x)) /* x must be base_hi */
130					/* On PCI is base+0x400 != base_hi */
131#define r_ecr(x)        (unsigned char)inb((x)+0x2) /* x must be base_hi */
132
133#define w_dtr(x,y)      outb(y, (x))
134#define w_str(x,y)      outb(y, (x)+1)
135#define w_epp(x,y)      outb(y, (x)+4)
136#define w_fifo(x,y)     outb(y, (x))	/* x must be base_hi */
137#define w_ecr(x,y)      outb(y, (x)+0x2)/* x must be base_hi */
138
139#ifdef CONFIG_SCSI_IZIP_SLOW_CTR
140#define w_ctr(x,y)      outb_p(y, (x)+2)
141#else
142#define w_ctr(x,y)      outb(y, (x)+2)
143#endif
144
145static int ppa_engine(ppa_struct *, struct scsi_cmnd *);
146
147#endif				/* _PPA_H */