diff options
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
-rw-r--r-- | drivers/ata/pata_pdc2027x.c | 158 |
1 files changed, 85 insertions, 73 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 93bcdadb7be3..a61cbc110688 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/libata.h> | 35 | #include <linux/libata.h> |
36 | 36 | ||
37 | #define DRV_NAME "pata_pdc2027x" | 37 | #define DRV_NAME "pata_pdc2027x" |
38 | #define DRV_VERSION "0.8" | 38 | #define DRV_VERSION "0.9" |
39 | #undef PDC_DEBUG | 39 | #undef PDC_DEBUG |
40 | 40 | ||
41 | #ifdef PDC_DEBUG | 41 | #ifdef PDC_DEBUG |
@@ -66,8 +66,10 @@ static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *e | |||
66 | static void pdc2027x_error_handler(struct ata_port *ap); | 66 | static void pdc2027x_error_handler(struct ata_port *ap); |
67 | static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); | 67 | static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); |
68 | static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); | 68 | static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); |
69 | static void pdc2027x_post_set_mode(struct ata_port *ap); | ||
70 | static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); | 69 | static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); |
70 | static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long mask); | ||
71 | static int pdc2027x_cable_detect(struct ata_port *ap); | ||
72 | static int pdc2027x_set_mode(struct ata_port *ap, struct ata_device **r_failed); | ||
71 | 73 | ||
72 | /* | 74 | /* |
73 | * ATA Timing Tables based on 133MHz controller clock. | 75 | * ATA Timing Tables based on 133MHz controller clock. |
@@ -146,6 +148,7 @@ static struct scsi_host_template pdc2027x_sht = { | |||
146 | 148 | ||
147 | static struct ata_port_operations pdc2027x_pata100_ops = { | 149 | static struct ata_port_operations pdc2027x_pata100_ops = { |
148 | .port_disable = ata_port_disable, | 150 | .port_disable = ata_port_disable, |
151 | .mode_filter = ata_pci_default_filter, | ||
149 | 152 | ||
150 | .tf_load = ata_tf_load, | 153 | .tf_load = ata_tf_load, |
151 | .tf_read = ata_tf_read, | 154 | .tf_read = ata_tf_read, |
@@ -166,8 +169,8 @@ static struct ata_port_operations pdc2027x_pata100_ops = { | |||
166 | .thaw = ata_bmdma_thaw, | 169 | .thaw = ata_bmdma_thaw, |
167 | .error_handler = pdc2027x_error_handler, | 170 | .error_handler = pdc2027x_error_handler, |
168 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 171 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
172 | .cable_detect = pdc2027x_cable_detect, | ||
169 | 173 | ||
170 | .irq_handler = ata_interrupt, | ||
171 | .irq_clear = ata_bmdma_irq_clear, | 174 | .irq_clear = ata_bmdma_irq_clear, |
172 | .irq_on = ata_irq_on, | 175 | .irq_on = ata_irq_on, |
173 | .irq_ack = ata_irq_ack, | 176 | .irq_ack = ata_irq_ack, |
@@ -179,7 +182,8 @@ static struct ata_port_operations pdc2027x_pata133_ops = { | |||
179 | .port_disable = ata_port_disable, | 182 | .port_disable = ata_port_disable, |
180 | .set_piomode = pdc2027x_set_piomode, | 183 | .set_piomode = pdc2027x_set_piomode, |
181 | .set_dmamode = pdc2027x_set_dmamode, | 184 | .set_dmamode = pdc2027x_set_dmamode, |
182 | .post_set_mode = pdc2027x_post_set_mode, | 185 | .set_mode = pdc2027x_set_mode, |
186 | .mode_filter = pdc2027x_mode_filter, | ||
183 | 187 | ||
184 | .tf_load = ata_tf_load, | 188 | .tf_load = ata_tf_load, |
185 | .tf_read = ata_tf_read, | 189 | .tf_read = ata_tf_read, |
@@ -200,8 +204,8 @@ static struct ata_port_operations pdc2027x_pata133_ops = { | |||
200 | .thaw = ata_bmdma_thaw, | 204 | .thaw = ata_bmdma_thaw, |
201 | .error_handler = pdc2027x_error_handler, | 205 | .error_handler = pdc2027x_error_handler, |
202 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 206 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
207 | .cable_detect = pdc2027x_cable_detect, | ||
203 | 208 | ||
204 | .irq_handler = ata_interrupt, | ||
205 | .irq_clear = ata_bmdma_irq_clear, | 209 | .irq_clear = ata_bmdma_irq_clear, |
206 | .irq_on = ata_irq_on, | 210 | .irq_on = ata_irq_on, |
207 | .irq_ack = ata_irq_ack, | 211 | .irq_ack = ata_irq_ack, |
@@ -212,7 +216,6 @@ static struct ata_port_operations pdc2027x_pata133_ops = { | |||
212 | static struct ata_port_info pdc2027x_port_info[] = { | 216 | static struct ata_port_info pdc2027x_port_info[] = { |
213 | /* PDC_UDMA_100 */ | 217 | /* PDC_UDMA_100 */ |
214 | { | 218 | { |
215 | .sht = &pdc2027x_sht, | ||
216 | .flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SLAVE_POSS | | 219 | .flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SLAVE_POSS | |
217 | ATA_FLAG_MMIO, | 220 | ATA_FLAG_MMIO, |
218 | .pio_mask = 0x1f, /* pio0-4 */ | 221 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -222,7 +225,6 @@ static struct ata_port_info pdc2027x_port_info[] = { | |||
222 | }, | 225 | }, |
223 | /* PDC_UDMA_133 */ | 226 | /* PDC_UDMA_133 */ |
224 | { | 227 | { |
225 | .sht = &pdc2027x_sht, | ||
226 | .flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SLAVE_POSS | | 228 | .flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SLAVE_POSS | |
227 | ATA_FLAG_MMIO, | 229 | ATA_FLAG_MMIO, |
228 | .pio_mask = 0x1f, /* pio0-4 */ | 230 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -261,7 +263,7 @@ static inline void __iomem *dev_mmio(struct ata_port *ap, struct ata_device *ade | |||
261 | } | 263 | } |
262 | 264 | ||
263 | /** | 265 | /** |
264 | * pdc2027x_pata_cbl_detect - Probe host controller cable detect info | 266 | * pdc2027x_pata_cable_detect - Probe host controller cable detect info |
265 | * @ap: Port for which cable detect info is desired | 267 | * @ap: Port for which cable detect info is desired |
266 | * | 268 | * |
267 | * Read 80c cable indicator from Promise extended register. | 269 | * Read 80c cable indicator from Promise extended register. |
@@ -270,7 +272,7 @@ static inline void __iomem *dev_mmio(struct ata_port *ap, struct ata_device *ade | |||
270 | * LOCKING: | 272 | * LOCKING: |
271 | * None (inherited from caller). | 273 | * None (inherited from caller). |
272 | */ | 274 | */ |
273 | static void pdc2027x_cbl_detect(struct ata_port *ap) | 275 | static int pdc2027x_cable_detect(struct ata_port *ap) |
274 | { | 276 | { |
275 | u32 cgcr; | 277 | u32 cgcr; |
276 | 278 | ||
@@ -281,13 +283,10 @@ static void pdc2027x_cbl_detect(struct ata_port *ap) | |||
281 | 283 | ||
282 | PDPRINTK("No cable or 80-conductor cable on port %d\n", ap->port_no); | 284 | PDPRINTK("No cable or 80-conductor cable on port %d\n", ap->port_no); |
283 | 285 | ||
284 | ap->cbl = ATA_CBL_PATA80; | 286 | return ATA_CBL_PATA80; |
285 | return; | ||
286 | |||
287 | cbl40: | 287 | cbl40: |
288 | printk(KERN_INFO DRV_NAME ": 40-conductor cable detected on port %d\n", ap->port_no); | 288 | printk(KERN_INFO DRV_NAME ": 40-conductor cable detected on port %d\n", ap->port_no); |
289 | ap->cbl = ATA_CBL_PATA40; | 289 | return ATA_CBL_PATA40; |
290 | ap->udma_mask &= ATA_UDMA_MASK_40C; | ||
291 | } | 290 | } |
292 | 291 | ||
293 | /** | 292 | /** |
@@ -314,7 +313,6 @@ static int pdc2027x_prereset(struct ata_port *ap) | |||
314 | /* Check whether port enabled */ | 313 | /* Check whether port enabled */ |
315 | if (!pdc2027x_port_enabled(ap)) | 314 | if (!pdc2027x_port_enabled(ap)) |
316 | return -ENOENT; | 315 | return -ENOENT; |
317 | pdc2027x_cbl_detect(ap); | ||
318 | return ata_std_prereset(ap); | 316 | return ata_std_prereset(ap); |
319 | } | 317 | } |
320 | 318 | ||
@@ -334,6 +332,32 @@ static void pdc2027x_error_handler(struct ata_port *ap) | |||
334 | } | 332 | } |
335 | 333 | ||
336 | /** | 334 | /** |
335 | * pdc2720x_mode_filter - mode selection filter | ||
336 | * @adev: ATA device | ||
337 | * @mask: list of modes proposed | ||
338 | * | ||
339 | * Block UDMA on devices that cause trouble with this controller. | ||
340 | */ | ||
341 | |||
342 | static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long mask) | ||
343 | { | ||
344 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | ||
345 | struct ata_device *pair = ata_dev_pair(adev); | ||
346 | |||
347 | if (adev->class != ATA_DEV_ATA || adev->devno == 0 || pair == NULL) | ||
348 | return ata_pci_default_filter(adev, mask); | ||
349 | |||
350 | /* Check for slave of a Maxtor at UDMA6 */ | ||
351 | ata_id_c_string(pair->id, model_num, ATA_ID_PROD, | ||
352 | ATA_ID_PROD_LEN + 1); | ||
353 | /* If the master is a maxtor in UDMA6 then the slave should not use UDMA 6 */ | ||
354 | if(strstr(model_num, "Maxtor") == 0 && pair->dma_mode == XFER_UDMA_6) | ||
355 | mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); | ||
356 | |||
357 | return ata_pci_default_filter(adev, mask); | ||
358 | } | ||
359 | |||
360 | /** | ||
337 | * pdc2027x_set_piomode - Initialize host controller PATA PIO timings | 361 | * pdc2027x_set_piomode - Initialize host controller PATA PIO timings |
338 | * @ap: Port to configure | 362 | * @ap: Port to configure |
339 | * @adev: um | 363 | * @adev: um |
@@ -444,17 +468,22 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
444 | } | 468 | } |
445 | 469 | ||
446 | /** | 470 | /** |
447 | * pdc2027x_post_set_mode - Set the timing registers back to correct values. | 471 | * pdc2027x_set_mode - Set the timing registers back to correct values. |
448 | * @ap: Port to configure | 472 | * @ap: Port to configure |
473 | * @r_failed: Returned device for failure | ||
449 | * | 474 | * |
450 | * The pdc2027x hardware will look at "SET FEATURES" and change the timing registers | 475 | * The pdc2027x hardware will look at "SET FEATURES" and change the timing registers |
451 | * automatically. The values set by the hardware might be incorrect, under 133Mhz PLL. | 476 | * automatically. The values set by the hardware might be incorrect, under 133Mhz PLL. |
452 | * This function overwrites the possibly incorrect values set by the hardware to be correct. | 477 | * This function overwrites the possibly incorrect values set by the hardware to be correct. |
453 | */ | 478 | */ |
454 | static void pdc2027x_post_set_mode(struct ata_port *ap) | 479 | static int pdc2027x_set_mode(struct ata_port *ap, struct ata_device **r_failed) |
455 | { | 480 | { |
456 | int i; | 481 | int i; |
457 | 482 | ||
483 | i = ata_do_set_mode(ap, r_failed); | ||
484 | if (i < 0) | ||
485 | return i; | ||
486 | |||
458 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 487 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
459 | struct ata_device *dev = &ap->device[i]; | 488 | struct ata_device *dev = &ap->device[i]; |
460 | 489 | ||
@@ -476,6 +505,7 @@ static void pdc2027x_post_set_mode(struct ata_port *ap) | |||
476 | } | 505 | } |
477 | } | 506 | } |
478 | } | 507 | } |
508 | return 0; | ||
479 | } | 509 | } |
480 | 510 | ||
481 | /** | 511 | /** |
@@ -521,12 +551,12 @@ static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc) | |||
521 | 551 | ||
522 | /** | 552 | /** |
523 | * pdc_read_counter - Read the ctr counter | 553 | * pdc_read_counter - Read the ctr counter |
524 | * @probe_ent: for the port address | 554 | * @host: target ATA host |
525 | */ | 555 | */ |
526 | 556 | ||
527 | static long pdc_read_counter(struct ata_probe_ent *probe_ent) | 557 | static long pdc_read_counter(struct ata_host *host) |
528 | { | 558 | { |
529 | void __iomem *mmio_base = probe_ent->iomap[PDC_MMIO_BAR]; | 559 | void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; |
530 | long counter; | 560 | long counter; |
531 | int retry = 1; | 561 | int retry = 1; |
532 | u32 bccrl, bccrh, bccrlv, bccrhv; | 562 | u32 bccrl, bccrh, bccrlv, bccrhv; |
@@ -564,12 +594,12 @@ retry: | |||
564 | * adjust_pll - Adjust the PLL input clock in Hz. | 594 | * adjust_pll - Adjust the PLL input clock in Hz. |
565 | * | 595 | * |
566 | * @pdc_controller: controller specific information | 596 | * @pdc_controller: controller specific information |
567 | * @probe_ent: For the port address | 597 | * @host: target ATA host |
568 | * @pll_clock: The input of PLL in HZ | 598 | * @pll_clock: The input of PLL in HZ |
569 | */ | 599 | */ |
570 | static void pdc_adjust_pll(struct ata_probe_ent *probe_ent, long pll_clock, unsigned int board_idx) | 600 | static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int board_idx) |
571 | { | 601 | { |
572 | void __iomem *mmio_base = probe_ent->iomap[PDC_MMIO_BAR]; | 602 | void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; |
573 | u16 pll_ctl; | 603 | u16 pll_ctl; |
574 | long pll_clock_khz = pll_clock / 1000; | 604 | long pll_clock_khz = pll_clock / 1000; |
575 | long pout_required = board_idx? PDC_133_MHZ:PDC_100_MHZ; | 605 | long pout_required = board_idx? PDC_133_MHZ:PDC_100_MHZ; |
@@ -649,19 +679,19 @@ static void pdc_adjust_pll(struct ata_probe_ent *probe_ent, long pll_clock, unsi | |||
649 | 679 | ||
650 | /** | 680 | /** |
651 | * detect_pll_input_clock - Detect the PLL input clock in Hz. | 681 | * detect_pll_input_clock - Detect the PLL input clock in Hz. |
652 | * @probe_ent: for the port address | 682 | * @host: target ATA host |
653 | * Ex. 16949000 on 33MHz PCI bus for pdc20275. | 683 | * Ex. 16949000 on 33MHz PCI bus for pdc20275. |
654 | * Half of the PCI clock. | 684 | * Half of the PCI clock. |
655 | */ | 685 | */ |
656 | static long pdc_detect_pll_input_clock(struct ata_probe_ent *probe_ent) | 686 | static long pdc_detect_pll_input_clock(struct ata_host *host) |
657 | { | 687 | { |
658 | void __iomem *mmio_base = probe_ent->iomap[PDC_MMIO_BAR]; | 688 | void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; |
659 | u32 scr; | 689 | u32 scr; |
660 | long start_count, end_count; | 690 | long start_count, end_count; |
661 | long pll_clock; | 691 | long pll_clock; |
662 | 692 | ||
663 | /* Read current counter value */ | 693 | /* Read current counter value */ |
664 | start_count = pdc_read_counter(probe_ent); | 694 | start_count = pdc_read_counter(host); |
665 | 695 | ||
666 | /* Start the test mode */ | 696 | /* Start the test mode */ |
667 | scr = readl(mmio_base + PDC_SYS_CTL); | 697 | scr = readl(mmio_base + PDC_SYS_CTL); |
@@ -673,7 +703,7 @@ static long pdc_detect_pll_input_clock(struct ata_probe_ent *probe_ent) | |||
673 | mdelay(100); | 703 | mdelay(100); |
674 | 704 | ||
675 | /* Read the counter values again */ | 705 | /* Read the counter values again */ |
676 | end_count = pdc_read_counter(probe_ent); | 706 | end_count = pdc_read_counter(host); |
677 | 707 | ||
678 | /* Stop the test mode */ | 708 | /* Stop the test mode */ |
679 | scr = readl(mmio_base + PDC_SYS_CTL); | 709 | scr = readl(mmio_base + PDC_SYS_CTL); |
@@ -692,11 +722,10 @@ static long pdc_detect_pll_input_clock(struct ata_probe_ent *probe_ent) | |||
692 | 722 | ||
693 | /** | 723 | /** |
694 | * pdc_hardware_init - Initialize the hardware. | 724 | * pdc_hardware_init - Initialize the hardware. |
695 | * @pdev: instance of pci_dev found | 725 | * @host: target ATA host |
696 | * @pdc_controller: controller specific information | 726 | * @board_idx: board identifier |
697 | * @pe: for the port address | ||
698 | */ | 727 | */ |
699 | static int pdc_hardware_init(struct pci_dev *pdev, struct ata_probe_ent *pe, unsigned int board_idx) | 728 | static int pdc_hardware_init(struct ata_host *host, unsigned int board_idx) |
700 | { | 729 | { |
701 | long pll_clock; | 730 | long pll_clock; |
702 | 731 | ||
@@ -706,15 +735,15 @@ static int pdc_hardware_init(struct pci_dev *pdev, struct ata_probe_ent *pe, uns | |||
706 | * Ex. 25MHz or 40MHz, we have to adjust the cycle_time. | 735 | * Ex. 25MHz or 40MHz, we have to adjust the cycle_time. |
707 | * The pdc20275 controller employs PLL circuit to help correct timing registers setting. | 736 | * The pdc20275 controller employs PLL circuit to help correct timing registers setting. |
708 | */ | 737 | */ |
709 | pll_clock = pdc_detect_pll_input_clock(pe); | 738 | pll_clock = pdc_detect_pll_input_clock(host); |
710 | 739 | ||
711 | if (pll_clock < 0) /* counter overflow? Try again. */ | 740 | if (pll_clock < 0) /* counter overflow? Try again. */ |
712 | pll_clock = pdc_detect_pll_input_clock(pe); | 741 | pll_clock = pdc_detect_pll_input_clock(host); |
713 | 742 | ||
714 | dev_printk(KERN_INFO, &pdev->dev, "PLL input clock %ld kHz\n", pll_clock/1000); | 743 | dev_printk(KERN_INFO, host->dev, "PLL input clock %ld kHz\n", pll_clock/1000); |
715 | 744 | ||
716 | /* Adjust PLL control register */ | 745 | /* Adjust PLL control register */ |
717 | pdc_adjust_pll(pe, pll_clock, board_idx); | 746 | pdc_adjust_pll(host, pll_clock, board_idx); |
718 | 747 | ||
719 | return 0; | 748 | return 0; |
720 | } | 749 | } |
@@ -746,8 +775,7 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base) | |||
746 | * Called when an instance of PCI adapter is inserted. | 775 | * Called when an instance of PCI adapter is inserted. |
747 | * This function checks whether the hardware is supported, | 776 | * This function checks whether the hardware is supported, |
748 | * initialize hardware and register an instance of ata_host to | 777 | * initialize hardware and register an instance of ata_host to |
749 | * libata by providing struct ata_probe_ent and ata_device_add(). | 778 | * libata. (implements struct pci_driver.probe() ) |
750 | * (implements struct pci_driver.probe() ) | ||
751 | * | 779 | * |
752 | * @pdev: instance of pci_dev found | 780 | * @pdev: instance of pci_dev found |
753 | * @ent: matching entry in the id_tbl[] | 781 | * @ent: matching entry in the id_tbl[] |
@@ -756,14 +784,21 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de | |||
756 | { | 784 | { |
757 | static int printed_version; | 785 | static int printed_version; |
758 | unsigned int board_idx = (unsigned int) ent->driver_data; | 786 | unsigned int board_idx = (unsigned int) ent->driver_data; |
759 | 787 | const struct ata_port_info *ppi[] = | |
760 | struct ata_probe_ent *probe_ent; | 788 | { &pdc2027x_port_info[board_idx], NULL }; |
789 | struct ata_host *host; | ||
761 | void __iomem *mmio_base; | 790 | void __iomem *mmio_base; |
762 | int rc; | 791 | int rc; |
763 | 792 | ||
764 | if (!printed_version++) | 793 | if (!printed_version++) |
765 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 794 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
766 | 795 | ||
796 | /* alloc host */ | ||
797 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2); | ||
798 | if (!host) | ||
799 | return -ENOMEM; | ||
800 | |||
801 | /* acquire resources and fill host */ | ||
767 | rc = pcim_enable_device(pdev); | 802 | rc = pcim_enable_device(pdev); |
768 | if (rc) | 803 | if (rc) |
769 | return rc; | 804 | return rc; |
@@ -771,6 +806,7 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de | |||
771 | rc = pcim_iomap_regions(pdev, 1 << PDC_MMIO_BAR, DRV_NAME); | 806 | rc = pcim_iomap_regions(pdev, 1 << PDC_MMIO_BAR, DRV_NAME); |
772 | if (rc) | 807 | if (rc) |
773 | return rc; | 808 | return rc; |
809 | host->iomap = pcim_iomap_table(pdev); | ||
774 | 810 | ||
775 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); | 811 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); |
776 | if (rc) | 812 | if (rc) |
@@ -780,46 +816,22 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de | |||
780 | if (rc) | 816 | if (rc) |
781 | return rc; | 817 | return rc; |
782 | 818 | ||
783 | /* Prepare the probe entry */ | 819 | mmio_base = host->iomap[PDC_MMIO_BAR]; |
784 | probe_ent = devm_kzalloc(&pdev->dev, sizeof(*probe_ent), GFP_KERNEL); | ||
785 | if (probe_ent == NULL) | ||
786 | return -ENOMEM; | ||
787 | |||
788 | probe_ent->dev = pci_dev_to_dev(pdev); | ||
789 | INIT_LIST_HEAD(&probe_ent->node); | ||
790 | |||
791 | probe_ent->sht = pdc2027x_port_info[board_idx].sht; | ||
792 | probe_ent->port_flags = pdc2027x_port_info[board_idx].flags; | ||
793 | probe_ent->pio_mask = pdc2027x_port_info[board_idx].pio_mask; | ||
794 | probe_ent->mwdma_mask = pdc2027x_port_info[board_idx].mwdma_mask; | ||
795 | probe_ent->udma_mask = pdc2027x_port_info[board_idx].udma_mask; | ||
796 | probe_ent->port_ops = pdc2027x_port_info[board_idx].port_ops; | ||
797 | 820 | ||
798 | probe_ent->irq = pdev->irq; | 821 | pdc_ata_setup_port(&host->ports[0]->ioaddr, mmio_base + 0x17c0); |
799 | probe_ent->irq_flags = IRQF_SHARED; | 822 | host->ports[0]->ioaddr.bmdma_addr = mmio_base + 0x1000; |
800 | probe_ent->iomap = pcim_iomap_table(pdev); | 823 | pdc_ata_setup_port(&host->ports[1]->ioaddr, mmio_base + 0x15c0); |
824 | host->ports[1]->ioaddr.bmdma_addr = mmio_base + 0x1008; | ||
801 | 825 | ||
802 | mmio_base = probe_ent->iomap[PDC_MMIO_BAR]; | ||
803 | |||
804 | pdc_ata_setup_port(&probe_ent->port[0], mmio_base + 0x17c0); | ||
805 | probe_ent->port[0].bmdma_addr = mmio_base + 0x1000; | ||
806 | pdc_ata_setup_port(&probe_ent->port[1], mmio_base + 0x15c0); | ||
807 | probe_ent->port[1].bmdma_addr = mmio_base + 0x1008; | ||
808 | |||
809 | probe_ent->n_ports = 2; | ||
810 | |||
811 | pci_set_master(pdev); | ||
812 | //pci_enable_intx(pdev); | 826 | //pci_enable_intx(pdev); |
813 | 827 | ||
814 | /* initialize adapter */ | 828 | /* initialize adapter */ |
815 | if (pdc_hardware_init(pdev, probe_ent, board_idx) != 0) | 829 | if (pdc_hardware_init(host, board_idx) != 0) |
816 | return -EIO; | 830 | return -EIO; |
817 | 831 | ||
818 | if (!ata_device_add(probe_ent)) | 832 | pci_set_master(pdev); |
819 | return -ENODEV; | 833 | return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, |
820 | 834 | &pdc2027x_sht); | |
821 | devm_kfree(&pdev->dev, probe_ent); | ||
822 | return 0; | ||
823 | } | 835 | } |
824 | 836 | ||
825 | /** | 837 | /** |