diff options
Diffstat (limited to 'drivers/ide/pci/atiixp.c')
-rw-r--r-- | drivers/ide/pci/atiixp.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index b56274af1782..648fdf30cdf4 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -121,6 +121,19 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
121 | spin_unlock_irqrestore(&atiixp_lock, flags); | 121 | spin_unlock_irqrestore(&atiixp_lock, flags); |
122 | } | 122 | } |
123 | 123 | ||
124 | static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif) | ||
125 | { | ||
126 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
127 | u8 udma_mode = 0, ch = hwif->channel; | ||
128 | |||
129 | pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); | ||
130 | |||
131 | if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40) | ||
132 | return ATA_CBL_PATA80; | ||
133 | else | ||
134 | return ATA_CBL_PATA40; | ||
135 | } | ||
136 | |||
124 | /** | 137 | /** |
125 | * init_hwif_atiixp - fill in the hwif for the ATIIXP | 138 | * init_hwif_atiixp - fill in the hwif for the ATIIXP |
126 | * @hwif: IDE interface | 139 | * @hwif: IDE interface |
@@ -131,21 +144,14 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
131 | 144 | ||
132 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | 145 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) |
133 | { | 146 | { |
134 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
135 | u8 udma_mode = 0, ch = hwif->channel; | ||
136 | |||
137 | hwif->set_pio_mode = &atiixp_set_pio_mode; | 147 | hwif->set_pio_mode = &atiixp_set_pio_mode; |
138 | hwif->set_dma_mode = &atiixp_set_dma_mode; | 148 | hwif->set_dma_mode = &atiixp_set_dma_mode; |
139 | 149 | ||
140 | if (!hwif->dma_base) | 150 | if (!hwif->dma_base) |
141 | return; | 151 | return; |
142 | 152 | ||
143 | pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); | 153 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
144 | 154 | hwif->cbl = atiixp_cable_detect(hwif); | |
145 | if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40) | ||
146 | hwif->cbl = ATA_CBL_PATA80; | ||
147 | else | ||
148 | hwif->cbl = ATA_CBL_PATA40; | ||
149 | } | 155 | } |
150 | 156 | ||
151 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { | 157 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { |