public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Higdon <jeremy@sgi.com>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] add spi attributes to qla1280
Date: Tue, 10 Aug 2004 16:05:52 -0700	[thread overview]
Message-ID: <20040810230552.GA26569@sgi.com> (raw)

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);

             reply	other threads:[~2004-08-10 23:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-10 23:05 Jeremy Higdon [this message]
2004-08-11  6:31 ` [PATCH] add spi attributes to qla1280 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040810230552.GA26569@sgi.com \
    --to=jeremy@sgi.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox