diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 17:58:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 17:58:02 -0500 |
commit | f3191248bf1bf6627c04c5624904df45e0a979ed (patch) | |
tree | ad7a49bf947f849740999702204373c3c12caea7 /drivers/ide/pci | |
parent | cbb51afa6d69be003cc827a89e023906885f241e (diff) | |
parent | a14dc57495899175a0827673fe23ed17b5653896 (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')
35 files changed, 387 insertions, 450 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 7f4d1857d555..824df78c7012 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/aec62xx.c Version 0.27 Sep 16, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | 3 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> |
6 | * | 4 | * |
@@ -90,7 +88,7 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entr | |||
90 | static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | 88 | static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) |
91 | { | 89 | { |
92 | ide_hwif_t *hwif = HWIF(drive); | 90 | ide_hwif_t *hwif = HWIF(drive); |
93 | struct pci_dev *dev = hwif->pci_dev; | 91 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
94 | u16 d_conf = 0; | 92 | u16 d_conf = 0; |
95 | u8 ultra = 0, ultra_conf = 0; | 93 | u8 ultra = 0, ultra_conf = 0; |
96 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; | 94 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; |
@@ -116,7 +114,7 @@ static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | |||
116 | static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | 114 | static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) |
117 | { | 115 | { |
118 | ide_hwif_t *hwif = HWIF(drive); | 116 | ide_hwif_t *hwif = HWIF(drive); |
119 | struct pci_dev *dev = hwif->pci_dev; | 117 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
120 | u8 unit = (drive->select.b.unit & 0x01); | 118 | u8 unit = (drive->select.b.unit & 0x01); |
121 | u8 tmp1 = 0, tmp2 = 0; | 119 | u8 tmp1 = 0, tmp2 = 0; |
122 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 120 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
@@ -170,7 +168,7 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch | |||
170 | 168 | ||
171 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | 169 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) |
172 | { | 170 | { |
173 | struct pci_dev *dev = hwif->pci_dev; | 171 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
174 | 172 | ||
175 | hwif->set_pio_mode = &aec_set_pio_mode; | 173 | hwif->set_pio_mode = &aec_set_pio_mode; |
176 | 174 | ||
@@ -188,7 +186,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
188 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | 186 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { |
189 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; | 187 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; |
190 | 188 | ||
191 | pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); | 189 | pci_read_config_byte(dev, 0x49, &ata66); |
192 | 190 | ||
193 | hwif->cbl = (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 191 | hwif->cbl = (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
194 | } | 192 | } |
@@ -202,6 +200,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { | |||
202 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 200 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
203 | .host_flags = IDE_HFLAG_SERIALIZE | | 201 | .host_flags = IDE_HFLAG_SERIALIZE | |
204 | IDE_HFLAG_NO_ATAPI_DMA | | 202 | IDE_HFLAG_NO_ATAPI_DMA | |
203 | IDE_HFLAG_NO_DSC | | ||
205 | IDE_HFLAG_ABUSE_SET_DMA_MODE | | 204 | IDE_HFLAG_ABUSE_SET_DMA_MODE | |
206 | IDE_HFLAG_OFF_BOARD, | 205 | IDE_HFLAG_OFF_BOARD, |
207 | .pio_mask = ATA_PIO4, | 206 | .pio_mask = ATA_PIO4, |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 49aa82e412b6..130cc6e784e5 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/alim15x3.c Version 0.29 Sep 16 2007 | ||
3 | * | ||
4 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer | 2 | * Copyright (C) 1998-2000 Michel Aubry, Maintainer |
5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer | 3 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer |
6 | * Copyright (C) 1999-2000 CJ, cjtsai@ali.com.tw, Maintainer | 4 | * Copyright (C) 1999-2000 CJ, cjtsai@ali.com.tw, Maintainer |
@@ -293,7 +291,7 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) | |||
293 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | 291 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) |
294 | { | 292 | { |
295 | ide_hwif_t *hwif = HWIF(drive); | 293 | ide_hwif_t *hwif = HWIF(drive); |
296 | struct pci_dev *dev = hwif->pci_dev; | 294 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
297 | int s_time, a_time, c_time; | 295 | int s_time, a_time, c_time; |
298 | u8 s_clc, a_clc, r_clc; | 296 | u8 s_clc, a_clc, r_clc; |
299 | unsigned long flags; | 297 | unsigned long flags; |
@@ -396,7 +394,7 @@ static u8 ali_udma_filter(ide_drive_t *drive) | |||
396 | static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) | 394 | static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) |
397 | { | 395 | { |
398 | ide_hwif_t *hwif = HWIF(drive); | 396 | ide_hwif_t *hwif = HWIF(drive); |
399 | struct pci_dev *dev = hwif->pci_dev; | 397 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
400 | u8 speed1 = speed; | 398 | u8 speed1 = speed; |
401 | u8 unit = (drive->select.b.unit & 0x01); | 399 | u8 unit = (drive->select.b.unit & 0x01); |
402 | u8 tmpbyte = 0x00; | 400 | u8 tmpbyte = 0x00; |
@@ -625,7 +623,7 @@ static int ali_cable_override(struct pci_dev *pdev) | |||
625 | 623 | ||
626 | static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) | 624 | static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif) |
627 | { | 625 | { |
628 | struct pci_dev *dev = hwif->pci_dev; | 626 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
629 | unsigned long flags; | 627 | unsigned long flags; |
630 | u8 cbl = ATA_CBL_PATA40, tmpbyte; | 628 | u8 cbl = ATA_CBL_PATA40, tmpbyte; |
631 | 629 | ||
@@ -688,12 +686,13 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) | |||
688 | 686 | ||
689 | static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) | 687 | static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) |
690 | { | 688 | { |
689 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
691 | u8 ideic, inmir; | 690 | u8 ideic, inmir; |
692 | s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, | 691 | s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, |
693 | 1, 11, 0, 12, 0, 14, 0, 15 }; | 692 | 1, 11, 0, 12, 0, 14, 0, 15 }; |
694 | int irq = -1; | 693 | int irq = -1; |
695 | 694 | ||
696 | if (hwif->pci_dev->device == PCI_DEVICE_ID_AL_M5229) | 695 | if (dev->device == PCI_DEVICE_ID_AL_M5229) |
697 | hwif->irq = hwif->channel ? 15 : 14; | 696 | hwif->irq = hwif->channel ? 15 : 14; |
698 | 697 | ||
699 | if (isa_dev) { | 698 | if (isa_dev) { |
@@ -745,7 +744,7 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) | |||
745 | return; | 744 | return; |
746 | if (!hwif->channel) | 745 | if (!hwif->channel) |
747 | outb(inb(dmabase + 2) & 0x60, dmabase + 2); | 746 | outb(inb(dmabase + 2) & 0x60, dmabase + 2); |
748 | ide_setup_dma(hwif, dmabase, 8); | 747 | ide_setup_dma(hwif, dmabase); |
749 | } | 748 | } |
750 | 749 | ||
751 | static const struct ide_port_info ali15x3_chipset __devinitdata = { | 750 | static const struct ide_port_info ali15x3_chipset __devinitdata = { |
@@ -775,7 +774,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev | |||
775 | }; | 774 | }; |
776 | 775 | ||
777 | struct ide_port_info d = ali15x3_chipset; | 776 | struct ide_port_info d = ali15x3_chipset; |
778 | u8 rev = dev->revision; | 777 | u8 rev = dev->revision, idx = id->driver_data; |
779 | 778 | ||
780 | if (pci_dev_present(ati_rs100)) | 779 | if (pci_dev_present(ati_rs100)) |
781 | printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); | 780 | printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); |
@@ -798,6 +797,9 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev | |||
798 | d.udma_mask = ATA_UDMA6; | 797 | d.udma_mask = ATA_UDMA6; |
799 | } | 798 | } |
800 | 799 | ||
800 | if (idx == 0) | ||
801 | d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; | ||
802 | |||
801 | #if defined(CONFIG_SPARC64) | 803 | #if defined(CONFIG_SPARC64) |
802 | d.init_hwif = init_hwif_common_ali15x3; | 804 | d.init_hwif = init_hwif_common_ali15x3; |
803 | #endif /* CONFIG_SPARC64 */ | 805 | #endif /* CONFIG_SPARC64 */ |
@@ -807,7 +809,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev | |||
807 | 809 | ||
808 | static const struct pci_device_id alim15x3_pci_tbl[] = { | 810 | static const struct pci_device_id alim15x3_pci_tbl[] = { |
809 | { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5229), 0 }, | 811 | { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5229), 0 }, |
810 | { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), 0 }, | 812 | { PCI_VDEVICE(AL, PCI_DEVICE_ID_AL_M5228), 1 }, |
811 | { 0, }, | 813 | { 0, }, |
812 | }; | 814 | }; |
813 | MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl); | 815 | MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl); |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index cee51fdafcf6..8c52bc9eaa59 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Version 2.24 | ||
3 | * | ||
4 | * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 | 2 | * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 |
5 | * IDE driver for Linux. | 3 | * IDE driver for Linux. |
6 | * | 4 | * |
@@ -28,81 +26,46 @@ | |||
28 | 26 | ||
29 | #include "ide-timing.h" | 27 | #include "ide-timing.h" |
30 | 28 | ||
31 | #define AMD_IDE_CONFIG (0x01 + amd_config->base) | 29 | enum { |
32 | #define AMD_CABLE_DETECT (0x02 + amd_config->base) | 30 | AMD_IDE_CONFIG = 0x41, |
33 | #define AMD_DRIVE_TIMING (0x08 + amd_config->base) | 31 | AMD_CABLE_DETECT = 0x42, |
34 | #define AMD_8BIT_TIMING (0x0e + amd_config->base) | 32 | AMD_DRIVE_TIMING = 0x48, |
35 | #define AMD_ADDRESS_SETUP (0x0c + amd_config->base) | 33 | AMD_8BIT_TIMING = 0x4e, |
36 | #define AMD_UDMA_TIMING (0x10 + amd_config->base) | 34 | AMD_ADDRESS_SETUP = 0x4c, |
37 | 35 | AMD_UDMA_TIMING = 0x50, | |
38 | #define AMD_CHECK_SWDMA 0x08 | ||
39 | #define AMD_BAD_SWDMA 0x10 | ||
40 | #define AMD_BAD_FIFO 0x20 | ||
41 | #define AMD_CHECK_SERENADE 0x40 | ||
42 | |||
43 | /* | ||
44 | * AMD SouthBridge chips. | ||
45 | */ | ||
46 | |||
47 | static struct amd_ide_chip { | ||
48 | unsigned short id; | ||
49 | u8 base; | ||
50 | u8 udma_mask; | ||
51 | u8 flags; | ||
52 | } amd_ide_chips[] = { | ||
53 | { PCI_DEVICE_ID_AMD_COBRA_7401, 0x40, ATA_UDMA2, AMD_BAD_SWDMA }, | ||
54 | { PCI_DEVICE_ID_AMD_VIPER_7409, 0x40, ATA_UDMA4, AMD_CHECK_SWDMA }, | ||
55 | { PCI_DEVICE_ID_AMD_VIPER_7411, 0x40, ATA_UDMA5, AMD_BAD_FIFO }, | ||
56 | { PCI_DEVICE_ID_AMD_OPUS_7441, 0x40, ATA_UDMA5, }, | ||
57 | { PCI_DEVICE_ID_AMD_8111_IDE, 0x40, ATA_UDMA6, AMD_CHECK_SERENADE }, | ||
58 | { PCI_DEVICE_ID_NVIDIA_NFORCE_IDE, 0x50, ATA_UDMA5, }, | ||
59 | { PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE, 0x50, ATA_UDMA6, }, | ||
60 | { PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE, 0x50, ATA_UDMA6, }, | ||
61 | { PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA, 0x50, ATA_UDMA6, }, | ||
62 | { PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE, 0x50, ATA_UDMA6, }, | ||
63 | { PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE, 0x50, ATA_UDMA6, }, | ||
64 | { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, 0x50, ATA_UDMA6, }, | ||
65 | { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, 0x50, ATA_UDMA6, }, | ||
66 | { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, ATA_UDMA6, }, | ||
67 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, ATA_UDMA6, }, | ||
68 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, ATA_UDMA6, }, | ||
69 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, 0x50, ATA_UDMA6, }, | ||
70 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, 0x50, ATA_UDMA6, }, | ||
71 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, 0x50, ATA_UDMA6, }, | ||
72 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, 0x50, ATA_UDMA6, }, | ||
73 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE, 0x50, ATA_UDMA6, }, | ||
74 | { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE, 0x50, ATA_UDMA6, }, | ||
75 | { PCI_DEVICE_ID_AMD_CS5536_IDE, 0x40, ATA_UDMA5, }, | ||
76 | { 0 } | ||
77 | }; | 36 | }; |
78 | 37 | ||
79 | static struct amd_ide_chip *amd_config; | ||
80 | static const struct ide_port_info *amd_chipset; | ||
81 | static unsigned int amd_80w; | 38 | static unsigned int amd_80w; |
82 | static unsigned int amd_clock; | 39 | static unsigned int amd_clock; |
83 | 40 | ||
84 | static char *amd_dma[] = { "16", "25", "33", "44", "66", "100", "133" }; | 41 | static char *amd_dma[] = { "16", "25", "33", "44", "66", "100", "133" }; |
85 | static unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7 }; | 42 | static unsigned char amd_cyc2udma[] = { 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7 }; |
86 | 43 | ||
44 | static inline u8 amd_offset(struct pci_dev *dev) | ||
45 | { | ||
46 | return (dev->vendor == PCI_VENDOR_ID_NVIDIA) ? 0x10 : 0; | ||
47 | } | ||
48 | |||
87 | /* | 49 | /* |
88 | * amd_set_speed() writes timing values to the chipset registers | 50 | * amd_set_speed() writes timing values to the chipset registers |
89 | */ | 51 | */ |
90 | 52 | ||
91 | static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ide_timing *timing) | 53 | static void amd_set_speed(struct pci_dev *dev, u8 dn, u8 udma_mask, |
54 | struct ide_timing *timing) | ||
92 | { | 55 | { |
93 | unsigned char t; | 56 | u8 t = 0, offset = amd_offset(dev); |
94 | 57 | ||
95 | pci_read_config_byte(dev, AMD_ADDRESS_SETUP, &t); | 58 | pci_read_config_byte(dev, AMD_ADDRESS_SETUP + offset, &t); |
96 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); | 59 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); |
97 | pci_write_config_byte(dev, AMD_ADDRESS_SETUP, t); | 60 | pci_write_config_byte(dev, AMD_ADDRESS_SETUP + offset, t); |
98 | 61 | ||
99 | pci_write_config_byte(dev, AMD_8BIT_TIMING + (1 - (dn >> 1)), | 62 | pci_write_config_byte(dev, AMD_8BIT_TIMING + offset + (1 - (dn >> 1)), |
100 | ((FIT(timing->act8b, 1, 16) - 1) << 4) | (FIT(timing->rec8b, 1, 16) - 1)); | 63 | ((FIT(timing->act8b, 1, 16) - 1) << 4) | (FIT(timing->rec8b, 1, 16) - 1)); |
101 | 64 | ||
102 | pci_write_config_byte(dev, AMD_DRIVE_TIMING + (3 - dn), | 65 | pci_write_config_byte(dev, AMD_DRIVE_TIMING + offset + (3 - dn), |
103 | ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); | 66 | ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); |
104 | 67 | ||
105 | switch (amd_config->udma_mask) { | 68 | switch (udma_mask) { |
106 | case ATA_UDMA2: t = timing->udma ? (0xc0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; | 69 | case ATA_UDMA2: t = timing->udma ? (0xc0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; |
107 | case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 2, 10)]) : 0x03; break; | 70 | case ATA_UDMA4: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 2, 10)]) : 0x03; break; |
108 | case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 1, 10)]) : 0x03; break; | 71 | case ATA_UDMA5: t = timing->udma ? (0xc0 | amd_cyc2udma[FIT(timing->udma, 1, 10)]) : 0x03; break; |
@@ -110,7 +73,7 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ide_timi | |||
110 | default: return; | 73 | default: return; |
111 | } | 74 | } |
112 | 75 | ||
113 | pci_write_config_byte(dev, AMD_UDMA_TIMING + (3 - dn), t); | 76 | pci_write_config_byte(dev, AMD_UDMA_TIMING + offset + (3 - dn), t); |
114 | } | 77 | } |
115 | 78 | ||
116 | /* | 79 | /* |
@@ -120,12 +83,15 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ide_timi | |||
120 | 83 | ||
121 | static void amd_set_drive(ide_drive_t *drive, const u8 speed) | 84 | static void amd_set_drive(ide_drive_t *drive, const u8 speed) |
122 | { | 85 | { |
123 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 86 | ide_hwif_t *hwif = drive->hwif; |
87 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
88 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); | ||
124 | struct ide_timing t, p; | 89 | struct ide_timing t, p; |
125 | int T, UT; | 90 | int T, UT; |
91 | u8 udma_mask = hwif->ultra_mask; | ||
126 | 92 | ||
127 | T = 1000000000 / amd_clock; | 93 | T = 1000000000 / amd_clock; |
128 | UT = (amd_config->udma_mask == ATA_UDMA2) ? T : (T / 2); | 94 | UT = (udma_mask == ATA_UDMA2) ? T : (T / 2); |
129 | 95 | ||
130 | ide_timing_compute(drive, speed, &t, T, UT); | 96 | ide_timing_compute(drive, speed, &t, T, UT); |
131 | 97 | ||
@@ -137,7 +103,7 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed) | |||
137 | if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1; | 103 | if (speed == XFER_UDMA_5 && amd_clock <= 33333) t.udma = 1; |
138 | if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15; | 104 | if (speed == XFER_UDMA_6 && amd_clock <= 33333) t.udma = 15; |
139 | 105 | ||
140 | amd_set_speed(HWIF(drive)->pci_dev, drive->dn, &t); | 106 | amd_set_speed(dev, drive->dn, udma_mask, &t); |
141 | } | 107 | } |
142 | 108 | ||
143 | /* | 109 | /* |
@@ -149,67 +115,68 @@ static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
149 | amd_set_drive(drive, XFER_PIO_0 + pio); | 115 | amd_set_drive(drive, XFER_PIO_0 + pio); |
150 | } | 116 | } |
151 | 117 | ||
152 | /* | 118 | static void __devinit amd7409_cable_detect(struct pci_dev *dev, |
153 | * The initialization callback. Here we determine the IDE chip type | 119 | const char *name) |
154 | * and initialize its drive independent registers. | 120 | { |
155 | */ | 121 | /* no host side cable detection */ |
122 | amd_80w = 0x03; | ||
123 | } | ||
156 | 124 | ||
157 | static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const char *name) | 125 | static void __devinit amd7411_cable_detect(struct pci_dev *dev, |
126 | const char *name) | ||
158 | { | 127 | { |
159 | unsigned char t; | ||
160 | unsigned int u; | ||
161 | int i; | 128 | int i; |
129 | u32 u = 0; | ||
130 | u8 t = 0, offset = amd_offset(dev); | ||
131 | |||
132 | pci_read_config_byte(dev, AMD_CABLE_DETECT + offset, &t); | ||
133 | pci_read_config_dword(dev, AMD_UDMA_TIMING + offset, &u); | ||
134 | amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0); | ||
135 | for (i = 24; i >= 0; i -= 8) | ||
136 | if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) { | ||
137 | printk(KERN_WARNING "%s: BIOS didn't set cable bits " | ||
138 | "correctly. Enabling workaround.\n", | ||
139 | name); | ||
140 | amd_80w |= (1 << (1 - (i >> 4))); | ||
141 | } | ||
142 | } | ||
162 | 143 | ||
163 | /* | 144 | /* |
164 | * Check for bad SWDMA. | 145 | * The initialization callback. Initialize drive independent registers. |
165 | */ | 146 | */ |
166 | 147 | ||
167 | if (amd_config->flags & AMD_CHECK_SWDMA) { | 148 | static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, |
168 | if (dev->revision <= 7) | 149 | const char *name) |
169 | amd_config->flags |= AMD_BAD_SWDMA; | 150 | { |
170 | } | 151 | u8 t = 0, offset = amd_offset(dev); |
171 | 152 | ||
172 | /* | 153 | /* |
173 | * Check 80-wire cable presence. | 154 | * Check 80-wire cable presence. |
174 | */ | 155 | */ |
175 | 156 | ||
176 | switch (amd_config->udma_mask) { | 157 | if (dev->vendor == PCI_VENDOR_ID_AMD && |
177 | 158 | dev->device == PCI_DEVICE_ID_AMD_COBRA_7401) | |
178 | case ATA_UDMA6: | 159 | ; /* no UDMA > 2 */ |
179 | case ATA_UDMA5: | 160 | else if (dev->vendor == PCI_VENDOR_ID_AMD && |
180 | pci_read_config_byte(dev, AMD_CABLE_DETECT, &t); | 161 | dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) |
181 | pci_read_config_dword(dev, AMD_UDMA_TIMING, &u); | 162 | amd7409_cable_detect(dev, name); |
182 | amd_80w = ((t & 0x3) ? 1 : 0) | ((t & 0xc) ? 2 : 0); | 163 | else |
183 | for (i = 24; i >= 0; i -= 8) | 164 | amd7411_cable_detect(dev, name); |
184 | if (((u >> i) & 4) && !(amd_80w & (1 << (1 - (i >> 4))))) { | ||
185 | printk(KERN_WARNING "%s: BIOS didn't set cable bits correctly. Enabling workaround.\n", | ||
186 | amd_chipset->name); | ||
187 | amd_80w |= (1 << (1 - (i >> 4))); | ||
188 | } | ||
189 | break; | ||
190 | |||
191 | case ATA_UDMA4: | ||
192 | /* no host side cable detection */ | ||
193 | amd_80w = 0x03; | ||
194 | break; | ||
195 | } | ||
196 | 165 | ||
197 | /* | 166 | /* |
198 | * Take care of prefetch & postwrite. | 167 | * Take care of prefetch & postwrite. |
199 | */ | 168 | */ |
200 | 169 | ||
201 | pci_read_config_byte(dev, AMD_IDE_CONFIG, &t); | 170 | pci_read_config_byte(dev, AMD_IDE_CONFIG + offset, &t); |
202 | pci_write_config_byte(dev, AMD_IDE_CONFIG, | 171 | /* |
203 | (amd_config->flags & AMD_BAD_FIFO) ? (t & 0x0f) : (t | 0xf0)); | 172 | * Check for broken FIFO support. |
204 | 173 | */ | |
205 | /* | 174 | if (dev->vendor == PCI_VENDOR_ID_AMD && |
206 | * Take care of incorrectly wired Serenade mainboards. | 175 | dev->vendor == PCI_DEVICE_ID_AMD_VIPER_7411) |
207 | */ | 176 | t &= 0x0f; |
208 | 177 | else | |
209 | if ((amd_config->flags & AMD_CHECK_SERENADE) && | 178 | t |= 0xf0; |
210 | dev->subsystem_vendor == PCI_VENDOR_ID_AMD && | 179 | pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t); |
211 | dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE) | ||
212 | amd_config->udma_mask = ATA_UDMA5; | ||
213 | 180 | ||
214 | /* | 181 | /* |
215 | * Determine the system bus clock. | 182 | * Determine the system bus clock. |
@@ -225,25 +192,19 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch | |||
225 | 192 | ||
226 | if (amd_clock < 20000 || amd_clock > 50000) { | 193 | if (amd_clock < 20000 || amd_clock > 50000) { |
227 | printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", | 194 | printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", |
228 | amd_chipset->name, amd_clock); | 195 | name, amd_clock); |
229 | amd_clock = 33333; | 196 | amd_clock = 33333; |
230 | } | 197 | } |
231 | 198 | ||
232 | /* | ||
233 | * Print the boot message. | ||
234 | */ | ||
235 | |||
236 | printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", | ||
237 | amd_chipset->name, pci_name(dev), dev->revision, | ||
238 | amd_dma[fls(amd_config->udma_mask) - 1]); | ||
239 | |||
240 | return dev->irq; | 199 | return dev->irq; |
241 | } | 200 | } |
242 | 201 | ||
243 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | 202 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) |
244 | { | 203 | { |
204 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
205 | |||
245 | if (hwif->irq == 0) /* 0 is bogus but will do for now */ | 206 | if (hwif->irq == 0) /* 0 is bogus but will do for now */ |
246 | hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); | 207 | hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel); |
247 | 208 | ||
248 | hwif->set_pio_mode = &amd_set_pio_mode; | 209 | hwif->set_pio_mode = &amd_set_pio_mode; |
249 | hwif->set_dma_mode = &amd_set_drive; | 210 | hwif->set_dma_mode = &amd_set_drive; |
@@ -251,10 +212,6 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
251 | if (!hwif->dma_base) | 212 | if (!hwif->dma_base) |
252 | return; | 213 | return; |
253 | 214 | ||
254 | hwif->ultra_mask = amd_config->udma_mask; | ||
255 | if (amd_config->flags & AMD_BAD_SWDMA) | ||
256 | hwif->swdma_mask = 0x00; | ||
257 | |||
258 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | 215 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { |
259 | if ((amd_80w >> hwif->channel) & 1) | 216 | if ((amd_80w >> hwif->channel) & 1) |
260 | hwif->cbl = ATA_CBL_PATA80; | 217 | hwif->cbl = ATA_CBL_PATA80; |
@@ -272,7 +229,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
272 | IDE_HFLAG_UNMASK_IRQS | \ | 229 | IDE_HFLAG_UNMASK_IRQS | \ |
273 | IDE_HFLAG_BOOTABLE) | 230 | IDE_HFLAG_BOOTABLE) |
274 | 231 | ||
275 | #define DECLARE_AMD_DEV(name_str) \ | 232 | #define DECLARE_AMD_DEV(name_str, swdma, udma) \ |
276 | { \ | 233 | { \ |
277 | .name = name_str, \ | 234 | .name = name_str, \ |
278 | .init_chipset = init_chipset_amd74xx, \ | 235 | .init_chipset = init_chipset_amd74xx, \ |
@@ -280,11 +237,12 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
280 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ | 237 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ |
281 | .host_flags = IDE_HFLAGS_AMD, \ | 238 | .host_flags = IDE_HFLAGS_AMD, \ |
282 | .pio_mask = ATA_PIO5, \ | 239 | .pio_mask = ATA_PIO5, \ |
283 | .swdma_mask = ATA_SWDMA2, \ | 240 | .swdma_mask = swdma, \ |
284 | .mwdma_mask = ATA_MWDMA2, \ | 241 | .mwdma_mask = ATA_MWDMA2, \ |
242 | .udma_mask = udma, \ | ||
285 | } | 243 | } |
286 | 244 | ||
287 | #define DECLARE_NV_DEV(name_str) \ | 245 | #define DECLARE_NV_DEV(name_str, udma) \ |
288 | { \ | 246 | { \ |
289 | .name = name_str, \ | 247 | .name = name_str, \ |
290 | .init_chipset = init_chipset_amd74xx, \ | 248 | .init_chipset = init_chipset_amd74xx, \ |
@@ -294,45 +252,62 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
294 | .pio_mask = ATA_PIO5, \ | 252 | .pio_mask = ATA_PIO5, \ |
295 | .swdma_mask = ATA_SWDMA2, \ | 253 | .swdma_mask = ATA_SWDMA2, \ |
296 | .mwdma_mask = ATA_MWDMA2, \ | 254 | .mwdma_mask = ATA_MWDMA2, \ |
255 | .udma_mask = udma, \ | ||
297 | } | 256 | } |
298 | 257 | ||
299 | static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { | 258 | static const struct ide_port_info amd74xx_chipsets[] __devinitdata = { |
300 | /* 0 */ DECLARE_AMD_DEV("AMD7401"), | 259 | /* 0 */ DECLARE_AMD_DEV("AMD7401", 0x00, ATA_UDMA2), |
301 | /* 1 */ DECLARE_AMD_DEV("AMD7409"), | 260 | /* 1 */ DECLARE_AMD_DEV("AMD7409", ATA_SWDMA2, ATA_UDMA4), |
302 | /* 2 */ DECLARE_AMD_DEV("AMD7411"), | 261 | /* 2 */ DECLARE_AMD_DEV("AMD7411", ATA_SWDMA2, ATA_UDMA5), |
303 | /* 3 */ DECLARE_AMD_DEV("AMD7441"), | 262 | /* 3 */ DECLARE_AMD_DEV("AMD7441", ATA_SWDMA2, ATA_UDMA5), |
304 | /* 4 */ DECLARE_AMD_DEV("AMD8111"), | 263 | /* 4 */ DECLARE_AMD_DEV("AMD8111", ATA_SWDMA2, ATA_UDMA6), |
305 | 264 | ||
306 | /* 5 */ DECLARE_NV_DEV("NFORCE"), | 265 | /* 5 */ DECLARE_NV_DEV("NFORCE", ATA_UDMA5), |
307 | /* 6 */ DECLARE_NV_DEV("NFORCE2"), | 266 | /* 6 */ DECLARE_NV_DEV("NFORCE2", ATA_UDMA6), |
308 | /* 7 */ DECLARE_NV_DEV("NFORCE2-U400R"), | 267 | /* 7 */ DECLARE_NV_DEV("NFORCE2-U400R", ATA_UDMA6), |
309 | /* 8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA"), | 268 | /* 8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA", ATA_UDMA6), |
310 | /* 9 */ DECLARE_NV_DEV("NFORCE3-150"), | 269 | /* 9 */ DECLARE_NV_DEV("NFORCE3-150", ATA_UDMA6), |
311 | /* 10 */ DECLARE_NV_DEV("NFORCE3-250"), | 270 | /* 10 */ DECLARE_NV_DEV("NFORCE3-250", ATA_UDMA6), |
312 | /* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA"), | 271 | /* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA", ATA_UDMA6), |
313 | /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2"), | 272 | /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2", ATA_UDMA6), |
314 | /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"), | 273 | /* 13 */ DECLARE_NV_DEV("NFORCE-CK804", ATA_UDMA6), |
315 | /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"), | 274 | /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04", ATA_UDMA6), |
316 | /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"), | 275 | /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51", ATA_UDMA6), |
317 | /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55"), | 276 | /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55", ATA_UDMA6), |
318 | /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"), | 277 | /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61", ATA_UDMA6), |
319 | /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65"), | 278 | /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65", ATA_UDMA6), |
320 | /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67"), | 279 | /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67", ATA_UDMA6), |
321 | /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73"), | 280 | /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73", ATA_UDMA6), |
322 | /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77"), | 281 | /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77", ATA_UDMA6), |
323 | /* 22 */ DECLARE_AMD_DEV("AMD5536"), | 282 | |
283 | /* 22 */ DECLARE_AMD_DEV("AMD5536", ATA_SWDMA2, ATA_UDMA5), | ||
324 | }; | 284 | }; |
325 | 285 | ||
326 | static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) | 286 | static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) |
327 | { | 287 | { |
328 | amd_chipset = amd74xx_chipsets + id->driver_data; | 288 | struct ide_port_info d; |
329 | amd_config = amd_ide_chips + id->driver_data; | 289 | u8 idx = id->driver_data; |
330 | if (dev->device != amd_config->id) { | 290 | |
331 | printk(KERN_ERR "%s: assertion 0x%02x == 0x%02x failed !\n", | 291 | d = amd74xx_chipsets[idx]; |
332 | pci_name(dev), dev->device, amd_config->id); | 292 | |
333 | return -ENODEV; | 293 | /* |
294 | * Check for bad SWDMA and incorrectly wired Serenade mainboards. | ||
295 | */ | ||
296 | if (idx == 1) { | ||
297 | if (dev->revision <= 7) | ||
298 | d.swdma_mask = 0; | ||
299 | d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; | ||
300 | } else if (idx == 4) { | ||
301 | if (dev->subsystem_vendor == PCI_VENDOR_ID_AMD && | ||
302 | dev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE) | ||
303 | d.udma_mask = ATA_UDMA5; | ||
334 | } | 304 | } |
335 | return ide_setup_pci_device(dev, amd_chipset); | 305 | |
306 | printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", | ||
307 | d.name, pci_name(dev), dev->revision, | ||
308 | amd_dma[fls(d.udma_mask) - 1]); | ||
309 | |||
310 | return ide_setup_pci_device(dev, &d); | ||
336 | } | 311 | } |
337 | 312 | ||
338 | static const struct pci_device_id amd74xx_pci_tbl[] = { | 313 | static const struct pci_device_id amd74xx_pci_tbl[] = { |
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 491871984aaa..b56274af1782 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/atiixp.c Version 0.05 Nov 9 2007 | ||
3 | * | ||
4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> | 2 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> |
5 | * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz | 3 | * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz |
6 | */ | 4 | */ |
@@ -55,7 +53,7 @@ static DEFINE_SPINLOCK(atiixp_lock); | |||
55 | 53 | ||
56 | static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) | 54 | static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) |
57 | { | 55 | { |
58 | struct pci_dev *dev = drive->hwif->pci_dev; | 56 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
59 | unsigned long flags; | 57 | unsigned long flags; |
60 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 58 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; |
61 | u32 pio_timing_data; | 59 | u32 pio_timing_data; |
@@ -88,7 +86,7 @@ static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
88 | 86 | ||
89 | static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | 87 | static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) |
90 | { | 88 | { |
91 | struct pci_dev *dev = drive->hwif->pci_dev; | 89 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
92 | unsigned long flags; | 90 | unsigned long flags; |
93 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 91 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; |
94 | u32 tmp32; | 92 | u32 tmp32; |
@@ -133,9 +131,8 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
133 | 131 | ||
134 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | 132 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) |
135 | { | 133 | { |
136 | u8 udma_mode = 0; | 134 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
137 | u8 ch = hwif->channel; | 135 | u8 udma_mode = 0, ch = hwif->channel; |
138 | struct pci_dev *pdev = hwif->pci_dev; | ||
139 | 136 | ||
140 | hwif->set_pio_mode = &atiixp_set_pio_mode; | 137 | hwif->set_pio_mode = &atiixp_set_pio_mode; |
141 | hwif->set_dma_mode = &atiixp_set_dma_mode; | 138 | hwif->set_dma_mode = &atiixp_set_dma_mode; |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index da3565e0071f..7240c20b9593 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996 | ||
3 | * | ||
4 | * Copyright (C) 1995-1996 Linus Torvalds & authors (see below) | 2 | * Copyright (C) 1995-1996 Linus Torvalds & authors (see below) |
5 | */ | 3 | */ |
6 | 4 | ||
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index cd4eb9def151..04aa9e59670e 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cmd64x.c Version 1.53 Dec 24, 2007 | ||
3 | * | ||
4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 2 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
5 | * Due to massive hardware bugs, UltraDMA is only supported | 3 | * Due to massive hardware bugs, UltraDMA is only supported |
6 | * on the 646U2 and not on the 646U. | 4 | * on the 646U2 and not on the 646U. |
@@ -71,7 +69,7 @@ static u8 quantize_timing(int timing, int quant) | |||
71 | */ | 69 | */ |
72 | static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time) | 70 | static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time) |
73 | { | 71 | { |
74 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 72 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
75 | int clock_time = 1000 / system_bus_clock(); | 73 | int clock_time = 1000 / system_bus_clock(); |
76 | u8 cycle_count, active_count, recovery_count, drwtim; | 74 | u8 cycle_count, active_count, recovery_count, drwtim; |
77 | static const u8 recovery_values[] = | 75 | static const u8 recovery_values[] = |
@@ -118,7 +116,7 @@ static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_ | |||
118 | static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio) | 116 | static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio) |
119 | { | 117 | { |
120 | ide_hwif_t *hwif = HWIF(drive); | 118 | ide_hwif_t *hwif = HWIF(drive); |
121 | struct pci_dev *dev = hwif->pci_dev; | 119 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
122 | unsigned int cycle_time; | 120 | unsigned int cycle_time; |
123 | u8 setup_count, arttim = 0; | 121 | u8 setup_count, arttim = 0; |
124 | 122 | ||
@@ -183,7 +181,7 @@ static void cmd64x_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
183 | static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) | 181 | static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed) |
184 | { | 182 | { |
185 | ide_hwif_t *hwif = HWIF(drive); | 183 | ide_hwif_t *hwif = HWIF(drive); |
186 | struct pci_dev *dev = hwif->pci_dev; | 184 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
187 | u8 unit = drive->dn & 0x01; | 185 | u8 unit = drive->dn & 0x01; |
188 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; | 186 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; |
189 | 187 | ||
@@ -245,7 +243,7 @@ static int cmd648_ide_dma_end (ide_drive_t *drive) | |||
245 | static int cmd64x_ide_dma_end (ide_drive_t *drive) | 243 | static int cmd64x_ide_dma_end (ide_drive_t *drive) |
246 | { | 244 | { |
247 | ide_hwif_t *hwif = HWIF(drive); | 245 | ide_hwif_t *hwif = HWIF(drive); |
248 | struct pci_dev *dev = hwif->pci_dev; | 246 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
249 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; | 247 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; |
250 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : | 248 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : |
251 | CFR_INTR_CH0; | 249 | CFR_INTR_CH0; |
@@ -285,7 +283,7 @@ static int cmd648_ide_dma_test_irq (ide_drive_t *drive) | |||
285 | static int cmd64x_ide_dma_test_irq (ide_drive_t *drive) | 283 | static int cmd64x_ide_dma_test_irq (ide_drive_t *drive) |
286 | { | 284 | { |
287 | ide_hwif_t *hwif = HWIF(drive); | 285 | ide_hwif_t *hwif = HWIF(drive); |
288 | struct pci_dev *dev = hwif->pci_dev; | 286 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
289 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; | 287 | int irq_reg = hwif->channel ? ARTTIM23 : CFR; |
290 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : | 288 | u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : |
291 | CFR_INTR_CH0; | 289 | CFR_INTR_CH0; |
@@ -375,7 +373,7 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha | |||
375 | 373 | ||
376 | static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif) | 374 | static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif) |
377 | { | 375 | { |
378 | struct pci_dev *dev = hwif->pci_dev; | 376 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
379 | u8 bmidecsr = 0, mask = hwif->channel ? 0x02 : 0x01; | 377 | u8 bmidecsr = 0, mask = hwif->channel ? 0x02 : 0x01; |
380 | 378 | ||
381 | switch (dev->device) { | 379 | switch (dev->device) { |
@@ -390,7 +388,7 @@ static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif) | |||
390 | 388 | ||
391 | static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | 389 | static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) |
392 | { | 390 | { |
393 | struct pci_dev *dev = hwif->pci_dev; | 391 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
394 | 392 | ||
395 | hwif->set_pio_mode = &cmd64x_set_pio_mode; | 393 | hwif->set_pio_mode = &cmd64x_set_pio_mode; |
396 | hwif->set_dma_mode = &cmd64x_set_dma_mode; | 394 | hwif->set_dma_mode = &cmd64x_set_dma_mode; |
@@ -443,7 +441,9 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { | |||
443 | .init_chipset = init_chipset_cmd64x, | 441 | .init_chipset = init_chipset_cmd64x, |
444 | .init_hwif = init_hwif_cmd64x, | 442 | .init_hwif = init_hwif_cmd64x, |
445 | .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, | 443 | .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, |
446 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, | 444 | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | |
445 | IDE_HFLAG_ABUSE_PREFETCH | | ||
446 | IDE_HFLAG_BOOTABLE, | ||
447 | .pio_mask = ATA_PIO5, | 447 | .pio_mask = ATA_PIO5, |
448 | .mwdma_mask = ATA_MWDMA2, | 448 | .mwdma_mask = ATA_MWDMA2, |
449 | .udma_mask = 0x00, /* no udma */ | 449 | .udma_mask = 0x00, /* no udma */ |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 6ec00b8d7ec1..9e01c6dc758e 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -69,7 +69,7 @@ static struct pio_clocks cs5520_pio_clocks[]={ | |||
69 | static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) | 69 | static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) |
70 | { | 70 | { |
71 | ide_hwif_t *hwif = HWIF(drive); | 71 | ide_hwif_t *hwif = HWIF(drive); |
72 | struct pci_dev *pdev = hwif->pci_dev; | 72 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
73 | int controller = drive->dn > 1 ? 1 : 0; | 73 | int controller = drive->dn > 1 ? 1 : 0; |
74 | 74 | ||
75 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ | 75 | /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index df5966b33460..765aac397ced 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cs5530.c Version 0.77 Sep 24 2007 | ||
3 | * | ||
4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> | 3 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> |
6 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 4 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 50b3d7791f55..66433aa53f59 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cs5535.c | ||
3 | * | ||
4 | * Copyright (C) 2004-2005 Advanced Micro Devices, Inc. | 2 | * Copyright (C) 2004-2005 Advanced Micro Devices, Inc. |
5 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 3 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * | 4 | * |
@@ -177,13 +175,15 @@ static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) | |||
177 | */ | 175 | */ |
178 | static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) | 176 | static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) |
179 | { | 177 | { |
178 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
179 | |||
180 | hwif->set_pio_mode = &cs5535_set_pio_mode; | 180 | hwif->set_pio_mode = &cs5535_set_pio_mode; |
181 | hwif->set_dma_mode = &cs5535_set_dma_mode; | 181 | hwif->set_dma_mode = &cs5535_set_dma_mode; |
182 | 182 | ||
183 | if (hwif->dma_base == 0) | 183 | if (hwif->dma_base == 0) |
184 | return; | 184 | return; |
185 | 185 | ||
186 | hwif->cbl = cs5535_cable_detect(hwif->pci_dev); | 186 | hwif->cbl = cs5535_cable_detect(dev); |
187 | } | 187 | } |
188 | 188 | ||
189 | static const struct ide_port_info cs5535_chipset __devinitdata = { | 189 | static const struct ide_port_info cs5535_chipset __devinitdata = { |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 3ec4c659a37d..50100ac8770f 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cy82c693.c Version 0.44 Nov 8, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer | 2 | * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer |
5 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator | 3 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator |
6 | * | 4 | * |
@@ -228,7 +226,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
228 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) | 226 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) |
229 | { | 227 | { |
230 | ide_hwif_t *hwif = HWIF(drive); | 228 | ide_hwif_t *hwif = HWIF(drive); |
231 | struct pci_dev *dev = hwif->pci_dev; | 229 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
232 | pio_clocks_t pclk; | 230 | pio_clocks_t pclk; |
233 | unsigned int addrCtrl; | 231 | unsigned int addrCtrl; |
234 | 232 | ||
@@ -397,8 +395,9 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) | |||
397 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) | 395 | static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) |
398 | { | 396 | { |
399 | static ide_hwif_t *primary; | 397 | static ide_hwif_t *primary; |
398 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
400 | 399 | ||
401 | if (PCI_FUNC(hwif->pci_dev->devfn) == 1) | 400 | if (PCI_FUNC(dev->devfn) == 1) |
402 | primary = hwif; | 401 | primary = hwif; |
403 | else { | 402 | else { |
404 | hwif->mate = primary; | 403 | hwif->mate = primary; |
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 26aa492071bb..27e47fc97100 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/delkin_cb.c | ||
3 | * | ||
4 | * Created 20 Oct 2004 by Mark Lord | 2 | * Created 20 Oct 2004 by Mark Lord |
5 | * | 3 | * |
6 | * Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter | 4 | * Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter |
@@ -87,7 +85,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
87 | return -ENODEV; | 85 | return -ENODEV; |
88 | } | 86 | } |
89 | pci_set_drvdata(dev, hwif); | 87 | pci_set_drvdata(dev, hwif); |
90 | hwif->pci_dev = dev; | 88 | hwif->dev = &dev->dev; |
91 | drive = &hwif->drives[0]; | 89 | drive = &hwif->drives[0]; |
92 | if (drive->present) { | 90 | if (drive->present) { |
93 | drive->io_32bit = 1; | 91 | drive->io_32bit = 1; |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 06885697ed7b..59ebe84f1053 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/generic.c Version 0.11 December 30, 2002 | ||
3 | * | ||
4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com> | 3 | * Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com> |
6 | * | 4 | * |
@@ -104,7 +102,8 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = { | |||
104 | 102 | ||
105 | { /* 14 */ | 103 | { /* 14 */ |
106 | .name = "Revolution", | 104 | .name = "Revolution", |
107 | .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 105 | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | |
106 | IDE_HFLAG_TRUST_BIOS_FOR_DMA | | ||
108 | IDE_HFLAG_OFF_BOARD, | 107 | IDE_HFLAG_OFF_BOARD, |
109 | .swdma_mask = ATA_SWDMA2, | 108 | .swdma_mask = ATA_SWDMA2, |
110 | .mwdma_mask = ATA_MWDMA2, | 109 | .mwdma_mask = ATA_MWDMA2, |
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index dfba0d13fcd3..25dbb814822d 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/hpt34x.c Version 0.40 Sept 10, 2002 | ||
3 | * | ||
4 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
3 | * | ||
5 | * May be copied or modified under the terms of the GNU General Public License | 4 | * May be copied or modified under the terms of the GNU General Public License |
6 | * | 5 | * |
7 | * | 6 | * |
@@ -45,7 +44,7 @@ | |||
45 | 44 | ||
46 | static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) | 45 | static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) |
47 | { | 46 | { |
48 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 47 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
49 | u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0; | 48 | u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0; |
50 | u8 hi_speed, lo_speed; | 49 | u8 hi_speed, lo_speed; |
51 | 50 | ||
@@ -131,6 +130,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) | |||
131 | 130 | ||
132 | #define IDE_HFLAGS_HPT34X \ | 131 | #define IDE_HFLAGS_HPT34X \ |
133 | (IDE_HFLAG_NO_ATAPI_DMA | \ | 132 | (IDE_HFLAG_NO_ATAPI_DMA | \ |
133 | IDE_HFLAG_NO_DSC | \ | ||
134 | IDE_HFLAG_ABUSE_SET_DMA_MODE | \ | 134 | IDE_HFLAG_ABUSE_SET_DMA_MODE | \ |
135 | IDE_HFLAG_NO_AUTODMA) | 135 | IDE_HFLAG_NO_AUTODMA) |
136 | 136 | ||
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 12685939a813..5623cad569da 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/hpt366.c Version 1.30 Dec 12, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 3 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
6 | * Portions Copyright (C) 2003 Red Hat Inc | 4 | * Portions Copyright (C) 2003 Red Hat Inc |
@@ -626,7 +624,8 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list) | |||
626 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) | 624 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) |
627 | { | 625 | { |
628 | ide_hwif_t *hwif = HWIF(drive); | 626 | ide_hwif_t *hwif = HWIF(drive); |
629 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | 627 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
628 | struct hpt_info *info = pci_get_drvdata(dev); | ||
630 | u8 mask = hwif->ultra_mask; | 629 | u8 mask = hwif->ultra_mask; |
631 | 630 | ||
632 | switch (info->chip_type) { | 631 | switch (info->chip_type) { |
@@ -665,7 +664,8 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive) | |||
665 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) | 664 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) |
666 | { | 665 | { |
667 | ide_hwif_t *hwif = HWIF(drive); | 666 | ide_hwif_t *hwif = HWIF(drive); |
668 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | 667 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
668 | struct hpt_info *info = pci_get_drvdata(dev); | ||
669 | 669 | ||
670 | switch (info->chip_type) { | 670 | switch (info->chip_type) { |
671 | case HPT372 : | 671 | case HPT372 : |
@@ -699,7 +699,7 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info) | |||
699 | 699 | ||
700 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | 700 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) |
701 | { | 701 | { |
702 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 702 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
703 | struct hpt_info *info = pci_get_drvdata(dev); | 703 | struct hpt_info *info = pci_get_drvdata(dev); |
704 | struct hpt_timings *t = info->timings; | 704 | struct hpt_timings *t = info->timings; |
705 | u8 itr_addr = 0x40 + (drive->dn * 4); | 705 | u8 itr_addr = 0x40 + (drive->dn * 4); |
@@ -742,7 +742,7 @@ static void hpt3xx_quirkproc(ide_drive_t *drive) | |||
742 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | 742 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) |
743 | { | 743 | { |
744 | ide_hwif_t *hwif = HWIF(drive); | 744 | ide_hwif_t *hwif = HWIF(drive); |
745 | struct pci_dev *dev = hwif->pci_dev; | 745 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
746 | struct hpt_info *info = pci_get_drvdata(dev); | 746 | struct hpt_info *info = pci_get_drvdata(dev); |
747 | 747 | ||
748 | if (drive->quirk_list) { | 748 | if (drive->quirk_list) { |
@@ -774,7 +774,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | |||
774 | */ | 774 | */ |
775 | static void hpt366_dma_lost_irq(ide_drive_t *drive) | 775 | static void hpt366_dma_lost_irq(ide_drive_t *drive) |
776 | { | 776 | { |
777 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 777 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
778 | u8 mcr1 = 0, mcr3 = 0, scr1 = 0; | 778 | u8 mcr1 = 0, mcr3 = 0, scr1 = 0; |
779 | 779 | ||
780 | pci_read_config_byte(dev, 0x50, &mcr1); | 780 | pci_read_config_byte(dev, 0x50, &mcr1); |
@@ -790,18 +790,20 @@ static void hpt366_dma_lost_irq(ide_drive_t *drive) | |||
790 | static void hpt370_clear_engine(ide_drive_t *drive) | 790 | static void hpt370_clear_engine(ide_drive_t *drive) |
791 | { | 791 | { |
792 | ide_hwif_t *hwif = HWIF(drive); | 792 | ide_hwif_t *hwif = HWIF(drive); |
793 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
793 | 794 | ||
794 | pci_write_config_byte(hwif->pci_dev, hwif->select_data, 0x37); | 795 | pci_write_config_byte(dev, hwif->select_data, 0x37); |
795 | udelay(10); | 796 | udelay(10); |
796 | } | 797 | } |
797 | 798 | ||
798 | static void hpt370_irq_timeout(ide_drive_t *drive) | 799 | static void hpt370_irq_timeout(ide_drive_t *drive) |
799 | { | 800 | { |
800 | ide_hwif_t *hwif = HWIF(drive); | 801 | ide_hwif_t *hwif = HWIF(drive); |
802 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
801 | u16 bfifo = 0; | 803 | u16 bfifo = 0; |
802 | u8 dma_cmd; | 804 | u8 dma_cmd; |
803 | 805 | ||
804 | pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); | 806 | pci_read_config_word(dev, hwif->select_data + 2, &bfifo); |
805 | printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); | 807 | printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); |
806 | 808 | ||
807 | /* get DMA command mode */ | 809 | /* get DMA command mode */ |
@@ -844,10 +846,11 @@ static void hpt370_dma_timeout(ide_drive_t *drive) | |||
844 | static int hpt374_ide_dma_test_irq(ide_drive_t *drive) | 846 | static int hpt374_ide_dma_test_irq(ide_drive_t *drive) |
845 | { | 847 | { |
846 | ide_hwif_t *hwif = HWIF(drive); | 848 | ide_hwif_t *hwif = HWIF(drive); |
849 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
847 | u16 bfifo = 0; | 850 | u16 bfifo = 0; |
848 | u8 dma_stat; | 851 | u8 dma_stat; |
849 | 852 | ||
850 | pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); | 853 | pci_read_config_word(dev, hwif->select_data + 2, &bfifo); |
851 | if (bfifo & 0x1FF) { | 854 | if (bfifo & 0x1FF) { |
852 | // printk("%s: %d bytes in FIFO\n", drive->name, bfifo); | 855 | // printk("%s: %d bytes in FIFO\n", drive->name, bfifo); |
853 | return 0; | 856 | return 0; |
@@ -867,7 +870,7 @@ static int hpt374_ide_dma_test_irq(ide_drive_t *drive) | |||
867 | static int hpt374_ide_dma_end(ide_drive_t *drive) | 870 | static int hpt374_ide_dma_end(ide_drive_t *drive) |
868 | { | 871 | { |
869 | ide_hwif_t *hwif = HWIF(drive); | 872 | ide_hwif_t *hwif = HWIF(drive); |
870 | struct pci_dev *dev = hwif->pci_dev; | 873 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
871 | u8 mcr = 0, mcr_addr = hwif->select_data; | 874 | u8 mcr = 0, mcr_addr = hwif->select_data; |
872 | u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; | 875 | u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; |
873 | 876 | ||
@@ -942,7 +945,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq) | |||
942 | static int hpt3xx_busproc(ide_drive_t *drive, int state) | 945 | static int hpt3xx_busproc(ide_drive_t *drive, int state) |
943 | { | 946 | { |
944 | ide_hwif_t *hwif = HWIF(drive); | 947 | ide_hwif_t *hwif = HWIF(drive); |
945 | struct pci_dev *dev = hwif->pci_dev; | 948 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
946 | u8 mcr_addr = hwif->select_data + 2; | 949 | u8 mcr_addr = hwif->select_data + 2; |
947 | u8 resetmask = hwif->channel ? 0x80 : 0x40; | 950 | u8 resetmask = hwif->channel ? 0x80 : 0x40; |
948 | u8 bsr2 = 0; | 951 | u8 bsr2 = 0; |
@@ -1278,7 +1281,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1278 | 1281 | ||
1279 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | 1282 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) |
1280 | { | 1283 | { |
1281 | struct pci_dev *dev = hwif->pci_dev; | 1284 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1282 | struct hpt_info *info = pci_get_drvdata(dev); | 1285 | struct hpt_info *info = pci_get_drvdata(dev); |
1283 | int serialize = HPT_SERIALIZE_IO; | 1286 | int serialize = HPT_SERIALIZE_IO; |
1284 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; | 1287 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; |
@@ -1393,7 +1396,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
1393 | 1396 | ||
1394 | static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) | 1397 | static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) |
1395 | { | 1398 | { |
1396 | struct pci_dev *dev = hwif->pci_dev; | 1399 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1397 | u8 masterdma = 0, slavedma = 0; | 1400 | u8 masterdma = 0, slavedma = 0; |
1398 | u8 dma_new = 0, dma_old = 0; | 1401 | u8 dma_new = 0, dma_old = 0; |
1399 | unsigned long flags; | 1402 | unsigned long flags; |
@@ -1413,7 +1416,7 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) | |||
1413 | 1416 | ||
1414 | local_irq_restore(flags); | 1417 | local_irq_restore(flags); |
1415 | 1418 | ||
1416 | ide_setup_dma(hwif, dmabase, 8); | 1419 | ide_setup_dma(hwif, dmabase); |
1417 | } | 1420 | } |
1418 | 1421 | ||
1419 | static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2) | 1422 | static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2) |
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 2a0f45c4f4c4..df74e588a530 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -28,7 +28,7 @@ | |||
28 | static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) | 28 | static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) |
29 | { | 29 | { |
30 | ide_hwif_t *hwif = HWIF(drive); | 30 | ide_hwif_t *hwif = HWIF(drive); |
31 | struct pci_dev *dev = hwif->pci_dev; | 31 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
32 | int is_slave = drive->dn & 1; | 32 | int is_slave = drive->dn & 1; |
33 | int master_port = 0x40; | 33 | int master_port = 0x40; |
34 | int slave_port = 0x44; | 34 | int slave_port = 0x44; |
@@ -85,7 +85,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
85 | static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | 85 | static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) |
86 | { | 86 | { |
87 | ide_hwif_t *hwif = HWIF(drive); | 87 | ide_hwif_t *hwif = HWIF(drive); |
88 | struct pci_dev *dev = hwif->pci_dev; | 88 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
89 | u8 maslave = 0x40; | 89 | u8 maslave = 0x40; |
90 | int a_speed = 3 << (drive->dn * 4); | 90 | int a_speed = 3 << (drive->dn * 4); |
91 | int u_flag = 1 << drive->dn; | 91 | int u_flag = 1 << drive->dn; |
@@ -152,6 +152,7 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
152 | 152 | ||
153 | static void __devinit init_hwif_it8213(ide_hwif_t *hwif) | 153 | static void __devinit init_hwif_it8213(ide_hwif_t *hwif) |
154 | { | 154 | { |
155 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
155 | u8 reg42h = 0; | 156 | u8 reg42h = 0; |
156 | 157 | ||
157 | hwif->set_dma_mode = &it8213_set_dma_mode; | 158 | hwif->set_dma_mode = &it8213_set_dma_mode; |
@@ -160,7 +161,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif) | |||
160 | if (!hwif->dma_base) | 161 | if (!hwif->dma_base) |
161 | return; | 162 | return; |
162 | 163 | ||
163 | pci_read_config_byte(hwif->pci_dev, 0x42, ®42h); | 164 | pci_read_config_byte(dev, 0x42, ®42h); |
164 | 165 | ||
165 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 166 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
166 | hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 167 | hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index e610a5340fdc..938d35f35c81 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -1,7 +1,4 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * linux/drivers/ide/pci/it821x.c Version 0.16 Jul 3 2007 | ||
4 | * | ||
5 | * Copyright (C) 2004 Red Hat <alan@redhat.com> | 2 | * Copyright (C) 2004 Red Hat <alan@redhat.com> |
6 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 3 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
7 | * | 4 | * |
@@ -113,7 +110,8 @@ static int it8212_noraid; | |||
113 | 110 | ||
114 | static void it821x_program(ide_drive_t *drive, u16 timing) | 111 | static void it821x_program(ide_drive_t *drive, u16 timing) |
115 | { | 112 | { |
116 | ide_hwif_t *hwif = drive->hwif; | 113 | ide_hwif_t *hwif = drive->hwif; |
114 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
117 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 115 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
118 | int channel = hwif->channel; | 116 | int channel = hwif->channel; |
119 | u8 conf; | 117 | u8 conf; |
@@ -123,7 +121,8 @@ static void it821x_program(ide_drive_t *drive, u16 timing) | |||
123 | conf = timing >> 8; | 121 | conf = timing >> 8; |
124 | else | 122 | else |
125 | conf = timing & 0xFF; | 123 | conf = timing & 0xFF; |
126 | pci_write_config_byte(hwif->pci_dev, 0x54 + 4 * channel, conf); | 124 | |
125 | pci_write_config_byte(dev, 0x54 + 4 * channel, conf); | ||
127 | } | 126 | } |
128 | 127 | ||
129 | /** | 128 | /** |
@@ -137,7 +136,8 @@ static void it821x_program(ide_drive_t *drive, u16 timing) | |||
137 | 136 | ||
138 | static void it821x_program_udma(ide_drive_t *drive, u16 timing) | 137 | static void it821x_program_udma(ide_drive_t *drive, u16 timing) |
139 | { | 138 | { |
140 | ide_hwif_t *hwif = drive->hwif; | 139 | ide_hwif_t *hwif = drive->hwif; |
140 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
141 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 141 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
142 | int channel = hwif->channel; | 142 | int channel = hwif->channel; |
143 | int unit = drive->select.b.unit; | 143 | int unit = drive->select.b.unit; |
@@ -148,11 +148,12 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing) | |||
148 | conf = timing >> 8; | 148 | conf = timing >> 8; |
149 | else | 149 | else |
150 | conf = timing & 0xFF; | 150 | conf = timing & 0xFF; |
151 | if(itdev->timing10 == 0) | 151 | |
152 | pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel + unit, conf); | 152 | if (itdev->timing10 == 0) |
153 | pci_write_config_byte(dev, 0x56 + 4 * channel + unit, conf); | ||
153 | else { | 154 | else { |
154 | pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel, conf); | 155 | pci_write_config_byte(dev, 0x56 + 4 * channel, conf); |
155 | pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel + 1, conf); | 156 | pci_write_config_byte(dev, 0x56 + 4 * channel + 1, conf); |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
@@ -167,6 +168,7 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing) | |||
167 | static void it821x_clock_strategy(ide_drive_t *drive) | 168 | static void it821x_clock_strategy(ide_drive_t *drive) |
168 | { | 169 | { |
169 | ide_hwif_t *hwif = drive->hwif; | 170 | ide_hwif_t *hwif = drive->hwif; |
171 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
170 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 172 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
171 | 173 | ||
172 | u8 unit = drive->select.b.unit; | 174 | u8 unit = drive->select.b.unit; |
@@ -205,10 +207,11 @@ static void it821x_clock_strategy(ide_drive_t *drive) | |||
205 | itdev->clock_mode = ATA_50; | 207 | itdev->clock_mode = ATA_50; |
206 | sel = 1; | 208 | sel = 1; |
207 | } | 209 | } |
208 | pci_read_config_byte(hwif->pci_dev, 0x50, &v); | 210 | |
211 | pci_read_config_byte(dev, 0x50, &v); | ||
209 | v &= ~(1 << (1 + hwif->channel)); | 212 | v &= ~(1 << (1 + hwif->channel)); |
210 | v |= sel << (1 + hwif->channel); | 213 | v |= sel << (1 + hwif->channel); |
211 | pci_write_config_byte(hwif->pci_dev, 0x50, v); | 214 | pci_write_config_byte(dev, 0x50, v); |
212 | 215 | ||
213 | /* | 216 | /* |
214 | * Reprogram the UDMA/PIO of the pair drive for the switch | 217 | * Reprogram the UDMA/PIO of the pair drive for the switch |
@@ -282,7 +285,8 @@ static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
282 | 285 | ||
283 | static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | 286 | static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) |
284 | { | 287 | { |
285 | ide_hwif_t *hwif = drive->hwif; | 288 | ide_hwif_t *hwif = drive->hwif; |
289 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
286 | struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); | 290 | struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); |
287 | int unit = drive->select.b.unit; | 291 | int unit = drive->select.b.unit; |
288 | int channel = hwif->channel; | 292 | int channel = hwif->channel; |
@@ -297,12 +301,12 @@ static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | |||
297 | itdev->udma[unit] = UDMA_OFF; | 301 | itdev->udma[unit] = UDMA_OFF; |
298 | 302 | ||
299 | /* UDMA bits off - Revision 0x10 do them in pairs */ | 303 | /* UDMA bits off - Revision 0x10 do them in pairs */ |
300 | pci_read_config_byte(hwif->pci_dev, 0x50, &conf); | 304 | pci_read_config_byte(dev, 0x50, &conf); |
301 | if(itdev->timing10) | 305 | if (itdev->timing10) |
302 | conf |= channel ? 0x60: 0x18; | 306 | conf |= channel ? 0x60: 0x18; |
303 | else | 307 | else |
304 | conf |= 1 << (3 + 2 * channel + unit); | 308 | conf |= 1 << (3 + 2 * channel + unit); |
305 | pci_write_config_byte(hwif->pci_dev, 0x50, conf); | 309 | pci_write_config_byte(dev, 0x50, conf); |
306 | 310 | ||
307 | it821x_clock_strategy(drive); | 311 | it821x_clock_strategy(drive); |
308 | /* FIXME: do we need to program this ? */ | 312 | /* FIXME: do we need to program this ? */ |
@@ -320,7 +324,8 @@ static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) | |||
320 | 324 | ||
321 | static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) | 325 | static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) |
322 | { | 326 | { |
323 | ide_hwif_t *hwif = drive->hwif; | 327 | ide_hwif_t *hwif = drive->hwif; |
328 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
324 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 329 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
325 | int unit = drive->select.b.unit; | 330 | int unit = drive->select.b.unit; |
326 | int channel = hwif->channel; | 331 | int channel = hwif->channel; |
@@ -337,12 +342,12 @@ static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) | |||
337 | itdev->udma[unit] |= 0x8080; /* UDMA 5/6 select on */ | 342 | itdev->udma[unit] |= 0x8080; /* UDMA 5/6 select on */ |
338 | 343 | ||
339 | /* UDMA on. Again revision 0x10 must do the pair */ | 344 | /* UDMA on. Again revision 0x10 must do the pair */ |
340 | pci_read_config_byte(hwif->pci_dev, 0x50, &conf); | 345 | pci_read_config_byte(dev, 0x50, &conf); |
341 | if(itdev->timing10) | 346 | if (itdev->timing10) |
342 | conf &= channel ? 0x9F: 0xE7; | 347 | conf &= channel ? 0x9F: 0xE7; |
343 | else | 348 | else |
344 | conf &= ~ (1 << (3 + 2 * channel + unit)); | 349 | conf &= ~ (1 << (3 + 2 * channel + unit)); |
345 | pci_write_config_byte(hwif->pci_dev, 0x50, conf); | 350 | pci_write_config_byte(dev, 0x50, conf); |
346 | 351 | ||
347 | it821x_clock_strategy(drive); | 352 | it821x_clock_strategy(drive); |
348 | it821x_program_udma(drive, itdev->udma[unit]); | 353 | it821x_program_udma(drive, itdev->udma[unit]); |
@@ -520,6 +525,7 @@ static void __devinit it821x_quirkproc(ide_drive_t *drive) | |||
520 | 525 | ||
521 | static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | 526 | static void __devinit init_hwif_it821x(ide_hwif_t *hwif) |
522 | { | 527 | { |
528 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
523 | struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); | 529 | struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); |
524 | u8 conf; | 530 | u8 conf; |
525 | 531 | ||
@@ -532,7 +538,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
532 | 538 | ||
533 | ide_set_hwifdata(hwif, idev); | 539 | ide_set_hwifdata(hwif, idev); |
534 | 540 | ||
535 | pci_read_config_byte(hwif->pci_dev, 0x50, &conf); | 541 | pci_read_config_byte(dev, 0x50, &conf); |
536 | if (conf & 1) { | 542 | if (conf & 1) { |
537 | idev->smart = 1; | 543 | idev->smart = 1; |
538 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 544 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
@@ -555,7 +561,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
555 | * this is necessary. | 561 | * this is necessary. |
556 | */ | 562 | */ |
557 | 563 | ||
558 | pci_read_config_byte(hwif->pci_dev, 0x08, &conf); | 564 | pci_read_config_byte(dev, 0x08, &conf); |
559 | if (conf == 0x10) { | 565 | if (conf == 0x10) { |
560 | idev->timing10 = 1; | 566 | idev->timing10 = 1; |
561 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 567 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 0083eaf89c77..8b40f6479c55 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -30,7 +30,7 @@ typedef enum { | |||
30 | 30 | ||
31 | static u8 __devinit ata66_jmicron(ide_hwif_t *hwif) | 31 | static u8 __devinit ata66_jmicron(ide_hwif_t *hwif) |
32 | { | 32 | { |
33 | struct pci_dev *pdev = hwif->pci_dev; | 33 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
34 | 34 | ||
35 | u32 control; | 35 | u32 control; |
36 | u32 control5; | 36 | u32 control5; |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index d4df4642dbb5..fc9eee9ccac3 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/ns87415.c Version 2.00 Sep. 10, 2002 | ||
3 | * | ||
4 | * Copyright (C) 1997-1998 Mark Lord <mlord@pobox.com> | 2 | * Copyright (C) 1997-1998 Mark Lord <mlord@pobox.com> |
5 | * Copyright (C) 1998 Eddie C. Dost <ecd@skynet.be> | 3 | * Copyright (C) 1998 Eddie C. Dost <ecd@skynet.be> |
6 | * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> |
@@ -71,10 +69,9 @@ static u8 superio_ide_inb (unsigned long port) | |||
71 | 69 | ||
72 | static void __devinit superio_ide_init_iops (struct hwif_s *hwif) | 70 | static void __devinit superio_ide_init_iops (struct hwif_s *hwif) |
73 | { | 71 | { |
72 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
74 | u32 base, dmabase; | 73 | u32 base, dmabase; |
75 | u8 tmp; | 74 | u8 port = hwif->channel, tmp; |
76 | struct pci_dev *pdev = hwif->pci_dev; | ||
77 | u8 port = hwif->channel; | ||
78 | 75 | ||
79 | base = pci_resource_start(pdev, port * 2) & ~3; | 76 | base = pci_resource_start(pdev, port * 2) & ~3; |
80 | dmabase = pci_resource_start(pdev, 4) & ~3; | 77 | dmabase = pci_resource_start(pdev, 4) & ~3; |
@@ -93,10 +90,11 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif) | |||
93 | 90 | ||
94 | static void __devinit init_iops_ns87415(ide_hwif_t *hwif) | 91 | static void __devinit init_iops_ns87415(ide_hwif_t *hwif) |
95 | { | 92 | { |
96 | if (PCI_SLOT(hwif->pci_dev->devfn) == 0xE) { | 93 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
94 | |||
95 | if (PCI_SLOT(dev->devfn) == 0xE) | ||
97 | /* Built-in - assume it's under superio. */ | 96 | /* Built-in - assume it's under superio. */ |
98 | superio_ide_init_iops(hwif); | 97 | superio_ide_init_iops(hwif); |
99 | } | ||
100 | } | 98 | } |
101 | #endif | 99 | #endif |
102 | 100 | ||
@@ -110,8 +108,8 @@ static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; | |||
110 | static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | 108 | static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) |
111 | { | 109 | { |
112 | ide_hwif_t *hwif = HWIF(drive); | 110 | ide_hwif_t *hwif = HWIF(drive); |
111 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
113 | unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data; | 112 | unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data; |
114 | struct pci_dev *dev = hwif->pci_dev; | ||
115 | unsigned long flags; | 113 | unsigned long flags; |
116 | 114 | ||
117 | local_irq_save(flags); | 115 | local_irq_save(flags); |
@@ -189,7 +187,7 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive) | |||
189 | 187 | ||
190 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | 188 | static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) |
191 | { | 189 | { |
192 | struct pci_dev *dev = hwif->pci_dev; | 190 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
193 | unsigned int ctrl, using_inta; | 191 | unsigned int ctrl, using_inta; |
194 | u8 progif; | 192 | u8 progif; |
195 | #ifdef __sparc_v9__ | 193 | #ifdef __sparc_v9__ |
@@ -231,8 +229,8 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) | |||
231 | 229 | ||
232 | #ifdef __sparc_v9__ | 230 | #ifdef __sparc_v9__ |
233 | /* | 231 | /* |
234 | * XXX: Reset the device, if we don't it will not respond | 232 | * XXX: Reset the device, if we don't it will not respond to |
235 | * to SELECT_DRIVE() properly during first probe_hwif(). | 233 | * SELECT_DRIVE() properly during first ide_probe_port(). |
236 | */ | 234 | */ |
237 | timeout = 10000; | 235 | timeout = 10000; |
238 | outb(12, hwif->io_ports[IDE_CONTROL_OFFSET]); | 236 | outb(12, hwif->io_ports[IDE_CONTROL_OFFSET]); |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 8953d9c3926f..0ce92d323036 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/opti621.c Version 0.9 Sep 24, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) | 2 | * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) |
5 | */ | 3 | */ |
6 | 4 | ||
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 89d2363a1ebd..bb29db03540e 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -149,6 +149,7 @@ static struct udma_timing { | |||
149 | static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | 149 | static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) |
150 | { | 150 | { |
151 | ide_hwif_t *hwif = HWIF(drive); | 151 | ide_hwif_t *hwif = HWIF(drive); |
152 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
152 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 153 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
153 | 154 | ||
154 | /* | 155 | /* |
@@ -159,7 +160,7 @@ static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
159 | * As we set up the PLL to output 133 MHz for UltraDMA/133 capable | 160 | * As we set up the PLL to output 133 MHz for UltraDMA/133 capable |
160 | * chips, we must override the default register settings... | 161 | * chips, we must override the default register settings... |
161 | */ | 162 | */ |
162 | if (max_dma_rate(hwif->pci_dev) == 4) { | 163 | if (max_dma_rate(dev) == 4) { |
163 | u8 mode = speed & 0x07; | 164 | u8 mode = speed & 0x07; |
164 | 165 | ||
165 | if (speed >= XFER_UDMA_0) { | 166 | if (speed >= XFER_UDMA_0) { |
@@ -186,9 +187,10 @@ static void pdcnew_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
186 | static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) | 187 | static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) |
187 | { | 188 | { |
188 | ide_hwif_t *hwif = drive->hwif; | 189 | ide_hwif_t *hwif = drive->hwif; |
190 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
189 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 191 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
190 | 192 | ||
191 | if (max_dma_rate(hwif->pci_dev) == 4) { | 193 | if (max_dma_rate(dev) == 4) { |
192 | set_indexed_reg(hwif, 0x0c + adj, pio_timings[pio].reg0c); | 194 | set_indexed_reg(hwif, 0x0c + adj, pio_timings[pio].reg0c); |
193 | set_indexed_reg(hwif, 0x0d + adj, pio_timings[pio].reg0d); | 195 | set_indexed_reg(hwif, 0x0d + adj, pio_timings[pio].reg0d); |
194 | set_indexed_reg(hwif, 0x13 + adj, pio_timings[pio].reg13); | 196 | set_indexed_reg(hwif, 0x13 + adj, pio_timings[pio].reg13); |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 3a1e081fe390..31a1308414a0 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/pdc202xx_old.c Version 0.52 Aug 27, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. | 3 | * Copyright (C) 2006-2007 MontaVista Software, Inc. |
6 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 4 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
@@ -66,7 +64,7 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *); | |||
66 | static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | 64 | static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) |
67 | { | 65 | { |
68 | ide_hwif_t *hwif = HWIF(drive); | 66 | ide_hwif_t *hwif = HWIF(drive); |
69 | struct pci_dev *dev = hwif->pci_dev; | 67 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
70 | u8 drive_pci = 0x60 + (drive->dn << 2); | 68 | u8 drive_pci = 0x60 + (drive->dn << 2); |
71 | 69 | ||
72 | u8 AP = 0, BP = 0, CP = 0; | 70 | u8 AP = 0, BP = 0, CP = 0; |
@@ -144,9 +142,10 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
144 | 142 | ||
145 | static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) | 143 | static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) |
146 | { | 144 | { |
145 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
147 | u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10); | 146 | u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10); |
148 | 147 | ||
149 | pci_read_config_word(hwif->pci_dev, 0x50, &CIS); | 148 | pci_read_config_word(dev, 0x50, &CIS); |
150 | 149 | ||
151 | return (CIS & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | 150 | return (CIS & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
152 | } | 151 | } |
@@ -305,12 +304,14 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, | |||
305 | 304 | ||
306 | static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | 305 | static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) |
307 | { | 306 | { |
307 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
308 | |||
308 | hwif->set_pio_mode = &pdc202xx_set_pio_mode; | 309 | hwif->set_pio_mode = &pdc202xx_set_pio_mode; |
309 | hwif->set_dma_mode = &pdc202xx_set_mode; | 310 | hwif->set_dma_mode = &pdc202xx_set_mode; |
310 | 311 | ||
311 | hwif->quirkproc = &pdc202xx_quirkproc; | 312 | hwif->quirkproc = &pdc202xx_quirkproc; |
312 | 313 | ||
313 | if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) | 314 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) |
314 | hwif->resetproc = &pdc202xx_reset; | 315 | hwif->resetproc = &pdc202xx_reset; |
315 | 316 | ||
316 | if (hwif->dma_base == 0) | 317 | if (hwif->dma_base == 0) |
@@ -319,7 +320,7 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | |||
319 | hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; | 320 | hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; |
320 | hwif->dma_timeout = &pdc202xx_dma_timeout; | 321 | hwif->dma_timeout = &pdc202xx_dma_timeout; |
321 | 322 | ||
322 | if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) { | 323 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) { |
323 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 324 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
324 | hwif->cbl = pdc202xx_old_cable_detect(hwif); | 325 | hwif->cbl = pdc202xx_old_cable_detect(hwif); |
325 | 326 | ||
@@ -334,7 +335,7 @@ static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase) | |||
334 | u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; | 335 | u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; |
335 | 336 | ||
336 | if (hwif->channel) { | 337 | if (hwif->channel) { |
337 | ide_setup_dma(hwif, dmabase, 8); | 338 | ide_setup_dma(hwif, dmabase); |
338 | return; | 339 | return; |
339 | } | 340 | } |
340 | 341 | ||
@@ -358,7 +359,7 @@ static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase) | |||
358 | } | 359 | } |
359 | #endif /* CONFIG_PDC202XX_BURST */ | 360 | #endif /* CONFIG_PDC202XX_BURST */ |
360 | 361 | ||
361 | ide_setup_dma(hwif, dmabase, 8); | 362 | ide_setup_dma(hwif, dmabase); |
362 | } | 363 | } |
363 | 364 | ||
364 | static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, | 365 | static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index bd6d3f77d30c..c1a6b68337d5 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/piix.c Version 0.54 Sep 5, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer | 2 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer |
5 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 3 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
6 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> | 4 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> |
@@ -8,53 +6,8 @@ | |||
8 | * | 6 | * |
9 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
10 | * | 8 | * |
11 | * PIO mode setting function for Intel chipsets. | 9 | * Documentation: |
12 | * For use instead of BIOS settings. | ||
13 | * | ||
14 | * 40-41 | ||
15 | * 42-43 | ||
16 | * | ||
17 | * 41 | ||
18 | * 43 | ||
19 | * | ||
20 | * | PIO 0 | c0 | 80 | 0 | | ||
21 | * | PIO 2 | SW2 | d0 | 90 | 4 | | ||
22 | * | PIO 3 | MW1 | e1 | a1 | 9 | | ||
23 | * | PIO 4 | MW2 | e3 | a3 | b | | ||
24 | * | ||
25 | * sitre = word40 & 0x4000; primary | ||
26 | * sitre = word42 & 0x4000; secondary | ||
27 | * | ||
28 | * 44 8421|8421 hdd|hdb | ||
29 | * | ||
30 | * 48 8421 hdd|hdc|hdb|hda udma enabled | ||
31 | * | ||
32 | * 0001 hda | ||
33 | * 0010 hdb | ||
34 | * 0100 hdc | ||
35 | * 1000 hdd | ||
36 | * | ||
37 | * 4a 84|21 hdb|hda | ||
38 | * 4b 84|21 hdd|hdc | ||
39 | * | ||
40 | * ata-33/82371AB | ||
41 | * ata-33/82371EB | ||
42 | * ata-33/82801AB ata-66/82801AA | ||
43 | * 00|00 udma 0 00|00 reserved | ||
44 | * 01|01 udma 1 01|01 udma 3 | ||
45 | * 10|10 udma 2 10|10 udma 4 | ||
46 | * 11|11 reserved 11|11 reserved | ||
47 | * | ||
48 | * 54 8421|8421 ata66 drive|ata66 enable | ||
49 | * | ||
50 | * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, ®40); | ||
51 | * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, ®42); | ||
52 | * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, ®44); | ||
53 | * pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, ®48); | ||
54 | * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, ®4a); | ||
55 | * pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, ®54); | ||
56 | * | 10 | * |
57 | * Documentation | ||
58 | * Publically available from Intel web site. Errata documentation | 11 | * Publically available from Intel web site. Errata documentation |
59 | * is also publically available. As an aide to anyone hacking on this | 12 | * is also publically available. As an aide to anyone hacking on this |
60 | * driver the list of errata that are relevant is below.going back to | 13 | * driver the list of errata that are relevant is below.going back to |
@@ -116,7 +69,7 @@ static int no_piix_dma; | |||
116 | static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio) | 69 | static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio) |
117 | { | 70 | { |
118 | ide_hwif_t *hwif = HWIF(drive); | 71 | ide_hwif_t *hwif = HWIF(drive); |
119 | struct pci_dev *dev = hwif->pci_dev; | 72 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
120 | int is_slave = drive->dn & 1; | 73 | int is_slave = drive->dn & 1; |
121 | int master_port = hwif->channel ? 0x42 : 0x40; | 74 | int master_port = hwif->channel ? 0x42 : 0x40; |
122 | int slave_port = 0x44; | 75 | int slave_port = 0x44; |
@@ -185,7 +138,7 @@ static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
185 | static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) | 138 | static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) |
186 | { | 139 | { |
187 | ide_hwif_t *hwif = HWIF(drive); | 140 | ide_hwif_t *hwif = HWIF(drive); |
188 | struct pci_dev *dev = hwif->pci_dev; | 141 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
189 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 142 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
190 | int a_speed = 3 << (drive->dn * 4); | 143 | int a_speed = 3 << (drive->dn * 4); |
191 | int u_flag = 1 << drive->dn; | 144 | int u_flag = 1 << drive->dn; |
@@ -305,7 +258,7 @@ static const struct ich_laptop ich_laptop[] = { | |||
305 | 258 | ||
306 | static u8 __devinit piix_cable_detect(ide_hwif_t *hwif) | 259 | static u8 __devinit piix_cable_detect(ide_hwif_t *hwif) |
307 | { | 260 | { |
308 | struct pci_dev *pdev = hwif->pci_dev; | 261 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
309 | const struct ich_laptop *lap = &ich_laptop[0]; | 262 | const struct ich_laptop *lap = &ich_laptop[0]; |
310 | u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30; | 263 | u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30; |
311 | 264 | ||
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 6b10ae260fa2..7ed6625819d4 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/rz1000.c Version 0.06 January 12, 2003 | ||
3 | * | ||
4 | * Copyright (C) 1995-1998 Linus Torvalds & author (see below) | 2 | * Copyright (C) 1995-1998 Linus Torvalds & author (see below) |
5 | */ | 3 | */ |
6 | 4 | ||
@@ -32,8 +30,8 @@ | |||
32 | 30 | ||
33 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | 31 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) |
34 | { | 32 | { |
33 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
35 | u16 reg; | 34 | u16 reg; |
36 | struct pci_dev *dev = hwif->pci_dev; | ||
37 | 35 | ||
38 | if (!pci_read_config_word (dev, 0x40, ®) && | 36 | if (!pci_read_config_word (dev, 0x40, ®) && |
39 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { | 37 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 32fdf53379f5..af499a60eb31 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/sc1200.c Version 0.97 Aug 3 2007 | ||
3 | * | ||
4 | * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> | 2 | * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> |
5 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 3 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * | 4 | * |
@@ -87,7 +85,7 @@ static const unsigned int sc1200_pio_timings[4][5] = | |||
87 | static void sc1200_tunepio(ide_drive_t *drive, u8 pio) | 85 | static void sc1200_tunepio(ide_drive_t *drive, u8 pio) |
88 | { | 86 | { |
89 | ide_hwif_t *hwif = drive->hwif; | 87 | ide_hwif_t *hwif = drive->hwif; |
90 | struct pci_dev *pdev = hwif->pci_dev; | 88 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
91 | unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0; | 89 | unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0; |
92 | 90 | ||
93 | pci_read_config_dword(pdev, basereg + 4, &format); | 91 | pci_read_config_dword(pdev, basereg + 4, &format); |
@@ -130,6 +128,7 @@ out: | |||
130 | static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | 128 | static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) |
131 | { | 129 | { |
132 | ide_hwif_t *hwif = HWIF(drive); | 130 | ide_hwif_t *hwif = HWIF(drive); |
131 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
133 | int unit = drive->select.b.unit; | 132 | int unit = drive->select.b.unit; |
134 | unsigned int reg, timings; | 133 | unsigned int reg, timings; |
135 | unsigned short pci_clock; | 134 | unsigned short pci_clock; |
@@ -160,12 +159,11 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
160 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; | 159 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; |
161 | 160 | ||
162 | if (unit == 0) { /* are we configuring drive0? */ | 161 | if (unit == 0) { /* are we configuring drive0? */ |
163 | pci_read_config_dword(hwif->pci_dev, basereg+4, ®); | 162 | pci_read_config_dword(dev, basereg + 4, ®); |
164 | timings |= reg & 0x80000000; /* preserve PIO format bit */ | 163 | timings |= reg & 0x80000000; /* preserve PIO format bit */ |
165 | pci_write_config_dword(hwif->pci_dev, basereg+4, timings); | 164 | pci_write_config_dword(dev, basereg + 4, timings); |
166 | } else { | 165 | } else |
167 | pci_write_config_dword(hwif->pci_dev, basereg+12, timings); | 166 | pci_write_config_dword(dev, basereg + 12, timings); |
168 | } | ||
169 | } | 167 | } |
170 | 168 | ||
171 | /* Replacement for the standard ide_dma_end action in | 169 | /* Replacement for the standard ide_dma_end action in |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 24a85bbcd2a6..7694969b02ce 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -594,7 +594,7 @@ static int __devinit init_setup_scc(struct pci_dev *dev, | |||
594 | 594 | ||
595 | static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | 595 | static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) |
596 | { | 596 | { |
597 | struct pci_dev *dev = hwif->pci_dev; | 597 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
598 | struct scc_ports *ports = pci_get_drvdata(dev); | 598 | struct scc_ports *ports = pci_get_drvdata(dev); |
599 | unsigned long dma_base = ports->dma; | 599 | unsigned long dma_base = ports->dma; |
600 | 600 | ||
@@ -620,7 +620,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
620 | hwif->io_ports[IDE_STATUS_OFFSET] = dma_base + 0x3c; | 620 | hwif->io_ports[IDE_STATUS_OFFSET] = dma_base + 0x3c; |
621 | hwif->io_ports[IDE_CONTROL_OFFSET] = dma_base + 0x40; | 621 | hwif->io_ports[IDE_CONTROL_OFFSET] = dma_base + 0x40; |
622 | 622 | ||
623 | hwif->irq = hwif->pci_dev->irq; | 623 | hwif->irq = dev->irq; |
624 | hwif->dma_base = dma_base; | 624 | hwif->dma_base = dma_base; |
625 | hwif->config_data = ports->ctl; | 625 | hwif->config_data = ports->ctl; |
626 | hwif->mmio = 1; | 626 | hwif->mmio = 1; |
@@ -636,7 +636,8 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
636 | 636 | ||
637 | static void __devinit init_iops_scc(ide_hwif_t *hwif) | 637 | static void __devinit init_iops_scc(ide_hwif_t *hwif) |
638 | { | 638 | { |
639 | struct pci_dev *dev = hwif->pci_dev; | 639 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
640 | |||
640 | hwif->hwif_data = NULL; | 641 | hwif->hwif_data = NULL; |
641 | if (pci_get_drvdata(dev) == NULL) | 642 | if (pci_get_drvdata(dev) == NULL) |
642 | return; | 643 | return; |
@@ -726,10 +727,8 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
726 | unsigned long dma_size = pci_resource_len(dev, 1); | 727 | unsigned long dma_size = pci_resource_len(dev, 1); |
727 | 728 | ||
728 | if (hwif->dmatable_cpu) { | 729 | if (hwif->dmatable_cpu) { |
729 | pci_free_consistent(hwif->pci_dev, | 730 | pci_free_consistent(dev, PRD_ENTRIES * PRD_BYTES, |
730 | PRD_ENTRIES * PRD_BYTES, | 731 | hwif->dmatable_cpu, hwif->dmatable_dma); |
731 | hwif->dmatable_cpu, | ||
732 | hwif->dmatable_dma); | ||
733 | hwif->dmatable_cpu = NULL; | 732 | hwif->dmatable_cpu = NULL; |
734 | } | 733 | } |
735 | 734 | ||
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 877c09bf4829..f495253b7d41 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/serverworks.c Version 0.22 Jun 27 2007 | ||
3 | * | ||
4 | * Copyright (C) 1998-2000 Michel Aubry | 2 | * Copyright (C) 1998-2000 Michel Aubry |
5 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz | 3 | * Copyright (C) 1998-2000 Andrzej Krzysztofowicz |
6 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
@@ -67,7 +65,7 @@ static int check_in_drive_lists (ide_drive_t *drive, const char **list) | |||
67 | 65 | ||
68 | static u8 svwks_udma_filter(ide_drive_t *drive) | 66 | static u8 svwks_udma_filter(ide_drive_t *drive) |
69 | { | 67 | { |
70 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 68 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
71 | u8 mask = 0; | 69 | u8 mask = 0; |
72 | 70 | ||
73 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) | 71 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) |
@@ -130,7 +128,7 @@ static void svwks_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
130 | static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; | 128 | static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; |
131 | static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; | 129 | static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; |
132 | 130 | ||
133 | struct pci_dev *dev = drive->hwif->pci_dev; | 131 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
134 | 132 | ||
135 | pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); | 133 | pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); |
136 | 134 | ||
@@ -153,7 +151,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
153 | static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; | 151 | static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; |
154 | 152 | ||
155 | ide_hwif_t *hwif = HWIF(drive); | 153 | ide_hwif_t *hwif = HWIF(drive); |
156 | struct pci_dev *dev = hwif->pci_dev; | 154 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
157 | u8 unit = (drive->select.b.unit & 0x01); | 155 | u8 unit = (drive->select.b.unit & 0x01); |
158 | 156 | ||
159 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; | 157 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; |
@@ -287,7 +285,8 @@ static u8 __devinit ata66_svwks_svwks(ide_hwif_t *hwif) | |||
287 | */ | 285 | */ |
288 | static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) | 286 | static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) |
289 | { | 287 | { |
290 | struct pci_dev *dev = hwif->pci_dev; | 288 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
289 | |||
291 | if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && | 290 | if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && |
292 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && | 291 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && |
293 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE || | 292 | (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE || |
@@ -305,7 +304,8 @@ static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif) | |||
305 | */ | 304 | */ |
306 | static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) | 305 | static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) |
307 | { | 306 | { |
308 | struct pci_dev *dev = hwif->pci_dev; | 307 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
308 | |||
309 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && | 309 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && |
310 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && | 310 | dev->vendor == PCI_VENDOR_ID_SERVERWORKS && |
311 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 311 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
@@ -316,7 +316,7 @@ static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif) | |||
316 | 316 | ||
317 | static u8 __devinit ata66_svwks(ide_hwif_t *hwif) | 317 | static u8 __devinit ata66_svwks(ide_hwif_t *hwif) |
318 | { | 318 | { |
319 | struct pci_dev *dev = hwif->pci_dev; | 319 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
320 | 320 | ||
321 | /* Server Works */ | 321 | /* Server Works */ |
322 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) | 322 | if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) |
@@ -340,6 +340,8 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif) | |||
340 | 340 | ||
341 | static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | 341 | static void __devinit init_hwif_svwks (ide_hwif_t *hwif) |
342 | { | 342 | { |
343 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
344 | |||
343 | hwif->set_pio_mode = &svwks_set_pio_mode; | 345 | hwif->set_pio_mode = &svwks_set_pio_mode; |
344 | hwif->set_dma_mode = &svwks_set_dma_mode; | 346 | hwif->set_dma_mode = &svwks_set_dma_mode; |
345 | hwif->udma_filter = &svwks_udma_filter; | 347 | hwif->udma_filter = &svwks_udma_filter; |
@@ -347,7 +349,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | |||
347 | if (!hwif->dma_base) | 349 | if (!hwif->dma_base) |
348 | return; | 350 | return; |
349 | 351 | ||
350 | if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | 352 | if (dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
351 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 353 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
352 | hwif->cbl = ata66_svwks(hwif); | 354 | hwif->cbl = ata66_svwks(hwif); |
353 | } | 355 | } |
@@ -418,7 +420,9 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device | |||
418 | 420 | ||
419 | d = serverworks_chipsets[idx]; | 421 | d = serverworks_chipsets[idx]; |
420 | 422 | ||
421 | if (idx == 2 || idx == 3) { | 423 | if (idx == 1) |
424 | d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; | ||
425 | else if (idx == 2 || idx == 3) { | ||
422 | if ((PCI_FUNC(dev->devfn) & 1) == 0) { | 426 | if ((PCI_FUNC(dev->devfn) & 1) == 0) { |
423 | if (pci_resource_start(dev, 0) != 0x01f1) | 427 | if (pci_resource_start(dev, 0) != 0x01f1) |
424 | d.host_flags &= ~IDE_HFLAG_BOOTABLE; | 428 | d.host_flags &= ~IDE_HFLAG_BOOTABLE; |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 9e0be7d54980..85902074b1fc 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -159,6 +159,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | if (intr_reg & 0x02) { | 161 | if (intr_reg & 0x02) { |
162 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
162 | /* Error when transferring DMA data on PCI bus */ | 163 | /* Error when transferring DMA data on PCI bus */ |
163 | u32 pci_err_addr_low, pci_err_addr_high, | 164 | u32 pci_err_addr_low, pci_err_addr_high, |
164 | pci_stat_cmd_reg; | 165 | pci_stat_cmd_reg; |
@@ -167,7 +168,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
167 | readl((void __iomem *)hwif->io_ports[IDE_IRQ_OFFSET]); | 168 | readl((void __iomem *)hwif->io_ports[IDE_IRQ_OFFSET]); |
168 | pci_err_addr_high = | 169 | pci_err_addr_high = |
169 | readl((void __iomem *)(hwif->io_ports[IDE_IRQ_OFFSET] + 4)); | 170 | readl((void __iomem *)(hwif->io_ports[IDE_IRQ_OFFSET] + 4)); |
170 | pci_read_config_dword(hwif->pci_dev, PCI_COMMAND, | 171 | pci_read_config_dword(dev, PCI_COMMAND, |
171 | &pci_stat_cmd_reg); | 172 | &pci_stat_cmd_reg); |
172 | printk(KERN_ERR | 173 | printk(KERN_ERR |
173 | "%s(%s) : PCI Bus Error when doing DMA:" | 174 | "%s(%s) : PCI Bus Error when doing DMA:" |
@@ -178,8 +179,7 @@ sgiioc4_clearirq(ide_drive_t * drive) | |||
178 | __FUNCTION__, drive->name, | 179 | __FUNCTION__, drive->name, |
179 | pci_err_addr_high, pci_err_addr_low); | 180 | pci_err_addr_high, pci_err_addr_low); |
180 | /* Clear the PCI Error indicator */ | 181 | /* Clear the PCI Error indicator */ |
181 | pci_write_config_dword(hwif->pci_dev, PCI_COMMAND, | 182 | pci_write_config_dword(dev, PCI_COMMAND, 0x00000146); |
182 | 0x00000146); | ||
183 | } | 183 | } |
184 | 184 | ||
185 | /* Clear the Interrupt, Error bits on the IOC4 */ | 185 | /* Clear the Interrupt, Error bits on the IOC4 */ |
@@ -334,6 +334,7 @@ sgiioc4_INB(unsigned long port) | |||
334 | static int __devinit | 334 | static int __devinit |
335 | ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | 335 | ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) |
336 | { | 336 | { |
337 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
337 | void __iomem *virt_dma_base; | 338 | void __iomem *virt_dma_base; |
338 | int num_ports = sizeof (ioc4_dma_regs_t); | 339 | int num_ports = sizeof (ioc4_dma_regs_t); |
339 | void *pad; | 340 | void *pad; |
@@ -359,7 +360,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
359 | } | 360 | } |
360 | hwif->dma_base = (unsigned long) virt_dma_base; | 361 | hwif->dma_base = (unsigned long) virt_dma_base; |
361 | 362 | ||
362 | hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev, | 363 | hwif->dmatable_cpu = pci_alloc_consistent(dev, |
363 | IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, | 364 | IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, |
364 | &hwif->dmatable_dma); | 365 | &hwif->dmatable_dma); |
365 | 366 | ||
@@ -368,7 +369,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
368 | 369 | ||
369 | hwif->sg_max_nents = IOC4_PRD_ENTRIES; | 370 | hwif->sg_max_nents = IOC4_PRD_ENTRIES; |
370 | 371 | ||
371 | pad = pci_alloc_consistent(hwif->pci_dev, IOC4_IDE_CACHELINE_SIZE, | 372 | pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE, |
372 | (dma_addr_t *) &(hwif->dma_status)); | 373 | (dma_addr_t *) &(hwif->dma_status)); |
373 | 374 | ||
374 | if (pad) { | 375 | if (pad) { |
@@ -376,8 +377,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigned long dma_base) | |||
376 | return 0; | 377 | return 0; |
377 | } | 378 | } |
378 | 379 | ||
379 | pci_free_consistent(hwif->pci_dev, | 380 | pci_free_consistent(dev, IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, |
380 | IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, | ||
381 | hwif->dmatable_cpu, hwif->dmatable_dma); | 381 | hwif->dmatable_cpu, hwif->dmatable_dma); |
382 | printk(KERN_INFO | 382 | printk(KERN_INFO |
383 | "%s() -- Error! Unable to allocate DMA Maps for drive %s\n", | 383 | "%s() -- Error! Unable to allocate DMA Maps for drive %s\n", |
@@ -517,8 +517,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) | |||
517 | } | 517 | } |
518 | 518 | ||
519 | use_pio_instead: | 519 | use_pio_instead: |
520 | pci_unmap_sg(hwif->pci_dev, hwif->sg_table, hwif->sg_nents, | 520 | ide_destroy_dmatable(drive); |
521 | hwif->sg_dma_direction); | ||
522 | 521 | ||
523 | return 0; /* revert to PIO for this request */ | 522 | return 0; /* revert to PIO for this request */ |
524 | } | 523 | } |
@@ -641,7 +640,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
641 | hw.dev = &dev->dev; | 640 | hw.dev = &dev->dev; |
642 | ide_init_port_hw(hwif, &hw); | 641 | ide_init_port_hw(hwif, &hw); |
643 | 642 | ||
644 | hwif->pci_dev = dev; | 643 | hwif->dev = &dev->dev; |
645 | hwif->channel = 0; /* Single Channel chip */ | 644 | hwif->channel = 0; /* Single Channel chip */ |
646 | 645 | ||
647 | /* The IOC4 uses MMIO rather than Port IO. */ | 646 | /* The IOC4 uses MMIO rather than Port IO. */ |
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 | ||
80 | static inline int is_sata(ide_hwif_t *hwif) | 78 | static 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) | |||
140 | static u8 sil_pata_udma_filter(ide_drive_t *drive) | 138 | static 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) | |||
303 | static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | 305 | static 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) | |||
377 | static int sil_sata_busproc(ide_drive_t * drive, int state) | 380 | static 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 | ||
644 | static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) | 648 | static 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 | ||
757 | static void __devinit init_iops_siimage(ide_hwif_t *hwif) | 761 | static 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 | ||
778 | static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | 784 | static 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 | ||
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 85d36996e6af..2a461de22aa0 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/sis5513.c Version 0.31 Aug 9, 2007 | ||
3 | * | ||
4 | * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2002 Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer | 3 | * Copyright (C) 2002 Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer |
6 | * Copyright (C) 2003 Vojtech Pavlik <vojtech@suse.cz> | 4 | * Copyright (C) 2003 Vojtech Pavlik <vojtech@suse.cz> |
@@ -197,7 +195,7 @@ static char* chipset_capability[] = { | |||
197 | 195 | ||
198 | static u8 sis_ata133_get_base(ide_drive_t *drive) | 196 | static u8 sis_ata133_get_base(ide_drive_t *drive) |
199 | { | 197 | { |
200 | struct pci_dev *dev = drive->hwif->pci_dev; | 198 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
201 | u32 reg54 = 0; | 199 | u32 reg54 = 0; |
202 | 200 | ||
203 | pci_read_config_dword(dev, 0x54, ®54); | 201 | pci_read_config_dword(dev, 0x54, ®54); |
@@ -207,7 +205,7 @@ static u8 sis_ata133_get_base(ide_drive_t *drive) | |||
207 | 205 | ||
208 | static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) | 206 | static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) |
209 | { | 207 | { |
210 | struct pci_dev *dev = drive->hwif->pci_dev; | 208 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
211 | u16 t1 = 0; | 209 | u16 t1 = 0; |
212 | u8 drive_pci = 0x40 + drive->dn * 2; | 210 | u8 drive_pci = 0x40 + drive->dn * 2; |
213 | 211 | ||
@@ -230,7 +228,7 @@ static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) | |||
230 | 228 | ||
231 | static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) | 229 | static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) |
232 | { | 230 | { |
233 | struct pci_dev *dev = drive->hwif->pci_dev; | 231 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
234 | u8 t1, drive_pci = 0x40 + drive->dn * 2; | 232 | u8 t1, drive_pci = 0x40 + drive->dn * 2; |
235 | 233 | ||
236 | /* timing bits: 7:4 active 3:0 recovery */ | 234 | /* timing bits: 7:4 active 3:0 recovery */ |
@@ -253,7 +251,7 @@ static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) | |||
253 | 251 | ||
254 | static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) | 252 | static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) |
255 | { | 253 | { |
256 | struct pci_dev *dev = drive->hwif->pci_dev; | 254 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
257 | u32 t1 = 0; | 255 | u32 t1 = 0; |
258 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; | 256 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; |
259 | 257 | ||
@@ -286,7 +284,7 @@ static void sis_program_timings(ide_drive_t *drive, const u8 mode) | |||
286 | static void config_drive_art_rwp (ide_drive_t *drive) | 284 | static void config_drive_art_rwp (ide_drive_t *drive) |
287 | { | 285 | { |
288 | ide_hwif_t *hwif = HWIF(drive); | 286 | ide_hwif_t *hwif = HWIF(drive); |
289 | struct pci_dev *dev = hwif->pci_dev; | 287 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
290 | u8 reg4bh = 0; | 288 | u8 reg4bh = 0; |
291 | u8 rw_prefetch = 0; | 289 | u8 rw_prefetch = 0; |
292 | 290 | ||
@@ -307,7 +305,7 @@ static void sis_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
307 | 305 | ||
308 | static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode) | 306 | static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode) |
309 | { | 307 | { |
310 | struct pci_dev *dev = drive->hwif->pci_dev; | 308 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
311 | u32 regdw = 0; | 309 | u32 regdw = 0; |
312 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; | 310 | u8 drive_pci = sis_ata133_get_base(drive), clk, idx; |
313 | 311 | ||
@@ -326,7 +324,7 @@ static void sis_ata133_program_udma_timings(ide_drive_t *drive, const u8 mode) | |||
326 | 324 | ||
327 | static void sis_ata33_program_udma_timings(ide_drive_t *drive, const u8 mode) | 325 | static void sis_ata33_program_udma_timings(ide_drive_t *drive, const u8 mode) |
328 | { | 326 | { |
329 | struct pci_dev *dev = drive->hwif->pci_dev; | 327 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
330 | u8 drive_pci = 0x40 + drive->dn * 2, reg = 0, i = chipset_family; | 328 | u8 drive_pci = 0x40 + drive->dn * 2, reg = 0, i = chipset_family; |
331 | 329 | ||
332 | pci_read_config_byte(dev, drive_pci + 1, ®); | 330 | pci_read_config_byte(dev, drive_pci + 1, ®); |
@@ -359,7 +357,7 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
359 | 357 | ||
360 | static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) | 358 | static u8 sis5513_ata133_udma_filter(ide_drive_t *drive) |
361 | { | 359 | { |
362 | struct pci_dev *dev = drive->hwif->pci_dev; | 360 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
363 | u32 regdw = 0; | 361 | u32 regdw = 0; |
364 | u8 drive_pci = sis_ata133_get_base(drive); | 362 | u8 drive_pci = sis_ata133_get_base(drive); |
365 | 363 | ||
@@ -530,7 +528,7 @@ static const struct sis_laptop sis_laptop[] = { | |||
530 | 528 | ||
531 | static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) | 529 | static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) |
532 | { | 530 | { |
533 | struct pci_dev *pdev = hwif->pci_dev; | 531 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
534 | const struct sis_laptop *lap = &sis_laptop[0]; | 532 | const struct sis_laptop *lap = &sis_laptop[0]; |
535 | u8 ata66 = 0; | 533 | u8 ata66 = 0; |
536 | 534 | ||
@@ -545,12 +543,12 @@ static u8 __devinit ata66_sis5513(ide_hwif_t *hwif) | |||
545 | if (chipset_family >= ATA_133) { | 543 | if (chipset_family >= ATA_133) { |
546 | u16 regw = 0; | 544 | u16 regw = 0; |
547 | u16 reg_addr = hwif->channel ? 0x52: 0x50; | 545 | u16 reg_addr = hwif->channel ? 0x52: 0x50; |
548 | pci_read_config_word(hwif->pci_dev, reg_addr, ®w); | 546 | pci_read_config_word(pdev, reg_addr, ®w); |
549 | ata66 = (regw & 0x8000) ? 0 : 1; | 547 | ata66 = (regw & 0x8000) ? 0 : 1; |
550 | } else if (chipset_family >= ATA_66) { | 548 | } else if (chipset_family >= ATA_66) { |
551 | u8 reg48h = 0; | 549 | u8 reg48h = 0; |
552 | u8 mask = hwif->channel ? 0x20 : 0x10; | 550 | u8 mask = hwif->channel ? 0x20 : 0x10; |
553 | pci_read_config_byte(hwif->pci_dev, 0x48, ®48h); | 551 | pci_read_config_byte(pdev, 0x48, ®48h); |
554 | ata66 = (reg48h & mask) ? 0 : 1; | 552 | ata66 = (reg48h & mask) ? 0 : 1; |
555 | } | 553 | } |
556 | 554 | ||
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index c7a125b66c29..da13a1298ada 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/sl82c105.c | ||
3 | * | ||
4 | * SL82C105/Winbond 553 IDE driver | 2 | * SL82C105/Winbond 553 IDE driver |
5 | * | 3 | * |
6 | * Maintainer unknown. | 4 | * Maintainer unknown. |
@@ -78,7 +76,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) | |||
78 | */ | 76 | */ |
79 | static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) | 77 | static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) |
80 | { | 78 | { |
81 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 79 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
82 | int reg = 0x44 + drive->dn * 4; | 80 | int reg = 0x44 + drive->dn * 4; |
83 | u16 drv_ctrl; | 81 | u16 drv_ctrl; |
84 | 82 | ||
@@ -147,7 +145,7 @@ static inline void sl82c105_reset_host(struct pci_dev *dev) | |||
147 | static void sl82c105_dma_lost_irq(ide_drive_t *drive) | 145 | static void sl82c105_dma_lost_irq(ide_drive_t *drive) |
148 | { | 146 | { |
149 | ide_hwif_t *hwif = HWIF(drive); | 147 | ide_hwif_t *hwif = HWIF(drive); |
150 | struct pci_dev *dev = hwif->pci_dev; | 148 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
151 | u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; | 149 | u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA; |
152 | u8 dma_cmd; | 150 | u8 dma_cmd; |
153 | 151 | ||
@@ -184,7 +182,7 @@ static void sl82c105_dma_lost_irq(ide_drive_t *drive) | |||
184 | static void sl82c105_dma_start(ide_drive_t *drive) | 182 | static void sl82c105_dma_start(ide_drive_t *drive) |
185 | { | 183 | { |
186 | ide_hwif_t *hwif = HWIF(drive); | 184 | ide_hwif_t *hwif = HWIF(drive); |
187 | struct pci_dev *dev = hwif->pci_dev; | 185 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
188 | int reg = 0x44 + drive->dn * 4; | 186 | int reg = 0x44 + drive->dn * 4; |
189 | 187 | ||
190 | DBG(("%s(drive:%s)\n", __FUNCTION__, drive->name)); | 188 | DBG(("%s(drive:%s)\n", __FUNCTION__, drive->name)); |
@@ -197,15 +195,17 @@ static void sl82c105_dma_start(ide_drive_t *drive) | |||
197 | 195 | ||
198 | static void sl82c105_dma_timeout(ide_drive_t *drive) | 196 | static void sl82c105_dma_timeout(ide_drive_t *drive) |
199 | { | 197 | { |
198 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); | ||
199 | |||
200 | DBG(("sl82c105_dma_timeout(drive:%s)\n", drive->name)); | 200 | DBG(("sl82c105_dma_timeout(drive:%s)\n", drive->name)); |
201 | 201 | ||
202 | sl82c105_reset_host(HWIF(drive)->pci_dev); | 202 | sl82c105_reset_host(dev); |
203 | ide_dma_timeout(drive); | 203 | ide_dma_timeout(drive); |
204 | } | 204 | } |
205 | 205 | ||
206 | static int sl82c105_dma_end(ide_drive_t *drive) | 206 | static int sl82c105_dma_end(ide_drive_t *drive) |
207 | { | 207 | { |
208 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 208 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
209 | int reg = 0x44 + drive->dn * 4; | 209 | int reg = 0x44 + drive->dn * 4; |
210 | int ret; | 210 | int ret; |
211 | 211 | ||
@@ -224,7 +224,7 @@ static int sl82c105_dma_end(ide_drive_t *drive) | |||
224 | */ | 224 | */ |
225 | static void sl82c105_resetproc(ide_drive_t *drive) | 225 | static void sl82c105_resetproc(ide_drive_t *drive) |
226 | { | 226 | { |
227 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 227 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
228 | u32 val; | 228 | u32 val; |
229 | 229 | ||
230 | DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); | 230 | DBG(("sl82c105_resetproc(drive:%s)\n", drive->name)); |
@@ -293,6 +293,7 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c | |||
293 | */ | 293 | */ |
294 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | 294 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) |
295 | { | 295 | { |
296 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
296 | unsigned int rev; | 297 | unsigned int rev; |
297 | 298 | ||
298 | DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); | 299 | DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); |
@@ -304,7 +305,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
304 | if (!hwif->dma_base) | 305 | if (!hwif->dma_base) |
305 | return; | 306 | return; |
306 | 307 | ||
307 | rev = sl82c105_bridge_revision(hwif->pci_dev); | 308 | rev = sl82c105_bridge_revision(dev); |
308 | if (rev <= 5) { | 309 | if (rev <= 5) { |
309 | /* | 310 | /* |
310 | * Never ever EVER under any circumstances enable | 311 | * Never ever EVER under any circumstances enable |
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index dbbb46819a2d..a6cf810c4699 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/slc90e66.c Version 0.19 Sep 24, 2007 | ||
3 | * | ||
4 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> | 3 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
6 | * | 4 | * |
@@ -26,7 +24,7 @@ static DEFINE_SPINLOCK(slc90e66_lock); | |||
26 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | 24 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) |
27 | { | 25 | { |
28 | ide_hwif_t *hwif = HWIF(drive); | 26 | ide_hwif_t *hwif = HWIF(drive); |
29 | struct pci_dev *dev = hwif->pci_dev; | 27 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
30 | int is_slave = drive->dn & 1; | 28 | int is_slave = drive->dn & 1; |
31 | int master_port = hwif->channel ? 0x42 : 0x40; | 29 | int master_port = hwif->channel ? 0x42 : 0x40; |
32 | int slave_port = 0x44; | 30 | int slave_port = 0x44; |
@@ -79,7 +77,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
79 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | 77 | static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) |
80 | { | 78 | { |
81 | ide_hwif_t *hwif = HWIF(drive); | 79 | ide_hwif_t *hwif = HWIF(drive); |
82 | struct pci_dev *dev = hwif->pci_dev; | 80 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
83 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 81 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
84 | int sitre = 0, a_speed = 7 << (drive->dn * 4); | 82 | int sitre = 0, a_speed = 7 << (drive->dn * 4); |
85 | int u_speed = 0, u_flag = 1 << drive->dn; | 83 | int u_speed = 0, u_flag = 1 << drive->dn; |
@@ -122,13 +120,14 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
122 | 120 | ||
123 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) | 121 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) |
124 | { | 122 | { |
123 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
125 | u8 reg47 = 0; | 124 | u8 reg47 = 0; |
126 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ | 125 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ |
127 | 126 | ||
128 | hwif->set_pio_mode = &slc90e66_set_pio_mode; | 127 | hwif->set_pio_mode = &slc90e66_set_pio_mode; |
129 | hwif->set_dma_mode = &slc90e66_set_dma_mode; | 128 | hwif->set_dma_mode = &slc90e66_set_dma_mode; |
130 | 129 | ||
131 | pci_read_config_byte(hwif->pci_dev, 0x47, ®47); | 130 | pci_read_config_byte(dev, 0x47, ®47); |
132 | 131 | ||
133 | if (hwif->dma_base == 0) | 132 | if (hwif->dma_base == 0) |
134 | return; | 133 | return; |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index e1faf6c2fe16..9fbbb4f2dd54 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/ide/pci/tc86c001.c Version 1.01 Sep 5, 2007 | ||
3 | * | ||
4 | * Copyright (C) 2002 Toshiba Corporation | 2 | * Copyright (C) 2002 Toshiba Corporation |
5 | * Copyright (C) 2005-2006 MontaVista Software, Inc. <source@mvista.com> | 3 | * Copyright (C) 2005-2006 MontaVista Software, Inc. <source@mvista.com> |
6 | * | 4 | * |
@@ -164,7 +162,8 @@ static int tc86c001_busproc(ide_drive_t *drive, int state) | |||
164 | 162 | ||
165 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | 163 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) |
166 | { | 164 | { |
167 | unsigned long sc_base = pci_resource_start(hwif->pci_dev, 5); | 165 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
166 | unsigned long sc_base = pci_resource_start(dev, 5); | ||
168 | u16 scr1 = inw(sc_base + 0x00); | 167 | u16 scr1 = inw(sc_base + 0x00); |
169 | 168 | ||
170 | /* System Control 1 Register bit 15 (Soft Reset) set */ | 169 | /* System Control 1 Register bit 15 (Soft Reset) set */ |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index ae52a96a1cf9..852b72693736 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * triflex.c | ||
3 | * | ||
4 | * IDE Chipset driver for the Compaq TriFlex IDE controller. | 2 | * IDE Chipset driver for the Compaq TriFlex IDE controller. |
5 | * | 3 | * |
6 | * Known to work with the Compaq Workstation 5x00 series. | 4 | * Known to work with the Compaq Workstation 5x00 series. |
@@ -43,7 +41,7 @@ | |||
43 | static void triflex_set_mode(ide_drive_t *drive, const u8 speed) | 41 | static void triflex_set_mode(ide_drive_t *drive, const u8 speed) |
44 | { | 42 | { |
45 | ide_hwif_t *hwif = HWIF(drive); | 43 | ide_hwif_t *hwif = HWIF(drive); |
46 | struct pci_dev *dev = hwif->pci_dev; | 44 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
47 | u8 channel_offset = hwif->channel ? 0x74 : 0x70; | 45 | u8 channel_offset = hwif->channel ? 0x74 : 0x70; |
48 | u16 timing = 0; | 46 | u16 timing = 0; |
49 | u32 triflex_timings = 0; | 47 | u32 triflex_timings = 0; |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 04cd893e1ab0..d9ebb698953a 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/trm290.c Version 1.05 Dec. 26, 2007 | ||
3 | * | ||
4 | * Copyright (c) 1997-1998 Mark Lord | 2 | * Copyright (c) 1997-1998 Mark Lord |
5 | * Copyright (c) 2007 MontaVista Software, Inc. <source@mvista.com> | 3 | * Copyright (c) 2007 MontaVista Software, Inc. <source@mvista.com> |
4 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public License | 5 | * May be copied or modified under the terms of the GNU General Public License |
7 | * | 6 | * |
8 | * June 22, 2004 - get rid of check_region | 7 | * June 22, 2004 - get rid of check_region |
@@ -209,10 +208,10 @@ static int trm290_dma_setup(ide_drive_t *drive) | |||
209 | } | 208 | } |
210 | /* select DMA xfer */ | 209 | /* select DMA xfer */ |
211 | trm290_prepare_drive(drive, 1); | 210 | trm290_prepare_drive(drive, 1); |
212 | outl(hwif->dmatable_dma | rw, hwif->dma_command); | 211 | outl(hwif->dmatable_dma | rw, hwif->dma_base); |
213 | drive->waiting_for_dma = 1; | 212 | drive->waiting_for_dma = 1; |
214 | /* start DMA */ | 213 | /* start DMA */ |
215 | outw((count * 2) - 1, hwif->dma_status); | 214 | outw(count * 2 - 1, hwif->dma_base + 2); |
216 | return 0; | 215 | return 0; |
217 | } | 216 | } |
218 | 217 | ||
@@ -222,23 +221,21 @@ static void trm290_dma_start(ide_drive_t *drive) | |||
222 | 221 | ||
223 | static int trm290_ide_dma_end (ide_drive_t *drive) | 222 | static int trm290_ide_dma_end (ide_drive_t *drive) |
224 | { | 223 | { |
225 | ide_hwif_t *hwif = HWIF(drive); | 224 | u16 status; |
226 | u16 status = 0; | ||
227 | 225 | ||
228 | drive->waiting_for_dma = 0; | 226 | drive->waiting_for_dma = 0; |
229 | /* purge DMA mappings */ | 227 | /* purge DMA mappings */ |
230 | ide_destroy_dmatable(drive); | 228 | ide_destroy_dmatable(drive); |
231 | status = inw(hwif->dma_status); | 229 | status = inw(HWIF(drive)->dma_base + 2); |
232 | return (status != 0x00ff); | 230 | return status != 0x00ff; |
233 | } | 231 | } |
234 | 232 | ||
235 | static int trm290_ide_dma_test_irq (ide_drive_t *drive) | 233 | static int trm290_ide_dma_test_irq (ide_drive_t *drive) |
236 | { | 234 | { |
237 | ide_hwif_t *hwif = HWIF(drive); | 235 | u16 status; |
238 | u16 status = 0; | ||
239 | 236 | ||
240 | status = inw(hwif->dma_status); | 237 | status = inw(HWIF(drive)->dma_base + 2); |
241 | return (status == 0x00ff); | 238 | return status == 0x00ff; |
242 | } | 239 | } |
243 | 240 | ||
244 | static void trm290_dma_host_set(ide_drive_t *drive, int on) | 241 | static void trm290_dma_host_set(ide_drive_t *drive, int on) |
@@ -247,21 +244,37 @@ static void trm290_dma_host_set(ide_drive_t *drive, int on) | |||
247 | 244 | ||
248 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | 245 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) |
249 | { | 246 | { |
250 | unsigned int cfgbase = 0; | 247 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
248 | unsigned int cfg_base = pci_resource_start(dev, 4); | ||
251 | unsigned long flags; | 249 | unsigned long flags; |
252 | u8 reg = 0; | 250 | u8 reg = 0; |
253 | struct pci_dev *dev = hwif->pci_dev; | 251 | |
254 | 252 | if ((dev->class & 5) && cfg_base) | |
255 | cfgbase = pci_resource_start(dev, 4); | 253 | printk(KERN_INFO "TRM290: chip"); |
256 | if ((dev->class & 5) && cfgbase) { | 254 | else { |
257 | hwif->config_data = cfgbase; | 255 | cfg_base = 0x3df0; |
258 | printk(KERN_INFO "TRM290: chip config base at 0x%04lx\n", | 256 | printk(KERN_INFO "TRM290: using default"); |
259 | hwif->config_data); | ||
260 | } else { | ||
261 | hwif->config_data = 0x3df0; | ||
262 | printk(KERN_INFO "TRM290: using default config base at 0x%04lx\n", | ||
263 | hwif->config_data); | ||
264 | } | 257 | } |
258 | printk(KERN_CONT " config base at 0x%04x\n", cfg_base); | ||
259 | hwif->config_data = cfg_base; | ||
260 | hwif->dma_base = (cfg_base + 4) ^ (hwif->channel ? 0x80 : 0); | ||
261 | |||
262 | printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", | ||
263 | hwif->name, hwif->dma_base, hwif->dma_base + 3); | ||
264 | |||
265 | if (!request_region(hwif->dma_base, 4, hwif->name)) { | ||
266 | printk(KERN_CONT " -- Error, ports in use.\n"); | ||
267 | return; | ||
268 | } | ||
269 | |||
270 | hwif->dmatable_cpu = pci_alloc_consistent(dev, PRD_ENTRIES * PRD_BYTES, | ||
271 | &hwif->dmatable_dma); | ||
272 | if (!hwif->dmatable_cpu) { | ||
273 | printk(KERN_CONT " -- Error, unable to allocate DMA table.\n"); | ||
274 | release_region(hwif->dma_base, 4); | ||
275 | return; | ||
276 | } | ||
277 | printk(KERN_CONT "\n"); | ||
265 | 278 | ||
266 | local_irq_save(flags); | 279 | local_irq_save(flags); |
267 | /* put config reg into first byte of hwif->select_data */ | 280 | /* put config reg into first byte of hwif->select_data */ |
@@ -276,15 +289,13 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | |||
276 | outb(reg, hwif->config_data + 3); | 289 | outb(reg, hwif->config_data + 3); |
277 | local_irq_restore(flags); | 290 | local_irq_restore(flags); |
278 | 291 | ||
279 | if ((reg & 0x10)) | 292 | if (reg & 0x10) |
280 | /* legacy mode */ | 293 | /* legacy mode */ |
281 | hwif->irq = hwif->channel ? 15 : 14; | 294 | hwif->irq = hwif->channel ? 15 : 14; |
282 | else if (!hwif->irq && hwif->mate && hwif->mate->irq) | 295 | else if (!hwif->irq && hwif->mate && hwif->mate->irq) |
283 | /* sharing IRQ with mate */ | 296 | /* sharing IRQ with mate */ |
284 | hwif->irq = hwif->mate->irq; | 297 | hwif->irq = hwif->mate->irq; |
285 | 298 | ||
286 | ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); | ||
287 | |||
288 | hwif->dma_host_set = &trm290_dma_host_set; | 299 | hwif->dma_host_set = &trm290_dma_host_set; |
289 | hwif->dma_setup = &trm290_dma_setup; | 300 | hwif->dma_setup = &trm290_dma_setup; |
290 | hwif->dma_exec_cmd = &trm290_dma_exec_cmd; | 301 | hwif->dma_exec_cmd = &trm290_dma_exec_cmd; |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 4b32c90f4896..24cb9047fb41 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -1,7 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * | ||
3 | * Version 3.50 | ||
4 | * | ||
5 | * VIA IDE driver for Linux. Supported southbridges: | 2 | * VIA IDE driver for Linux. Supported southbridges: |
6 | * | 3 | * |
7 | * vt82c576, vt82c586, vt82c586a, vt82c586b, vt82c596a, vt82c596b, | 4 | * vt82c576, vt82c586, vt82c586a, vt82c586b, vt82c596a, vt82c596b, |
@@ -121,8 +118,8 @@ struct via82cxxx_dev | |||
121 | 118 | ||
122 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | 119 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) |
123 | { | 120 | { |
124 | struct pci_dev *dev = hwif->pci_dev; | 121 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
125 | struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev); | 122 | struct via82cxxx_dev *vdev = pci_get_drvdata(dev); |
126 | u8 t; | 123 | u8 t; |
127 | 124 | ||
128 | if (~vdev->via_config->flags & VIA_BAD_AST) { | 125 | if (~vdev->via_config->flags & VIA_BAD_AST) { |
@@ -159,8 +156,10 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | |||
159 | 156 | ||
160 | static void via_set_drive(ide_drive_t *drive, const u8 speed) | 157 | static void via_set_drive(ide_drive_t *drive, const u8 speed) |
161 | { | 158 | { |
162 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 159 | ide_hwif_t *hwif = drive->hwif; |
163 | struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); | 160 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); |
161 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
162 | struct via82cxxx_dev *vdev = pci_get_drvdata(dev); | ||
164 | struct ide_timing t, p; | 163 | struct ide_timing t, p; |
165 | unsigned int T, UT; | 164 | unsigned int T, UT; |
166 | 165 | ||
@@ -408,7 +407,7 @@ static int via_cable_override(struct pci_dev *pdev) | |||
408 | 407 | ||
409 | static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) | 408 | static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) |
410 | { | 409 | { |
411 | struct pci_dev *pdev = hwif->pci_dev; | 410 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
412 | struct via82cxxx_dev *vdev = pci_get_drvdata(pdev); | 411 | struct via82cxxx_dev *vdev = pci_get_drvdata(pdev); |
413 | 412 | ||
414 | if (via_cable_override(pdev)) | 413 | if (via_cable_override(pdev)) |