Skip to contentSkip to conversation

ATP867X PCI IDE driver

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

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

PATCH 1/1 ATP867X PCI IDE driver

Marcelo 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.4.26 port has had minimal testing, but has also had minimal 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 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. Stay tuned for the 2.6.5 port.

Eric Uhrhane
[email protected]

Documentation/Configure.help +8 -0
diff -rNBdU 3 linux-2.4.26.orig/Documentation/Configure.help linux-2.4.26/Documentation/Configure.help
@@ -1167,6 +1167,14 @@
 
   Say Y here if you have an ATI IXP chipset IDE controller.
 
+Acard/Artop 867X (867A) Support
+CONFIG_BLK_DEV_ATP867X
+  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.
+
+  If unsure, say N.
+
 CMD64X/CMD680 chipset support
 CONFIG_BLK_DEV_CMD64X
   Say Y here if you have an IDE controller which uses any of these
drivers/ide/Config.in +1 -0
diff -rNBdU 3 linux-2.4.26.orig/drivers/ide/Config.in linux-2.4.26/drivers/ide/Config.in
@@ -50,6 +50,7 @@
 	    dep_tristate '    AMD and nVidia IDE support' CONFIG_BLK_DEV_AMD74XX $CONFIG_BLK_DEV_IDEDMA_PCI
 	    dep_mbool    '      AMD Viper ATA-66 Override' CONFIG_AMD74XX_OVERRIDE $CONFIG_BLK_DEV_AMD74XX
 	    dep_tristate '    ATI IXP chipset IDE support' CONFIG_BLK_DEV_ATIIXP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_X86
+	    dep_bool '    ACARD 867X support' CONFIG_BLK_DEV_ATP867X $CONFIG_BLK_DEV_IDEDMA_PCI
 	    dep_tristate '    CMD64{3|6|8|9} chipset support' CONFIG_BLK_DEV_CMD64X $CONFIG_BLK_DEV_IDEDMA_PCI
 	    dep_tristate '    Compaq Triflex IDE support' CONFIG_BLK_DEV_TRIFLEX $CONFIG_BLK_DEV_IDEDMA_PCI
 	    dep_tristate '    CY82C693 chipset support' CONFIG_BLK_DEV_CY82C693 $CONFIG_BLK_DEV_IDEDMA_PCI
drivers/ide/pci/atp867.c +737 -0

737 lines not on this page · raw message

drivers/ide/pci/atp867.h +11 -0
diff -rNBdU 3 linux-2.4.26.orig/drivers/ide/pci/atp867.h linux-2.4.26/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.4.26.orig/drivers/ide/pci/Makefile linux-2.4.26/drivers/ide/pci/Makefile
@@ -9,6 +9,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_CMD640)		+= cmd640.o
 obj-$(CONFIG_BLK_DEV_CMD64X)		+= cmd64x.o
 obj-$(CONFIG_BLK_DEV_CS5530)		+= cs5530.o
drivers/ide/setup-pci.c +31 -2
diff -rNBdU 3 linux-2.4.26.orig/drivers/ide/setup-pci.c linux-2.4.26/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
@@ -183,6 +186,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;
 	else if (hwif->mate && hwif->mate->dma_base) {
@@ -416,12 +424,23 @@
 	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
+
 	/*  Possibly we should fail if these checks report true */
 	ide_pci_check_iomem(dev, d, 2*port);
 	ide_pci_check_iomem(dev, d, 2*port+1);
  
 	ctl  = pci_resource_start(dev, 2*port+1);
 	base = pci_resource_start(dev, 2*port);
+#ifdef CONFIG_BLK_DEV_ATP867X
+	}
+#endif
 	if ((ctl && !base) || (base && !ctl)) {
 		printk(KERN_ERR "%s: inconsistent baseregs (BIOS) "
 			"for port %d, skipping\n", d->name, port);
@@ -627,9 +646,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.4.26.orig/include/linux/pci_ids.h linux-2.4.26/include/linux/pci_ids.h
@@ -1292,6 +1292,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