Skip to contentSkip to conversation

qla4xxx: bug fix: driver hardware semaphore needs to be grabbed before soft reset

PATCH In review David C Somayajulu 1 participant 3 messages Nov 16, 2006 – Nov 21, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 qla4xxx: bug fix: driver hardware semaphore needs to be grabbed before soft reset

On qla4xxx, the driver needs to grab the drvr semaphore provided by the hardware, prior to issuing a reset. This patches takes care of a couple of places where it was not being done. In addition there is minor clean up.

The patch has been generated with reference to scsi-misc-2.6.git

---
 drivers/scsi/qla4xxx/ql4_glbl.h    |    1 +
 drivers/scsi/qla4xxx/ql4_init.c    |    2 +-
 drivers/scsi/qla4xxx/ql4_os.c      |   42 ++++++++++--------------------------
 drivers/scsi/qla4xxx/ql4_version.h |    7 +-----
 4 files changed, 15 insertions(+), 37 deletions(-)
drivers/scsi/qla4xxx/ql4_glbl.h +1 -0
index 2c803ed..79661c1 100644
@@ -8,6 +8,7 @@
 #ifndef __QLA4x_GBL_H
 #define	__QLA4x_GBL_H
 
+int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
 int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port);
 int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb);
 int qla4xxx_initialize_adapter(struct scsi_qla_host * ha,
drivers/scsi/qla4xxx/ql4_init.c +1 -1
index bb3a1c1..9e81b81 100644
@@ -978,7 +978,7 @@ static int qla4xxx_start_firmware_from_f
 	return status;
 }
 
