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

* Re: [PATCH] add spi attributes to qla1280
  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
  1 sibling, 0 replies; 9+ messages in thread
From: Jes Sorensen @ 2004-08-11  6:31 UTC (permalink / raw)
  To: Jeremy Higdon; +Cc: linux-scsi, James.Bottomley

>>>>> "Jeremy" == Jeremy Higdon <jeremy@sgi.com> writes:

Jeremy> This patch adds SPI attributes to the qla1280 driver.  It is
Jeremy> similar to a patch submitted back in March by mort, except
Jeremy> that it has been updated to the current API.

Jeremy> Jes, can you confirm that this is okay?

Jeremy,

Patch looks good to me! James, feel free to push this.

Cheers,
Jes

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

* Re: [PATCH] add spi attributes to qla1280
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2004-08-11  7:11 UTC (permalink / raw)
  To: Jeremy Higdon; +Cc: linux-scsi

> +	if (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP12160 ||
> +	    ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP10160)
> +		is1x160 = 1;
> +	else
> +		is1x160 = 0;

The driver in James' tree has most of my 1040-support patches merged,
sp please use the apporpinquate IS_ISP* macros like the rest of the drivers
does, and please handle the 1040 aswell in that code.

> +static struct scsi_transport_template *qla1280_transport_template = NULL;

No need to initialize to NULL here.

>  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,
> +};

Any chance you could declare this just below the host template?  that keeps
the code better organized.


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

* Re: [PATCH] add spi attributes to qla1280
  2004-08-11  7:11 ` Christoph Hellwig
@ 2004-08-11 21:56   ` Jeremy Higdon
  2004-08-11 22:05     ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Higdon @ 2004-08-11 21:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-scsi

On Wed, Aug 11, 2004 at 08:11:18AM +0100, Christoph Hellwig wrote:
> > +	if (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP12160 ||
> > +	    ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP10160)
> > +		is1x160 = 1;
> > +	else
> > +		is1x160 = 0;
> 
> The driver in James' tree has most of my 1040-support patches merged,
> sp please use the apporpinquate IS_ISP* macros like the rest of the drivers
> does, and please handle the 1040 aswell in that code.

The above is consistent with the rest of the driver in 2.6.8-rc2.
So are you asking that I submit a patch to the driver in James's
tree instead of to 2.6.8-rc2?

To avoid possibility of error, can you give me the URL for James's
tree?  Is it a bk tree or a kernel.org tree?

> > +static struct scsi_transport_template *qla1280_transport_template = NULL;
> 
> No need to initialize to NULL here.

I thought about that.  What I did was take a patch that Martin Hicks
submitted on March 10th and then make changes based on what I saw that
James had done for the 53c700 driver, which has:

drivers/scsi/53c700.c:STATIC struct scsi_transport_template *NCR_700_transport_template = NULL;

I will remove the initializer if I don't need it.

> >  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,
> > +};
> 
> Any chance you could declare this just below the host template?  that keeps
> the code better organized.

Sure.

jeremy

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

* Re: [PATCH] add spi attributes to qla1280
  2004-08-11 21:56   ` Jeremy Higdon
@ 2004-08-11 22:05     ` Christoph Hellwig
  2004-08-11 22:16       ` Jeremy Higdon
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2004-08-11 22:05 UTC (permalink / raw)
  To: Jeremy Higdon; +Cc: linux-scsi

On Wed, Aug 11, 2004 at 02:56:51PM -0700, Jeremy Higdon wrote:
> The above is consistent with the rest of the driver in 2.6.8-rc2.
> So are you asking that I submit a patch to the driver in James's
> tree instead of to 2.6.8-rc2?

Yes.

> To avoid possibility of error, can you give me the URL for James's
> tree?  Is it a bk tree or a kernel.org tree?

bk://linux-scsi.bkbits.net/scsi-misc-2.6, it's also part of the
latest -mm tree.

> > No need to initialize to NULL here.
> 
> I thought about that.  What I did was take a patch that Martin Hicks
> submitted on March 10th and then make changes based on what I saw that
> James had done for the 53c700 driver, which has:
> 
> drivers/scsi/53c700.c:STATIC struct scsi_transport_template *NCR_700_transport_template = NULL;

needs fixing aswell :)


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

* Re: [PATCH] add spi attributes to qla1280
  2004-08-11 22:05     ` Christoph Hellwig
@ 2004-08-11 22:16       ` Jeremy Higdon
  2004-08-11 22:22         ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Higdon @ 2004-08-11 22:16 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-scsi

On Wed, Aug 11, 2004 at 11:05:56PM +0100, Christoph Hellwig wrote:
> On Wed, Aug 11, 2004 at 02:56:51PM -0700, Jeremy Higdon wrote:
> > The above is consistent with the rest of the driver in 2.6.8-rc2.
> > So are you asking that I submit a patch to the driver in James's
> > tree instead of to 2.6.8-rc2?
> 
> Yes.
> 
> > To avoid possibility of error, can you give me the URL for James's
> > tree?  Is it a bk tree or a kernel.org tree?
> 
> bk://linux-scsi.bkbits.net/scsi-misc-2.6, it's also part of the
> latest -mm tree.


So I'll submit a patch to 2.6.8-rc4-mm1 then, if that's okay.

Thanks,

Jeremy

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

* Re: [PATCH] add spi attributes to qla1280
  2004-08-11 22:16       ` Jeremy Higdon
@ 2004-08-11 22:22         ` Christoph Hellwig
  2004-08-12  5:29           ` Jeremy Higdon
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2004-08-11 22:22 UTC (permalink / raw)
  To: Jeremy Higdon; +Cc: Christoph Hellwig, linux-scsi

