Skip to contentSkip to conversation

wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver

PATCH Applied Ondrej Zary 3 participants 7 messages Nov 24, 2014 – Nov 25, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver

Hello,
this is a new driver for Western Digital WD7193, WD7197 and WD7296 PCI SCSI controllers based on WD33C296A chip. These nice cards never worked good with Linux.

It's based on old and ugly wd719x driver written back in 2.0 days, then hacked to 2.2 and finally to 2.4 kernels. Most of the code is rewritten: from ~4100 lines to ~1200.

I've tested the driver on a WD7193 card with some hard drives and CD-ROMs:

QUANTUM  LP240S GM240S01X 4.6
IBM      0663L12          e g
IBM      DORS-32160       WA0A
SONY     CD-ROM CDU-55S   1.0t
SONY     CD-ROM CDU-415   1.1g

The card supports TCQ and linked commands (for cmd_per_lun > 1?) but I don't know how it should be implemented in a driver.

Device/bus/host resets seem to work fine when tested by sg_reset. But don't know how to test command abort.

The card requires firmware that can be cut out of the Windows NT driver that can be downloaded from WD at:
http://support.wdc.com/product/download.asp?groupid=801&sid=27&lang=en
There is no license anywhere in the file or on the page - so I guess that the firmware cannot be added to linux-firmware.

This script that downloads and extracts the firmware is in Documentation/

Signature · 1 line
Ondrej Zary
#1 lore raw

PATCH v2 1/3 eeprom-93cx6: Add (read-only) support for 8-bit mode

Add read-only support for EEPROMs configured in 8-bit mode (ORG pin connected to GND).
This will be used by wd719x driver.

---
 drivers/misc/eeprom/eeprom_93cx6.c |   62 +++++++++++++++++++++++++++++++++++-
 include/linux/eeprom_93cx6.h       |    4 +++
 2 files changed, 65 insertions(+), 1 deletion(-)