-static int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
+int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
 {
 #define QL4_LOCK_DRVR_WAIT	300
 #define QL4_LOCK_DRVR_SLEEP	100
drivers/scsi/qla4xxx/ql4_os.c +12 -30

66 lines not on this page · raw message

drivers/scsi/qla4xxx/ql4_version.h +1 -6
index b3fe7e6..d05048b 100644
@@ -5,9 +5,4 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
-#define QLA4XXX_DRIVER_VERSION	"5.00.05b9-k"
-
-#define QL4_DRIVER_MAJOR_VER	5
-#define QL4_DRIVER_MINOR_VER	0
-#define QL4_DRIVER_PATCH_VER	5
-#define QL4_DRIVER_BETA_VER	9
+#define QLA4XXX_DRIVER_VERSION	"5.00.06-k"
Signature · 1 line
1.4.2.3
#2 lore raw

Re: [PATCH] [SCSI] qla4xxx: fix for timing issue for nvram accesses.

This patch fixes a timing issue related to nvram accesses in qla4xxx driver for some cpu/slot speed combination.

---
 drivers/scsi/qla4xxx/ql4_nvram.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/scsi/qla4xxx/ql4_nvram.c +19 -0
index fc50203..a84ed3e 100644
@@ -29,7 +29,9 @@ static int fm93c56a_select(struct scsi_q
 
 	ha->eeprom_cmd_data = AUBURN_EEPROM_CS_1 | 0x000f0000;
 	writel(ha->eeprom_cmd_data, isp_nvram(ha));
+	udelay(1);
 	readl(isp_nvram(ha));
+	udelay(1);
 	return 1;
 }
 
@@ -42,11 +44,15 @@ static int fm93c56a_cmd(struct scsi_qla_
 
 	/* Clock in a zero, then do the start bit. */
 	writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, isp_nvram(ha));
+	udelay(1);
 	writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
 	       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
+	udelay(1);
 	writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
 	       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
+	udelay(1);
 	readl(isp_nvram(ha));
+	udelay(1);
 	mask = 1 << (FM93C56A_CMD_BITS - 1);
 
 	/* Force the previous data bit to be different. */
@@ -61,13 +67,17 @@ static int fm93c56a_cmd(struct scsi_qla_
 			 * match.
 			 */
 			writel(ha->eeprom_cmd_data | dataBit, isp_nvram(ha));
+			udelay(1);
 			previousBit = dataBit;
 		}
 		writel(ha->eeprom_cmd_data | dataBit |
 		       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
+		udelay(1);
 		writel(ha->eeprom_cmd_data | dataBit |
 		       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
+		udelay(1);
 		readl(isp_nvram(ha));
+		udelay(1);
 		cmd = cmd << 1;
 	}
 	mask = 1 << (eeprom_no_addr_bits(ha) - 1);
@@ -83,13 +93,17 @@ static int fm93c56a_cmd(struct scsi_qla_
 			 * match.
 			 */
 			writel(ha->eeprom_cmd_data | dataBit, isp_nvram(ha));
+			udelay(1);
 			previousBit = dataBit;
 		}
 		writel(ha->eeprom_cmd_data | dataBit |
 		       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
+		udelay(1);
 		writel(ha->eeprom_cmd_data | dataBit |
 		       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
+		udelay(1);
 		readl(isp_nvram(ha));
+		udelay(1);
 		addr = addr << 1;
 	}
 	return 1;
@@ -99,7 +113,9 @@ static int fm93c56a_deselect(struct scsi
 {
 	ha->eeprom_cmd_data = AUBURN_EEPROM_CS_0 | 0x000f0000;
 	writel(ha->eeprom_cmd_data, isp_nvram(ha));
+	udelay(1);
 	readl(isp_nvram(ha));
+	udelay(1);
 	return 1;
 }
 
@@ -114,10 +130,13 @@ static int fm93c56a_datain(struct scsi_q
 	for (i = 0; i < eeprom_no_data_bits(ha); i++) {
 		writel(ha->eeprom_cmd_data |
 		       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
+		udelay(1);
 		writel(ha->eeprom_cmd_data |
 		       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
+		udelay(1);
 		dataBit =
 			(readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0;
+		udelay(1);
 		data = (data << 1) | dataBit;
 	}
 
Signature · 1 line
1.4.2.3
#3 lore raw

Re: [PATCH] [SCSI] qla4xxx: fix for timing issue for nvram accesses.

Quoted 1 line · David C Somayajulu

This patch fixes a timing issue related to nvram accesses in qla4xxx driver for some cpu/slot speed combination.

Cleaned up patch.

Quoted 2 lines
---
 drivers/scsi/qla4xxx/ql4_nvram.c |   64 +++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 28 deletions(-)
drivers/scsi/qla4xxx/ql4_nvram.c +36 -28
index fc50203..58afd13 100644
@@ -7,6 +7,13 @@
 
 #include "ql4_def.h"
 
+static inline void eeprom_cmd(uint32_t cmd, struct scsi_qla_host *ha)
+{
+	writel(cmd, isp_nvram(ha));
+	readl(isp_nvram(ha));
+	udelay(1);
+}
+
 static inline int eeprom_size(struct scsi_qla_host *ha)
 {
 	return is_qla4010(ha) ? FM93C66A_SIZE_16 : FM93C86A_SIZE_16;
@@ -28,8 +35,7 @@ static int fm93c56a_select(struct scsi_q
 	DEBUG5(printk(KERN_ERR "fm93c56a_select:\n"));
 
 	ha->eeprom_cmd_data = AUBURN_EEPROM_CS_1 | 0x000f0000;
-	writel(ha->eeprom_cmd_data, isp_nvram(ha));
-	readl(isp_nvram(ha));
+	eeprom_cmd(ha->eeprom_cmd_data, ha);
 	return 1;
 }
 
@@ -41,12 +47,13 @@ static int fm93c56a_cmd(struct scsi_qla_
 	int previousBit;
 
 	/* Clock in a zero, then do the start bit. */
-	writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, isp_nvram(ha));
-	writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
-	       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
-	writel(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
-	       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
-	readl(isp_nvram(ha));
+	eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, ha);
+
+	eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
+	       AUBURN_EEPROM_CLK_RISE, ha);
+	eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
+	       AUBURN_EEPROM_CLK_FALL, ha);
+
 	mask = 1 << (FM93C56A_CMD_BITS - 1);
 
 	/* Force the previous data bit to be different. */
@@ -60,14 +67,14 @@ static int fm93c56a_cmd(struct scsi_qla_
 			 * If the bit changed, then change the DO state to
 			 * match.
 			 */
-			writel(ha->eeprom_cmd_data | dataBit, isp_nvram(ha));
+			eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha);
 			previousBit = dataBit;
 		}
-		writel(ha->eeprom_cmd_data | dataBit |
-		       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
-		writel(ha->eeprom_cmd_data | dataBit |
-		       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
-		readl(isp_nvram(ha));
+		eeprom_cmd(ha->eeprom_cmd_data | dataBit |
+		       AUBURN_EEPROM_CLK_RISE, ha);
+		eeprom_cmd(ha->eeprom_cmd_data | dataBit |
+		       AUBURN_EEPROM_CLK_FALL, ha);
+
 		cmd = cmd << 1;
 	}
 	mask = 1 << (eeprom_no_addr_bits(ha) - 1);
@@ -82,14 +89,15 @@ static int fm93c56a_cmd(struct scsi_qla_
 			 * If the bit changed, then change the DO state to
 			 * match.
 			 */
-			writel(ha->eeprom_cmd_data | dataBit, isp_nvram(ha));
+			eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha);
+
 			previousBit = dataBit;
 		}
-		writel(ha->eeprom_cmd_data | dataBit |
-		       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
-		writel(ha->eeprom_cmd_data | dataBit |
-		       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
-		readl(isp_nvram(ha));
+		eeprom_cmd(ha->eeprom_cmd_data | dataBit |
+		       AUBURN_EEPROM_CLK_RISE, ha);
+		eeprom_cmd(ha->eeprom_cmd_data | dataBit |
+		       AUBURN_EEPROM_CLK_FALL, ha);
+
 		addr = addr << 1;
 	}
 	return 1;
@@ -98,8 +106,7 @@ static int fm93c56a_cmd(struct scsi_qla_
 static int fm93c56a_deselect(struct scsi_qla_host * ha)
 {
 	ha->eeprom_cmd_data = AUBURN_EEPROM_CS_0 | 0x000f0000;
-	writel(ha->eeprom_cmd_data, isp_nvram(ha));
-	readl(isp_nvram(ha));
+	eeprom_cmd(ha->eeprom_cmd_data, ha);
 	return 1;
 }
 
@@ -112,12 +119,13 @@ static int fm93c56a_datain(struct scsi_q
 	/* Read the data bits
 	 * The first bit is a dummy.  Clock right over it. */
 	for (i = 0; i < eeprom_no_data_bits(ha); i++) {
-		writel(ha->eeprom_cmd_data |
-		       AUBURN_EEPROM_CLK_RISE, isp_nvram(ha));
-		writel(ha->eeprom_cmd_data |
-		       AUBURN_EEPROM_CLK_FALL, isp_nvram(ha));
-		dataBit =
-			(readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0;
+		eeprom_cmd(ha->eeprom_cmd_data |
+		       AUBURN_EEPROM_CLK_RISE, ha);
+		eeprom_cmd(ha->eeprom_cmd_data |
+		       AUBURN_EEPROM_CLK_FALL, ha);
+
+		dataBit = (readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0;
+
 		data = (data << 1) | dataBit;
 	}
 
Signature · 1 line
1.4.2.3