On Wed, Aug 11, 2004 at 03:16:36PM -0700, Jeremy Higdon wrote:
> > bk://linux-scsi.bkbits.net/scsi-misc-2.6, it's also part of the
> > latest -mm tree.
> 
> 
> So I'll submit a patch to 2.6.8-rc4-mm1 then, if that's okay.

Sounds good.  While you're at it can you also fix the compilation
error when the driver is compiled for port I/O instead of normal
mmio (e.g. SGI ViswW), you broke that with your readb_relaxed changes.

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

* Re: [PATCH] add spi attributes to qla1280
  2004-08-11 22:22         ` Christoph Hellwig
@ 2004-08-12  5:29           ` Jeremy Higdon
  2004-08-12  9:08             ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Higdon @ 2004-08-12  5:29 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-scsi

On Wed, Aug 11, 2004 at 11:22:25PM +0100, Christoph Hellwig wrote:
> On Wed, Aug 11, 2004 at 03:16:36PM -0700, Jeremy Higdon wrote:
> > 
> > So I'll submit a patch to 2.6.8-rc4-mm1 then, if that's okay.
> 
> Sounds good.  While you're at it can you also fix the compilation
> error when the driver is compiled for port I/O instead of normal
> mmio (e.g. SGI ViswW), you broke that with your readb_relaxed changes.

Okay.  Here is the new rendition, based on 2.6.8-rc4-mm1, with the
fix for port I/O.  For sync period and offset, it seems that the
isp1040 is the same as the isp1280.

Thanks,

jeremy


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


diff -ur -X /home/jeremy/dontdiff linux-2.6.8-rc4/drivers/scsi/Kconfig linux-2.6.8-rc4.new/drivers/scsi/Kconfig
--- linux-2.6.8-rc4/drivers/scsi/Kconfig	2004-08-11 22:22:41.000000000 -0700
+++ linux-2.6.8-rc4.new/drivers/scsi/Kconfig	2004-08-11 17:41:57.000000000 -0700
@@ -1276,6 +1276,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-rc4/drivers/scsi/qla1280.c linux-2.6.8-rc4.new/drivers/scsi/qla1280.c
--- linux-2.6.8-rc4/drivers/scsi/qla1280.c	2004-08-11 22:22:41.000000000 -0700
+++ linux-2.6.8-rc4.new/drivers/scsi/qla1280.c	2004-08-11 17:47:13.000000000 -0700
@@ -356,6 +356,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>
@@ -1490,6 +1492,15 @@
 		status = qla1280_set_target_parameters(ha, bus, target);
 	qla1280_get_target_parameters(ha, device);
 	spin_unlock_irqrestore(HOST_LOCK, flags);
+
+	spi_period(device) = nv->bus[bus].target[target].sync_period;
+	if (IS_ISP1x160(ha))
+		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;
 }
 
@@ -4681,6 +4692,12 @@
 };
 #endif
 
+static struct scsi_transport_template *qla1280_transport_template;
+static struct spi_function_template qla1280_transport_functions = {
+	.show_period = 1,
+	.show_offset = 1,
+};
+
 static int __devinit
 qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
@@ -4769,6 +4786,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;
@@ -4910,6 +4928,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
@@ -4934,6 +4956,7 @@
 qla1280_exit(void)
 {
 	pci_unregister_driver(&qla1280_pci_driver);
+	spi_release_transport(qla1280_transport_template);
 }
 
 module_init(qla1280_init);
diff -ur -X /home/jeremy/dontdiff linux-2.6.8-rc4/drivers/scsi/qla1280.h linux-2.6.8-rc4.new/drivers/scsi/qla1280.h
--- linux-2.6.8-rc4/drivers/scsi/qla1280.h	2004-08-11 22:22:41.000000000 -0700
+++ linux-2.6.8-rc4.new/drivers/scsi/qla1280.h	2004-08-11 17:39:31.000000000 -0700
@@ -62,6 +62,7 @@
 #define WRT_REG_WORD(addr, data)	writew(data, addr)
 #else				/* MEMORY_MAPPED_IO */
 #define RD_REG_WORD(addr)		inw((unsigned long)addr)
+#define RD_REG_WORD_dmasync(addr)	inw((unsigned long)addr)
 #define WRT_REG_WORD(addr, data)	outw(data, (unsigned long)addr)
 #endif				/* MEMORY_MAPPED_IO */
 

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

* Re: [PATCH] add spi attributes to qla1280
  2004-08-12  5:29           ` Jeremy Higdon
@ 2004-08-12  9:08             ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2004-08-12  9:08 UTC (permalink / raw)
  To: Jeremy Higdon; +Cc: linux-scsi

On Wed, Aug 11, 2004 at 10:29:24PM -0700, Jeremy Higdon wrote:
> On Wed, Aug 11, 2004 at 11:22:25PM +0100, Christoph Hellwig wrote:
> > On Wed, Aug 11, 2004 at 03:16:36PM -0700, Jeremy Higdon wrote:
> > > 
> > > So I'll submit a patch to 2.6.8-rc4-mm1 then, if that's okay.
> > 
> > Sounds good.  While you're at it can you also fix the compilation
> > error when the driver is compiled for port I/O instead of normal
> > mmio (e.g. SGI ViswW), you broke that with your readb_relaxed changes.
> 
> Okay.  Here is the new rendition, based on 2.6.8-rc4-mm1, with the
> fix for port I/O.  For sync period and offset, it seems that the
> isp1040 is the same as the isp1280.

Looks good to me.


^ 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.