Commit bf8022f7 authored by James Bottomley's avatar James Bottomley

Eliminate really old ncr53c8xx driver

- Remove direct configuration of this driver
- Only remaining use is in the parisc zalon driver
- Split the driver up to make it more use to 720 based drivers
- Update zalon to new module/SCSI methods
parent 62b1ea27
......@@ -953,27 +953,6 @@ config SCSI_ZALON
used on the add-in Bluefish, Barracuda & Shrike SCSI cards.
Say Y here if you have one of these machines or cards.
config SCSI_NCR53C8XX
tristate "NCR53C8XX SCSI support"
depends on PCI && SCSI_SYM53C8XX_2!=y && SCSI_ZALON!=y && SCSI
---help---
This is the BSD ncr driver adapted to Linux for the NCR53C8XX family
of PCI-SCSI controllers. This driver supports parity checking,
tagged command queuing and fast synchronous data transfers up to 80
MB/s with wide FAST-40 LVD devices and controllers.
Recent versions of the 53C8XX chips are better supported by the
option "SYM53C8XX SCSI support", below.
Note: there is yet another driver for the 53c8xx family of
controllers ("NCR53c7,8xx SCSI support" above). If you want to use
them both, you need to say M to both and build them as modules, but
only one may be active at a time. If you have a 53c8xx board, you
probably do not want to use the "NCR53c7,8xx SCSI support".
Please read <file:Documentation/scsi/ncr53c8xx.txt> for more
information.
config SCSI_SYM53C8XX
tristate "SYM53C8XX SCSI support"
depends on PCI && SCSI_SYM53C8XX_2!=y && SCSI
......@@ -1002,8 +981,8 @@ config SCSI_SYM53C8XX
information.
config SCSI_NCR53C8XX_DEFAULT_TAGS
int "default tagged command queue depth"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX || SCSI_ZALON)
int " default tagged command queue depth"
depends on (SCSI_SYM53C8XX || SCSI_ZALON || SCSI_NCR_Q720)
default "8"
---help---
"Tagged command queuing" is a feature of SCSI-2 which improves
......@@ -1028,8 +1007,8 @@ config SCSI_NCR53C8XX_DEFAULT_TAGS
There is no safe option other than using good SCSI devices.
config SCSI_NCR53C8XX_MAX_TAGS
int "maximum number of queued commands"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX || SCSI_ZALON)
int " maximum number of queued commands"
depends on (SCSI_SYM53C8XX || SCSI_ZALON || SCSI_NCR_Q720)
default "32"
---help---
This option allows you to specify the maximum number of commands
......@@ -1045,8 +1024,8 @@ config SCSI_NCR53C8XX_MAX_TAGS
There is no safe option and the default answer is recommended.
config SCSI_NCR53C8XX_SYNC
int "synchronous transfers frequency in MHz"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX || SCSI_ZALON)
int " synchronous transfers frequency in MHz"
depends on (SCSI_SYM53C8XX || SCSI_ZALON || SCSI_NCR_Q720)
default "20"
---help---
The SCSI Parallel Interface-2 Standard defines 5 classes of transfer
......@@ -1079,8 +1058,8 @@ config SCSI_NCR53C8XX_SYNC
terminations and SCSI conformant devices.
config SCSI_NCR53C8XX_PROFILE
bool "enable profiling"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX || SCSI_ZALON)
bool " enable profiling"
depends on (SCSI_SYM53C8XX || SCSI_ZALON || SCSI_NCR_Q720)
help
This option allows you to enable profiling information gathering.
These statistics are not very accurate due to the low frequency
......@@ -1090,8 +1069,8 @@ config SCSI_NCR53C8XX_PROFILE
The normal answer therefore is N.
config SCSI_NCR53C8XX_IOMAPPED
bool "use normal IO"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX) && !SCSI_ZALON
bool " use normal IO"
depends on SCSI_SYM53C8XX && !(SCSI_ZALON || SCSI_NCR_Q720)
help
If you say Y here, the driver will use normal IO, as opposed to
memory mapped IO. Memory mapped IO has less latency than normal IO
......@@ -1103,8 +1082,8 @@ config SCSI_NCR53C8XX_IOMAPPED
related problems.
config SCSI_NCR53C8XX_PQS_PDS
bool "include support for the NCR PQS/PDS SCSI card"
depends on (SCSI_NCR53C8XX || SCSI_SYM53C8XX) && SCSI_SYM53C8XX
bool " include support for the NCR PQS/PDS SCSI card"
depends on SCSI_SYM53C8XX
help
Say Y here if you have a special SCSI adapter produced by NCR
corporation called a PCI Quad SCSI or PCI Dual SCSI. You do not need
......@@ -1115,8 +1094,8 @@ config SCSI_NCR53C8XX_PQS_PDS
The common answer here is N, but answering Y is safe.
config SCSI_NCR53C8XX_NO_DISCONNECT
bool "not allow targets to disconnect"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX || SCSI_ZALON) && SCSI_NCR53C8XX_DEFAULT_TAGS=0
bool " not allow targets to disconnect"
depends on (SCSI_SYM53C8XX || SCSI_ZALON || SCSI_NCR_Q720) && SCSI_NCR53C8XX_DEFAULT_TAGS=0
help
This option is only provided for safety if you suspect some SCSI
device of yours to not support properly the target-disconnect
......@@ -1125,8 +1104,8 @@ config SCSI_NCR53C8XX_NO_DISCONNECT
than 1 device on a SCSI bus. The normal answer therefore is N.
config SCSI_NCR53C8XX_SYMBIOS_COMPAT
bool "assume boards are SYMBIOS compatible (EXPERIMENTAL)"
depends on PCI && SCSI_SYM53C8XX_2!=y && (SCSI_NCR53C8XX || SCSI_SYM53C8XX || SCSI_ZALON) && EXPERIMENTAL
bool " assume boards are SYMBIOS compatible (EXPERIMENTAL)"
depends on (SCSI_SYM53C8XX || SCSI_ZALON || SCSI_NCR_Q720 ) && EXPERIMENTAL
---help---
This option allows you to enable some features depending on GPIO
wiring. These General Purpose Input/Output pins can be used for
......
......@@ -81,7 +81,6 @@ obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o
obj-$(CONFIG_SCSI_DTC3280) += dtc.o
obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/
obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
obj-$(CONFIG_SCSI_NCR53C8XX) += ncr53c8xx.o
obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o
obj-$(CONFIG_SCSI_EATA_PIO) += eata_pio.o
obj-$(CONFIG_SCSI_7000FASST) += wd7000.o
......@@ -133,6 +132,12 @@ sd_mod-objs := sd.o
sr_mod-objs := sr.o sr_ioctl.o sr_vendor.o
initio-objs := ini9100u.o i91uscsi.o
a100u2w-objs := inia100.o i60uscsi.o
ncr53c8xx-flags-$(CONFIG_SCSI_ZALON) \
:= -DCONFIG_NCR53C8XX_PREFETCH \
-DCONFIG_SCSI_NCR53C8XX_NO_WORD_TRANSFERS \
-DCONFIG_SCSI_NCR53C8XX_NO_NVRAM \
-DSCSI_NCR_BIG_ENDIAN -DSIMULATED_INTFLY
CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m)
zalon7xx-objs := zalon.o ncr53c8xx.o
cpqfc-objs := cpqfcTSinit.o cpqfcTScontrol.o cpqfcTSi2c.o \
cpqfcTSworker.o cpqfcTStrigger.o
......
......@@ -82,7 +82,7 @@
** Etc...
**
** Supported NCR/SYMBIOS chips:
** 53C720 (Wide, Fast SCSI-2, HP Zalon)
** 53C720 (Wide, Fast SCSI-2, intfly problems)
** 53C810 (8 bits, Fast SCSI-2, no rom BIOS)
** 53C815 (8 bits, Fast SCSI-2, on board rom BIOS)
** 53C820 (Wide, Fast SCSI-2, no rom BIOS)
......@@ -173,31 +173,6 @@
#endif
#endif
/*
** Define the BSD style u_int32 and u_int64 type.
** Are in fact u_int32_t and u_int64_t :-)
*/
typedef u32 u_int32;
typedef u64 u_int64;
typedef u_long vm_offset_t;
#ifdef __hppa__
/*
* Yuck. Current plan is to use ncr58c8xx.c for non-pci big endian
* chips, and sym53c8xx.c for pci little endian chips. Define this
* here so it gets seen by sym53c8xx_defs.h, pulled in via ncr53c8xx.h.
*/
#define SCSI_NCR_BIG_ENDIAN
/* INTFLY interrupts don't always seem to get serviced atm..... */
#define SIMULATED_INTFLY
#endif
#if defined(CONFIG_SCSI_ZALON) || defined(CONFIG_SCSI_ZALON_MODULE)
#define ENABLE_SCSI_ZALON
#include <asm/parisc-device.h>
#include "zalon.h"
#endif
#include "ncr53c8xx.h"
/*
......@@ -215,6 +190,12 @@ typedef u_long vm_offset_t;
#include "sym53c8xx_comm.h"
int ncr53c8xx_slave_configure(Scsi_Device *device);
int ncr53c8xx_bus_reset(Scsi_Cmnd *cmd);
int ncr53c8xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *));
const char *ncr53c8xx_info (struct Scsi_Host *host);
/*==========================================================
**
** The CCB done queue uses an array of CCB virtual
......@@ -397,7 +378,6 @@ static Scsi_Host_Template *the_template = NULL;
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
static irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void ncr53c8xx_timeout(unsigned long np);
static int ncr53c8xx_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
int length, int func);
......@@ -1245,7 +1225,7 @@ struct ncb {
** return from the subroutine.
*/
#ifdef ENABLE_SCSI_ZALON
#ifdef CONFIG_NCR53C8XX_PREFETCH
#define PREFETCH_FLUSH_CNT 2
#define PREFETCH_FLUSH SCR_CALL, PADDRH (wait_dma),
#else
......@@ -1419,8 +1399,6 @@ static int ncr_reset_scsi_bus (ncb_p np, int enab_int, int settle_delay);
static void ncr_usercmd (ncb_p np);
#endif
static int ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device);
static void insert_into_waiting_list(ncb_p np, Scsi_Cmnd *cmd);
static Scsi_Cmnd *retrieve_from_waiting_list(int to_remove, ncb_p np, Scsi_Cmnd *cmd);
static void process_waiting_list(ncb_p np, int sts);
......@@ -3236,7 +3214,7 @@ static u_long div_10M[] =
* ctest4 for others.
*/
#define burst_code(dmode, ctest0, ctest4, ctest5) \
(np->device_id == PSEUDO_ZALON_720_ID) ? \
(np->device_id == PSEUDO_720_ID) ? \
(ctest0) & 0x80? 0 : (((dmode) & 0xc0) >> 6) + 1 : \
(ctest4) & 0x80? 0 : (((dmode) & 0xc0) >> 6) + ((ctest5) & 0x04) + 1
......@@ -3245,7 +3223,7 @@ static u_long div_10M[] =
*/
static inline void ncr_init_burst(ncb_p np, u_char bc)
{
u_char *be = (np->device_id == PSEUDO_ZALON_720_ID) ?
u_char *be = (np->device_id == PSEUDO_720_ID) ?
&np->rv_ctest0 : &np->rv_ctest4;
*be &= ~0x80;
np->rv_dmode &= ~(0x3 << 6);
......@@ -3646,7 +3624,7 @@ static int __init ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
** start the timer daemon.
*/
static int __init
struct Scsi_Host * __init
ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
{
struct host_data *host_data;
......@@ -3656,7 +3634,22 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
ncr_nvram *nvram = device->nvram;
int i;
#ifndef ENABLE_SCSI_ZALON
#ifdef SCSI_NCR_PROC_INFO_SUPPORT
tpnt->proc_info = ncr53c8xx_proc_info,
#endif
tpnt->info = ncr53c8xx_info;
tpnt->queuecommand = ncr53c8xx_queue_command;
tpnt->slave_configure = ncr53c8xx_slave_configure;
tpnt->eh_bus_reset_handler = ncr53c8xx_bus_reset;
tpnt->can_queue = SCSI_NCR_CAN_QUEUE;
tpnt->this_id = 7;
tpnt->sg_tablesize = SCSI_NCR_SG_TABLESIZE;
tpnt->cmd_per_lun = SCSI_NCR_CMD_PER_LUN;
tpnt->use_clustering = DISABLE_CLUSTERING;
if(device->differential)
driver_setup.diff_support = device->differential;
printk(KERN_INFO "ncr53c%s-%d: rev 0x%x on pci bus %d device %d function %d "
#ifdef __sparc__
"irq %s\n",
......@@ -3670,13 +3663,12 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
__irq_itoa(device->slot.irq));
#else
device->slot.irq);
#endif
#endif
/*
** Allocate host_data structure
*/
if (!(instance = scsi_register(tpnt, sizeof(*host_data))))
if (!(instance = scsi_host_alloc(tpnt, sizeof(*host_data))))
goto attach_error;
host_data = (struct host_data *) instance->hostdata;
......@@ -3744,7 +3736,11 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
np->paddr2 = (np->features & FE_RAM)? device->slot.base_2 : 0;
#ifndef SCSI_NCR_IOMAPPED
if(device->slot.base_v)
np->vaddr = device->slot.base_v;
else
np->vaddr = remap_pci_mem(device->slot.base_c, (u_long) 128);
if (!np->vaddr) {
printk(KERN_ERR
"%s: can't map memory mapped IO region\n",ncr_name(np));
......@@ -3763,16 +3759,14 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
np->reg = (struct ncr_reg*) np->vaddr;
#endif /* !defined SCSI_NCR_IOMAPPED */
#else
/*
** Try to map the controller chip into iospace.
*/
#ifndef ENABLE_SCSI_ZALON
request_region(device->slot.io_port, 128, "ncr53c8xx");
#endif
np->base_io = device->slot.io_port;
#endif /* !defined SCSI_NCR_IOMAPPED */
#ifdef SCSI_NCR_NVRAM_SUPPORT
if (nvram) {
......@@ -3898,24 +3892,6 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
** Install the interrupt handler.
*/
if (request_irq(device->slot.irq, ncr53c8xx_intr,
((driver_setup.irqm & 0x10) ? 0 : SA_SHIRQ) |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
((driver_setup.irqm & 0x20) ? 0 : SA_INTERRUPT),
#else
0,
#endif
"ncr53c8xx", np)) {
#ifdef __sparc__
printk(KERN_ERR "%s: request irq %s failure\n",
ncr_name(np), __irq_itoa(device->slot.irq));
#else
printk(KERN_ERR "%s: request irq %d failure\n",
ncr_name(np), device->slot.irq);
#endif
goto attach_error;
}
np->irq = device->slot.irq;
/*
......@@ -3981,40 +3957,13 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
NCR_UNLOCK_NCB(np, flags);
return 0;
return instance;
attach_error:
if (!instance) return -1;
if (!instance) return NULL;
printk(KERN_INFO "%s: detaching...\n", ncr_name(np));
if (!np)
goto unregister;
#ifndef SCSI_NCR_IOMAPPED
if (np->vaddr) {
#ifdef DEBUG_NCR53C8XX
printk(KERN_DEBUG "%s: releasing memory mapped IO region %lx[%d]\n", ncr_name(np), (u_long) np->vaddr, 128);
#endif
unmap_pci_mem((vm_offset_t) np->vaddr, (u_long) 128);
}
#endif /* !SCSI_NCR_IOMAPPED */
if (np->base_io) {
#ifdef DEBUG_NCR53C8XX
printk(KERN_DEBUG "%s: releasing IO region %x[%d]\n", ncr_name(np), np->base_io, 128);
#endif
#ifndef ENABLE_SCSI_ZALON
release_region(np->base_io, 128);
#endif
}
if (np->irq) {
#ifdef DEBUG_NCR53C8XX
#ifdef __sparc__
printk(KERN_INFO "%s: freeing irq %s\n", ncr_name(np),
__irq_itoa(np->irq));
#else
printk(KERN_INFO "%s: freeing irq %d\n", ncr_name(np), np->irq);
#endif
#endif
free_irq(np->irq, np);
}
if (np->scripth0)
m_free_dma(np->scripth0, sizeof(struct scripth), "SCRIPTH");
if (np->script0)
......@@ -4024,9 +3973,9 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
m_free_dma(np, sizeof(struct ncb), "NCB");
unregister:
scsi_unregister(instance);
scsi_host_put(instance);
return -1;
return NULL;
}
......@@ -4823,7 +4772,7 @@ static int ncr_reset_scsi_bus(ncb_p np, int enab_int, int settle_delay)
** properly set IRQ mode, prior to resetting the bus.
*/
OUTB (nc_stest3, TE);
if (np->device_id != PSEUDO_ZALON_720_ID)
if (np->device_id != PSEUDO_720_ID)
OUTB (nc_dcntl, (np->rv_dcntl & IRQM));
OUTB (nc_scntl1, CRST);
UDELAY (200);
......@@ -5061,19 +5010,6 @@ static int ncr_detach(ncb_p np)
OUTW (nc_sien , 0);
OUTB (nc_dien , 0);
/*
** Free irq
*/
#ifdef DEBUG_NCR53C8XX
#ifdef __sparc__
printk("%s: freeing irq %s\n", ncr_name(np), __irq_itoa(np->irq));
#else
printk("%s: freeing irq %d\n", ncr_name(np), np->irq);
#endif
#endif
free_irq(np->irq, np);
/*
** Reset NCR chip
** Restore bios setting for automatic clock detection.
......@@ -5093,24 +5029,6 @@ static int ncr_detach(ncb_p np)
ncr_selectclock(np, np->sv_scntl3);
/*
** Release Memory mapped IO region and IO mapped region
*/
#ifndef SCSI_NCR_IOMAPPED
#ifdef DEBUG_NCR53C8XX
printk("%s: releasing memory mapped IO region %lx[%d]\n", ncr_name(np), (u_long) np->vaddr, 128);
#endif
unmap_pci_mem((vm_offset_t) np->vaddr, (u_long) 128);
#endif /* !SCSI_NCR_IOMAPPED */
#ifdef DEBUG_NCR53C8XX
printk("%s: releasing IO region %x[%d]\n", ncr_name(np), np->base_io, 128);
#endif
#ifndef ENABLE_SCSI_ZALON
release_region(np->base_io, 128);
#endif
/*
** Free allocated ccb(s)
*/
......@@ -8634,7 +8552,7 @@ static void __init ncr_getclock (ncb_p np, int mult)
f1 = ncrgetfreq (np, 11);
f2 = ncrgetfreq (np, 11);
if (bootverbose)
if(bootverbose)
printk ("%s: NCR clock is %uKHz, %uKHz\n", ncr_name(np), f1, f2);
if (f1 > f2) f1 = f2; /* trust lower result */
......@@ -8774,10 +8692,12 @@ printk("ncr53c8xx : command successfully queued\n");
** routine for each host that uses this IRQ.
*/
static irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
{
unsigned long flags;
ncb_p np = (ncb_p) dev_id;
struct Scsi_Host *shost = (struct Scsi_Host *)dev_id;
struct host_data *host_data = (struct host_data *)shost->hostdata;
ncb_p np = host_data->ncb;
Scsi_Cmnd *done_list;
#ifdef DEBUG_NCR53C8XX
......@@ -9335,7 +9255,7 @@ __setup("ncr53c8xx=", ncr53c8xx_setup);
*/
static u_short ncr_chip_ids[] __initdata = {
PSEUDO_ZALON_720_ID,
PSEUDO_720_ID,
PCI_DEVICE_ID_NCR_53C810,
PCI_DEVICE_ID_NCR_53C815,
PCI_DEVICE_ID_NCR_53C820,
......@@ -9350,73 +9270,6 @@ static u_short ncr_chip_ids[] __initdata = {
PCI_DEVICE_ID_NCR_53C1510D
};
#ifdef ENABLE_SCSI_ZALON
/* Attach a 53c720 interfaced via Zalon chip on HP boxes. */
int zalon_attach(Scsi_Host_Template *tpnt, unsigned long io_port,
struct parisc_device *dev, int irq, int unit)
{
u_short device_id;
u_char revision;
int i;
ncr_chip *chip;
ncr_device device;
tpnt->proc_name = NAME53C8XX;
tpnt->proc_info = ncr53c8xx_proc_info;
#if defined(SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT) && defined(MODULE)
if (ncr53c8xx)
ncr53c8xx_setup(ncr53c8xx);
#endif
#ifdef SCSI_NCR_DEBUG_INFO_SUPPORT
ncr_debug = driver_setup.debug;
#endif
if (initverbose >= 2)
ncr_print_driver_setup();
memset(&device, 0, sizeof(ncr_device));
chip = 0;
device_id = PSEUDO_ZALON_720_ID;
revision = 0;
for (i = 0; i < sizeof(ncr_chip_table)/sizeof(ncr_chip_table[0]); i++) { if (device_id != ncr_chip_table[i].device_id)
continue;
chip = &device.chip;
memcpy(chip, &ncr_chip_table[i], sizeof(*chip));
chip->revision_id = revision;
break;
}
if (!chip) {
printk(NAME53C8XX ": not initializing, device not supported\n"); return -1;
}
/* Fix some features according to driver setup. */
driver_setup.diff_support = 2;
/* The following three are needed before any other access. */
writeb(0x20, io_port + 0x38); /* DCNTL_REG, EA */
writeb(0x04, io_port + 0x1b); /* CTEST0_REG, EHP */
writeb(0x80, io_port + 0x22); /* CTEST4_REG, MUX */
/* Initialise ncr_device structure with items required by ncr_attach. */
device.host_id = driver_setup.host_id;
device.dev = &dev->dev;
device.slot.bus = 0;
device.slot.device_fn = 0;
device.slot.base = (u_long)io_port;
device.slot.base_c = (u_long)io_port;
device.slot.base_2 = 0;
device.slot.base_2_c = 0;
device.slot.io_port = io_port;
device.slot.irq = irq;
device.attach_done = 0;
printk(KERN_INFO NAME53C8XX ": 53c%s detected\n", device.chip.name);
return ncr_attach(tpnt, unit, &device);
}
#endif
/*==========================================================
**
......@@ -9445,33 +9298,3 @@ const char *ncr53c8xx_info (struct Scsi_Host *host)
{
return SCSI_NCR_DRIVER_NAME;
}
/*
** Module stuff
*/
MODULE_LICENSE("GPL");
static Scsi_Host_Template driver_template = {
#ifdef ENABLE_SCSI_ZALON
.proc_name = "zalon720",
.detect = zalon7xx_detect,
.release = zalon7xx_release,
#else
.proc_name = NAME53C8XX,
.detect = ncr53c8xx_detect,
.release = ncr53c8xx_release,
#endif
#ifdef SCSI_NCR_PROC_INFO_SUPPORT
.proc_info = ncr53c8xx_proc_info,
#endif
.info = ncr53c8xx_info,
.queuecommand = ncr53c8xx_queue_command,
.slave_configure = ncr53c8xx_slave_configure,
.eh_bus_reset_handler = ncr53c8xx_bus_reset,
.can_queue = SCSI_NCR_CAN_QUEUE,
.this_id = 7,
.sg_tablesize = SCSI_NCR_SG_TABLESIZE,
.cmd_per_lun = SCSI_NCR_CMD_PER_LUN,
.use_clustering = DISABLE_CLUSTERING,
};
#include "scsi_module.c"
......@@ -42,6 +42,79 @@
#ifndef NCR53C8XX_H
#define NCR53C8XX_H
/*
** Define the BSD style u_int32 and u_int64 type.
** Are in fact u_int32_t and u_int64_t :-)
*/
typedef u32 u_int32;
typedef u64 u_int64;
typedef u_long vm_offset_t;
#include "sym53c8xx_defs.h"
/*==========================================================
**
** Structures used by the detection routine to transmit
** device configuration to the attach function.
**
**==========================================================
*/
typedef struct {
int bus;
u_char device_fn;
u_long base;
u_long base_2;
u_long io_port;
u_long base_c;
u_long base_2_c;
u_long base_v;
u_long base_2_v;
int irq;
/* port and reg fields to use INB, OUTB macros */
u_long base_io;
volatile struct ncr_reg *reg;
} ncr_slot;
/*==========================================================
**
** Structure used to store the NVRAM content.
**
**==========================================================
*/
typedef struct {
int type;
#define SCSI_NCR_SYMBIOS_NVRAM (1)
#define SCSI_NCR_TEKRAM_NVRAM (2)
#ifdef SCSI_NCR_NVRAM_SUPPORT
union {
Symbios_nvram Symbios;
Tekram_nvram Tekram;
} data;
#endif
} ncr_nvram;
/*==========================================================
**
** Structure used by detection routine to save data on
** each detected board for attach.
**
**==========================================================
*/
typedef struct {
struct device *dev;
ncr_slot slot;
ncr_chip chip;
ncr_nvram *nvram;
u_char host_id;
#ifdef SCSI_NCR_PQS_PDS_SUPPORT
u_char pqs_pds;
#endif
__u8 differential;
int attach_done;
} ncr_device;
extern struct Scsi_Host *ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device);
extern int ncr53c8xx_release(struct Scsi_Host *host);
irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
#endif /* NCR53C8XX_H */
......@@ -795,7 +795,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp)
dma_addr_t daddr;
vp = (m_addr_t) dma_alloc_coherent(mp->bush,
PAGE_SIZE<<MEMO_PAGE_ORDER,
&daddr, GFP_KERNEL);
&daddr, GFP_ATOMIC);
if (vp) {
int hc = VTOB_HASH_CODE(vp);
vbp->vaddr = vp;
......@@ -1098,66 +1098,6 @@ static struct ncr_driver_setup
#define bootverbose (np->verbose)
/*==========================================================
**
** Structures used by the detection routine to transmit
** device configuration to the attach function.
**
**==========================================================
*/
typedef struct {
int bus;
u_char device_fn;
u_long base;
u_long base_2;
u_long io_port;
u_long base_c;
u_long base_2_c;
int irq;
/* port and reg fields to use INB, OUTB macros */
u_long base_io;
volatile struct ncr_reg *reg;
} ncr_slot;
/*==========================================================
**
** Structure used to store the NVRAM content.
**
**==========================================================
*/
typedef struct {
int type;
#define SCSI_NCR_SYMBIOS_NVRAM (1)
#define SCSI_NCR_TEKRAM_NVRAM (2)
#ifdef SCSI_NCR_NVRAM_SUPPORT
union {
Symbios_nvram Symbios;
Tekram_nvram Tekram;
} data;
#endif
} ncr_nvram;
/*==========================================================
**
** Structure used by detection routine to save data on
** each detected board for attach.
**
**==========================================================
*/
typedef struct {
device_t dev;
ncr_slot slot;
ncr_chip chip;
ncr_nvram *nvram;
u_char host_id;
#ifdef SCSI_NCR_PQS_PDS_SUPPORT
u_char pqs_pds;
#endif
int attach_done;
} ncr_device;
static int ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device);
/*==========================================================
**
** NVRAM detection and reading.
......
......@@ -85,7 +85,7 @@
/*
* No more an option, enabled by default.
*/
#ifndef ENABLE_SCSI_ZALON
#ifndef CONFIG_SCSI_NCR53C8XX_NO_NVRAM
# ifndef CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT
# define CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT
# endif
......@@ -188,10 +188,6 @@
#define SCSI_NCR_IOMAPPED
#define SCSI_NCR_PCI_MEM_NOT_SUPPORTED
#endif
#elif defined(__sparc__)
#undef SCSI_NCR_IOMAPPED
#elif defined(__hppa__) && defined(ENABLE_SCSI_ZALON)
#undef SCSI_NCR_IOMAPPED
#endif
/*
......@@ -532,7 +528,6 @@
*/
#if defined(SCSI_NCR_IOMAPPED)
/*
* IO mapped only input / ouput
*/
......@@ -593,7 +588,7 @@
#else
#ifdef ENABLE_SCSI_ZALON
#ifdef CONFIG_SCSI_NCR53C8XX_NO_WORD_TRANSFERS
/* Only 8 or 32 bit transfers allowed */
#define INW_OFF(o) (readb((char *)np->reg + ncr_offw(o)) << 8 | readb((char *)np->reg + ncr_offw(o) + 1))
#else
......@@ -601,7 +596,7 @@
#endif
#define INL_OFF(o) readl_raw((char *)np->reg + (o))
#ifdef ENABLE_SCSI_ZALON
#ifdef CONFIG_SCSI_NCR53C8XX_NO_WORD_TRANSFERS
/* Only 8 or 32 bit transfers allowed */
#define OUTW_OFF(o, val) do { writeb((char)((val) >> 8), (char *)np->reg + ncr_offw(o)); writeb((char)(val), (char *)np->reg + ncr_offw(o) + 1); } while (0)
#else
......@@ -654,8 +649,8 @@
** NCR53C8XX Device Ids
*/
#ifndef PSEUDO_ZALON_720_ID
#define PSEUDO_ZALON_720_ID 0x5a00
#ifndef PSEUDO_720_ID
#define PSEUDO_720_ID 0x5a00
#endif
#ifndef PCI_DEVICE_ID_NCR_53C810
......@@ -785,7 +780,7 @@ typedef struct {
#define SCSI_NCR_CHIP_TABLE \
{ \
{PSEUDO_ZALON_720_ID, 0x0f, "720", 3, 8, 4, \
{PSEUDO_720_ID, 0x0f, "720", 3, 8, 4, \
FE_WIDE|FE_DIFF|FE_EHP|FE_MUX|FE_EA} \
, \
{PCI_DEVICE_ID_NCR_53C810, 0x0f, "810", 4, 8, 4, \
......@@ -860,7 +855,7 @@ typedef struct {
*/
#define SCSI_NCR_CHIP_IDS \
{ \
PSEUDO_ZALON_720_ID, \
PSEUDO_720_ID, \
PCI_DEVICE_ID_NCR_53C810, \
PCI_DEVICE_ID_NCR_53C815, \
PCI_DEVICE_ID_NCR_53C820, \
......
......@@ -24,30 +24,24 @@
#include "scsi.h"
#include "hosts.h"
/*
* ** Define the BSD style u_int32 and u_int64 type.
* ** Are in fact u_int32_t and u_int64_t :-)
* */
typedef u32 u_int32;
typedef u64 u_int64;
typedef u_long vm_offset_t;
#include "ncr53c8xx.h"
#include "zalon.h"
MODULE_AUTHOR("Richard Hirst");
MODULE_DESCRIPTION("Bluefish/Zalon 720 SCSI Driver");
MODULE_LICENSE("GPL");
static ncr_chip zalon720_chip __initdata = {
.device_id = PSEUDO_720_ID,
.revision_id = 0x0f,
.name = "720",
.burst_max = 3,
.offset_max = 8,
.nr_divisor = 4,
.features = FE_WIDE | FE_DIFF | FE_EHP| FE_MUX | FE_EA,
};
/* hosts_* are kluges to pass info between the zalon7xx_detected()
** and the register_parisc_driver() callbacks.
*/
static Scsi_Host_Template *hosts_tptr;
static int hosts_used=0;
static int zalon_id = 0;
extern int zalon_attach(Scsi_Host_Template *tpnt,
unsigned long base_addr,
struct parisc_device *dev,
int irq_vector,
int unit
);
#if 0
......@@ -81,6 +75,11 @@ lasi_scsi_clock(void * hpa, int defaultclock)
}
#endif
static Scsi_Host_Template zalon7xx_template = {
.module = THIS_MODULE,
.proc_name = "zalon7xx",
};
static int __init
zalon_scsi_callback(struct parisc_device *dev)
{
......@@ -88,6 +87,10 @@ zalon_scsi_callback(struct parisc_device *dev)
u32 zalon_vers;
int irq;
unsigned long zalon = dev->hpa;
unsigned long io_port = zalon + GSC_SCSI_ZALON_OFFSET;
static int unit = 0;
struct Scsi_Host *host;
ncr_device device;
__raw_writel(CMD_RESET, zalon + IO_MODULE_IO_COMMAND);
while (!(__raw_readl(zalon + IO_MODULE_IO_STATUS) & IOSTATUS_RY))
......@@ -112,17 +115,43 @@ zalon_scsi_callback(struct parisc_device *dev)
if ( zalon_vers == 0)
printk(KERN_WARNING "%s: Zalon 1.1 or earlier\n", __FUNCTION__);
/*
** zalon_attach: returns -1 on failure, 0 on success
*/
hosts_used = zalon_attach(hosts_tptr, dev->hpa + GSC_SCSI_ZALON_OFFSET,
dev, irq, zalon_id);
memset(&device, 0, sizeof(ncr_device));
/* The following three are needed before any other access. */
writeb(0x20, io_port + 0x38); /* DCNTL_REG, EA */
writeb(0x04, io_port + 0x1b); /* CTEST0_REG, EHP */
writeb(0x80, io_port + 0x22); /* CTEST4_REG, MUX */
/* Initialise ncr_device structure with items required by ncr_attach. */
device.chip = zalon720_chip;
device.host_id = 7;
device.dev = &dev->dev;
device.slot.base = (u_long)io_port;
device.slot.base_c = (u_long)io_port;
device.slot.irq = irq;
device.differential = 2;
host = ncr_attach(&zalon7xx_template, unit, &device);
if(!host)
goto fail;
strlcpy(dev->dev.name, "zalon7xx", sizeof(dev->dev.name));
if(request_irq(irq, ncr53c8xx_intr, SA_SHIRQ, dev->dev.name, host)) {
printk(KERN_ERR "%s: irq problem with %d, detaching\n ",
dev->dev.name, irq);
goto fail;
}
unit++;
if (hosts_used == 0)
zalon_id++;
dev_set_drvdata(&dev->dev, host);
hosts_used = (hosts_used == 0);
return (hosts_used == 0);
scsi_add_host(host, &dev->dev);
return 0;
fail:
return -ENODEV;
}
static struct parisc_device_id zalon_tbl[] = {
......@@ -132,30 +161,35 @@ static struct parisc_device_id zalon_tbl[] = {
MODULE_DEVICE_TABLE(parisc, zalon_tbl);
static int __exit zalon_remove(struct parisc_device *dev)
{
struct Scsi_Host *host = dev_get_drvdata(&dev->dev);
int irq = host->irq;
scsi_remove_host(host);
ncr53c8xx_release(host);
free_irq(irq, host);
return 0;
}
static struct parisc_driver zalon_driver = {
.name = "GSC SCSI (Zalon)",
.id_table = zalon_tbl,
.probe = zalon_scsi_callback,
.remove = __devexit_p(zalon_remove),
};
int zalon7xx_detect(Scsi_Host_Template *tpnt)
static int __init zalon7xx_init(void)
{
/* "pass" the parameter to the callback functions */
hosts_tptr = tpnt;
hosts_used = 0;
/* claim all zalon cards. */
register_parisc_driver(&zalon_driver);
/* Check if any callbacks actually found/claimed anything. */
return (hosts_used != 0);
return register_parisc_driver(&zalon_driver);
}
extern int ncr53c8xx_release(struct Scsi_Host *host);
int zalon7xx_release(struct Scsi_Host *host)
static void __exit zalon7xx_exit(void)
{
ncr53c8xx_release(host);
unregister_parisc_driver(&zalon_driver);
return 1;
}
module_init(zalon7xx_init);
module_exit(zalon7xx_exit);
......@@ -2,21 +2,8 @@
#define ZALON7XX_H
#include <linux/types.h>
#include "sym53c8xx_defs.h"
extern int zalon7xx_detect(Scsi_Host_Template *);
#include <scsi/scsicam.h>
extern struct proc_dir_entry proc_scsi_zalon7xx;
/* borrowed from drivers/scsi/ncr53c8xx.h */
int zalon7xx_detect(Scsi_Host_Template *tpnt);
const char *ncr53c8xx_info(struct Scsi_Host *host);
int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int zalon7xx_release(struct Scsi_Host *);
#define GSC_SCSI_ZALON_OFFSET 0x800
#define IO_MODULE_EIM (1*4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment