aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/siimage.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:31 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:31 -0500
commit36501650ec45b1db308c3b51886044863be2d762 (patch)
tree74cf9d9f313e510f8424f9bac35da8d61cce9f7b /drivers/ide/pci/siimage.c
parentf6fb786d6dcdd7d730e4fba620b071796f487e1b (diff)
ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
Keep pointer to struct device instead of struct pci_dev in ide_hwif_t. While on it: * Use *dev->dma_mask instead of pci_dev->dma_mask in ide_toggle_bounce(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/siimage.c')
-rw-r--r--drivers/ide/pci/siimage.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 908f37b4e0ee..391eea88c760 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -79,7 +79,7 @@ static int pdev_is_sata(struct pci_dev *pdev)
79 79
80static inline int is_sata(ide_hwif_t *hwif) 80static inline int is_sata(ide_hwif_t *hwif)
81{ 81{
82 return pdev_is_sata(hwif->pci_dev); 82 return pdev_is_sata(to_pci_dev(hwif->dev));
83} 83}
84 84
85/** 85/**
@@ -140,13 +140,14 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
140static u8 sil_pata_udma_filter(ide_drive_t *drive) 140static u8 sil_pata_udma_filter(ide_drive_t *drive)
141{ 141{
142 ide_hwif_t *hwif = drive->hwif; 142 ide_hwif_t *hwif = drive->hwif;
143 struct pci_dev *dev = to_pci_dev(hwif->dev);
143 unsigned long base = (unsigned long) hwif->hwif_data; 144 unsigned long base = (unsigned long) hwif->hwif_data;
144 u8 mask = 0, scsc = 0; 145 u8 mask = 0, scsc = 0;
145 146
146 if (hwif->mmio) 147 if (hwif->mmio)
147 scsc = hwif->INB(base + 0x4A); 148 scsc = hwif->INB(base + 0x4A);
148 else 149 else
149 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); 150 pci_read_config_byte(dev, 0x8A, &scsc);
150 151
151 if ((scsc & 0x30) == 0x10) /* 133 */ 152 if ((scsc & 0x30) == 0x10) /* 133 */
152 mask = ATA_UDMA6; 153 mask = ATA_UDMA6;
@@ -219,19 +220,21 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
219 mode |= (unit ? 0x10 : 0x01); 220 mode |= (unit ? 0x10 : 0x01);
220 hwif->OUTB(mode, base + addr_mask); 221 hwif->OUTB(mode, base + addr_mask);
221 } else { 222 } else {
222 pci_write_config_word(hwif->pci_dev, addr, speedp); 223 struct pci_dev *dev = to_pci_dev(hwif->dev);
223 pci_write_config_word(hwif->pci_dev, tfaddr, speedt); 224
224 pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); 225 pci_write_config_word(dev, addr, speedp);
226 pci_write_config_word(dev, tfaddr, speedt);
227 pci_read_config_word(dev, tfaddr - 2, &speedp);
225 speedp &= ~0x200; 228 speedp &= ~0x200;
226 /* Set IORDY for mode 3 or 4 */ 229 /* Set IORDY for mode 3 or 4 */
227 if (pio > 2) 230 if (pio > 2)
228 speedp |= 0x200; 231 speedp |= 0x200;
229 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); 232 pci_write_config_word(dev, tfaddr - 2, speedp);
230 233
231 pci_read_config_byte(hwif->pci_dev, addr_mask, &mode); 234 pci_read_config_byte(dev, addr_mask, &mode);
232 mode &= ~(unit ? 0x30 : 0x03); 235 mode &= ~(unit ? 0x30 : 0x03);
233 mode |= (unit ? 0x10 : 0x01); 236 mode |= (unit ? 0x10 : 0x01);
234 pci_write_config_byte(hwif->pci_dev, addr_mask, mode); 237 pci_write_config_byte(dev, addr_mask, mode);
235 } 238 }
236} 239}
237 240
@@ -250,6 +253,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
250 u16 dma[] = { 0x2208, 0x10C2, 0x10C1 }; 253 u16 dma[] = { 0x2208, 0x10C2, 0x10C1 };
251 254
252 ide_hwif_t *hwif = HWIF(drive); 255 ide_hwif_t *hwif = HWIF(drive);
256 struct pci_dev *dev = to_pci_dev(hwif->dev);
253 u16 ultra = 0, multi = 0; 257 u16 ultra = 0, multi = 0;
254 u8 mode = 0, unit = drive->select.b.unit; 258 u8 mode = 0, unit = drive->select.b.unit;
255 unsigned long base = (unsigned long)hwif->hwif_data; 259 unsigned long base = (unsigned long)hwif->hwif_data;
@@ -266,10 +270,10 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
266 multi = hwif->INW(ma); 270 multi = hwif->INW(ma);
267 ultra = hwif->INW(ua); 271 ultra = hwif->INW(ua);
268 } else { 272 } else {
269 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); 273 pci_read_config_byte(dev, 0x8A, &scsc);
270 pci_read_config_byte(hwif->pci_dev, addr_mask, &mode); 274 pci_read_config_byte(dev, addr_mask, &mode);
271 pci_read_config_word(hwif->pci_dev, ma, &multi); 275 pci_read_config_word(dev, ma, &multi);
272 pci_read_config_word(hwif->pci_dev, ua, &ultra); 276 pci_read_config_word(dev, ua, &ultra);
273 } 277 }
274 278
275 mode &= ~((unit) ? 0x30 : 0x03); 279 mode &= ~((unit) ? 0x30 : 0x03);
@@ -293,9 +297,9 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
293 hwif->OUTW(multi, ma); 297 hwif->OUTW(multi, ma);
294 hwif->OUTW(ultra, ua); 298 hwif->OUTW(ultra, ua);
295 } else { 299 } else {
296 pci_write_config_byte(hwif->pci_dev, addr_mask, mode); 300 pci_write_config_byte(dev, addr_mask, mode);
297 pci_write_config_word(hwif->pci_dev, ma, multi); 301 pci_write_config_word(dev, ma, multi);
298 pci_write_config_word(hwif->pci_dev, ua, ultra); 302 pci_write_config_word(dev, ua, ultra);
299 } 303 }
300} 304}
301 305
@@ -303,6 +307,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) 307static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
304{ 308{
305 ide_hwif_t *hwif = HWIF(drive); 309 ide_hwif_t *hwif = HWIF(drive);
310 struct pci_dev *dev = to_pci_dev(hwif->dev);
306 u8 dma_altstat = 0; 311 u8 dma_altstat = 0;
307 unsigned long addr = siimage_selreg(hwif, 1); 312 unsigned long addr = siimage_selreg(hwif, 1);
308 313
@@ -311,7 +316,7 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
311 return 1; 316 return 1;
312 317
313 /* return 1 if Device INTR asserted */ 318 /* return 1 if Device INTR asserted */
314 pci_read_config_byte(hwif->pci_dev, addr, &dma_altstat); 319 pci_read_config_byte(dev, addr, &dma_altstat);
315 if (dma_altstat & 8) 320 if (dma_altstat & 8)
316 return 0; //return 1; 321 return 0; //return 1;
317 return 0; 322 return 0;
@@ -377,13 +382,14 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
377static int sil_sata_busproc(ide_drive_t * drive, int state) 382static int sil_sata_busproc(ide_drive_t * drive, int state)
378{ 383{
379 ide_hwif_t *hwif = HWIF(drive); 384 ide_hwif_t *hwif = HWIF(drive);
385 struct pci_dev *dev = to_pci_dev(hwif->dev);
380 u32 stat_config = 0; 386 u32 stat_config = 0;
381 unsigned long addr = siimage_selreg(hwif, 0); 387 unsigned long addr = siimage_selreg(hwif, 0);
382 388
383 if (hwif->mmio) 389 if (hwif->mmio)
384 stat_config = readl((void __iomem *)addr); 390 stat_config = readl((void __iomem *)addr);
385 else 391 else
386 pci_read_config_dword(hwif->pci_dev, addr, &stat_config); 392 pci_read_config_dword(dev, addr, &stat_config);
387 393
388 switch (state) { 394 switch (state) {
389 case BUSSTATE_ON: 395 case BUSSTATE_ON:
@@ -643,7 +649,7 @@ static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const ch
643 649
644static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) 650static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
645{ 651{
646 struct pci_dev *dev = hwif->pci_dev; 652 struct pci_dev *dev = to_pci_dev(hwif->dev);
647 void *addr = pci_get_drvdata(dev); 653 void *addr = pci_get_drvdata(dev);
648 u8 ch = hwif->channel; 654 u8 ch = hwif->channel;
649 hw_regs_t hw; 655 hw_regs_t hw;
@@ -756,12 +762,14 @@ static void __devinit sil_quirkproc(ide_drive_t *drive)
756 762
757static void __devinit init_iops_siimage(ide_hwif_t *hwif) 763static void __devinit init_iops_siimage(ide_hwif_t *hwif)
758{ 764{
765 struct pci_dev *dev = to_pci_dev(hwif->dev);
766
759 hwif->hwif_data = NULL; 767 hwif->hwif_data = NULL;
760 768
761 /* Pessimal until we finish probing */ 769 /* Pessimal until we finish probing */
762 hwif->rqsize = 15; 770 hwif->rqsize = 15;
763 771
764 if (pci_get_drvdata(hwif->pci_dev) == NULL) 772 if (pci_get_drvdata(dev) == NULL)
765 return; 773 return;
766 774
767 init_mmio_iops_siimage(hwif); 775 init_mmio_iops_siimage(hwif);
@@ -777,11 +785,12 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
777 785
778static u8 __devinit ata66_siimage(ide_hwif_t *hwif) 786static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
779{ 787{
788 struct pci_dev *dev = to_pci_dev(hwif->dev);
780 unsigned long addr = siimage_selreg(hwif, 0); 789 unsigned long addr = siimage_selreg(hwif, 0);
781 u8 ata66 = 0; 790 u8 ata66 = 0;
782 791
783 if (pci_get_drvdata(hwif->pci_dev) == NULL) 792 if (pci_get_drvdata(dev) == NULL)
784 pci_read_config_byte(hwif->pci_dev, addr, &ata66); 793 pci_read_config_byte(dev, addr, &ata66);
785 else 794 else
786 ata66 = hwif->INB(addr); 795 ata66 = hwif->INB(addr);
787 796