g_NCR5380 driver, parameters passed to module

W. Friess (Wolfgang.Friess@dlr.de)
Tue, 16 Apr 1996 16:43:43 +0200


The patch appended allows parameter passing to the generic NCR5380/53C400
driver if it is loaded as a MODULE. In my situation it is suitable to
use the driver as a temporary module, since the NCR53C400 card is that of the
HP SCANJET, which cannot be used for other purposes and which is used
together with the scanner once a week at most.

The module can be loaded with e.g.
modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
(see the little documentation in the patch.)
It is a rather crude hack and works for one card only. Perhaps
someone with a similar configuration could test it out?

Best regards, Wolfgang

diff -r -u orig/linux/drivers/scsi/g_NCR5380.c linux/drivers/scsi/g_NCR5380.c
--- orig/linux/drivers/scsi/g_NCR5380.c Tue Apr 16 11:57:51 1996
+++ linux/drivers/scsi/g_NCR5380.c Tue Apr 16 16:21:59 1996
@@ -50,6 +50,23 @@
*
* -1 should be specified for no or DMA interrupt, -2 to autoprobe for an
* IRQ line if overridden on the command line.
+ *
+ * 3. When included as a module, with arguments passed on the command line:
+ * ncr_irq=xx the interrupt
+ * ncr_addr=xx the port or base address (for port or memory
+ * mapped, resp.)
+ * ncr_dma=xx the DMA
+ * ncr_5380=1 to set up for a NCR5380 board
+ * ncr_53c400=1 to set up for a NCR53C400 board
+ * e.g.
+ * modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1
+ * for a port mapped NCR5380 board or
+ * modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
+ * for a memory mapped NCR53C400 board with interrupts disabled.
+ *
+ * 255 should be specified for no or DMA interrupt, 254 to autoprobe for an
+ * IRQ line if overridden on the command line.
+ *
*/

/*
@@ -93,6 +110,13 @@
S_IFDIR | S_IRUGO | S_IXUGO, 2
};

+#define NCR_NOT_SET 0
+static int ncr_irq=NCR_NOT_SET;
+static int ncr_dma=NCR_NOT_SET;
+static int ncr_addr=NCR_NOT_SET;
+static int ncr_5380=NCR_NOT_SET;
+static int ncr_53c400=NCR_NOT_SET;
+
static struct override {
NCR5380_implementation_fields;
int irq;
@@ -189,6 +213,17 @@
int flags = 0;
struct Scsi_Host *instance;

+ if (ncr_irq != NCR_NOT_SET)
+ overrides[0].irq=ncr_irq;
+ if (ncr_dma != NCR_NOT_SET)
+ overrides[0].dma=ncr_dma;
+ if (ncr_addr != NCR_NOT_SET)
+ overrides[0].NCR5380_map_name=(NCR5380_map_type)ncr_addr;
+ if (ncr_5380 != NCR_NOT_SET)
+ overrides[0].board=BOARD_NCR5380;
+ else if (ncr_53c400 != NCR_NOT_SET)
+ overrides[0].board=BOARD_NCR53C400;
+
tpnt->proc_dir = &proc_scsi_g_ncr5380;

for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
@@ -253,7 +288,8 @@

NCR5380_setup(instance);

- free_irq(instance->irq, NULL);
+ if (instance->irq != IRQ_NONE)
+ free_irq(instance->irq, NULL);

return 0;
}