summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>2002-09-24 21:20:13 -0700
committerJens Axboe <axboe@suse.de>2002-09-24 21:20:13 -0700
commit26b9005035ff86b2b48bf178e919e1ca6fc4982c (patch)
treebe2a247ab197488bb1d24f6b239c3357cdd8a4fe
parent92f2c52c20363b06122ae9405edd4bd5cd5c54bd (diff)
[PATCH] ALi and Cypress IDE fixes
These two chipsets are most common on alpha. - cy82c693: allow the generic IDE setup code to work correctly with broken PCI registers layout of this chip. This fixes quite a few problems with secondary channel, plus some hacks in arch code can go away. - ALi M5229: enable DMA.
-rw-r--r--drivers/ide/pci/cy82c693.c29
-rw-r--r--drivers/ide/pci/cy82c693.h8
-rw-r--r--drivers/ide/setup-pci.c1
3 files changed, 26 insertions, 12 deletions
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 06b5495a79fd..cbb0abb97407 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -338,6 +338,9 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
*/
unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name)
{
+ if (PCI_FUNC(dev->devfn) != 1)
+ return 0;
+
#ifdef CY82C693_SETDMA_CLOCK
u8 data = 0;
#endif /* CY82C693_SETDMA_CLOCK */
@@ -411,20 +414,30 @@ void __init init_hwif_cy82c693(ide_hwif_t *hwif)
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
-void __init init_dma_cy82c693 (ide_hwif_t *hwif, unsigned long dmabase)
+static __initdata ide_hwif_t *primary;
+
+void __init init_iops_cy82c693(ide_hwif_t *hwif)
{
- ide_setup_dma(hwif, dmabase, 8);
+ if (PCI_FUNC(hwif->pci_dev->devfn) == 1)
+ primary = hwif;
+ else {
+ hwif->mate = primary;
+ hwif->channel = 1;
+ }
}
-extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
-
static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_pci_device_t *d = &cy82c693_chipsets[id->driver_data];
- if ((!(PCI_FUNC(dev->devfn) & 1) ||
- (!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE))))
- return 0; /* CY82C693 is more than only a IDE controller */
- ide_setup_pci_device(dev, d);
+ struct pci_dev *dev2;
+
+ /* CY82C693 is more than only a IDE controller.
+ Function 1 is primary IDE channel, function 2 - secondary. */
+ if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
+ PCI_FUNC(dev->devfn) == 1) {
+ dev2 = pci_find_slot(dev->bus->number, dev->devfn + 1);
+ ide_setup_pci_devices(dev, dev2, d);
+ }
return 0;
}
diff --git a/drivers/ide/pci/cy82c693.h b/drivers/ide/pci/cy82c693.h
index b5c6f9652d51..d7c8d19a8523 100644
--- a/drivers/ide/pci/cy82c693.h
+++ b/drivers/ide/pci/cy82c693.h
@@ -66,7 +66,7 @@ typedef struct pio_clocks_s {
extern unsigned int init_chipset_cy82c693(struct pci_dev *, const char *);
extern void init_hwif_cy82c693(ide_hwif_t *);
-extern void init_dma_cy82c693(ide_hwif_t *, unsigned long);
+extern void init_iops_cy82c693(ide_hwif_t *);
static ide_pci_device_t cy82c693_chipsets[] __initdata = {
{ /* 0 */
@@ -74,10 +74,10 @@ static ide_pci_device_t cy82c693_chipsets[] __initdata = {
device: PCI_DEVICE_ID_CONTAQ_82C693,
name: "CY82C693",
init_chipset: init_chipset_cy82c693,
- init_iops: NULL,
+ init_iops: init_iops_cy82c693,
init_hwif: init_hwif_cy82c693,
- init_dma: init_dma_cy82c693,
- channels: 2,
+ init_dma: NULL,
+ channels: 1,
autodma: AUTODMA,
enablebits: {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
bootable: ON_BOARD,
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 29dfacd9b29d..8ef4fc169dec 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -250,6 +250,7 @@ second_chance_to_dma:
switch(dev->device) {
case PCI_DEVICE_ID_AL_M5219:
+ case PCI_DEVICE_ID_AL_M5229:
case PCI_DEVICE_ID_AMD_VIPER_7409:
case PCI_DEVICE_ID_CMD_643:
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE: