diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:15 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:15 -0400 |
commit | 60e57ed7c12917932a01d1679d92a7a8735afbce (patch) | |
tree | 7bdbde85b117c0c976f25e22b6507f774608f50c /drivers/ide/pci | |
parent | 08da591e14cf87247ec09b17c350235157a92fc3 (diff) |
aec62xx: convert to use ->host_priv
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r-- | drivers/ide/pci/aec62xx.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 7a5d246fe9b1..7ca7989bc35d 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -59,10 +59,6 @@ static const struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { | |||
59 | { 0, 0x00, 0x00 } | 59 | { 0, 0x00, 0x00 } |
60 | }; | 60 | }; |
61 | 61 | ||
62 | #define BUSCLOCK(D) \ | ||
63 | ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) | ||
64 | |||
65 | |||
66 | /* | 62 | /* |
67 | * TO DO: active tuning and correction of cards without a bios. | 63 | * TO DO: active tuning and correction of cards without a bios. |
68 | */ | 64 | */ |
@@ -88,6 +84,8 @@ static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | |||
88 | { | 84 | { |
89 | ide_hwif_t *hwif = HWIF(drive); | 85 | ide_hwif_t *hwif = HWIF(drive); |
90 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 86 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
87 | struct ide_host *host = pci_get_drvdata(dev); | ||
88 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; | ||
91 | u16 d_conf = 0; | 89 | u16 d_conf = 0; |
92 | u8 ultra = 0, ultra_conf = 0; | 90 | u8 ultra = 0, ultra_conf = 0; |
93 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; | 91 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; |
@@ -96,7 +94,7 @@ static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | |||
96 | local_irq_save(flags); | 94 | local_irq_save(flags); |
97 | /* 0x40|(2*drive->dn): Active, 0x41|(2*drive->dn): Recovery */ | 95 | /* 0x40|(2*drive->dn): Active, 0x41|(2*drive->dn): Recovery */ |
98 | pci_read_config_word(dev, 0x40|(2*drive->dn), &d_conf); | 96 | pci_read_config_word(dev, 0x40|(2*drive->dn), &d_conf); |
99 | tmp0 = pci_bus_clock_list(speed, BUSCLOCK(dev)); | 97 | tmp0 = pci_bus_clock_list(speed, bus_clock); |
100 | d_conf = ((tmp0 & 0xf0) << 4) | (tmp0 & 0xf); | 98 | d_conf = ((tmp0 & 0xf0) << 4) | (tmp0 & 0xf); |
101 | pci_write_config_word(dev, 0x40|(2*drive->dn), d_conf); | 99 | pci_write_config_word(dev, 0x40|(2*drive->dn), d_conf); |
102 | 100 | ||
@@ -104,7 +102,7 @@ static void aec6210_set_mode(ide_drive_t *drive, const u8 speed) | |||
104 | tmp2 = 0x00; | 102 | tmp2 = 0x00; |
105 | pci_read_config_byte(dev, 0x54, &ultra); | 103 | pci_read_config_byte(dev, 0x54, &ultra); |
106 | tmp1 = ((0x00 << (2*drive->dn)) | (ultra & ~(3 << (2*drive->dn)))); | 104 | tmp1 = ((0x00 << (2*drive->dn)) | (ultra & ~(3 << (2*drive->dn)))); |
107 | ultra_conf = pci_bus_clock_list_ultra(speed, BUSCLOCK(dev)); | 105 | ultra_conf = pci_bus_clock_list_ultra(speed, bus_clock); |
108 | tmp2 = ((ultra_conf << (2*drive->dn)) | (tmp1 & ~(3 << (2*drive->dn)))); | 106 | tmp2 = ((ultra_conf << (2*drive->dn)) | (tmp1 & ~(3 << (2*drive->dn)))); |
109 | pci_write_config_byte(dev, 0x54, tmp2); | 107 | pci_write_config_byte(dev, 0x54, tmp2); |
110 | local_irq_restore(flags); | 108 | local_irq_restore(flags); |
@@ -114,6 +112,8 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | |||
114 | { | 112 | { |
115 | ide_hwif_t *hwif = HWIF(drive); | 113 | ide_hwif_t *hwif = HWIF(drive); |
116 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 114 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
115 | struct ide_host *host = pci_get_drvdata(dev); | ||
116 | struct chipset_bus_clock_list_entry *bus_clock = host->host_priv; | ||
117 | u8 unit = (drive->select.b.unit & 0x01); | 117 | u8 unit = (drive->select.b.unit & 0x01); |
118 | u8 tmp1 = 0, tmp2 = 0; | 118 | u8 tmp1 = 0, tmp2 = 0; |
119 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 119 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
@@ -122,12 +122,12 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed) | |||
122 | local_irq_save(flags); | 122 | local_irq_save(flags); |
123 | /* high 4-bits: Active, low 4-bits: Recovery */ | 123 | /* high 4-bits: Active, low 4-bits: Recovery */ |
124 | pci_read_config_byte(dev, 0x40|drive->dn, &drive_conf); | 124 | pci_read_config_byte(dev, 0x40|drive->dn, &drive_conf); |
125 | drive_conf = pci_bus_clock_list(speed, BUSCLOCK(dev)); | 125 | drive_conf = pci_bus_clock_list(speed, bus_clock); |
126 | pci_write_config_byte(dev, 0x40|drive->dn, drive_conf); | 126 | pci_write_config_byte(dev, 0x40|drive->dn, drive_conf); |
127 | 127 | ||
128 | pci_read_config_byte(dev, (0x44|hwif->channel), &ultra); | 128 | pci_read_config_byte(dev, (0x44|hwif->channel), &ultra); |
129 | tmp1 = ((0x00 << (4*unit)) | (ultra & ~(7 << (4*unit)))); | 129 | tmp1 = ((0x00 << (4*unit)) | (ultra & ~(7 << (4*unit)))); |
130 | ultra_conf = pci_bus_clock_list_ultra(speed, BUSCLOCK(dev)); | 130 | ultra_conf = pci_bus_clock_list_ultra(speed, bus_clock); |
131 | tmp2 = ((ultra_conf << (4*unit)) | (tmp1 & ~(7 << (4*unit)))); | 131 | tmp2 = ((ultra_conf << (4*unit)) | (tmp1 & ~(7 << (4*unit)))); |
132 | pci_write_config_byte(dev, (0x44|hwif->channel), tmp2); | 132 | pci_write_config_byte(dev, (0x44|hwif->channel), tmp2); |
133 | local_irq_restore(flags); | 133 | local_irq_restore(flags); |
@@ -140,13 +140,6 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
140 | 140 | ||
141 | static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) | 141 | static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) |
142 | { | 142 | { |
143 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; | ||
144 | |||
145 | if (bus_speed <= 33) | ||
146 | pci_set_drvdata(dev, (void *) aec6xxx_33_base); | ||
147 | else | ||
148 | pci_set_drvdata(dev, (void *) aec6xxx_34_base); | ||
149 | |||
150 | /* These are necessary to get AEC6280 Macintosh cards to work */ | 143 | /* These are necessary to get AEC6280 Macintosh cards to work */ |
151 | if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || | 144 | if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || |
152 | (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R)) { | 145 | (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R)) { |
@@ -254,10 +247,17 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { | |||
254 | 247 | ||
255 | static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 248 | static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
256 | { | 249 | { |
250 | const struct chipset_bus_clock_list_entry *bus_clock; | ||
257 | struct ide_port_info d; | 251 | struct ide_port_info d; |
258 | u8 idx = id->driver_data; | 252 | u8 idx = id->driver_data; |
253 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; | ||
259 | int err; | 254 | int err; |
260 | 255 | ||
256 | if (bus_speed <= 33) | ||
257 | bus_clock = aec6xxx_33_base; | ||
258 | else | ||
259 | bus_clock = aec6xxx_34_base; | ||
260 | |||
261 | err = pci_enable_device(dev); | 261 | err = pci_enable_device(dev); |
262 | if (err) | 262 | if (err) |
263 | return err; | 263 | return err; |
@@ -273,7 +273,7 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi | |||
273 | } | 273 | } |
274 | } | 274 | } |
275 | 275 | ||
276 | err = ide_pci_init_one(dev, &d, NULL); | 276 | err = ide_pci_init_one(dev, &d, (void *)bus_clock); |
277 | if (err) | 277 | if (err) |
278 | pci_disable_device(dev); | 278 | pci_disable_device(dev); |
279 | 279 | ||