14 #include <linux/kernel.h>
15 #include <linux/module.h>
24 #define DRV_NAME "pata_platform"
25 #define DRV_VERSION "1.2"
27 static int pio_mask = 1;
55 .set_mode = pata_platform_set_mode,
58 static void pata_platform_setup_port(
struct ata_ioports *ioaddr,
62 ioaddr->data_addr = ioaddr->cmd_addr + (
ATA_REG_DATA << shift);
63 ioaddr->error_addr = ioaddr->cmd_addr + (
ATA_REG_ERR << shift);
65 ioaddr->nsect_addr = ioaddr->cmd_addr + (
ATA_REG_NSECT << shift);
66 ioaddr->lbal_addr = ioaddr->cmd_addr + (
ATA_REG_LBAL << shift);
67 ioaddr->lbam_addr = ioaddr->cmd_addr + (
ATA_REG_LBAM << shift);
68 ioaddr->lbah_addr = ioaddr->cmd_addr + (
ATA_REG_LBAH << shift);
69 ioaddr->device_addr = ioaddr->cmd_addr + (
ATA_REG_DEVICE << shift);
70 ioaddr->status_addr = ioaddr->cmd_addr + (
ATA_REG_STATUS << shift);
71 ioaddr->command_addr = ioaddr->cmd_addr + (
ATA_REG_CMD << shift);
105 unsigned int ioport_shift,
123 if (irq_res && irq_res->
start > 0) {
124 irq = irq_res->
start;
125 irq_flags = irq_res->
flags;
136 ap->
ops = &pata_platform_port_ops;
153 resource_size(io_res));
155 resource_size(ctl_res));
157 ap->ioaddr.cmd_addr = devm_ioport_map(dev, io_res->
start,
158 resource_size(io_res));
159 ap->ioaddr.ctl_addr = devm_ioport_map(dev, ctl_res->
start,
160 resource_size(ctl_res));
162 if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr) {
163 dev_err(dev,
"failed to map IO/CTL base\n");
167 ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr;
169 pata_platform_setup_port(&ap->ioaddr, ioport_shift);
171 ata_port_desc(ap,
"%s cmd 0x%llx ctl 0x%llx", mmio ?
"mmio" :
"ioport",
172 (
unsigned long long)io_res->
start,
173 (
unsigned long long)ctl_res->
start);
177 irq_flags, &pata_platform_sht);
209 dev_err(&pdev->
dev,
"invalid number of resources\n");
217 if (io_res ==
NULL) {
227 if (ctl_res ==
NULL) {
251 .probe = pata_platform_probe,