Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58312
b: refs/heads/master
c: b740d88
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 9, 2007
1 parent 28edf35 commit 24e3bb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 76 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 71d441ddb51941d9d8279bdc858f965711b85c14
refs/heads/master: b740d8846e2e184909e9f74d4ad9d67ae0e084ea
77 changes: 2 additions & 75 deletions trunk/drivers/ide/pci/serverworks.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* linux/drivers/ide/pci/serverworks.c Version 0.11 Jun 2 2007
* linux/drivers/ide/pci/serverworks.c Version 0.20 Jun 3 2007
*
* Copyright (C) 1998-2000 Michel Aubry
* Copyright (C) 1998-2000 Andrzej Krzysztofowicz
Expand Down Expand Up @@ -151,84 +151,11 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 &&
drive->media == ide_disk && speed >= XFER_UDMA_0)
BUG();

pci_read_config_byte(dev, drive_pci[drive->dn], &pio_timing);
pci_read_config_byte(dev, drive_pci2[drive->dn], &dma_timing);

pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing);
pci_read_config_word(dev, 0x4A, &csb5_pio);
pci_read_config_byte(dev, 0x54, &ultra_enable);

/* If we are in RAID mode (eg AMI MegaIDE) then we can't it
turns out trust the firmware configuration */

if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
goto oem_setup_failed;

/* Per Specified Design by OEM, and ASIC Architect */
if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
if (!drive->init_speed) {
u8 dma_stat = inb(hwif->dma_status);

if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) &&
((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) {
drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)];
return 0;
} else if ((dma_timing) &&
((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) {
u8 dmaspeed;

switch (dma_timing & 0x77) {
case 0x20:
dmaspeed = XFER_MW_DMA_2;
break;
case 0x21:
dmaspeed = XFER_MW_DMA_1;
break;
case 0x77:
dmaspeed = XFER_MW_DMA_0;
break;
default:
goto dma_pio;
}

drive->current_speed = drive->init_speed = dmaspeed;
return 0;
}
dma_pio:
if (pio_timing) {
u8 piospeed;

switch (pio_timing & 0x7f) {
case 0x20:
piospeed = XFER_PIO_4;
break;
case 0x22:
piospeed = XFER_PIO_3;
break;
case 0x34:
piospeed = XFER_PIO_2;
break;
case 0x47:
piospeed = XFER_PIO_1;
break;
case 0x5d:
piospeed = XFER_PIO_0;
break;
default:
goto oem_setup_failed;
}

drive->current_speed = drive->init_speed = piospeed;
return 0;
}
}
}

oem_setup_failed:

pio_timing = 0;
dma_timing = 0;
ultra_timing &= ~(0x0F << (4*unit));
ultra_enable &= ~(0x01 << drive->dn);
csb5_pio &= ~(0x0F << (4*drive->dn));
Expand Down

0 comments on commit 24e3bb0

Please sign in to comment.