diff options
Diffstat (limited to 'drivers/ide/pci/aec62xx.c')
-rw-r--r-- | drivers/ide/pci/aec62xx.c | 97 |
1 files changed, 39 insertions, 58 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 3a4c2c26a77e..b3dc12a70d51 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/aec62xx.c Version 0.25 Aug 1, 2007 | 2 | * linux/drivers/ide/pci/aec62xx.c Version 0.26 Sep 1, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | 5 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> |
@@ -184,34 +184,23 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch | |||
184 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | 184 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) |
185 | { | 185 | { |
186 | struct pci_dev *dev = hwif->pci_dev; | 186 | struct pci_dev *dev = hwif->pci_dev; |
187 | u8 reg54 = 0, mask = hwif->channel ? 0xf0 : 0x0f; | ||
188 | unsigned long flags; | ||
189 | 187 | ||
190 | hwif->set_pio_mode = &aec_set_pio_mode; | 188 | hwif->set_pio_mode = &aec_set_pio_mode; |
191 | 189 | ||
192 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { | 190 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) |
193 | if(hwif->mate) | ||
194 | hwif->mate->serialized = hwif->serialized = 1; | ||
195 | hwif->set_dma_mode = &aec6210_set_mode; | 191 | hwif->set_dma_mode = &aec6210_set_mode; |
196 | } else | 192 | else |
197 | hwif->set_dma_mode = &aec6260_set_mode; | 193 | hwif->set_dma_mode = &aec6260_set_mode; |
198 | 194 | ||
199 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | ||
200 | |||
201 | if (hwif->dma_base == 0) | 195 | if (hwif->dma_base == 0) |
202 | return; | 196 | return; |
203 | 197 | ||
204 | hwif->ultra_mask = hwif->cds->udma_mask; | ||
205 | hwif->mwdma_mask = 0x07; | ||
206 | |||
207 | hwif->dma_lost_irq = &aec62xx_dma_lost_irq; | 198 | hwif->dma_lost_irq = &aec62xx_dma_lost_irq; |
208 | 199 | ||
209 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { | 200 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) |
210 | spin_lock_irqsave(&ide_lock, flags); | 201 | return; |
211 | pci_read_config_byte (dev, 0x54, ®54); | 202 | |
212 | pci_write_config_byte(dev, 0x54, (reg54 & ~mask)); | 203 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { |
213 | spin_unlock_irqrestore(&ide_lock, flags); | ||
214 | } else if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | ||
215 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; | 204 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; |
216 | 205 | ||
217 | pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); | 206 | pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); |
@@ -220,73 +209,53 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
220 | } | 209 | } |
221 | } | 210 | } |
222 | 211 | ||
223 | static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d) | ||
224 | { | ||
225 | return ide_setup_pci_device(dev, d); | ||
226 | } | ||
227 | |||
228 | static int __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d) | ||
229 | { | ||
230 | unsigned long dma_base = pci_resource_start(dev, 4); | ||
231 | |||
232 | if (inb(dma_base + 2) & 0x10) { | ||
233 | d->name = (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R) ? | ||
234 | "AEC6880R" : "AEC6880"; | ||
235 | d->udma_mask = 0x7f; /* udma0-6 */ | ||
236 | } | ||
237 | |||
238 | return ide_setup_pci_device(dev, d); | ||
239 | } | ||
240 | |||
241 | static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | 212 | static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { |
242 | { /* 0 */ | 213 | { /* 0 */ |
243 | .name = "AEC6210", | 214 | .name = "AEC6210", |
244 | .init_setup = init_setup_aec62xx, | ||
245 | .init_chipset = init_chipset_aec62xx, | 215 | .init_chipset = init_chipset_aec62xx, |
246 | .init_hwif = init_hwif_aec62xx, | 216 | .init_hwif = init_hwif_aec62xx, |
247 | .autodma = AUTODMA, | ||
248 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 217 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
249 | .bootable = OFF_BOARD, | 218 | .host_flags = IDE_HFLAG_SERIALIZE | |
219 | IDE_HFLAG_NO_ATAPI_DMA | | ||
220 | IDE_HFLAG_OFF_BOARD, | ||
250 | .pio_mask = ATA_PIO4, | 221 | .pio_mask = ATA_PIO4, |
251 | .udma_mask = 0x07, /* udma0-2 */ | 222 | .mwdma_mask = ATA_MWDMA2, |
223 | .udma_mask = ATA_UDMA2, | ||
252 | },{ /* 1 */ | 224 | },{ /* 1 */ |
253 | .name = "AEC6260", | 225 | .name = "AEC6260", |
254 | .init_setup = init_setup_aec62xx, | ||
255 | .init_chipset = init_chipset_aec62xx, | 226 | .init_chipset = init_chipset_aec62xx, |
256 | .init_hwif = init_hwif_aec62xx, | 227 | .init_hwif = init_hwif_aec62xx, |
257 | .autodma = NOAUTODMA, | 228 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA | |
258 | .bootable = OFF_BOARD, | 229 | IDE_HFLAG_OFF_BOARD, |
259 | .pio_mask = ATA_PIO4, | 230 | .pio_mask = ATA_PIO4, |
260 | .udma_mask = 0x1f, /* udma0-4 */ | 231 | .mwdma_mask = ATA_MWDMA2, |
232 | .udma_mask = ATA_UDMA4, | ||
261 | },{ /* 2 */ | 233 | },{ /* 2 */ |
262 | .name = "AEC6260R", | 234 | .name = "AEC6260R", |
263 | .init_setup = init_setup_aec62xx, | ||
264 | .init_chipset = init_chipset_aec62xx, | 235 | .init_chipset = init_chipset_aec62xx, |
265 | .init_hwif = init_hwif_aec62xx, | 236 | .init_hwif = init_hwif_aec62xx, |
266 | .autodma = AUTODMA, | ||
267 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 237 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
268 | .bootable = NEVER_BOARD, | 238 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA, |
269 | .pio_mask = ATA_PIO4, | 239 | .pio_mask = ATA_PIO4, |
270 | .udma_mask = 0x1f, /* udma0-4 */ | 240 | .mwdma_mask = ATA_MWDMA2, |
241 | .udma_mask = ATA_UDMA4, | ||
271 | },{ /* 3 */ | 242 | },{ /* 3 */ |
272 | .name = "AEC6280", | 243 | .name = "AEC6280", |
273 | .init_setup = init_setup_aec6x80, | ||
274 | .init_chipset = init_chipset_aec62xx, | 244 | .init_chipset = init_chipset_aec62xx, |
275 | .init_hwif = init_hwif_aec62xx, | 245 | .init_hwif = init_hwif_aec62xx, |
276 | .autodma = AUTODMA, | 246 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, |
277 | .bootable = OFF_BOARD, | ||
278 | .pio_mask = ATA_PIO4, | 247 | .pio_mask = ATA_PIO4, |
279 | .udma_mask = 0x3f, /* udma0-5 */ | 248 | .mwdma_mask = ATA_MWDMA2, |
249 | .udma_mask = ATA_UDMA5, | ||
280 | },{ /* 4 */ | 250 | },{ /* 4 */ |
281 | .name = "AEC6280R", | 251 | .name = "AEC6280R", |
282 | .init_setup = init_setup_aec6x80, | ||
283 | .init_chipset = init_chipset_aec62xx, | 252 | .init_chipset = init_chipset_aec62xx, |
284 | .init_hwif = init_hwif_aec62xx, | 253 | .init_hwif = init_hwif_aec62xx, |
285 | .autodma = AUTODMA, | ||
286 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 254 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
287 | .bootable = OFF_BOARD, | 255 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, |
288 | .pio_mask = ATA_PIO4, | 256 | .pio_mask = ATA_PIO4, |
289 | .udma_mask = 0x3f, /* udma0-5 */ | 257 | .mwdma_mask = ATA_MWDMA2, |
258 | .udma_mask = ATA_UDMA5, | ||
290 | } | 259 | } |
291 | }; | 260 | }; |
292 | 261 | ||
@@ -304,9 +273,21 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
304 | 273 | ||
305 | static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 274 | static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
306 | { | 275 | { |
307 | ide_pci_device_t d = aec62xx_chipsets[id->driver_data]; | 276 | ide_pci_device_t d; |
277 | u8 idx = id->driver_data; | ||
278 | |||
279 | d = aec62xx_chipsets[idx]; | ||
280 | |||
281 | if (idx == 3 || idx == 4) { | ||
282 | unsigned long dma_base = pci_resource_start(dev, 4); | ||
283 | |||
284 | if (inb(dma_base + 2) & 0x10) { | ||
285 | d.name = (idx == 4) ? "AEC6880R" : "AEC6880"; | ||
286 | d.udma_mask = ATA_UDMA6; | ||
287 | } | ||
288 | } | ||
308 | 289 | ||
309 | return d.init_setup(dev, &d); | 290 | return ide_setup_pci_device(dev, &d); |
310 | } | 291 | } |
311 | 292 | ||
312 | static const struct pci_device_id aec62xx_pci_tbl[] = { | 293 | static const struct pci_device_id aec62xx_pci_tbl[] = { |