All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add spi attributes to qla1280
@ 2004-08-10 23:05 Jeremy Higdon
  2004-08-11  6:31 ` Jes Sorensen
  2004-08-11  7:11 ` Christoph Hellwig
  0 siblings, 2 replies; 9+ messages in thread
From: Jeremy Higdon @ 2004-08-10 23:05 UTC (permalink / raw)
  To: linux-scsi

This patch adds SPI attributes to the qla1280 driver.

It is similar to a patch submitted back in March by mort, except that it has
been updated to the current API.

Jes, can you confirm that this is okay?


Signed-off-by: Jeremy Higdon <jeremy@sgi.com>

Thanks,
jeremy


diff -ur -X /home/jeremy/dontdiff linux-2.6.8-rc2/drivers/scsi/Kconfig linux-2.6.8-rc2.new/drivers/scsi/Kconfig
--- linux-2.6.8-rc2/drivers/scsi/Kconfig	2004-08-10 15:57:22.000000000 -0700
+++ linux-2.6.8-rc2.new/drivers/scsi/Kconfig	2004-08-05 18:52:10.000000000 -0700
@@ -1258,6 +1258,7 @@
 config SCSI_QLOGIC_1280
 	tristate "Qlogic QLA 1280 SCSI support"
 	depends on PCI && SCSI
+	select SCSI_SPI_ATTRS
 	help
 	  Say Y if you have a QLogic ISP1x80/1x160 SCSI host adapter.
 
diff -ur -X /home/jeremy/dontdiff linux-2.6.8-rc2/drivers/scsi/qla1280.c linux-2.6.8-rc2.new/drivers/scsi/qla1280.c
--- linux-2.6.8-rc2/drivers/scsi/qla1280.c	2004-08-10 15:57:22.000000000 -0700
+++ linux-2.6.8-rc2.new/drivers/scsi/qla1280.c	2004-08-10 00:52:05.000000000 -0700
@@ -353,6 +353,8 @@
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
+#include <scsi/scsi_transport.h>
+#include <scsi/scsi_transport_spi.h>
 #include "scsi.h"
 #else
 #include <linux/blk.h>
@@ -1447,6 +1449,7 @@
 	int status = 0;
 	struct nvram *nv;
 	unsigned long flags;
+	int is1x160;
 
 	ha = (struct scsi_qla_host *)device->host->hostdata;
 	nv = &ha->nvram;
@@ -1489,6 +1492,21 @@
 		status = qla1280_set_target_parameters(ha, bus, target);
 	qla1280_get_target_parameters(ha, device);
 	spin_unlock_irqrestore(HOST_LOCK, flags);
+
+	if (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP12160 ||
+	    ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP10160)
+		is1x160 = 1;
+	else
+		is1x160 = 0;
+
+	spi_period(device) = nv->bus[bus].target[target].sync_period;
+	if (is1x160)
+		spi_offset(device) = nv->bus[bus].target[target].flags.
+			flags1x160.sync_offset;
+	else
+		spi_offset(device) = nv->bus[bus].target[target].flags.
+			flags1x80.sync_offset;
+
 	return status;
 }
 
@@ -4670,6 +4688,8 @@
 };
 #endif
 
+static struct scsi_transport_template *qla1280_transport_template = NULL;
+
 static int __devinit
 qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
@@ -4758,6 +4778,7 @@
 	host->max_id = MAX_TARGETS;
 	host->max_sectors = 1024;
 	host->unique_id = host->host_no;
+	host->transportt = qla1280_transport_template;
 
 #if LINUX_VERSION_CODE < 0x020545
 	host->select_queue_depths = qla1280_select_queue_depth;
@@ -4890,6 +4911,12 @@
 	.remove		= __devexit_p(qla1280_remove_one),
 };
 
+static struct spi_function_template qla1280_transport_functions = {
+	.show_period = 1,
+	.show_offset = 1,
+};
+
+
 static int __init
 qla1280_init(void)
 {
@@ -4899,6 +4926,10 @@
 		return -EINVAL;
 	}
 
+	qla1280_transport_template = spi_attach_transport(&qla1280_transport_functions);
+	if (!qla1280_transport_template)
+		return -ENODEV;
+
 #ifdef MODULE
 	/*
 	 * If we are called as a module, the qla1280 pointer may not be null
@@ -4923,6 +4954,7 @@
 qla1280_exit(void)
 {
 	pci_unregister_driver(&qla1280_pci_driver);
+	spi_release_transport(qla1280_transport_template);
 }
 
 module_init(qla1280_init);

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-08-12  9:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 23:05 [PATCH] add spi attributes to qla1280 Jeremy Higdon
2004-08-11  6:31 ` Jes Sorensen
2004-08-11  7:11 ` Christoph Hellwig
2004-08-11 21:56   ` Jeremy Higdon
2004-08-11 22:05     ` Christoph Hellwig
2004-08-11 22:16       ` Jeremy Higdon
2004-08-11 22:22         ` Christoph Hellwig
2004-08-12  5:29           ` Jeremy Higdon
2004-08-12  9:08             ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.