aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/siimage.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 17:58:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 17:58:02 -0500
commitf3191248bf1bf6627c04c5624904df45e0a979ed (patch)
treead7a49bf947f849740999702204373c3c12caea7 /drivers/ide/pci/siimage.c
parentcbb51afa6d69be003cc827a89e023906885f241e (diff)
parenta14dc57495899175a0827673fe23ed17b5653896 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (100 commits) ide: move hwif_register() call out of ide_probe_port() ide: factor out code for tuning devices from ide_probe_port() ide: move handling of I/O resources out of ide_probe_port() ide: make probe_hwif() return an error value ide: use ide_remove_port_from_hwgroup in init_irq() ide: prepare init_irq() for using ide_remove_port_from_hwgroup() ide: factor out code removing port from hwgroup from ide_unregister() ide: I/O resources are released too early in ide_unregister() ide: cleanup ide_system_bus_speed() ide: remove needless zeroing of hwgroup fields from init_irq() ide: remove unused ide_hwgroup_t fields ide_platform: remove struct hwif_prop ide: remove hwif->present manipulations from hwif_init() ide: move wait_hwif_ready() documentation in the right place ide: fix handling of busy I/O resources in probe_hwif() <linux/hdsmart.h> is not used by kernel code ide: don't include <linux/hdsmart.h> ide-floppy: cleanup header ide: update/add my Copyrights ide: delete filenames/versions from comments ...
Diffstat (limited to 'drivers/ide/pci/siimage.c')
-rw-r--r--drivers/ide/pci/siimage.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 908f37b4e0ee..4877bc8cd599 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.19 Nov 16 2007
3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 2 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 3 * Copyright (C) 2003 Red Hat <alan@redhat.com>
6 * Copyright (C) 2007 MontaVista Software, Inc. 4 * Copyright (C) 2007 MontaVista Software, Inc.
@@ -79,7 +77,7 @@ static int pdev_is_sata(struct pci_dev *pdev)
79 77
80static inline int is_sata(ide_hwif_t *hwif) 78static inline int is_sata(ide_hwif_t *hwif)
81{ 79{
82 return pdev_is_sata(hwif->pci_dev); 80 return pdev_is_sata(to_pci_dev(hwif->dev));
83} 81}
84 82
85/** 83/**
@@ -140,13 +138,14 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
140static u8 sil_pata_udma_filter(ide_drive_t *drive) 138static u8 sil_pata_udma_filter(ide_drive_t *drive)
141{ 139{
142 ide_hwif_t *hwif = drive->hwif; 140 ide_hwif_t *hwif = drive->hwif;
141 struct pci_dev *dev = to_pci_dev(hwif->dev);
143 unsigned long base = (unsigned long) hwif->hwif_data; 142 unsigned long base = (unsigned long) hwif->hwif_data;
144 u8 mask = 0, scsc = 0; 143 u8 mask = 0, scsc = 0;
145 144
146 if (hwif->mmio) 145 if (hwif->mmio)
147 scsc = hwif->INB(base + 0x4A); 146 scsc = hwif->INB(base + 0x4A);
148 else 147 else
149 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); 148 pci_read_config_byte(dev, 0x8A, &scsc);
150 149
151 if ((scsc & 0x30) == 0x10) /* 133 */ 150 if ((scsc & 0x30) == 0x10) /* 133 */
152 mask = ATA_UDMA6; 151 mask = ATA_UDMA6;
@@ -219,19 +218,21 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
219 mode |= (unit ? 0x10 : 0x01); 218 mode |= (unit ? 0x10 : 0x01);
220 hwif->OUTB(mode, base + addr_mask); 219 hwif->OUTB(mode, base + addr_mask);
221 } else { 220 } else {
222 pci_write_config_word(hwif->pci_dev, addr, speedp); 221 struct pci_dev *dev = to_pci_dev(hwif->dev);
223 pci_write_config_word(hwif->pci_dev, tfaddr, speedt); 222
224 pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); 223 pci_write_config_word(dev, addr, speedp);
224 pci_write_config_word(dev, tfaddr, speedt);
225 pci_read_config_word(dev, tfaddr - 2, &speedp);
225 speedp &= ~0x200; 226 speedp &= ~0x200;
226 /* Set IORDY for mode 3 or 4 */ 227 /* Set IORDY for mode 3 or 4 */
227 if (pio > 2) 228 if (pio > 2)
228 speedp |= 0x200; 229 speedp |= 0x200;
229 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); 230 pci_write_config_word(dev, tfaddr - 2, speedp);
230 231
231 pci_read_config_byte(hwif->pci_dev, addr_mask, &mode); 232 pci_read_config_byte(dev, addr_mask, &mode);
232 mode &= ~(unit ? 0x30 : 0x03); 233 mode &= ~(unit ? 0x30 : 0x03);
233 mode |= (unit ? 0x10 : 0x01); 234 mode |= (unit ? 0x10 : 0x01);
234 pci_write_config_byte(hwif->pci_dev, addr_mask, mode); 235 pci_write_config_byte(dev, addr_mask, mode);
235 } 236 }
236} 237}
237 238
@@ -250,6 +251,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
250 u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; 251 u16 dma[] = { 0x2208, 0x10C2, 0x10C1 };
251 252
252 ide_hwif_t *hwif = HWIF(drive); 253 ide_hwif_t *hwif = HWIF(drive);
254 struct pci_dev *dev = to_pci_dev(hwif->dev);
253 u16 ultra = 0, multi = 0; 255 u16 ultra = 0, multi = 0;
254 u8 mode = 0, unit = drive->select.b.unit; 256 u8 mode = 0, unit = drive->select.b.unit;
255 unsigned long base = (unsigned long)hwif->hwif_data; 257 unsigned long base = (unsigned long)hwif->hwif_data;
@@ -266,10 +268,10 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
266 multi = hwif->INW(ma); 268 multi = hwif->INW(ma);
267 ultra = hwif->INW(ua); 269 ultra = hwif->INW(ua);
268 } else { 270 } else {
269 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); 271 pci_read_config_byte(dev, 0x8A, &scsc);
270 pci_read_config_byte(hwif->pci_dev, addr_mask, &mode); 272 pci_read_config_byte(dev, addr_mask, &mode);
271 pci_read_config_word(hwif->pci_dev, ma, &multi); 273 pci_read_config_word(dev, ma, &multi);
272 pci_read_config_word(hwif->pci_dev, ua, &ultra); 274 pci_read_config_word(dev, ua, &ultra);
273 } 275 }
274 276
275 mode &= ~((unit) ? 0x30 : 0x03); 277 mode &= ~((unit) ? 0x30 : 0x03);
@@ -293,9 +295,9 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
293 hwif->OUTW(multi, ma); 295 hwif->OUTW(multi, ma);
294 hwif->OUTW(ultra, ua); 296 hwif->OUTW(ultra, ua);
295 } else { 297 } else {
296 pci_write_config_byte(hwif->pci_dev, addr_mask, mode); 298 pci_write_config_byte(dev, addr_mask, mode);
297 pci_write_config_word(hwif->pci_dev, ma, multi); 299 pci_write_config_word(dev, ma, multi);
298 pci_write_config_word(hwif->pci_dev, ua, ultra); 300 pci_write_config_word(dev, ua, ultra);
299 } 301 }
300} 302}
301 303
@@ -303,6 +305,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
303static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) 305static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
304{ 306{
305 ide_hwif_t *hwif = HWIF(drive); 307 ide_hwif_t *hwif = HWIF(drive);
308 struct pci_dev *dev = to_pci_dev(hwif->dev);
306 u8 dma_altstat = 0; 309 u8 dma_altstat = 0;
307 unsigned long addr = siimage_selreg(hwif, 1); 310 unsigned long addr = siimage_selreg(hwif, 1);
308 311
@@ -311,7 +314,7 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
311 return 1; 314 return 1;
312 315
313 /* return 1 if Device INTR asserted */ 316 /* return 1 if Device INTR asserted */
314 pci_read_config_byte(hwif->pci_dev, addr, &dma_altstat); 317 pci_read_config_byte(dev, addr, &dma_altstat);
315 if (dma_altstat & 8) 318 if (dma_altstat & 8)
316 return 0; //return 1; 319 return 0; //return 1;
317 return 0; 320 return 0;
@@ -377,13 +380,14 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
377static int sil_sata_busproc(ide_drive_t * drive, int state) 380static int sil_sata_busproc(ide_drive_t * drive, int state)
378{ 381{
379 ide_hwif_t *hwif = HWIF(drive); 382 ide_hwif_t *hwif = HWIF(drive);
383 struct pci_dev *dev = to_pci_dev(hwif->dev);
380 u32 stat_config = 0; 384 u32 stat_config = 0;
381 unsigned long addr = siimage_selreg(hwif, 0); 385 unsigned long addr = siimage_selreg(hwif, 0);
382 386
383 if (hwif->mmio) 387 if (hwif->mmio)
384 stat_config = readl((void __iomem *)addr); 388 stat_config = readl((void __iomem *)addr);
385 else 389 else
386 pci_read_config_dword(hwif->pci_dev, addr, &stat_config); 390 pci_read_config_dword(dev, addr, &stat_config);
387 391
388 switch (state) { 392 switch (state) {
389 case BUSSTATE_ON: 393 case BUSSTATE_ON:
@@ -643,7 +647,7 @@ static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const ch
643 647
644static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) 648static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
645{ 649{
646 struct pci_dev *dev = hwif->pci_dev; 650 struct pci_dev *dev = to_pci_dev(hwif->dev);
647 void *addr = pci_get_drvdata(dev); 651 void *addr = pci_get_drvdata(dev);
648 u8 ch = hwif->channel; 652 u8 ch = hwif->channel;
649 hw_regs_t hw; 653 hw_regs_t hw;
@@ -756,12 +760,14 @@ static void __devinit sil_quirkproc(ide_drive_t *drive)
756 760
757static void __devinit init_iops_siimage(ide_hwif_t *hwif) 761static void __devinit init_iops_siimage(ide_hwif_t *hwif)
758{ 762{
763 struct pci_dev *dev = to_pci_dev(hwif->dev);
764
759 hwif->hwif_data = NULL; 765 hwif->hwif_data = NULL;
760 766
761 /* Pessimal until we finish probing */ 767 /* Pessimal until we finish probing */
762 hwif->rqsize = 15; 768 hwif->rqsize = 15;
763 769
764 if (pci_get_drvdata(hwif->pci_dev) == NULL) 770 if (pci_get_drvdata(dev) == NULL)
765 return; 771 return;
766 772
767 init_mmio_iops_siimage(hwif); 773 init_mmio_iops_siimage(hwif);
@@ -777,11 +783,12 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
777 783
778static u8 __devinit ata66_siimage(ide_hwif_t *hwif) 784static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
779{ 785{
786 struct pci_dev *dev = to_pci_dev(hwif->dev);
780 unsigned long addr = siimage_selreg(hwif, 0); 787 unsigned long addr = siimage_selreg(hwif, 0);
781 u8 ata66 = 0; 788 u8 ata66 = 0;
782 789
783 if (pci_get_drvdata(hwif->pci_dev) == NULL) 790 if (pci_get_drvdata(dev) == NULL)
784 pci_read_config_byte(hwif->pci_dev, addr, &ata66); 791 pci_read_config_byte(dev, addr, &ata66);
785 else 792 else
786 ata66 = hwif->INB(addr); 793 ata66 = hwif->INB(addr);
787 794