2 * sata_inic162x.c - Driver for Initio 162x SATA controllers
4 * Copyright 2006 SUSE Linux Products GmbH
5 * Copyright 2006 Tejun Heo <teheo@novell.com>
7 * This file is released under GPL v2.
9 * This controller is eccentric and easily locks up if something isn't
10 * right. Documentation is available at initio's website but it only
11 * documents registers (not programming model).
15 * - ATAPI read works but burning doesn't. This thing is really
16 * peculiar about ATAPI and I couldn't figure out how ATAPI PIO and
17 * ATAPI DMA WRITE should be programmed. If you've got a clue, be
19 * - Both STR and STD work.
22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/pci.h>
25 #include <scsi/scsi_host.h>
26 #include <linux/libata.h>
27 #include <linux/blkdev.h>
28 #include <scsi/scsi_device.h>
30 #define DRV_NAME "sata_inic162x"
31 #define DRV_VERSION "0.3"
45 /* registers for ATA TF operation */
52 PORT_PRD_XFERLEN
= 0x10,
60 HCTL_IRQOFF
= (1 << 8), /* global IRQ off */
61 HCTL_PWRDWN
= (1 << 13), /* power down PHYs */
62 HCTL_SOFTRST
= (1 << 13), /* global reset (no phy reset) */
63 HCTL_RPGSEL
= (1 << 15), /* register page select */
65 HCTL_KNOWN_BITS
= HCTL_IRQOFF
| HCTL_PWRDWN
| HCTL_SOFTRST
|
68 /* HOST_IRQ_(STAT|MASK) bits */
69 HIRQ_PORT0
= (1 << 0),
70 HIRQ_PORT1
= (1 << 1),
71 HIRQ_SOFT
= (1 << 14),
72 HIRQ_GLOBAL
= (1 << 15), /* STAT only */
74 /* PORT_IRQ_(STAT|MASK) bits */
75 PIRQ_OFFLINE
= (1 << 0), /* device unplugged */
76 PIRQ_ONLINE
= (1 << 1), /* device plugged */
77 PIRQ_COMPLETE
= (1 << 2), /* completion interrupt */
78 PIRQ_FATAL
= (1 << 3), /* fatal error */
79 PIRQ_ATA
= (1 << 4), /* ATA interrupt */
80 PIRQ_REPLY
= (1 << 5), /* reply FIFO not empty */
81 PIRQ_PENDING
= (1 << 7), /* port IRQ pending (STAT only) */
83 PIRQ_ERR
= PIRQ_OFFLINE
| PIRQ_ONLINE
| PIRQ_FATAL
,
85 PIRQ_MASK_DMA_READ
= PIRQ_REPLY
| PIRQ_ATA
,
86 PIRQ_MASK_OTHER
= PIRQ_REPLY
| PIRQ_COMPLETE
,
87 PIRQ_MASK_FREEZE
= 0xff,
89 /* PORT_PRD_CTL bits */
90 PRD_CTL_START
= (1 << 0),
91 PRD_CTL_WR
= (1 << 3),
92 PRD_CTL_DMAEN
= (1 << 7), /* DMA enable */
94 /* PORT_IDMA_CTL bits */
95 IDMA_CTL_RST_ATA
= (1 << 2), /* hardreset ATA bus */
96 IDMA_CTL_RST_IDMA
= (1 << 5), /* reset IDMA machinary */
97 IDMA_CTL_GO
= (1 << 7), /* IDMA mode go */
98 IDMA_CTL_ATA_NIEN
= (1 << 8), /* ATA IRQ disable */
101 struct inic_host_priv
{
105 struct inic_port_priv
{
111 static struct scsi_host_template inic_sht
= {
112 .module
= THIS_MODULE
,
114 .ioctl
= ata_scsi_ioctl
,
115 .queuecommand
= ata_scsi_queuecmd
,
116 .can_queue
= ATA_DEF_QUEUE
,
117 .this_id
= ATA_SHT_THIS_ID
,
118 .sg_tablesize
= LIBATA_MAX_PRD
,
119 .cmd_per_lun
= ATA_SHT_CMD_PER_LUN
,
120 .emulated
= ATA_SHT_EMULATED
,
121 .use_clustering
= ATA_SHT_USE_CLUSTERING
,
122 .proc_name
= DRV_NAME
,
123 .dma_boundary
= ATA_DMA_BOUNDARY
,
124 .slave_configure
= ata_scsi_slave_config
,
125 .slave_destroy
= ata_scsi_slave_destroy
,
126 .bios_param
= ata_std_bios_param
,
129 static const int scr_map
[] = {
135 static void __iomem
*inic_port_base(struct ata_port
*ap
)
137 return ap
->host
->iomap
[MMIO_BAR
] + ap
->port_no
* PORT_SIZE
;
140 static void __inic_set_pirq_mask(struct ata_port
*ap
, u8 mask
)
142 void __iomem
*port_base
= inic_port_base(ap
);
143 struct inic_port_priv
*pp
= ap
->private_data
;
145 writeb(mask
, port_base
+ PORT_IRQ_MASK
);
146 pp
->cached_pirq_mask
= mask
;
149 static void inic_set_pirq_mask(struct ata_port
*ap
, u8 mask
)
151 struct inic_port_priv
*pp
= ap
->private_data
;
153 if (pp
->cached_pirq_mask
!= mask
)
154 __inic_set_pirq_mask(ap
, mask
);
157 static void inic_reset_port(void __iomem
*port_base
)
159 void __iomem
*idma_ctl
= port_base
+ PORT_IDMA_CTL
;
162 ctl
= readw(idma_ctl
);
163 ctl
&= ~(IDMA_CTL_RST_IDMA
| IDMA_CTL_ATA_NIEN
| IDMA_CTL_GO
);
165 /* mask IRQ and assert reset */
166 writew(ctl
| IDMA_CTL_RST_IDMA
| IDMA_CTL_ATA_NIEN
, idma_ctl
);
167 readw(idma_ctl
); /* flush */
169 /* give it some time */
173 writew(ctl
| IDMA_CTL_ATA_NIEN
, idma_ctl
);
176 writeb(0xff, port_base
+ PORT_IRQ_STAT
);
178 /* reenable ATA IRQ, turn off IDMA mode */
179 writew(ctl
, idma_ctl
);
182 static int inic_scr_read(struct ata_port
*ap
, unsigned sc_reg
, u32
*val
)
184 void __iomem
*scr_addr
= ap
->ioaddr
.scr_addr
;
187 if (unlikely(sc_reg
>= ARRAY_SIZE(scr_map
)))
190 addr
= scr_addr
+ scr_map
[sc_reg
] * 4;
191 *val
= readl(scr_addr
+ scr_map
[sc_reg
] * 4);
193 /* this controller has stuck DIAG.N, ignore it */
194 if (sc_reg
== SCR_ERROR
)
195 *val
&= ~SERR_PHYRDY_CHG
;
199 static int inic_scr_write(struct ata_port
*ap
, unsigned sc_reg
, u32 val
)
201 void __iomem
*scr_addr
= ap
->ioaddr
.scr_addr
;
204 if (unlikely(sc_reg
>= ARRAY_SIZE(scr_map
)))
207 addr
= scr_addr
+ scr_map
[sc_reg
] * 4;
208 writel(val
, scr_addr
+ scr_map
[sc_reg
] * 4);
213 * In TF mode, inic162x is very similar to SFF device. TF registers
214 * function the same. DMA engine behaves similary using the same PRD
215 * format as BMDMA but different command register, interrupt and event
216 * notification methods are used. The following inic_bmdma_*()
217 * functions do the impedance matching.
219 static void inic_bmdma_setup(struct ata_queued_cmd
*qc
)
221 struct ata_port
*ap
= qc
->ap
;
222 struct inic_port_priv
*pp
= ap
->private_data
;
223 void __iomem
*port_base
= inic_port_base(ap
);
224 int rw
= qc
->tf
.flags
& ATA_TFLAG_WRITE
;
226 /* make sure device sees PRD table writes */
229 /* load transfer length */
230 writel(qc
->nbytes
, port_base
+ PORT_PRD_XFERLEN
);
232 /* turn on DMA and specify data direction */
233 pp
->cached_prdctl
= pp
->dfl_prdctl
| PRD_CTL_DMAEN
;
235 pp
->cached_prdctl
|= PRD_CTL_WR
;
236 writeb(pp
->cached_prdctl
, port_base
+ PORT_PRD_CTL
);
238 /* issue r/w command */
239 ap
->ops
->exec_command(ap
, &qc
->tf
);
242 static void inic_bmdma_start(struct ata_queued_cmd
*qc
)
244 struct ata_port
*ap
= qc
->ap
;
245 struct inic_port_priv
*pp
= ap
->private_data
;
246 void __iomem
*port_base
= inic_port_base(ap
);
248 /* start host DMA transaction */
249 pp
->cached_prdctl
|= PRD_CTL_START
;
250 writeb(pp
->cached_prdctl
, port_base
+ PORT_PRD_CTL
);
253 static void inic_bmdma_stop(struct ata_queued_cmd
*qc
)
255 struct ata_port
*ap
= qc
->ap
;
256 struct inic_port_priv
*pp
= ap
->private_data
;
257 void __iomem
*port_base
= inic_port_base(ap
);
259 /* stop DMA engine */
260 writeb(pp
->dfl_prdctl
, port_base
+ PORT_PRD_CTL
);
263 static u8
inic_bmdma_status(struct ata_port
*ap
)
265 /* event is already verified by the interrupt handler */
269 static void inic_host_intr(struct ata_port
*ap
)
271 void __iomem
*port_base
= inic_port_base(ap
);
272 struct ata_eh_info
*ehi
= &ap
->link
.eh_info
;
275 /* fetch and clear irq */
276 irq_stat
= readb(port_base
+ PORT_IRQ_STAT
);
277 writeb(irq_stat
, port_base
+ PORT_IRQ_STAT
);
279 if (likely(!(irq_stat
& PIRQ_ERR
))) {
280 struct ata_queued_cmd
*qc
=
281 ata_qc_from_tag(ap
, ap
->link
.active_tag
);
283 if (unlikely(!qc
|| (qc
->tf
.flags
& ATA_TFLAG_POLLING
))) {
284 ata_chk_status(ap
); /* clear ATA interrupt */
288 if (likely(ata_host_intr(ap
, qc
)))
291 ata_chk_status(ap
); /* clear ATA interrupt */
292 ata_port_printk(ap
, KERN_WARNING
, "unhandled "
293 "interrupt, irq_stat=%x\n", irq_stat
);
298 ata_ehi_push_desc(ehi
, "irq_stat=0x%x", irq_stat
);
300 if (irq_stat
& (PIRQ_OFFLINE
| PIRQ_ONLINE
)) {
301 ata_ehi_hotplugged(ehi
);
307 static irqreturn_t
inic_interrupt(int irq
, void *dev_instance
)
309 struct ata_host
*host
= dev_instance
;
310 void __iomem
*mmio_base
= host
->iomap
[MMIO_BAR
];
314 host_irq_stat
= readw(mmio_base
+ HOST_IRQ_STAT
);
316 if (unlikely(!(host_irq_stat
& HIRQ_GLOBAL
)))
319 spin_lock(&host
->lock
);
321 for (i
= 0; i
< NR_PORTS
; i
++) {
322 struct ata_port
*ap
= host
->ports
[i
];
324 if (!(host_irq_stat
& (HIRQ_PORT0
<< i
)))
327 if (likely(ap
&& !(ap
->flags
& ATA_FLAG_DISABLED
))) {
332 dev_printk(KERN_ERR
, host
->dev
, "interrupt "
333 "from disabled port %d (0x%x)\n",
338 spin_unlock(&host
->lock
);
341 return IRQ_RETVAL(handled
);
344 static unsigned int inic_qc_issue(struct ata_queued_cmd
*qc
)
346 struct ata_port
*ap
= qc
->ap
;
348 /* ATA IRQ doesn't wait for DMA transfer completion and vice
349 * versa. Mask IRQ selectively to detect command completion.
350 * Without it, ATA DMA read command can cause data corruption.
352 * Something similar might be needed for ATAPI writes. I
353 * tried a lot of combinations but couldn't find the solution.
355 if (qc
->tf
.protocol
== ATA_PROT_DMA
&&
356 !(qc
->tf
.flags
& ATA_TFLAG_WRITE
))
357 inic_set_pirq_mask(ap
, PIRQ_MASK_DMA_READ
);
359 inic_set_pirq_mask(ap
, PIRQ_MASK_OTHER
);
361 /* Issuing a command to yet uninitialized port locks up the
362 * controller. Most of the time, this happens for the first
363 * command after reset which are ATA and ATAPI IDENTIFYs.
364 * Fast fail if stat is 0x7f or 0xff for those commands.
366 if (unlikely(qc
->tf
.command
== ATA_CMD_ID_ATA
||
367 qc
->tf
.command
== ATA_CMD_ID_ATAPI
)) {
368 u8 stat
= ata_chk_status(ap
);
369 if (stat
== 0x7f || stat
== 0xff)
373 return ata_qc_issue_prot(qc
);
376 static void inic_freeze(struct ata_port
*ap
)
378 void __iomem
*port_base
= inic_port_base(ap
);
380 __inic_set_pirq_mask(ap
, PIRQ_MASK_FREEZE
);
383 writeb(0xff, port_base
+ PORT_IRQ_STAT
);
385 readb(port_base
+ PORT_IRQ_STAT
); /* flush */
388 static void inic_thaw(struct ata_port
*ap
)
390 void __iomem
*port_base
= inic_port_base(ap
);
393 writeb(0xff, port_base
+ PORT_IRQ_STAT
);
395 __inic_set_pirq_mask(ap
, PIRQ_MASK_OTHER
);
397 readb(port_base
+ PORT_IRQ_STAT
); /* flush */
401 * SRST and SControl hardreset don't give valid signature on this
402 * controller. Only controller specific hardreset mechanism works.
404 static int inic_hardreset(struct ata_link
*link
, unsigned int *class,
405 unsigned long deadline
)
407 struct ata_port
*ap
= link
->ap
;
408 void __iomem
*port_base
= inic_port_base(ap
);
409 void __iomem
*idma_ctl
= port_base
+ PORT_IDMA_CTL
;
410 const unsigned long *timing
= sata_ehc_deb_timing(&link
->eh_context
);
414 /* hammer it into sane state */
415 inic_reset_port(port_base
);
417 val
= readw(idma_ctl
);
418 writew(val
| IDMA_CTL_RST_ATA
, idma_ctl
);
419 readw(idma_ctl
); /* flush */
421 writew(val
& ~IDMA_CTL_RST_ATA
, idma_ctl
);
423 rc
= sata_link_resume(link
, timing
, deadline
);
425 ata_link_printk(link
, KERN_WARNING
, "failed to resume "
426 "link after reset (errno=%d)\n", rc
);
430 *class = ATA_DEV_NONE
;
431 if (ata_link_online(link
)) {
432 struct ata_taskfile tf
;
434 /* wait a while before checking status */
435 ata_wait_after_reset(ap
, deadline
);
437 rc
= ata_wait_ready(ap
, deadline
);
438 /* link occupied, -ENODEV too is an error */
440 ata_link_printk(link
, KERN_WARNING
, "device not ready "
441 "after hardreset (errno=%d)\n", rc
);
445 ata_tf_read(ap
, &tf
);
446 *class = ata_dev_classify(&tf
);
447 if (*class == ATA_DEV_UNKNOWN
)
448 *class = ATA_DEV_NONE
;
454 static void inic_error_handler(struct ata_port
*ap
)
456 void __iomem
*port_base
= inic_port_base(ap
);
457 struct inic_port_priv
*pp
= ap
->private_data
;
460 /* reset PIO HSM and stop DMA engine */
461 inic_reset_port(port_base
);
463 spin_lock_irqsave(ap
->lock
, flags
);
464 ap
->hsm_task_state
= HSM_ST_IDLE
;
465 writeb(pp
->dfl_prdctl
, port_base
+ PORT_PRD_CTL
);
466 spin_unlock_irqrestore(ap
->lock
, flags
);
468 /* PIO and DMA engines have been stopped, perform recovery */
469 ata_do_eh(ap
, ata_std_prereset
, NULL
, inic_hardreset
,
473 static void inic_post_internal_cmd(struct ata_queued_cmd
*qc
)
475 /* make DMA engine forget about the failed command */
476 if (qc
->flags
& ATA_QCFLAG_FAILED
)
477 inic_reset_port(inic_port_base(qc
->ap
));
480 static void inic_dev_config(struct ata_device
*dev
)
482 /* inic can only handle upto LBA28 max sectors */
483 if (dev
->max_sectors
> ATA_MAX_SECTORS
)
484 dev
->max_sectors
= ATA_MAX_SECTORS
;
486 if (dev
->n_sectors
>= 1 << 28) {
487 ata_dev_printk(dev
, KERN_ERR
,
488 "ERROR: This driver doesn't support LBA48 yet and may cause\n"
489 " data corruption on such devices. Disabling.\n");
490 ata_dev_disable(dev
);
494 static void init_port(struct ata_port
*ap
)
496 void __iomem
*port_base
= inic_port_base(ap
);
498 /* Setup PRD address */
499 writel(ap
->prd_dma
, port_base
+ PORT_PRD_ADDR
);
502 static int inic_port_resume(struct ata_port
*ap
)
508 static int inic_port_start(struct ata_port
*ap
)
510 void __iomem
*port_base
= inic_port_base(ap
);
511 struct inic_port_priv
*pp
;
515 /* alloc and initialize private data */
516 pp
= devm_kzalloc(ap
->host
->dev
, sizeof(*pp
), GFP_KERNEL
);
519 ap
->private_data
= pp
;
521 /* default PRD_CTL value, DMAEN, WR and START off */
522 tmp
= readb(port_base
+ PORT_PRD_CTL
);
523 tmp
&= ~(PRD_CTL_DMAEN
| PRD_CTL_WR
| PRD_CTL_START
);
524 pp
->dfl_prdctl
= tmp
;
526 /* Alloc resources */
527 rc
= ata_port_start(ap
);
538 static struct ata_port_operations inic_port_ops
= {
539 .tf_load
= ata_tf_load
,
540 .tf_read
= ata_tf_read
,
541 .check_status
= ata_check_status
,
542 .exec_command
= ata_exec_command
,
543 .dev_select
= ata_std_dev_select
,
545 .scr_read
= inic_scr_read
,
546 .scr_write
= inic_scr_write
,
548 .bmdma_setup
= inic_bmdma_setup
,
549 .bmdma_start
= inic_bmdma_start
,
550 .bmdma_stop
= inic_bmdma_stop
,
551 .bmdma_status
= inic_bmdma_status
,
553 .irq_clear
= ata_noop_irq_clear
,
554 .irq_on
= ata_irq_on
,
556 .qc_prep
= ata_qc_prep
,
557 .qc_issue
= inic_qc_issue
,
558 .data_xfer
= ata_data_xfer
,
560 .freeze
= inic_freeze
,
562 .error_handler
= inic_error_handler
,
563 .post_internal_cmd
= inic_post_internal_cmd
,
564 .dev_config
= inic_dev_config
,
566 .port_resume
= inic_port_resume
,
568 .port_start
= inic_port_start
,
571 static struct ata_port_info inic_port_info
= {
572 /* For some reason, ATAPI_PROT_PIO is broken on this
573 * controller, and no, PIO_POLLING does't fix it. It somehow
574 * manages to report the wrong ireason and ignoring ireason
575 * results in machine lock up. Tell libata to always prefer
578 .flags
= ATA_FLAG_SATA
| ATA_FLAG_PIO_DMA
,
579 .pio_mask
= 0x1f, /* pio0-4 */
580 .mwdma_mask
= 0x07, /* mwdma0-2 */
581 .udma_mask
= ATA_UDMA6
,
582 .port_ops
= &inic_port_ops
585 static int init_controller(void __iomem
*mmio_base
, u16 hctl
)
590 hctl
&= ~HCTL_KNOWN_BITS
;
592 /* Soft reset whole controller. Spec says reset duration is 3
593 * PCI clocks, be generous and give it 10ms.
595 writew(hctl
| HCTL_SOFTRST
, mmio_base
+ HOST_CTL
);
596 readw(mmio_base
+ HOST_CTL
); /* flush */
598 for (i
= 0; i
< 10; i
++) {
600 val
= readw(mmio_base
+ HOST_CTL
);
601 if (!(val
& HCTL_SOFTRST
))
605 if (val
& HCTL_SOFTRST
)
608 /* mask all interrupts and reset ports */
609 for (i
= 0; i
< NR_PORTS
; i
++) {
610 void __iomem
*port_base
= mmio_base
+ i
* PORT_SIZE
;
612 writeb(0xff, port_base
+ PORT_IRQ_MASK
);
613 inic_reset_port(port_base
);
616 /* port IRQ is masked now, unmask global IRQ */
617 writew(hctl
& ~HCTL_IRQOFF
, mmio_base
+ HOST_CTL
);
618 val
= readw(mmio_base
+ HOST_IRQ_MASK
);
619 val
&= ~(HIRQ_PORT0
| HIRQ_PORT1
);
620 writew(val
, mmio_base
+ HOST_IRQ_MASK
);
626 static int inic_pci_device_resume(struct pci_dev
*pdev
)
628 struct ata_host
*host
= dev_get_drvdata(&pdev
->dev
);
629 struct inic_host_priv
*hpriv
= host
->private_data
;
630 void __iomem
*mmio_base
= host
->iomap
[MMIO_BAR
];
633 rc
= ata_pci_device_do_resume(pdev
);
637 if (pdev
->dev
.power
.power_state
.event
== PM_EVENT_SUSPEND
) {
638 rc
= init_controller(mmio_base
, hpriv
->cached_hctl
);
643 ata_host_resume(host
);
649 static int inic_init_one(struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
651 static int printed_version
;
652 const struct ata_port_info
*ppi
[] = { &inic_port_info
, NULL
};
653 struct ata_host
*host
;
654 struct inic_host_priv
*hpriv
;
655 void __iomem
* const *iomap
;
658 if (!printed_version
++)
659 dev_printk(KERN_DEBUG
, &pdev
->dev
, "version " DRV_VERSION
"\n");
662 host
= ata_host_alloc_pinfo(&pdev
->dev
, ppi
, NR_PORTS
);
663 hpriv
= devm_kzalloc(&pdev
->dev
, sizeof(*hpriv
), GFP_KERNEL
);
667 host
->private_data
= hpriv
;
669 /* acquire resources and fill host */
670 rc
= pcim_enable_device(pdev
);
674 rc
= pcim_iomap_regions(pdev
, 0x3f, DRV_NAME
);
677 host
->iomap
= iomap
= pcim_iomap_table(pdev
);
679 for (i
= 0; i
< NR_PORTS
; i
++) {
680 struct ata_port
*ap
= host
->ports
[i
];
681 struct ata_ioports
*port
= &ap
->ioaddr
;
682 unsigned int offset
= i
* PORT_SIZE
;
684 port
->cmd_addr
= iomap
[2 * i
];
685 port
->altstatus_addr
=
686 port
->ctl_addr
= (void __iomem
*)
687 ((unsigned long)iomap
[2 * i
+ 1] | ATA_PCI_CTL_OFS
);
688 port
->scr_addr
= iomap
[MMIO_BAR
] + offset
+ PORT_SCR
;
692 ata_port_pbar_desc(ap
, MMIO_BAR
, -1, "mmio");
693 ata_port_pbar_desc(ap
, MMIO_BAR
, offset
, "port");
694 ata_port_desc(ap
, "cmd 0x%llx ctl 0x%llx",
695 (unsigned long long)pci_resource_start(pdev
, 2 * i
),
696 (unsigned long long)pci_resource_start(pdev
, (2 * i
+ 1)) |
700 hpriv
->cached_hctl
= readw(iomap
[MMIO_BAR
] + HOST_CTL
);
702 /* Set dma_mask. This devices doesn't support 64bit addressing. */
703 rc
= pci_set_dma_mask(pdev
, DMA_32BIT_MASK
);
705 dev_printk(KERN_ERR
, &pdev
->dev
,
706 "32-bit DMA enable failed\n");
710 rc
= pci_set_consistent_dma_mask(pdev
, DMA_32BIT_MASK
);
712 dev_printk(KERN_ERR
, &pdev
->dev
,
713 "32-bit consistent DMA enable failed\n");
718 * This controller is braindamaged. dma_boundary is 0xffff
719 * like others but it will lock up the whole machine HARD if
720 * 65536 byte PRD entry is fed. Reduce maximum segment size.
722 rc
= pci_set_dma_max_seg_size(pdev
, 65536 - 512);
724 dev_printk(KERN_ERR
, &pdev
->dev
,
725 "failed to set the maximum segment size.\n");
729 rc
= init_controller(iomap
[MMIO_BAR
], hpriv
->cached_hctl
);
731 dev_printk(KERN_ERR
, &pdev
->dev
,
732 "failed to initialize controller\n");
736 pci_set_master(pdev
);
737 return ata_host_activate(host
, pdev
->irq
, inic_interrupt
, IRQF_SHARED
,
741 static const struct pci_device_id inic_pci_tbl
[] = {
742 { PCI_VDEVICE(INIT
, 0x1622), },
746 static struct pci_driver inic_pci_driver
= {
748 .id_table
= inic_pci_tbl
,
750 .suspend
= ata_pci_device_suspend
,
751 .resume
= inic_pci_device_resume
,
753 .probe
= inic_init_one
,
754 .remove
= ata_pci_remove_one
,
757 static int __init
inic_init(void)
759 return pci_register_driver(&inic_pci_driver
);
762 static void __exit
inic_exit(void)
764 pci_unregister_driver(&inic_pci_driver
);
767 MODULE_AUTHOR("Tejun Heo");
768 MODULE_DESCRIPTION("low-level driver for Initio 162x SATA");
769 MODULE_LICENSE("GPL v2");
770 MODULE_DEVICE_TABLE(pci
, inic_pci_tbl
);
771 MODULE_VERSION(DRV_VERSION
);
773 module_init(inic_init
);
774 module_exit(inic_exit
);