|
@@ -121,6 +121,19 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
|
|
|
spin_unlock_irqrestore(&atiixp_lock, flags);
|
|
|
}
|
|
|
|
|
|
+static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif)
|
|
|
+{
|
|
|
+ struct pci_dev *pdev = to_pci_dev(hwif->dev);
|
|
|
+ u8 udma_mode = 0, ch = hwif->channel;
|
|
|
+
|
|
|
+ pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
|
|
|
+
|
|
|
+ if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
|
|
|
+ return ATA_CBL_PATA80;
|
|
|
+ else
|
|
|
+ return ATA_CBL_PATA40;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* init_hwif_atiixp - fill in the hwif for the ATIIXP
|
|
|
* @hwif: IDE interface
|
|
@@ -131,21 +144,14 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
|
|
|
|
|
|
static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
|
|
|
{
|
|
|
- struct pci_dev *pdev = to_pci_dev(hwif->dev);
|
|
|
- u8 udma_mode = 0, ch = hwif->channel;
|
|
|
-
|
|
|
hwif->set_pio_mode = &atiixp_set_pio_mode;
|
|
|
hwif->set_dma_mode = &atiixp_set_dma_mode;
|
|
|
|
|
|
if (!hwif->dma_base)
|
|
|
return;
|
|
|
|
|
|
- pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
|
|
|
-
|
|
|
- if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
|
|
|
- hwif->cbl = ATA_CBL_PATA80;
|
|
|
- else
|
|
|
- hwif->cbl = ATA_CBL_PATA40;
|
|
|
+ if (hwif->cbl != ATA_CBL_PATA40_SHORT)
|
|
|
+ hwif->cbl = atiixp_cable_detect(hwif);
|
|
|
}
|
|
|
|
|
|
static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
|