drivers/misc/eeprom/eeprom_93cx6.c +61 -1
index 0ff4b02..0cf2c9d 100644
@@ -170,7 +170,7 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom,
 }
 
 /**
- * eeprom_93cx6_read - Read multiple words from eeprom
+ * eeprom_93cx6_read - Read a word from eeprom
  * @eeprom: Pointer to eeprom structure
  * @word: Word index from where we should start reading
  * @data: target pointer where the information will have to be stored
@@ -235,6 +235,66 @@ void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word,
 EXPORT_SYMBOL_GPL(eeprom_93cx6_multiread);
 
 /**
+ * eeprom_93cx6_readb - Read a byte from eeprom
+ * @eeprom: Pointer to eeprom structure
+ * @word: Byte index from where we should start reading
+ * @data: target pointer where the information will have to be stored
+ *
+ * This function will read a byte of the eeprom data
+ * into the given data pointer.
+ */
+void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte,
+	u8 *data)
+{
+	u16 command;
+	u16 tmp;
+
+	/*
+	 * Initialize the eeprom register
+	 */
+	eeprom_93cx6_startup(eeprom);
+
+	/*
+	 * Select the read opcode and the byte to be read.
+	 */
+	command = (PCI_EEPROM_READ_OPCODE << (eeprom->width + 1)) | byte;
+	eeprom_93cx6_write_bits(eeprom, command,
+		PCI_EEPROM_WIDTH_OPCODE + eeprom->width + 1);
+
+	/*
+	 * Read the requested 8 bits.
+	 */
+	eeprom_93cx6_read_bits(eeprom, &tmp, 8);
+	*data = tmp & 0xff;
+
+	/*
+	 * Cleanup eeprom register.
+	 */
+	eeprom_93cx6_cleanup(eeprom);
+}
+EXPORT_SYMBOL_GPL(eeprom_93cx6_readb);
+
+/**
+ * eeprom_93cx6_multireadb - Read multiple bytes from eeprom
+ * @eeprom: Pointer to eeprom structure
+ * @byte: Index from where we should start reading
+ * @data: target pointer where the information will have to be stored
+ * @words: Number of bytes that should be read.
+ *
+ * This function will read all requested bytes from the eeprom,
+ * this is done by calling eeprom_93cx6_readb() multiple times.
+ */
+void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom, const u8 byte,
+	u8 *data, const u16 bytes)
+{
+	unsigned int i;
+
+	for (i = 0; i < bytes; i++)
+		eeprom_93cx6_readb(eeprom, byte + i, &data[i]);
+}
+EXPORT_SYMBOL_GPL(eeprom_93cx6_multireadb);
+
+/**
  * eeprom_93cx6_wren - set the write enable state
  * @eeprom: Pointer to eeprom structure
  * @enable: true to enable writes, otherwise disable writes
include/linux/eeprom_93cx6.h +4 -0
index e50f98b..eb0b198 100644
@@ -75,6 +75,10 @@ extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
 	const u8 word, u16 *data);
 extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
 	const u8 word, __le16 *data, const u16 words);
+extern void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom,
+	const u8 byte, u8 *data);
+extern void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom,
+	const u8 byte, u8 *data, const u16 bytes);
 
 extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
 
Signature · 1 line
Ondrej Zary
#2 lore raw

PATCH v2 2/3 wd719x: Introduce Western Digital WD7193/7197/7296 PCI SCSI card driver

In reply to Ondrej Zary

Introduce wd719x, a driver for Western Digital WD7193, WD7197 and WD7296 PCI SCSI controllers based on WD33C296A chip.
Tested with WD7193 card.

---
 drivers/scsi/Kconfig  |    8 +
 drivers/scsi/Makefile |    1 +
 drivers/scsi/wd719x.c |  997 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/wd719x.h |  249 ++++++++++++
 4 files changed, 1255 insertions(+)
 create mode 100644 drivers/scsi/wd719x.c
 create mode 100644 drivers/scsi/wd719x.h
drivers/scsi/Kconfig +8 -0
index 3a820f6..fd81d14 100644
@@ -1451,6 +1451,14 @@ config SCSI_NSP32
 	  To compile this driver as a module, choose M here: the
 	  module will be called nsp32.
 
+config SCSI_WD719X
+	tristate "Western Digital WD7193/7197/7296 support"
+	depends on PCI && SCSI
+	select EEPROM_93CX6
+	---help---
+	  This is a driver for Western Digital WD7193, WD7197 and WD7296 PCI
+	  SCSI controllers (based on WD33C296A chip).
+
 config SCSI_DEBUG
 	tristate "SCSI debugging host simulator"
 	depends on SCSI
drivers/scsi/Makefile +1 -0
index 59f1ce6..d8bfca5 100644
@@ -143,6 +143,7 @@ obj-$(CONFIG_SCSI_VIRTIO)	+= virtio_scsi.o
 obj-$(CONFIG_VMWARE_PVSCSI)	+= vmw_pvscsi.o
 obj-$(CONFIG_XEN_SCSI_FRONTEND)	+= xen-scsifront.o
 obj-$(CONFIG_HYPERV_STORAGE)	+= hv_storvsc.o
+obj-$(CONFIG_SCSI_WD719X)	+= wd719x.o
 
 obj-$(CONFIG_ARM)		+= arm/
 
drivers/scsi/wd719x.c new file +997 -0

997 lines not on this page · raw message

drivers/scsi/wd719x.h new file +249 -0

249 lines not on this page · raw message

Signature · 1 line
Ondrej Zary
Reviewed-by on v2 2/3
#3 lore raw
Quoted 6 lines · Ondrej Zary

Introduce wd719x, a driver for Western Digital WD7193, WD7197 and WD7296 PCI SCSI controllers based on WD33C296A chip.
Tested with WD7193 card.

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH v2 3/3 wd719x: Add firmware documentation

In reply to Ondrej Zary

Add documentation and script to obtain required firmware.

---
 Documentation/scsi/wd719x.txt |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/scsi/wd719x.txt
Documentation/scsi/wd719x.txt new file +21 -0
new file mode 100644
index 0000000..0816b02
@@ -0,0 +1,21 @@
+Driver for Western Digital WD7193, WD7197 and WD7296 SCSI cards
+---------------------------------------------------------------
+
+The card requires firmware that can be cut out of the Windows NT driver that
+can be downloaded from WD at:
+http://support.wdc.com/product/download.asp?groupid=801&sid=27&lang=en
+
+There is no license anywhere in the file or on the page - so the firmware
+probably cannot be added to linux-firmware.
+
+This script downloads and extracts the firmware, creating wd719x-risc.bin and
+d719x-wcs.bin files. Put them in /lib/firmware/.
+
+#!/bin/sh
+wget http://support.wdc.com/download/archive/pciscsi.exe
+lha xi pciscsi.exe pci-scsi.exe
+lha xi pci-scsi.exe nt/wd7296a.sys
+rm pci-scsi.exe
+dd if=wd7296a.sys of=wd719x-risc.bin bs=1 skip=5760 count=14336
+dd if=wd7296a.sys of=wd719x-wcs.bin bs=1 skip=20096 count=514
+rm wd7296a.sys
Signature · 1 line
Ondrej Zary
Reviewed-by on v2 3/3
#5 lore raw

Re: [PATCH 3/3] wd719x: Add firmware documentation

Quoted 26 lines · Ondrej Zary

Add documentation and script to obtain required firmware.

---
 Documentation/scsi/wd719x.txt |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/scsi/wd719x.txt
Documentation/scsi/wd719x.txt new file +11 -0
new file mode 100644
index 0000000..0816b02
@@ -0,0 +1,21 @@
+Driver for Western Digital WD7193, WD7197 and WD7296 SCSI cards
+---------------------------------------------------------------
+
+The card requires firmware that can be cut out of the Windows NT driver that
+can be downloaded from WD at:
+http://support.wdc.com/product/download.asp?groupid=801&sid=27&lang=en
+
+There is no license anywhere in the file or on the page - so the firmware
+probably cannot be added to linux-firmware.
+
+This script downloads and extracts the firmware, creating wd719x-risc.bin and

Documentation/scsi/wd719x.txt line 21

Quoted 10 lines
Documentation/scsi/wd719x.txt new file +10 -0
+d719x-wcs.bin files. Put them in /lib/firmware/.
+
+#!/bin/sh
+wget http://support.wdc.com/download/archive/pciscsi.exe
+lha xi pciscsi.exe pci-scsi.exe
+lha xi pci-scsi.exe nt/wd7296a.sys
+rm pci-scsi.exe
+dd if=wd7296a.sys of=wd719x-risc.bin bs=1 skip=5760 count=14336
+dd if=wd7296a.sys of=wd719x-wcs.bin bs=1 skip=20096 count=514
+rm wd7296a.sys

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)