aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/aec62xx.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
commitac95beedf8bc97b24f9540d4da9952f07221c023 (patch)
treec29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/pci/aec62xx.c
parent4a27214d7be31e122db4102166f49ec15958e8e9 (diff)
ide: add struct ide_port_ops (take 2)
* Move hooks for port/host specific methods from ide_hwif_t to 'struct ide_port_ops'. * Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info' and ide_hwif_t. * Update host drivers and core code accordingly. While at it: * Rename ata66_*() cable detect functions to *_cable_detect() to match the standard naming. (Suggested by Sergei Shtylyov) v2: * Fix build for bast-ide. (Noticed by Andrew Morton) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/aec62xx.c')
-rw-r--r--drivers/ide/pci/aec62xx.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index c9ba15afe97d..ca16f37f9486 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -135,7 +135,7 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed)
135 135
136static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio) 136static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
137{ 137{
138 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); 138 drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0);
139} 139}
140 140
141static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 141static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
@@ -175,27 +175,23 @@ static u8 __devinit atp86x_cable_detect(ide_hwif_t *hwif)
175 return (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 175 return (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
176} 176}
177 177
178static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) 178static const struct ide_port_ops atp850_port_ops = {
179{ 179 .set_pio_mode = aec_set_pio_mode,
180 struct pci_dev *dev = to_pci_dev(hwif->dev); 180 .set_dma_mode = aec6210_set_mode,
181 181};
182 hwif->set_pio_mode = &aec_set_pio_mode;
183
184 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
185 hwif->set_dma_mode = &aec6210_set_mode;
186 else {
187 hwif->set_dma_mode = &aec6260_set_mode;
188 182
189 hwif->cable_detect = atp86x_cable_detect; 183static const struct ide_port_ops atp86x_port_ops = {
190 } 184 .set_pio_mode = aec_set_pio_mode,
191} 185 .set_dma_mode = aec6260_set_mode,
186 .cable_detect = atp86x_cable_detect,
187};
192 188
193static const struct ide_port_info aec62xx_chipsets[] __devinitdata = { 189static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
194 { /* 0 */ 190 { /* 0 */
195 .name = "AEC6210", 191 .name = "AEC6210",
196 .init_chipset = init_chipset_aec62xx, 192 .init_chipset = init_chipset_aec62xx,
197 .init_hwif = init_hwif_aec62xx,
198 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 193 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
194 .port_ops = &atp850_port_ops,
199 .host_flags = IDE_HFLAG_SERIALIZE | 195 .host_flags = IDE_HFLAG_SERIALIZE |
200 IDE_HFLAG_NO_ATAPI_DMA | 196 IDE_HFLAG_NO_ATAPI_DMA |
201 IDE_HFLAG_NO_DSC | 197 IDE_HFLAG_NO_DSC |
@@ -207,7 +203,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
207 },{ /* 1 */ 203 },{ /* 1 */
208 .name = "AEC6260", 204 .name = "AEC6260",
209 .init_chipset = init_chipset_aec62xx, 205 .init_chipset = init_chipset_aec62xx,
210 .init_hwif = init_hwif_aec62xx, 206 .port_ops = &atp86x_port_ops,
211 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA | 207 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA |
212 IDE_HFLAG_ABUSE_SET_DMA_MODE | 208 IDE_HFLAG_ABUSE_SET_DMA_MODE |
213 IDE_HFLAG_OFF_BOARD, 209 IDE_HFLAG_OFF_BOARD,
@@ -217,8 +213,8 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
217 },{ /* 2 */ 213 },{ /* 2 */
218 .name = "AEC6260R", 214 .name = "AEC6260R",
219 .init_chipset = init_chipset_aec62xx, 215 .init_chipset = init_chipset_aec62xx,
220 .init_hwif = init_hwif_aec62xx,
221 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 216 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
217 .port_ops = &atp86x_port_ops,
222 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | 218 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
223 IDE_HFLAG_ABUSE_SET_DMA_MODE | 219 IDE_HFLAG_ABUSE_SET_DMA_MODE |
224 IDE_HFLAG_NON_BOOTABLE, 220 IDE_HFLAG_NON_BOOTABLE,
@@ -228,7 +224,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
228 },{ /* 3 */ 224 },{ /* 3 */
229 .name = "AEC6280", 225 .name = "AEC6280",
230 .init_chipset = init_chipset_aec62xx, 226 .init_chipset = init_chipset_aec62xx,
231 .init_hwif = init_hwif_aec62xx, 227 .port_ops = &atp86x_port_ops,
232 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | 228 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
233 IDE_HFLAG_ABUSE_SET_DMA_MODE | 229 IDE_HFLAG_ABUSE_SET_DMA_MODE |
234 IDE_HFLAG_OFF_BOARD, 230 IDE_HFLAG_OFF_BOARD,
@@ -238,8 +234,8 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
238 },{ /* 4 */ 234 },{ /* 4 */
239 .name = "AEC6280R", 235 .name = "AEC6280R",
240 .init_chipset = init_chipset_aec62xx, 236 .init_chipset = init_chipset_aec62xx,
241 .init_hwif = init_hwif_aec62xx,
242 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 237 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
238 .port_ops = &atp86x_port_ops,
243 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | 239 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
244 IDE_HFLAG_ABUSE_SET_DMA_MODE | 240 IDE_HFLAG_ABUSE_SET_DMA_MODE |
245 IDE_HFLAG_OFF_BOARD, 241 IDE_HFLAG_OFF_BOARD,