aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_isapnp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_isapnp.c')
-rw-r--r--drivers/ata/pata_isapnp.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 2580ab3146bf..d042efdfbac4 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -56,7 +56,6 @@ static struct ata_port_operations isapnp_port_ops = {
56 56
57 .data_xfer = ata_data_xfer, 57 .data_xfer = ata_data_xfer,
58 58
59 .irq_handler = ata_interrupt,
60 .irq_clear = ata_bmdma_irq_clear, 59 .irq_clear = ata_bmdma_irq_clear,
61 .irq_on = ata_irq_on, 60 .irq_on = ata_irq_on,
62 .irq_ack = ata_irq_ack, 61 .irq_ack = ata_irq_ack,
@@ -75,8 +74,10 @@ static struct ata_port_operations isapnp_port_ops = {
75 74
76static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev_id) 75static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev_id)
77{ 76{
78 struct ata_probe_ent ae; 77 struct ata_host *host;
78 struct ata_port *ap;
79 void __iomem *cmd_addr, *ctl_addr; 79 void __iomem *cmd_addr, *ctl_addr;
80 int rc;
80 81
81 if (pnp_port_valid(idev, 0) == 0) 82 if (pnp_port_valid(idev, 0) == 0)
82 return -ENODEV; 83 return -ENODEV;
@@ -85,34 +86,36 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
85 if (pnp_irq_valid(idev, 0) == 0) 86 if (pnp_irq_valid(idev, 0) == 0)
86 return -ENODEV; 87 return -ENODEV;
87 88
89 /* allocate host */
90 host = ata_host_alloc(&idev->dev, 1);
91 if (!host)
92 return -ENOMEM;
93
94 /* acquire resources and fill host */
88 cmd_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 0), 8); 95 cmd_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 0), 8);
89 if (!cmd_addr) 96 if (!cmd_addr)
90 return -ENOMEM; 97 return -ENOMEM;
91 98
92 memset(&ae, 0, sizeof(struct ata_probe_ent)); 99 ap = host->ports[0];
93 INIT_LIST_HEAD(&ae.node); 100
94 ae.dev = &idev->dev; 101 ap->ops = &isapnp_port_ops;
95 ae.port_ops = &isapnp_port_ops; 102 ap->pio_mask = 1;
96 ae.sht = &isapnp_sht; 103 ap->flags |= ATA_FLAG_SLAVE_POSS;
97 ae.n_ports = 1; 104
98 ae.pio_mask = 1; /* ISA so PIO 0 cycles */ 105 ap->ioaddr.cmd_addr = cmd_addr;
99 ae.irq = pnp_irq(idev, 0);
100 ae.irq_flags = 0;
101 ae.port_flags = ATA_FLAG_SLAVE_POSS;
102 ae.port[0].cmd_addr = cmd_addr;
103 106
104 if (pnp_port_valid(idev, 1) == 0) { 107 if (pnp_port_valid(idev, 1) == 0) {
105 ctl_addr = devm_ioport_map(&idev->dev, 108 ctl_addr = devm_ioport_map(&idev->dev,
106 pnp_port_start(idev, 1), 1); 109 pnp_port_start(idev, 1), 1);
107 ae.port[0].altstatus_addr = ctl_addr; 110 ap->ioaddr.altstatus_addr = ctl_addr;
108 ae.port[0].ctl_addr = ctl_addr; 111 ap->ioaddr.ctl_addr = ctl_addr;
109 ae.port_flags |= ATA_FLAG_SRST;
110 } 112 }
111 ata_std_ports(&ae.port[0]);
112 113
113 if (ata_device_add(&ae) == 0) 114 ata_std_ports(&ap->ioaddr);
114 return -ENODEV; 115
115 return 0; 116 /* activate */
117 return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0,
118 &isapnp_sht);
116} 119}
117 120
118/** 121/**