Skip to contentSkip to conversation

ATP867X PCI IDE driver for 2.6.5

PATCH New Eric Uhrhane 1 participant 1 message Apr 14, 2004 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ATP867X PCI IDE driver for 2.6.5

Alan, Linus, et al:

This is a new driver for the Acard/Artop PCI ATA/SATA cards
(6885[LP]/6896[S]) based on the ATP867{A,B} chips. It supports connectivity only, no fancy ATP867B RAID stuff, for up to 8 drives. The first version of this patch [written for 2.4.18] has been tested on about a dozen x86 SMP machines with several kinds of hard drives, in PIO4 and UDMA5, as well as in a few other configurations. This 2.6.5 port has had much less testing, but has also had only small changes from the original.
Acard tell me that they may have seen issues running ATAPI devices using
this driver, but that they can't be sure that they weren't seeing problems with higher-level software. I've given it a quick test [under 2.4] with my DVD drive, and didn't see anything obvious. YMMV.
Feel free to send me comments directly, but I'll also try to check on
the list via archives.

Eric Uhrhane
[email protected]

drivers/ide/Kconfig +7 -0
diff -rNBdU 3 linux-2.6.5.orig/drivers/ide/Kconfig linux-2.6.5/drivers/ide/Kconfig
@@ -569,6 +569,13 @@
 
 	  Say Y here if you have an ATI IXP chipset IDE controller.
 
+config BLK_DEV_ATP867X
+	tristate "Artop/Acard ATP867X support"
+	help
+	  This driver supports the Acard 6885[LP]/6896[S] PCI IDE RAID cards,
+	  based on the Artop 867X chip.  It supplies connectivity only, for up
+	  to 8 drives--no fancy RAID features.
+
 config BLK_DEV_CMD64X
 	tristate "CMD64{3|6|8|9} chipset support"
 	help
drivers/ide/pci/atp867.c +725 -0

725 lines not on this page · raw message

drivers/ide/pci/atp867.h +11 -0
diff -rNBdU 3 linux-2.6.5.orig/drivers/ide/pci/atp867.h linux-2.6.5/drivers/ide/pci/atp867.h
@@ -0,0 +1,11 @@
+#ifndef ATP867X_H
+#define ATP867X_H
+
+#include <linux/pci.h>
+#include <linux/ide.h>
+
+extern unsigned int atp867x_get_dma_base(ide_hwif_t *hwif);
+extern void atp867x_get_ports(struct pci_dev *dev, unsigned int channel,
+	unsigned long *base, unsigned long *control);
+
+#endif /* ATP867X_H */
drivers/ide/pci/Makefile +1 -0
diff -rNBdU 3 linux-2.6.5.orig/drivers/ide/pci/Makefile linux-2.6.5/drivers/ide/pci/Makefile
@@ -4,6 +4,7 @@
 obj-$(CONFIG_BLK_DEV_ALI15X3)		+= alim15x3.o
 obj-$(CONFIG_BLK_DEV_AMD74XX)		+= amd74xx.o
 obj-$(CONFIG_BLK_DEV_ATIIXP)		+= atiixp.o
+obj-$(CONFIG_BLK_DEV_ATP867X)		+= atp867.o
 obj-$(CONFIG_BLK_DEV_CMD64X)		+= cmd64x.o
 obj-$(CONFIG_BLK_DEV_CS5520)		+= cs5520.o
 obj-$(CONFIG_BLK_DEV_CS5530)		+= cs5530.o
drivers/ide/setup-pci.c +27 -2
diff -rNBdU 3 linux-2.6.5.orig/drivers/ide/setup-pci.c linux-2.6.5/drivers/ide/setup-pci.c
@@ -32,6 +32,9 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
+#ifdef CONFIG_BLK_DEV_ATP867X
+#include "pci/atp867.h"
+#endif
 
 /**
  *	ide_match_hwif	-	match a PCI IDE against an ide_hwif
@@ -185,6 +188,11 @@
 second_chance_to_dma:
 #endif /* CONFIG_BLK_DEV_IDEDMA_FORCED */
 
+#ifdef CONFIG_BLK_DEV_ATP867X
+	if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP867A))
+		return atp867x_get_dma_base(hwif);
+#endif
+
 	if ((hwif->mmio) && (hwif->dma_base))
 		return hwif->dma_base;
 
@@ -422,6 +430,13 @@
 	unsigned long ctl = 0, base = 0;
 	ide_hwif_t *hwif;
 
+#ifdef CONFIG_BLK_DEV_ATP867X
+	/* pci_resource_start won't work for this chip. */
+	if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP867A)) {
+		atp867x_get_ports(dev, port, &base, &ctl);
+	}
+	else
+#endif
 	if(!d->isa_ports)
 	{
 		/*  Possibly we should fail if these checks report true */
@@ -604,9 +619,19 @@
 	 * Set up the IDE ports
 	 */
 	 
-	for (port = 0; port <= 1; ++port) {
-		ide_pci_enablebit_t *e = &(d->enablebits[port]);
+	for (port = 0; port <= d->channels; ++port) {
+		/* eju: HACK to support ATP867X, which really only has one
+		 * enablebits entry [entered twice], but has 4 ports.  Currently
+		 * no other driver has more than 2 ports. */
+		ide_pci_enablebit_t *e = &(d->enablebits[port % 2]);
 	
+		/* eju: It's not clear that we need to do anything here, but
+		 * this does no harm, and pairs up the ports neatly.  I'm not
+		 * sure what proc_ide_write_config will do, though.  */
+		if (2 == port) {
+			mate = NULL;
+		}
+
 		/* 
 		 * If this is a Promise FakeRaid controller,
 		 * the 2nd controller will be marked as 
include/linux/pci_ids.h +1 -0
diff -rNBdU 3 linux-2.6.5.orig/include/linux/pci_ids.h linux-2.6.5/include/linux/pci_ids.h
@@ -1405,6 +1405,7 @@
 #define PCI_DEVICE_ID_ARTOP_ATP860R	0x0007
 #define PCI_DEVICE_ID_ARTOP_ATP865	0x0008
 #define PCI_DEVICE_ID_ARTOP_ATP865R	0x0009
+#define PCI_DEVICE_ID_ARTOP_ATP867A	0x000A
 #define PCI_DEVICE_ID_ARTOP_AEC7610	0x8002
 #define PCI_DEVICE_ID_ARTOP_AEC7612UW	0x8010
 #define PCI_DEVICE_ID_ARTOP_AEC7612U	0x8020